Advertisement
Rochet2

LHA Final version 2.3

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