Advertisement
Rochet2

LB Final version 2.1

Aug 4th, 2011
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 20.25 KB | None | 0 0
  1. _run = true
  2. if(GetEngineName == nil) then print("You NEED LuaBridge to run this script.") _run = false end
  3. if(LCF == nil) then print("You NEED LCF to run this script.") _run = false end
  4. if(_run == false) then print("Gossip system script execution terminated.") return; end
  5. _run = nil
  6. if (MapMgr == nil) then return; end
  7.  
  8. --[[
  9. FULL CREDIT ABOUT THIS GOES TO Rochet2 AT WOW-V.COM
  10.  
  11. YOU ARE NOT ALLOWED TO RELEASE THIS SCRIPT ANYWHERE WITHOUT MY PERMISSION.
  12. YOU ARE NOT ALLOWED TO SHARE THIS SCRIPT BY POSTING THE SCRIPT OR LINK TO IT ON ANY WEBSITE.
  13. ALL SHARING IS DONE BY GIVING CREDIT TO THE MAKER (Rochet2) AND BY ONLY POSTING A LINK TO HIS THREAD AT WOW-V.COM
  14. LINK TO THE ORIGINAL AND ONLY RELEASE THREAD: http://wow-v.com/forums/index.php?topic=24301.0
  15.  
  16. THIS SCRIPT IS FOR YOUR OWN USE ONLY!
  17.  
  18. More Rochet2's work at projectcode.zzl.org
  19. ]]--
  20.  
  21. DBGossipsys = {}
  22.  
  23. function DBGossipsys.Command(event, pPlayer, pMessage, pType, pLanguage, pMisc)
  24.  
  25.     if(pPlayer:GetSession():IsGM() and pMessage:lower() == ".reload gossip") then
  26.         DBGossipsys.LoadData()
  27.         DBGossipsys.reLoadUnitMenu(true)
  28.         SendWorldMessage("Gossip_* tables reloaded", 2)
  29.         return false
  30.     end
  31.  
  32. end
  33.  
  34. function DBGossipsys.LoadData()
  35.  
  36.     DBGossipsys.menu = {}
  37.     DBGossipsys.scripts = {}
  38.     DBGossipsys.option = {}
  39.     DBGossipsys.conditions = {}
  40.  
  41.     DBGossipsys.gossip_menu = WorldDB:Query("SELECT `menu_id`, `npc_text_id` FROM `custom_gossip`.`gossip_menu`")
  42.     if(DBGossipsys.gossip_menu ~= nil) then
  43.     DBGossipsys.menu["rowcount"] = DBGossipsys.gossip_menu:GetRowCount()
  44.     else
  45.         DBGossipsys.menu["rowcount"] = 0
  46.         print("Table `custom_gossip`.`gossip_menu` was empty. Using npc_text = 1.\nAfter filling, use .reload gossip")
  47.     end
  48.  
  49.     DBGossipsys.gossip_scripts = WorldDB:Query("SELECT `command`, `float`, `map`, `x`, `y`, `z`, `o`, `value`, `bool`, `string`, `value2`, `script_id` FROM `custom_gossip`.`gossip_scripts` ORDER BY `command` DESC, `script_id` ASC")
  50.     if(DBGossipsys.gossip_scripts ~= nil) then
  51.         DBGossipsys.scripts["rowcount"] = DBGossipsys.gossip_scripts:GetRowCount()
  52.     else
  53.         DBGossipsys.scripts["rowcount"] = 0
  54.         print("Table `custom_gossip`.`gossip_scripts` was empty. After fill, reload gossip")
  55.     end
  56.  
  57.     DBGossipsys.gossip_option = WorldDB:Query("SELECT `menu_id`, `order`, `script_id`, `next_menu_id`, `icon`, `name`, `cost`, `popup`, `req_level`, `team` FROM `custom_gossip`.`gossip_menu_option` WHERE `order` BETWEEN 1 AND 30 ORDER BY `menu_id` ASC, `order` ASC")
  58.     if(DBGossipsys.gossip_option ~= nil) then
  59.         DBGossipsys.option["rowcount"] = DBGossipsys.gossip_option:GetRowCount()
  60.     else
  61.         DBGossipsys.option["rowcount"] = 0
  62.         print("Table `custom_gossip`.`gossip_menu_option` was empty.\nAfter filling, use .reload gossip")
  63.     end
  64.    
  65.     DBGossipsys.gossip_conditions = WorldDB:Query("SELECT `menu_id`, `order`, `has_id`, `value`, `bool` FROM `custom_gossip`.`gossip_conditions` ORDER BY `menu_id` ASC, `order` ASC")
  66.     if(DBGossipsys.gossip_conditions ~= nil) then
  67.         DBGossipsys.conditions["rowcount"] = DBGossipsys.gossip_conditions:GetRowCount()
  68.     else
  69.         DBGossipsys.conditions["rowcount"] = 0
  70.         print("Table `custom_gossip`.`gossip_conditions` was empty.\nAfter filling, use .reload gossip")
  71.     end
  72.  
  73.     for i = 1, DBGossipsys.menu["rowcount"] do
  74.         DBGossipsys.menu[i] = {DBGossipsys.gossip_menu:GetColumn(0):GetUInt32(), DBGossipsys.gossip_menu:GetColumn(1):GetUInt32()}
  75.         DBGossipsys.gossip_menu:NextRow()
  76.     end
  77.     for i = 1, DBGossipsys.scripts["rowcount"] do
  78.         if(DBGossipsys.gossip_scripts:GetColumn(8):GetUInt32() == 0) then
  79.             truefalse = false
  80.         else
  81.             truefalse = true
  82.         end
  83.         DBGossipsys.scripts[i] = {DBGossipsys.gossip_scripts:GetColumn(0):GetUInt32(), DBGossipsys.gossip_scripts:GetColumn(1):GetFloat(), DBGossipsys.gossip_scripts:GetColumn(2):GetUInt32(), DBGossipsys.gossip_scripts:GetColumn(3):GetFloat(), DBGossipsys.gossip_scripts:GetColumn(4):GetFloat(), DBGossipsys.gossip_scripts:GetColumn(5):GetFloat(), DBGossipsys.gossip_scripts:GetColumn(6):GetFloat(), DBGossipsys.gossip_scripts:GetColumn(7):GetUInt32(), truefalse, DBGossipsys.gossip_scripts:GetColumn(9):GetString(), DBGossipsys.gossip_scripts:GetColumn(10):GetUInt32(), DBGossipsys.gossip_scripts:GetColumn(11):GetUInt32()}
  84.         DBGossipsys.gossip_scripts:NextRow()
  85.     end
  86.     for i = 1, DBGossipsys.option["rowcount"] do
  87.         DBGossipsys.option[i] = {DBGossipsys.gossip_option:GetColumn(0):GetUInt32(), DBGossipsys.gossip_option:GetColumn(1):GetUInt32(), DBGossipsys.gossip_option:GetColumn(2):GetUInt32(), DBGossipsys.gossip_option:GetColumn(3):GetUInt32(), DBGossipsys.gossip_option:GetColumn(4):GetUInt32(), DBGossipsys.gossip_option:GetColumn(5):GetString(), DBGossipsys.gossip_option:GetColumn(6):GetUInt32(), DBGossipsys.gossip_option:GetColumn(7):GetString(), DBGossipsys.gossip_option:GetColumn(8):GetUInt32(), DBGossipsys.gossip_option:GetColumn(9):GetUInt32()}
  88.         DBGossipsys.gossip_option:NextRow()
  89.     end
  90.     for i = 1, DBGossipsys.conditions["rowcount"] do
  91.         if(DBGossipsys.gossip_conditions:GetColumn(4):GetUInt32() == 0) then
  92.             _bool = false
  93.         else
  94.             _bool = true
  95.         end
  96.         DBGossipsys.conditions[i] = {DBGossipsys.gossip_conditions:GetColumn(0):GetUInt32(), DBGossipsys.gossip_conditions:GetColumn(1):GetUInt32(), DBGossipsys.gossip_conditions:GetColumn(2):GetUInt32(), DBGossipsys.gossip_conditions:GetColumn(3):GetUInt32()}
  97.         DBGossipsys.gossip_conditions:NextRow()
  98.     end
  99.    
  100.     -- empty load table, no useless data storing
  101.     DBGossipsys.gossip_menu = nil
  102.     DBGossipsys.gossip_scripts = nil
  103.     DBGossipsys.gossip_option = nil
  104.     DBGossipsys.gossip_conditions = nil
  105.    
  106. end
  107.  
  108. RegisterServerHook(16, DBGossipsys.Command)
  109.  
  110. function DBGossipsys.reLoadUnitMenu(reload)
  111.  
  112.     if(reload == true)then
  113.         DBGossipsys.unit_reload = {}
  114.         DBGossipsys.gossip_units_reload = WorldDB:Query("SELECT `entry`, `type`, `menu_id`, `check_combat` FROM `custom_gossip`.`units` WHERE `entry` BETWEEN 1 AND 200000 ORDER BY `entry` ASC")
  115.         if(DBGossipsys.gossip_units_reload ~= nil) then
  116.             DBGossipsys.unit_reload["rowcount"] = DBGossipsys.gossip_units_reload:GetRowCount()
  117.         else
  118.             DBGossipsys.unit_reload["rowcount"] = 0
  119.             print("Table `custom_gossip`.`units` was empty.\nAfter filling, reload luaengine or restart server.")
  120.         end
  121.         for i = 1, DBGossipsys.unit_reload["rowcount"] do
  122.             if(DBGossipsys.gossip_units_reload:GetColumn(0):GetUInt32() == DBGossipsys.unit[i][1] and DBGossipsys.gossip_units_reload:GetColumn(1):GetUInt32() == DBGossipsys.unit[i][2])then
  123.                 DBGossipsys.unit[i][3] = DBGossipsys.gossip_units_reload:GetColumn(2):GetUInt32()
  124.                 DBGossipsys.unit[i][4] = DBGossipsys.gossip_units_reload:GetColumn(3):GetUInt32()
  125.             end
  126.             DBGossipsys.gossip_units_reload:NextRow()
  127.         end
  128.         -- empty reload table, no useless data storing
  129.         DBGossipsys.unit_reload = nil
  130.     else
  131.         DBGossipsys.unit = {}
  132.         DBGossipsys.gossip_units = WorldDB:Query("SELECT `entry`, `type`, `menu_id`, `check_combat` FROM `custom_gossip`.`units` WHERE `entry` BETWEEN 1 AND 200000 ORDER BY `entry` ASC")
  133.         if(DBGossipsys.gossip_units ~= nil) then
  134.             DBGossipsys.unit["rowcount"] = DBGossipsys.gossip_units:GetRowCount()
  135.         else
  136.             DBGossipsys.unit["rowcount"] = 0
  137.             print("Table `custom_gossip`.`units` was empty.\nAfter filling, reload luaengine or restart server.")
  138.         end
  139.         for i = 1, DBGossipsys.unit["rowcount"] do
  140.             DBGossipsys.unit[i] = {DBGossipsys.gossip_units:GetColumn(0):GetUInt32(), DBGossipsys.gossip_units:GetColumn(1):GetUInt32(), DBGossipsys.gossip_units:GetColumn(2):GetUInt32(), DBGossipsys.gossip_units:GetColumn(3):GetUInt32()}
  141.             DBGossipsys.gossip_units:NextRow()
  142.         end
  143.         -- empty load table, no useless data storing
  144.         DBGossipsys.gossip_units = nil
  145.     end
  146.  
  147. end
  148.  
  149. -- Populating data tables on load
  150. DBGossipsys.reLoadUnitMenu(false)
  151. DBGossipsys.LoadData()
  152.  
  153. function DBGossipsys.GetMenu(npc_text, pUnit, pPlayer) -- (menu_id, pPlayer, pUnit, npc_text, DBGossipsys.option)
  154.  
  155.     local menu = GossipMenu(pUnit, npc_text, 0)
  156.     for i = 1, DBGossipsys.option["rowcount"] do
  157.         if(DBGossipsys.option[i][1] == menu_id) then
  158.             if(pPlayer:GetLevel() >= DBGossipsys.option[i][9] and (pPlayer:GetTeam() == DBGossipsys.option[i][10] or DBGossipsys.option[i][10] == 2)) then
  159.                 _hide = false
  160.                 for l = 1, DBGossipsys.conditions["rowcount"] do
  161.                     if(DBGossipsys.conditions[l][1] == menu_id and DBGossipsys.conditions[l][2] == DBGossipsys.option[i][2]) then
  162.                         local _has_ID = DBGossipsys.conditions[l][3]
  163.                         local _value = DBGossipsys.conditions[l][4]
  164.                         if(_has_ID == 0) then
  165.                             if(_bool) then
  166.                                 if(pPlayer:HasSpell(_value) == false) then
  167.                                     _hide = true
  168.                                 end
  169.                             else
  170.                                 if(pPlayer:HasSpell(_value) == true) then
  171.                                     _hide = true
  172.                                 end
  173.                             end
  174.                         elseif(_has_ID == 1) then
  175.                             if(_bool) then
  176.                                 if(pPlayer:HasAura(_value) == false) then
  177.                                     _hide = true
  178.                                 end
  179.                             else
  180.                                 if(pPlayer:HasAura(_value) == true) then
  181.                                     _hide = true
  182.                                 end
  183.                             end
  184.                         elseif(_has_ID == 2) then
  185.                             if(_bool) then
  186.                                 if(pPlayer:HasSkill(_value) == false) then
  187.                                     _hide = true
  188.                                 end
  189.                             else
  190.                                 if(pPlayer:HasSkill(_value) == true) then
  191.                                     _hide = true
  192.                                 end
  193.                             end
  194.                         elseif(_has_ID == 3) then
  195.                             if(_bool) then
  196.                                 if(pPlayer:HasItem(_value) == false) then
  197.                                     _hide = true
  198.                                 end
  199.                             else
  200.                                 if(pPlayer:HasItem(_value) == true) then
  201.                                     _hide = true
  202.                                 end
  203.                             end
  204.                         elseif(_has_ID == 4) then
  205.                             if(_bool) then
  206.                                 if(pPlayer:HasQuest(_value) == false) then
  207.                                     _hide = true
  208.                                 end
  209.                             else
  210.                                 if(pPlayer:HasQuest(_value) == true) then
  211.                                     _hide = true
  212.                                 end
  213.                             end
  214.                         elseif(_has_ID == 5) then
  215.                             if(_bool) then
  216.                                 if(pPlayer:HasFinishedQuest(_value) == false) then
  217.                                     _hide = true
  218.                                 end
  219.                             else
  220.                                 if(pPlayer:HasFinishedQuest(_value) == true) then
  221.                                     _hide = true
  222.                                 end
  223.                             end
  224.                         elseif(_has_ID == 6) then
  225.                             if(_bool) then
  226.                                 if(pPlayer:HasTitle(_value) == false) then
  227.                                     _hide = true
  228.                                 end
  229.                             else
  230.                                 if(pPlayer:HasTitle(_value) == true) then
  231.                                     _hide = true
  232.                                 end
  233.                             end
  234.                         elseif(_has_ID == 7) then
  235.                             if(_bool) then
  236.                                 if(pPlayer:IsInPhase(_value) == false) then
  237.                                     _hide = true
  238.                                 end
  239.                             else
  240.                                 if(pPlayer:IsInPhase(_value) == true) then
  241.                                     _hide = true
  242.                                 end
  243.                             end
  244.                         elseif(_has_ID == 8) then
  245.                             if(_bool) then
  246.                                 if(pPlayer:IsStealthed() == false) then
  247.                                     _hide = true
  248.                                 end
  249.                             else
  250.                                 if(pPlayer:IsStealthed() == true) then
  251.                                     _hide = true
  252.                                 end
  253.                             end
  254.                         elseif(_has_ID == 9) then -- true: male, false: female
  255.                             if(_bool) then
  256.                                 if(pPlayer:GetGender() == 1) then
  257.                                     _hide = true
  258.                                 end
  259.                             else
  260.                                 if(pPlayer:GetGender() == 0) then
  261.                                     _hide = true
  262.                                 end
  263.                             end
  264.                         end
  265.                     end
  266.                 end
  267.                 if(_hide == false) then
  268.                     menu:AddMenuItem(DBGossipsys.option[i][5], DBGossipsys.option[i][6], i, DBGossipsys.option[i][7], DBGossipsys.option[i][8])
  269.                 end
  270.             end
  271.         end
  272.     end
  273.     menu:Send(pPlayer)
  274.  
  275. end
  276.  
  277. function DBGossipsys.Item_trigg(pUnit, event, pPlayer)
  278.  
  279.     return DBGossipsys.Hello(pUnit, event, pPlayer)
  280.    
  281. end
  282.  
  283. function DBGossipsys.Hello(pUnit, event, pPlayer)
  284.    
  285.     if(pUnit:IsCreature()) then
  286.         unit_type = 0
  287.     elseif(pUnit:IsGameObject()) then
  288.         unit_type = 1
  289.     elseif(pUnit:IsItem()) then
  290.         unit_type = 2
  291.     end
  292.     for i = 1, DBGossipsys.unit["rowcount"] do
  293.         if(DBGossipsys.unit[i][1] == pUnit:GetEntry() and DBGossipsys.unit[i][2] == unit_type) then
  294.             check_combat = DBGossipsys.unit[i][4]
  295.             menu_id = DBGossipsys.unit[i][3]
  296.             break
  297.         end
  298.     end
  299.     for i = 1, DBGossipsys.menu["rowcount"] do
  300.         if(DBGossipsys.menu[i][1] == menu_id) then
  301.             npc_text = DBGossipsys.menu[i][2]
  302.             break
  303.         end
  304.     end
  305.     if(check_combat == 1 and pPlayer.CombatStatus:IsInCombat() == true) then
  306.         pPlayer:SendAreaTriggerMessage("|cffff0000You are in combat|r")
  307.         GossipMenu.Complete(pPlayer)
  308.     else
  309.         if(npc_text == nil or npc_text <= 0) then npc_text = 1 end
  310.         DBGossipsys.GetMenu(npc_text, pUnit, pPlayer)
  311.     end
  312.  
  313. end
  314.  
  315. function DBGossipsys.Select(pUnit, event, pPlayer, intid, code)
  316.  
  317.     cost_in_copper = DBGossipsys.option[intid][7]
  318.     if(DBGossipsys.option[intid][3] ~= 0) then
  319.         for l = 1, DBGossipsys.scripts["rowcount"] do
  320.             if(DBGossipsys.scripts[l][12] == DBGossipsys.option[intid][3]) then
  321.                 -- todo, implement quest add, remove, PVP flags
  322.                 -- define things
  323.                 local _value = DBGossipsys.scripts[l][8]
  324.                 local _value2 = DBGossipsys.scripts[l][11]
  325.                 local _command = DBGossipsys.scripts[l][1]
  326.                 local _float = DBGossipsys.scripts[l][2]
  327.                 local _map = DBGossipsys.scripts[l][3]
  328.                 local _x = DBGossipsys.scripts[l][4]
  329.                 local _y = DBGossipsys.scripts[l][5]
  330.                 local _z = DBGossipsys.scripts[l][6]
  331.                 local _o = DBGossipsys.scripts[l][7]
  332.                 local _string = DBGossipsys.scripts[l][10]
  333.                 if(_command == 1) then -- set scale
  334.                     pPlayer:SetScale(_float)
  335.                 elseif(_command == 2) then -- set phase
  336.                     pPlayer:PhaseSet(_value)
  337.                 elseif(_command == 3) then -- play sound false: to player true: to ppl around
  338.                     if(truefalse == false) then
  339.                         pPlayer:PlaySoundToPlayer(_value)
  340.                     else
  341.                         pPlayer:PlaySoundToSet(_value)
  342.                     end
  343.                 elseif(_command == 4) then -- false:set, true:add level
  344.                     if(truefalse == false) then
  345.                         pPlayer:SetLevel(_value)
  346.                     else
  347.                         pPlayer:ModLevel(_value)
  348.                     end
  349.                 elseif(_command == 5) then -- set NPC faction temporarily
  350.                     if(pUnit:IsCreature()) then
  351.                         pUnit:SetFaction(_value)
  352.                     end
  353.                 elseif(_command == 6) then -- false:morph, true: demorph
  354.                     if(truefalse == false) then
  355.                         pPlayer:SetDisplayID(_value)
  356.                     else
  357.                         pPlayer:Demorph()
  358.                     end
  359.                 elseif(_command == 7) then -- NPC casts spell on False: player, true: self
  360.                     if(pUnit:IsCreature()) then
  361.                         if(truefalse == false) then
  362.                             pUnit:FullCastSpellOnTarget(pPlayer, _value)
  363.                         else
  364.                             pUnit:FullCastSpellOnTarget(pUnit, _value)
  365.                         end
  366.                     end
  367.                 elseif(_command == 8) then -- Player casts spell on False: player, true: NPC
  368.                     if(truefalse == false) then
  369.                         pPlayer:FullCastSpellOnTarget(pPlayer, _value)
  370.                     else
  371.                         if(pUnit:IsCreature()) then
  372.                             pPlayer:FullCastSpellOnTarget(pUnit, _value)
  373.                         end
  374.                     end
  375.                 elseif(_command == 9) then -- remove aura
  376.                     pPlayer:RemoveAura(_value, pPlayer)
  377.                 elseif(_command == 10) then -- player sends message to ppl
  378.                     pPlayer:SendChatMessage(_value, 0, _string, 0)
  379.                 elseif(_command == 11) then -- send false:areatriggermessage, true:error to player
  380.                     if(truefalse == false) then
  381.                         pPlayer:SendAreaTriggerMessage(_string)
  382.                     else
  383.                         pPlayer:SendAreaTriggerMessage("|cffff0000".._string.."|r")
  384.                     end
  385.                 elseif(_command == 12) then -- teach spell
  386.                     --if(truefalse == false) then
  387.                     --  pPlayer:UnlearnSpell(_value) -- Does not work yet?
  388.                     --else
  389.                         pPlayer:AddSpell(_value)
  390.                     --end
  391.                 elseif(_command == 13) then -- reset talents
  392.                     pPlayer:ResetTalents()
  393.                 elseif(_command == 14) then -- false: remove, true: add title
  394.                     pPlayer:SetKnownTitle(_value, truefalse)
  395.                 elseif(_command == 15) then -- dismount
  396.                     pPlayer:Dismount()
  397.                 elseif(_command == 16) then -- True:possess, False:unpossess
  398.                     if(pUnit:IsCreature()) then
  399.                         if(truefalse == false) then
  400.                             pPlayer:Unpossess()
  401.                         else
  402.                             pPlayer:Possess(pUnit)
  403.                         end
  404.                     end
  405.                 elseif(_command == 17) then -- Set Hearthstone false: to player, true: to coords
  406.                     if(truefalse == false) then
  407.                         pPlayer:SetBindPoint(pPlayer:GetPositionX(), pPlayer:GetPositionY(), pPlayer:GetPositionZ(), 0, pPlayer:GetMapID())
  408.                     else
  409.                         pPlayer:SetBindPoint(_x, _y, _z, 0, _map)
  410.                     end
  411.                 elseif(_command == 18) then -- Join guild (if not in one already)
  412.                     if(pPlayer:IsInGuild() == false) then
  413.                         pPlayer:SetGuildID(_value)
  414.                     end
  415.                 elseif(_command == 19) then -- set guild rank
  416.                     pPlayer:SetGuildRank(_value)
  417.                 elseif(_command == 20) then -- true: give, false: take gold (copper)
  418.                     if(truefalse == false) then
  419.                         pPlayer:TakeGold(_value)
  420.                     else
  421.                         pPlayer:GiveGold(_value)
  422.                     end
  423.                 elseif(_command == 21) then -- true: add, false: take items
  424.                     if(truefalse == false) then
  425.                         pPlayer:RemoveItem(_value, _value2)
  426.                     else
  427.                         pPlayer:AddItem(_value, _value2)
  428.                     end
  429.                 elseif(_command == 22) then -- Send a message to everyone
  430.                     SendWorldMessage(_string, _value)
  431.                 elseif(_command == 23) then -- Make an SQL statement (insert, delete, update..) Default DB = world
  432.                     WorldDB:Query(_string)
  433.                 elseif(_command == 24) then -- spawn npc true: to coords, false: to player (temporarlily if time > 0)
  434.                     if(truefalse == false) then
  435.                         pPlayer:SpawnCreature(_value, pPlayer:GetPositionX(), pPlayer:GetPositionY(), pPlayer:GetPositionZ(), pPlayer:GetOrientation(), 0, _value2)
  436.                     else
  437.                         pPlayer:SpawnCreature(_value, _x, _y, _z, _o, 0, _value2)
  438.                     end
  439.                 elseif(_command == 25) then -- false: NPC, true: player emotes -- _value2 = time to use for emoting.
  440.                     if(truefalse == false and pUnit:IsCreature()) then
  441.                         pUnit:Emote(_value, _value2)
  442.                     elseif(truefalse == true) then
  443.                         pPlayer:Emote(_value, _value2)
  444.                     end
  445.                 elseif(_command == 26) then -- Activate gameobject nearest false: to player, true: to coords; with Entry
  446.                     if(truefalse == false) then
  447.                         local GOB = pPlayer:GetGameObjectNearestCoords(pPlayer:GetPositionX(), pPlayer:GetPositionY(), pPlayer:GetPositionZ(), _value)
  448.                         if(GOB ~= nil) then
  449.                             GOB:Activate()
  450.                         end
  451.                     else
  452.                         local GOB = pPlayer:GetGameObjectNearestCoords(_x, _y, _z, _value)
  453.                         if(GOB ~= nil) then
  454.                             GOB:Activate()
  455.                         end
  456.                     end
  457.                 elseif(_command == 27) then -- NPC instant casts spell on False: player, true: self
  458.                     if(pUnit:IsCreature()) then
  459.                         if(truefalse == false) then
  460.                             pUnit:CastSpellOnTarget(pPlayer, _value)
  461.                         else
  462.                             pUnit:CastSpellOnTarget(pUnit, _value)
  463.                         end
  464.                     end
  465.                 elseif(_command == 28) then
  466.                     if(truefalse == false) then -- Player instant casts spell on False: player, true: NPC
  467.                         pPlayer:CastSpellOnTarget(pPlayer, _value)
  468.                     else
  469.                         if(pUnit:IsCreature()) then
  470.                             pPlayer:CastSpellOnTarget(pUnit, _value)
  471.                         end
  472.                     end
  473.                 elseif(_command == 0) then -- teleport
  474.                     GossipMenu.Complete(pPlayer)
  475.                     pPlayer:SafeTeleport(_map, 0, _x, _y, _z, _o)
  476.                     break
  477.                 end
  478.             end
  479.         end
  480.     end
  481.     if(DBGossipsys.option[intid][4] < 0) then
  482.         GossipMenu.Complete(pPlayer)
  483.     else
  484.         menu_id = DBGossipsys.option[intid][4]
  485.         for i = 1, DBGossipsys.menu["rowcount"] do
  486.             if(DBGossipsys.menu[i][1] == menu_id) then
  487.                 npc_text = DBGossipsys.menu[i][2]
  488.                 break
  489.             end
  490.         end
  491.         if(npc_text == nil or npc_text <= 0) then npc_text = 1 end
  492.         DBGossipsys.GetMenu(npc_text, pUnit, pPlayer)
  493.     end
  494.     if(pPlayer:GetSession():IsGM() == false) then
  495.         pPlayer:TakeGold(cost_in_copper)
  496.     end
  497.    
  498. end
  499.  
  500. for i = 1, DBGossipsys.unit["rowcount"] do
  501.     if(DBGossipsys.unit[i][2] == 0) then
  502.         WorldDB:Query("UPDATE `creature_proto` SET `npcflags` = 1 WHERE `entry` = '"..DBGossipsys.unit[i][1].."'")
  503.         RegisterUnitGossipEvent(DBGossipsys.unit[i][1], 1, DBGossipsys.Hello)
  504.         RegisterUnitGossipEvent(DBGossipsys.unit[i][1], 2, DBGossipsys.Select)
  505.     elseif(DBGossipsys.unit[i][2] == 1) then
  506.         RegisterGameObjectEvent(DBGossipsys.unit[i][1], 4, DBGossipsys.Hello)
  507.         RegisterGOGossipEvent(DBGossipsys.unit[i][1], 2, DBGossipsys.Select)
  508.     elseif(DBGossipsys.unit[i][2] == 2) then
  509.         WorldDB:Query("UPDATE `items` SET `spellid_1` = 33227, `spelltrigger_1` = 0 WHERE `entry` = '"..DBGossipsys.unit[i][1].."'")
  510.         RegisterItemGossipEvent(DBGossipsys.unit[i][1], 1, DBGossipsys.Item_trigg)
  511.         RegisterItemGossipEvent(DBGossipsys.unit[i][1], 2, DBGossipsys.Select)
  512.     end
  513. end
  514.  
  515. --[[
  516. FULL CREDIT ABOUT THIS GOES TO Rochet2 AT WOW-V.COM
  517.  
  518. YOU ARE NOT ALLOWED TO RELEASE THIS SCRIPT ANYWHERE WITHOUT MY PERMISSION.
  519. YOU ARE NOT ALLOWED TO SHARE THIS SCRIPT BY POSTING THE SCRIPT OR LINK TO IT ON ANY WEBSITE.
  520. ALL SHARING IS DONE BY GIVING CREDIT TO THE MAKER (Rochet2) AND BY ONLY POSTING A LINK TO HIS THREAD AT WOW-V.COM
  521. LINK TO THE ORIGINAL AND ONLY RELEASE THREAD: http://wow-v.com/forums/index.php?topic=24301.0
  522.  
  523. THIS SCRIPT IS FOR YOUR OWN USE ONLY!
  524.  
  525. More Rochet2's work at projectcode.zzl.org
  526. ]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement