Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.56 KB | None | 0 0
  1. function Plate_Requester_Stoned(pUnit, event, player)
  2.     pUnit:GossipCreateMenu(999999, player, 0)
  3.     pUnit:GossipMenuAddItem(0, "I would like to buy some armour.", 246, 1)
  4.     pUnit:GossipMenuAddItem(0, "Nevermind.", 250, 0)
  5.     pUnit:GossipSendMenu(player)
  6. end
  7.  
  8.  
  9. function Plate_Requester_Stoned_Gossip(pUnit, event, player, id, intid, code)
  10.     if(intid == 246) then
  11.         if code ~= nil then
  12.             local item = WorldDBQuery("SELECT `quality` FROM `items` WHERE `entry` = '"..code.."';")
  13.             if item ~= nil then -- Check it exists
  14.                 item = item:GetColumn(0):GetString()
  15.                 if item == "2" or item == "1" or item == "0" then -- Quality
  16.                     if WorldDBQuery("SELECT `class` FROM `items` WHERE `entry` = '"..code.."';"):GetColumn(0):GetString() == "4" then -- Armour
  17.                         if WorldDBQuery("SELECT `subclass` FROM `items` WHERE `entry` = '"..code.."';"):GetColumn(0):GetString() == "3" or WorldDBQuery("SELECT `subclass` FROM `items` WHERE `entry` = '"..code.."';"):GetColumn(0):GetString() == "4" then -- Make sure it's plate or mail
  18.                             if player:GetCoinage() > 200000 then -- In copper
  19.                                 local count = WorldDBQuery("SELECT `Amount` from `arequest_cooldown` WHERE `Name` = '"..player:GetName().."';")
  20.                                 if count == nil then
  21.                                 WorldDBQuery("INSERT INTO `arequest_cooldown` VALUES ('"..player:GetName().."', '1');")
  22.                                 player:DealGoldCost(200000) -- In copper
  23.                                 player:AddItem(code, 1)
  24.                                 else
  25.                                     if count:GetColumn():GetString() == "15" then
  26.                                     player:SendAreaTriggerMessage("|CFFff0000You have reached your limit of items you are allowed to request!|R")
  27.                                     else
  28.                                     count = count:GetColumn(0)
  29.                                     count = count + 1
  30.                                     WorldDBQuery("UPDATE `arequest_cooldown` SET `Amount` = '"..count.."';")
  31.                                     player:DealGoldCost(200000) -- In copper
  32.                                     player:AddItem(code, 1)
  33.                                     end
  34.                                 end
  35.                             else
  36.                             player:SendAreaTriggerMessage("|CFFff0000You do not have enough gold!|R")
  37.                             end
  38.                         else
  39.                         player:SendAreaTriggerMessage("|CFFff0000This blacksmith can only make mail and plate armour!|R")
  40.                         end
  41.                     else
  42.                     player:SendAreaTriggerMessage("|CFFff0000That is not armour!|R")
  43.                     end
  44.                 else
  45.                 player:SendAreaTriggerMessage("|CFFff0000That item is too rare!|R")
  46.                 end
  47.             else
  48.             player:SendAreaTriggerMessage("|CFFff0000That item does not exist!|R")
  49.             end
  50.         end
  51.     player:GossipComplete()
  52.     end
  53.     if(intid == 250) then
  54.     player:GossipComplete()
  55.     end
  56. end
  57.  
  58. RegisterUnitGossipEvent(31111, 1, "Plate_Requester_Stoned")
  59. RegisterUnitGossipEvent(31111, 2, "Plate_Requester_Stoned_Gossip")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement