--[[
______ _ _ __ __
| ____| | | | | \ \ / /
| |__ ___ _ __ __ _ ___ | |_| |_ ___ _ __ _____\ \ /\ / /____ __
| __/ _ \| '__/ _` |/ _ \| __| __/ _ \ '_ \______\ \/ \/ / _ \ \ /\ / /
| | | (_) | | | (_| | (_) | |_| || __/ | | | \ /\ / (_) \ V V /
|_| \___/|_| \__, |\___/ \__|\__\___|_| |_| \/ \/ \___/ \_/\_/
__/ |
|___/
]]
local file_dir = "scripts/logs/hs_logs.txt"
local file = assert(io.open(file_dir, "a"))
local bountyToken = 89998 --Bounty Token ID
local ITEM_ID = 6948 -- Hearthstone ID
function Teleporter_OnGossip(event, plr, item)
if(plr:GetTeam() == 0) then
plr:GossipMenuAddItem(0, "|cff00CDFFMain Cities ", 0, 2000)
else
plr:GossipMenuAddItem(0, "|cffB00808Main Cities", 0 , 3000)
end
plr:GossipMenuAddItem(0, "Teleports" , 0, 5000)
if GetVIPLevel(plr:GetAccountId() >= 1) then
plr:GossipMenuAddItem(0, "|TInterface\\ChatFrame\\UI-ChatIcon-Vip.blp:0:2:0:0|t",0 , 4000,0)
end
plr:GossipMenuAddItem(0, "About You", 0, 7000)
plr:GossipMenuAddItem(0, "Bounty System", 0, 300)
plr:GossipSendMenu(1, item)
end
function Teleporter_OnClick(event, plr, item, sender, intid, code)
if(intid == 1000) then
plr:GossipMenuAddItem(0, "Task Area |TInterface\\ChatFrame\\UI-ChatIcon-PVE.blp:0:2:0:0|t",0 , 1,0)
plr:GossipMenuAddItem(0, "Task Area |TInterface\\ChatFrame\\UI-ChatIcon-PVP.blp:0:2:0:0|t",0 , 1,0)
plr:GossipSendMenu(1, item)
elseif(intid == 7000)then
plr:GossipMenuAddItem(0, "Your gear score is: " ..plr:GetGearLevel().. "" ,0, 7000)
plr:GossipMenuAddItem(0, "Your VIP level is " ..GetVIPLevel(plr:GetAccountId()).. "", 0, 7000)
plr:GossipSendMenu(1, item)
elseif(intid == 4000) then
if GetVIPLevel(plr:GetAccountId()) <= 1 then
--print "Unauthorized Acess to the vip function. " ..plr:GetName().. ""
plr:SendBroadcastMessage("We detected that you have Unauthorized access to the vip panel this will be logged")
local line = os.date("%x [%X]", os.time())..": "..plr:GetName().." Unauthorized Access to the vip function."
file:write(line.."\n")
file:flush()
return
end
plr:GossipMenuAddItem(0, "Vip Mall", 0, 4003)
plr:GossipMenuAddItem(0, "Repair All Item", 0, 4005)
plr:GossipMenuAddItem(0, "Max Level", 0, 4002)
plr:GossipMenuAddItem(0, "Bank", 0, 4001)
plr:GossipMenuAddItem(0, "Set Home", 0, 4004)
plr:GossipMenuAddItem(0, "Back", 0 , 100000)
plr:GossipSendMenu(1, item)
elseif(intid == 5000) then
plr:GossipMenuAddItem(0, "Hearthstone", 0, 100)
plr:GossipMenuAddItem(0, "Task Area",0 , 1000,0)
plr:GossipMenuAddItem(0, "PVP Zone",0 , 10,0)
plr:GossipMenuAddItem(0, "Instances",0 , 8900)
plr:GossipMenuAddItem(0, "Item Preview",0 , 8901)
plr:GossipMenuAddItem(0, "Back", 0 , 100000)
plr:GossipSendMenu(1, item)
elseif(intid == 2000) then
plr:GossipMenuAddItem(0, "Stormwind", 0, 2001)
plr:GossipMenuAddItem(0, "Ironfoge", 0, 2002)
plr:GossipMenuAddItem(0, "The Exodar", 0, 2003)
plr:GossipMenuAddItem(0, "Back", 0 , 100000)
plr:GossipSendMenu(1, item)
elseif(intid == 3000) then
plr:GossipMenuAddItem(0, "Orgrimmar", 0, 3001)
plr:GossipMenuAddItem(0, "Thunderbluff", 0, 3002)
plr:GossipMenuAddItem(0, "Undercity", 0, 3003)
plr:GossipMenuAddItem(0, "Back", 0 , 100000)
plr:GossipSendMenu(1, item)
elseif(intid == 8900) then
plr:GossipMenuAddItem(0, "Deadmines", 0, 8903)
plr:GossipMenuAddItem(0, "Molten Core", 0, 8902)
plr:GossipMenuAddItem(0, "Back", 0 , 100000)
plr:GossipSendMenu(1, item)
elseif(intid == 300) then
plr:GossipMenuAddItem(0, "This system is not perfect and there might still be some bugs, if you find any of them report it or if you have any suggestion regarding this system", 0, 300)
plr:GossipMenuAddItem(0, "I would like to place a bounty", 0, 301)
plr:GossipMenuAddItem(0, "Bounty List", 0, 302)
plr:GossipMenuAddItem(0, "Back", 0 , 100000)
plr:GossipSendMenu(1, item)
elseif(intid == 301) then
plr:GossipMenuAddItem(0, "100 Bounty Tokens", 0, 3021, true, "Who would you like to place a bounty on?", 10000)
plr:GossipMenuAddItem(0, "200 Bounty Tokens", 0, 3022, true, "Who would you like to place a bounty on?", 10000)
plr:GossipMenuAddItem(0, "300 Bounty Tokens", 0, 3023, true, "Who would you like to place a bounty on?", 10000)
plr:GossipMenuAddItem(0, "400 Bounty Tokens", 0, 3024, true, "Who would you like to place a bounty on?", 10000)
plr:GossipMenuAddItem(0, "500 Bounty Tokens", 0, 3025, true, "Who would you like to place a bounty on?", 10000)
plr:GossipSendMenu(1, item)
-- Bounty Hunter System
elseif(intid == 302) then
local getNameQuery = AuthDBQuery("SELECT Playername, Price, Placer FROM bounty_db")
if (getNameQuery) then
repeat
local name = getNameQuery:GetString(0)
local price = getNameQuery:GetString(1)
local placer = getNameQuery:GetString(2)
plr:GossipMenuAddItem(0, "" ..name.. " Price: " ..price.. " Placer: " ..placer.. "" , 0, 302)
until not getNameQuery:NextRow()
end
plr:GossipMenuAddItem(0, "Refresh", 0, 302)
plr:GossipMenuAddItem(0, "Back", 0 , 300)
elseif(intid == 3021) then
InsertBounty(code, 100, plr:GetName())
plr:SendBroadcastMessage("You have placed bounty on: " ..code.."")
plr:RemoveItem(89998, 100)
elseif(intid == 3022) then
InsertBounty(code, 200, plr:GetName())
plr:SendBroadcastMessage("You have placed bounty on: " ..code.."")
plr:RemoveItem(89998, 200)
elseif(intid == 3023) then
InsertBounty(code, 300, plr:GetName())
plr:SendBroadcastMessage("You have placed bounty on: " ..code.."")
plr:RemoveItem(89998, 300)
elseif(intid == 3024) then
InsertBounty(code, 400, plr:GetName())
plr:SendBroadcastMessage("You have placed bounty on: " ..code.."")
plr:RemoveItem(89998, 400)
elseif(intid == 3025) then -- End Bounty System
InsertBounty(code, 400, plr:GetName())
plr:SendBroadcastMessage("You have placed bounty on: " ..code.."")
plr:RemoveItem(89998, 500)
elseif(intid == 100000) then
Teleporter_OnGossip(event, plr, item)
--------------------------------------------------------------------------
-- under here i will put all the teleports and other things --
--------------------------------------------------------------------------
elseif(intid == 1) then -- Normal Mall
plr:Teleport(530, -248.392258, 939.716187, 84.378456, 1.494630 )
--Vip Stuff under here
elseif(intid == 4001) then -- opens up the player bank
plr:SendShowBank(plr)
elseif(intid == 4003) then --Vip MAll
plr:Teleport(0,-4119.738281, -1090.597168, 168.953934, 5.988140)
elseif(intid == 4005) then -- Repair all items
plr:DurabilityRepairAll()
elseif(intid == 4002) then -- sets your level to 85
plr:SetLevel(85)
elseif(intid == 4004) then
plr:SetBindPointAtPlayerLoc()
--Cities goes under here
--Ally
elseif(intid == 2001) then --Stormwind
plr:Teleport(0, -8830.297852, 625.666199, 93.949638, 3.853518)
elseif(intid == 2002) then --Ironforge
plr:Teleport(0, -4923.146973, -948.432251, 501.552063, 5.372409)
elseif(intid == 2003) then --The Exodar
plr:Teleport(530, -3964.102539, -11672.352539, -137.411285, 0.400547)
--Horde
elseif(intid == 3001) then --Orgrimmar
plr:Teleport(1, 1629.359985, -4373.390137, 31.482185, 3.548390)
elseif(intid == 3002) then --Thunderbluff
plr:Teleport(1, -1277.369995, 124.804001, 131.286987, 5.222740)
elseif(intid == 3003) then --Undercity
plr:Teleport(0, 1584.069946, 241.987000, -52.153400, 0.049647)
-- Other
elseif(intid == 100) then
plr:CastSpell(plr, 8690)
elseif(intid == 10) then --PvP Zone
plr:Teleport(801, 561.474304, 1011.290527, 5.370491, 5.626557 )
elseif(intid == 8901) then --Preview zone
plr:Teleport(0, -7143.082031, -3875.430908, 336.437500, 3.044534)
--Instances
elseif(intid == 8903) then
plr:Teleport(36, -16.400000, -383.070007, 61.779999, 1.860000)
elseif(intid == 8902) then
plr:Teleport(409, 1096.000000, -467.000000, -104.599998, 3.640000 )
end
end
function PlayerKilled(event, killer, plr)
--Bounty
plr:SendBroadcastMessage("You was killed by: " ..killer:GetName().. "")
if(GetBountyPrice(plr:GetName()) >= 1) then
killer:SendBroadcastMessage("You killed: " ..plr:GetName().. " And recived: " ..GetBountyPrice(plr:GetName()).."")
killer:AddItem(bountyToken, GetBountyPrice(plr:GetName()))
end
playerDiedBounty(plr:GetName())
end
--Custom Fucntions
function GetVIPLevel(accountid)
local VIPLevel = AuthDBQuery("SELECT VIPLevel from vip_players where accountID='" .. accountid .. "'")
local level = 0
if(VIPLevel) then
repeat
level = VIPLevel:GetUInt32(0)
until not VIPLevel:NextRow()
end
return level
end
function GetBountyPrice(Pname)
local BountyPrice = AuthDBQuery("SELECT Price from bounty_db where playername='" .. Pname .. "'")
local price = 0
if(BountyPrice) then
repeat
price = BountyPrice:GetUInt32(0)
until not BountyPrice:NextRow()
end
return price
end
function playerDiedBounty(PlayerName)
AuthDBQuery("DELETE FROM bounty_db WHERE PlayerName='" .. PlayerName .. "'")
end
function InsertBounty(Playername, Price, placer)
AuthDBQuery("INSERT INTO `bounty_db` (`Playername`, `Price` , `placer`) VALUES ('" .. Playername .. "', '" ..Price.. "', '" ..placer.. "')")
end
RegisterItemGossipEvent(ITEM_ID, 1, Teleporter_OnGossip)
RegisterItemGossipEvent(ITEM_ID, 2, Teleporter_OnClick)