Advertisement
Guest User

Untitled

a guest
Jul 31st, 2009
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 17.69 KB | None | 0 0
  1. /* required sql tables for Guild System*/
  2. // remove /*  */ around the query if you dont want sql errors.
  3.  
  4. /*
  5. DROP TABLE IF EXISTS "ab_guild_lands";
  6.  
  7. CREATE TABLE "ab_guild_lands" (
  8.   "guild_id" int(6) unsigned NOT NULL DEFAULT '0',
  9.   "posX" float NOT NULL DEFAULT '0',
  10.   "posY" float NOT NULL DEFAULT '0',
  11.   "posZ" float NOT NULL DEFAULT '0',
  12.   "mapId" int(10) unsigned NOT NULL DEFAULT '0',
  13.   "zoneid" int(10) unsigned NOT NULL COMMENT 'zone id',
  14.   "areaid" int(10) unsigned NOT NULL COMMENT 'area id',
  15.   PRIMARY KEY ("zoneid")
  16. );
  17.  
  18. DROP TABLE IF EXISTS "ab_land_data";
  19.  
  20. CREATE TABLE "ab_land_data" (
  21.   "guild_id" int(6) unsigned NOT NULL,
  22.   "hostility" enum('HOSTILE','PASSIVE') NOT NULL DEFAULT 'PASSIVE' COMMENT 'Hostility checks',
  23.   "deed" enum('NOTFORSALE','FORSALE') NOT NULL DEFAULT 'NOTFORSALE',
  24.   "landtax" enum('0','1','2','3','4','5','6','7','8','9','10') NOT NULL DEFAULT '0',
  25.   "SalePrice" enum('10K','15K','20K','25K','50K','75K','100k','125K','150K','175K','200K') NOT NULL DEFAULT '10K' COMMENT 'sales checks',
  26.   "mapid" int(10) unsigned NOT NULL,
  27.   "areaid" int(10) unsigned NOT NULL,
  28.   "zoneid" int(10) unsigned NOT NULL,
  29.   PRIMARY KEY ("zoneid")
  30. );
  31.  
  32. */
  33. #include "StdAfx.h"
  34. #include "Setup.h"
  35.  
  36. // The Defines below are not yet implemented, please be patient, its hot and muggy
  37. // out here in Tac Town
  38.  
  39. #define REQ_LEVEL                   80 // change this for level requirements
  40.  
  41. // REMOVING GOLD REMOVAL UNTIL CODED PROPERLY
  42. // #define REQ_COINAGE                  1500000000  // 1500000000 = 150k Gold
  43. #define PORT_REQ_COINAGE            15000       // ??
  44. #define FOOD_ID                     45932
  45. //#define SETPRICE_10               10K
  46. //#define SETPRICE_15               15K
  47. //#define SETPRICE_20               20K
  48. //#define SETPRICE_25               25K
  49. //#define SETPRICE_50               50K
  50. //#define SETPRICE_75               75K
  51. //#define SETPRICE_100              100K
  52. //#define SETPRICE_125              125K
  53. //#define SETPRICE_150              150K
  54. //#define SETPRICE_175              175K
  55. //#define SETPRICE_200              200K
  56. //#define GUILD_SHOP_NPC            993311      // Jotoxs Sick Automated Vendor.(look on mmowned for the updated script)
  57. //#define SPELL_BUFF                22888       // I chose Rallying Cry of the Dragon
  58. static bool bypassCombat = false;//If set to true, will enable players to #event while in combat
  59.  
  60. // Chat Commands
  61. static string COMS              = "#help";          // Lists commands
  62.  
  63. static string COM_ZONE          = "#zone";
  64. static string SET_4_SALE        = "#zone sell";     // sets land for sale
  65. static string BUYLAND           = "#zone buy";      // Buys land if its available for purchase in world.
  66. static string SET_NOT_4_SALE    = "#zone reset";    // sets not for sale
  67. static string G_HEARTH          = "#zone port";     // Ports player to closest Guild house if in a Zone owned by Guild
  68. static string SET_G_HEARTH      = "#zone hearth";   // Sets the location for #zone port
  69.  
  70. static string COM_ADD           = "#add";
  71. static string ADD_FOOD          = "#add food";      // Gives player food/drink
  72. static string ADD_ITEM          = "#add item";      // Gives player items
  73.  
  74.  
  75. static string plr_evn_cmd       = "#event";
  76. static string event_com         = "#event on";
  77. static string event_off         = "#event off";
  78. static string mall_cmd          = "#mall";
  79. static string mall_nort         = "#mall northrend";
  80. static string mall_outl         = "#mall outlands";
  81. static string mall_kalim        = "#mall kalimdor";
  82. static string mall_azero        = "#mall azeroth";
  83.  
  84. //Default Values
  85. static bool event_on = false;
  86. static uint32 emapid = 0;
  87. static float ex = 0.0f;
  88. static float ey = 0.0f;
  89. static float ez = 0.0f;
  90.  
  91. // commented out statics will be usable functions in the near future.
  92.  
  93. //static string WORLD_CHAT      = "#world";
  94. //static string SHOP            = "#guild shop";        //will spawn Jotox's NPC ID - I will not provide his script, I just really love his Vendor Script :)
  95. //static string BUFFME          = "#buffme";            // Gives player buffs - dont have correct functions for adding buffs properly yet
  96.  
  97.  
  98.  
  99. void AddItem(PlayerPointer Plr, const uint32 &ItemID, const uint32 &Amt, const bool &Stack)
  100. {
  101.     ItemPointer ITEM_PTR;
  102.     SlotResult SlotID;
  103.    
  104.     if(Plr == NULL)
  105.         return;
  106.     if(Stack)
  107.     {
  108.     ITEM_PTR = Plr->GetItemInterface()->FindItemLessMax(ItemID, Amt, false);
  109.         if(ITEM_PTR != NULLITEM)
  110.         {
  111.         ITEM_PTR->ModUnsigned32Value(ITEM_FIELD_STACK_COUNT, Amt);
  112.         ITEM_PTR->m_isDirty = true;
  113.         Plr->BroadcastMessage("You have recieved %s%s x%u.", MSG_COLOR_GREEN, ITEM_PTR->GetProto()->Name1, Amt);
  114.         return;
  115.         }      
  116.     }
  117.     for(uint32 i = 1;i <= Amt;i++)
  118.     {
  119.     ITEM_PTR = objmgr.CreateItem(ItemID, Plr);
  120.         if(ITEM_PTR == NULLITEM)
  121.         return;
  122.         SlotID = Plr->GetItemInterface()->FindFreeInventorySlot(ITEM_PTR->GetProto());
  123.         if(SlotID.Result)
  124.         {
  125.         Plr->GetItemInterface()->SafeAddItem(ItemID, SlotID.ContainerSlot, SlotID.Slot);
  126.         Plr->BroadcastMessage("You have recieved %s%s x%u.", MSG_COLOR_GREEN, ITEM_PTR->GetProto()->Name1, Amt);
  127.         }
  128.         else
  129.         Plr->SendAreaTriggerMessage("You Do not have enough Free Space.");
  130.     }
  131. }
  132.  
  133. bool Guild_Chat(PlayerPointer Plr, uint32 Type, uint32 Lang, string Message, string Misc)
  134. {
  135. if(Message == COMS)
  136.     {
  137.         Plr->BroadcastMessage("[Commands List]");
  138.         Plr->BroadcastMessage("[YOU MUST USE LOWERCASE!]");
  139.         Plr->BroadcastMessage("#help - Shows available Commands.");
  140.         Plr->BroadcastMessage("#zone - Used for zone commands.");
  141.         Plr->BroadcastMessage("#add - Adds an Item to your Bags.");
  142.         Plr->BroadcastMessage("#mall - available mall ports.");
  143.         Plr->BroadcastMessage("#event - join available events.");
  144.  
  145. return true;
  146. }
  147. else if(Message == COM_ZONE)
  148.     {
  149.         Plr->BroadcastMessage("[Commands List]");
  150.         Plr->BroadcastMessage("#zone sell - Sets your land For Sale");
  151.         Plr->BroadcastMessage("#zone buy - Use this command to purchase Land for your Guild.");
  152.         Plr->BroadcastMessage("#zone reset - Resets your land Sale - Must be done before another player purchases land.");
  153.         Plr->BroadcastMessage("#zone port - Teleports you to nearest Guild House on Land you own.");
  154.         Plr->BroadcastMessage("#zone hearth - Resets Your Guilds Hearth Location per Zone.");
  155. return true;
  156. }
  157. else if(Message == COM_ADD)
  158.     {
  159.         Plr->BroadcastMessage("[Commands List]");
  160.         Plr->BroadcastMessage("#add food - Adds Food to your Bags.");
  161. return true;
  162. }
  163. //else if(Message == COM_ADD_ITEM)
  164. //  {
  165. //      Plr->BroadcastMessage("[Commands List]");
  166. //      Plr->BroadcastMessage("#add item swords - Adds Food to your Bags.");
  167. //return true;
  168. //}
  169. else if(Message == BUYLAND)
  170.     {
  171.     QueryResult * Q_RES_BUY_COM = CharacterDatabase.Query("SELECT * FROM ab_guild_lands WHERE guild_id = %u AND zoneid = %u", Plr->GetGuildId(), Plr->GetZoneId());
  172.     QueryResult * Q_RES_BUY_FORSALE = CharacterDatabase.Query("SELECT * FROM ab_land_data WHERE zoneid = %u AND deed = FORSALE", Plr->GetZoneId());
  173.     if(Plr->GetMapId() != 0 && Plr->GetMapId() != 1 && Plr->GetMapId() != 530 && Plr->GetMapId() != 571)
  174.     {
  175.         Plr->BroadcastMessage("You can't purchase Instances!");
  176.         return true;
  177.     }
  178.     if(
  179.         Plr->CombatStatus.IsInCombat())
  180.     {
  181.         Plr->BroadcastMessage("You are in Combat!");
  182.         return true;
  183.     }
  184.     if(
  185.         Plr->getLevel() < REQ_LEVEL) // I run a High rate server, so I set this level cap to 80 for default
  186.     {
  187.         Plr->BroadcastMessage("You must be level 80.");
  188.         return true;
  189.     }
  190.     if(
  191.         Plr->GetGuildId() == NULL)
  192.     {  
  193.         Plr->BroadcastMessage("You are not in a Guild.");
  194.         return true;
  195.     }
  196.     if(
  197.         Plr->GetGuild()->GetGuildLeader() != Plr->GetGUID())
  198.     {
  199.         Plr->BroadcastMessage("You are not the Guild Master.");
  200.         return true;
  201.     }
  202.     if(Q_RES_BUY_FORSALE != NULL)
  203.     {
  204.         Plr->BroadcastMessage("This area is not for sale.");
  205.     }
  206.     if(Q_RES_BUY_FORSALE == NULL)
  207.     {
  208.         CharacterDatabase.Execute("REPLACE INTO ab_land_data VALUES('%u', 'PASSIVE', 'NOTFORSALE', '0', '10K', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetMapId(), Plr->GetAreaID(), Plr->GetZoneId());
  209.         CharacterDatabase.Execute("REPLACE INTO ab_guild_lands VALUES('%u', '%f', '%f', '%f', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetPositionX(), Plr->GetPositionY(), Plr->GetPositionZ(), Plr->GetMapId(), Plr->GetZoneId(), Plr->GetAreaID());
  210.         Plr->BroadcastMessage("Congrats! You just purchased this Zone From another Guild.");
  211.     }
  212.     if(Q_RES_BUY_COM != NULL)
  213.     {
  214.         Plr->BroadcastMessage("This area has already been purchased.");
  215.     }
  216.     if(Q_RES_BUY_COM == NULL)
  217.     {
  218.         CharacterDatabase.Execute("INSERT INTO ab_guild_lands VALUES('%u', '%f', '%f', '%f', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetPositionX(), Plr->GetPositionY(), Plr->GetPositionZ(), Plr->GetMapId(), Plr->GetZoneId(), Plr->GetAreaID());
  219.         CharacterDatabase.Execute("INSERT INTO ab_land_data VALUES('%u', 'PASSIVE', 'NOTFORSALE', '0', '10K', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetMapId(), Plr->GetAreaID(), Plr->GetZoneId());
  220.         Plr->BroadcastMessage("Gratz! Your Guild now Owns this area.");
  221.             }
  222.         return true;
  223.         }
  224. else if(Message == SET_G_HEARTH)
  225.     {
  226.     QueryResult * Q_RES_G_HEARTH_SET = CharacterDatabase.Query("SELECT * FROM ab_guild_lands WHERE guild_id = %u AND zoneid = %u", Plr->GetGuildId(), Plr->GetZoneId());
  227.     if(Plr->GetMapId() != 0 && Plr->GetMapId() != 1 && Plr->GetMapId() != 530 && Plr->GetMapId() != 571)
  228.     {
  229.         Plr->BroadcastMessage("You can't use this command in Instances!");
  230.         return true;
  231.     }
  232.     if(
  233.         Plr->CombatStatus.IsInCombat())
  234.     {
  235.         Plr->BroadcastMessage("You are in Combat!");
  236.         return true;
  237.     }
  238.     if(
  239.         Plr->getLevel() < REQ_LEVEL)
  240.     {
  241.         Plr->BroadcastMessage("You must be level 80.");
  242.         return true;
  243.     }
  244.     if(
  245.         Plr->GetGuildId() == NULL)
  246.     {  
  247.         Plr->BroadcastMessage("You are not in a Guild.");
  248.         return true;
  249.     }
  250.     if(
  251.         Plr->GetGuild()->GetGuildLeader() != Plr->GetGUID())
  252.     {
  253.         Plr->BroadcastMessage("You are not the Guild Master.");
  254.         return true;
  255.     }
  256.     if(Q_RES_G_HEARTH_SET == NULL)
  257.     {
  258.         Plr->BroadcastMessage("Your Guild does not Own Land in this Area.");
  259.     }
  260.     if(Q_RES_G_HEARTH_SET != NULL)
  261.     {
  262.         CharacterDatabase.Execute("REPLACE INTO ab_guild_lands VALUES('%u', '%f', '%f', '%f', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetPositionX(), Plr->GetPositionY(), Plr->GetPositionZ(), Plr->GetMapId(), Plr->GetZoneId(), Plr->GetAreaID());
  263.         Plr->BroadcastMessage("Your Guild Hearth Is Now Set.");
  264.             }
  265.         return true;
  266.         }
  267. else if(Message == SET_4_SALE)
  268.     {
  269.     QueryResult * Q_RES_SET_4_SALE = CharacterDatabase.Query("SELECT * FROM ab_guild_lands WHERE guild_id = %u AND zoneid = %u", Plr->GetGuildId(), Plr->GetZoneId());
  270.     uint32 PLR_COINAGE = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
  271.     QueryResult * Q_RES_SET_DATA = CharacterDatabase.Query("SELECT * FROM ab_land_data WHERE guild_id = %u AND zoneid = %u AND deed = NOTFORSALE", Plr->GetGuildId(), Plr->GetZoneId());
  272.     if(Plr->GetMapId() != 0 && Plr->GetMapId() != 1 && Plr->GetMapId() != 530 && Plr->GetMapId() != 571)
  273.     {
  274.         Plr->BroadcastMessage("You can't use this command in Instances!");
  275.         return true;
  276.     }
  277.     if(
  278.         Plr->CombatStatus.IsInCombat())
  279.     {
  280.         Plr->BroadcastMessage("You are in Combat!");
  281.         return true;
  282.     }
  283.     if(
  284.         Plr->getLevel() < REQ_LEVEL)
  285.     {
  286.         Plr->BroadcastMessage("You must be level 80.");
  287.         return true;
  288.     }
  289.     if(
  290.         Plr->GetGuildId() == NULL)
  291.     {  
  292.         Plr->BroadcastMessage("You are not in a Guild.");
  293.         return true;
  294.     }
  295.     if(
  296.         Plr->GetGuild()->GetGuildLeader() != Plr->GetGUID())
  297.     {
  298.         Plr->BroadcastMessage("You are not the Guild Master.");
  299.         return true;
  300.     }
  301.     if(Q_RES_SET_4_SALE == NULL)
  302.     {
  303.         Plr->BroadcastMessage("Your Guild does not Own Land in this Area.");
  304.     }
  305.     if(Q_RES_SET_DATA == NULL)
  306.     {
  307.         Plr->BroadcastMessage("Your Guild does not Own Land in this Area.");
  308.     }
  309.     if(Q_RES_SET_4_SALE != NULL)
  310.     {
  311.         CharacterDatabase.Execute("REPLACE INTO ab_land_data VALUES('%u', 'PASSIVE', 'FORSALE', '0', '10K', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetMapId(), Plr->GetAreaID(), Plr->GetZoneId());
  312.        
  313.         Plr->BroadcastMessage("Your Land is now for Sale, you still have the option to reset your sale, but this must be done before someone purchases the land.");
  314.             }
  315.     if(Q_RES_SET_DATA != NULL)
  316.     {
  317.         CharacterDatabase.Execute("REPLACE INTO ab_land_data VALUES('%u', 'PASSIVE', 'FORSALE', '0', '10K', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetMapId(), Plr->GetAreaID(), Plr->GetZoneId());
  318.        
  319.         Plr->BroadcastMessage("Your Land is now for Sale, you still have the option to reset your sale, but this must be done before someone purchases the land.");
  320.             }
  321.         return true;
  322.         }
  323. else if(Message == SET_NOT_4_SALE)
  324.     {
  325.     QueryResult * Q_RES_SET_NOT_4_SALE = CharacterDatabase.Query("SELECT * FROM ab_guild_lands WHERE guild_id = %u AND zoneid = %u", Plr->GetGuildId(), Plr->GetZoneId());
  326.     uint32 PLR_COINAGE = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
  327.     QueryResult * Q_RES_SET_DATA2 = CharacterDatabase.Query("SELECT * FROM ab_land_data WHERE guild_id = %u AND zoneid = %u AND deed = FORSALE", Plr->GetGuildId(), Plr->GetZoneId());
  328.     if(Plr->GetMapId() != 0 && Plr->GetMapId() != 1 && Plr->GetMapId() != 530 && Plr->GetMapId() != 571)
  329.     {
  330.         Plr->BroadcastMessage("You can't use this command in Instances!");
  331.         return true;
  332.     }
  333.     if(
  334.         Plr->CombatStatus.IsInCombat())
  335.     {
  336.         Plr->BroadcastMessage("You are in Combat!");
  337.         return true;
  338.     }
  339.     if(
  340.         Plr->getLevel() < REQ_LEVEL)
  341.     {
  342.         Plr->BroadcastMessage("You must be level 80.");
  343.         return true;
  344.     }
  345.     if(
  346.         Plr->GetGuildId() == NULL)
  347.     {  
  348.         Plr->BroadcastMessage("You are not in a Guild.");
  349.         return true;
  350.     }
  351.     if(
  352.         Plr->GetGuild()->GetGuildLeader() != Plr->GetGUID())
  353.     {
  354.         Plr->BroadcastMessage("You are not the Guild Master.");
  355.         return true;
  356.     }
  357.     if(Q_RES_SET_NOT_4_SALE == NULL)
  358.     {
  359.         Plr->BroadcastMessage("Your Guild does not Own Land in this Area.");
  360.     }
  361.     if(Q_RES_SET_DATA2 == NULL)
  362.     {
  363.         Plr->BroadcastMessage("Your Guild does not Own Land in this Area.");
  364.     }
  365.     if(Q_RES_SET_NOT_4_SALE != NULL)
  366.     {
  367.         CharacterDatabase.Execute("REPLACE INTO ab_land_data VALUES('%u', 'PASSIVE', 'NOTFORSALE', '0', '10K', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetMapId(), Plr->GetAreaID(), Plr->GetZoneId());
  368.        
  369.         Plr->BroadcastMessage("Your Land is no longer for sale.");
  370.             }
  371.     if(Q_RES_SET_DATA2 != NULL)
  372.     {
  373.         CharacterDatabase.Execute("REPLACE INTO ab_land_data VALUES('%u', 'PASSIVE', 'NOTFORSALE', '0', '10K', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetMapId(), Plr->GetAreaID(), Plr->GetZoneId());
  374.        
  375.         Plr->BroadcastMessage("Your Land is no longer for sale.");
  376.             }
  377.         return true;
  378.         }
  379.  
  380.         else if(Message == ADD_FOOD)
  381.         {
  382.         AddItem(Plr, FOOD_ID, 1, true);// "1" is the amount of the item to give - True means we stack item
  383.         return true;
  384.         }
  385.         else if(Message == event_com && Plr->GetSession()->HasGMPermissions())
  386.         {
  387.         event_on = true;
  388.         ex = Plr->GetPositionX();
  389.         ey = Plr->GetPositionY();
  390.         ez = Plr->GetPositionZ();
  391.         emapid = Plr->GetMapId();
  392.         return true;
  393.         }
  394.         else if(Message == event_off && Plr->GetSession()->HasGMPermissions())
  395.         {
  396.         event_on = false;
  397.         return true;
  398.         }
  399.         else if(Message == plr_evn_cmd)
  400.         {
  401.         if(event_on)
  402.         if(bypassCombat || !Plr->CombatStatus.IsInCombat())
  403.         Plr->EventTeleport(emapid, ex, ey, ez);
  404.         else
  405.         Plr->BroadcastMessage("You can't port while in combat.");
  406.         else
  407.         Plr->BroadcastMessage("There's no active event at the moment.");
  408.         return true;
  409.         }
  410.         else if(Message == mall_cmd)
  411.         {
  412.         if(bypassCombat || !Plr->CombatStatus.IsInCombat())
  413.         if( Plr->GetTeam() == 1 )
  414.         Plr->EventTeleport(571, 2827.1, 6176.8, 122); //<---Done Horde Mall--->//
  415.         else
  416.         Plr->EventTeleport(571, 2314.69, 5258.58, 12); //<-----Done Ally Mall--->//
  417.         else
  418.             Plr->BroadcastMessage("You can't port while in combat.");  
  419.     return true;
  420.     }
  421. else if(Message == G_HEARTH)
  422.     {
  423.     QueryResult * Q_RES_LOWBIE = CharacterDatabase.Query("SELECT * FROM ab_guild_lands WHERE guild_id = %u AND zoneid = %u", Plr->GetGuildId(), Plr->GetZoneId());
  424.     if(Q_RES_LOWBIE == NULL)
  425.     {
  426.         Plr->BroadcastMessage("Your Guild does not own any Land Nearby.");
  427.         Plr->Gossip_Complete();
  428.     return true;
  429.     }
  430.     if(Q_RES_LOWBIE->GetRowCount() > 1)
  431.     {
  432.         Plr->BroadcastMessage("Error 421 - Please Report this on the Forums - MYSQL Error - Too much Data to Input");
  433.         Plr->Gossip_Complete();
  434.     return true;
  435.     }
  436.         float x, y, z;
  437.         uint32 MapID;
  438.         Field * F_RES = Q_RES_LOWBIE->Fetch();
  439.         x = F_RES[1].GetFloat();
  440.         y = F_RES[2].GetFloat();
  441.         z = F_RES[3].GetFloat();
  442.         MapID = F_RES[4].GetUInt32();
  443.         Plr->EventTeleport(MapID, x, y, z);
  444.         }
  445.     return true;
  446. }
  447.  
  448. bool ZoneCheckHostile(PlayerPointer Plr, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
  449. {   QueryResult * RES_IS_LAND_HOSTILE = CharacterDatabase.Query("SELECT * FROM ab_land_data WHERE zoneid = %u AND hostility = HOSTILE", Plr->GetZoneId());
  450.     if(RES_IS_LAND_HOSTILE == NULL)
  451.     {
  452.     Plr->SetFFAPvPFlag();
  453.     sChatHandler.SystemMessage(Plr->GetSession(), "Be wary young Traveler, This land is hostile to you... ");
  454.     return true;
  455.     }
  456. }
  457. bool ZoneCheckPassive(PlayerPointer Plr, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
  458. {
  459.     QueryResult * RES_IS_LAND_PASSIVE = CharacterDatabase.Query("SELECT * FROM ab_land_data WHERE zoneid = %u AND hostility = PASSIVE", Plr->GetZoneId());
  460.     if(RES_IS_LAND_PASSIVE == NULL)
  461.     {
  462.     Plr->RemoveFFAPvPFlag();
  463.     sChatHandler.SystemMessage(Plr->GetSession(), "You are in a Passive zone, you are now safe... for now.");
  464.     return true;
  465.     }
  466. }
  467. void OnNewGuild(PlayerPointer Plr, Guild * G_PTR)
  468. {
  469.     char NewGuild[1024];
  470.     snprintf((char*)NewGuild, 1024, "[Guild System] |cff33ff55 [%s]|r - has been formed by|cffff00bb %s", G_PTR->GetGuildName(), Plr->GetName());
  471.     sWorld.SendWorldWideScreenText(NewGuild);
  472. }
  473. void OnJoinGuild(PlayerPointer Plr, Guild * G_PTR)
  474. {
  475.     char JoinGuild[1024];
  476.     snprintf((char*)JoinGuild, 1024, "[Guild System] |cff33ff55 [%s]|r - has Joined the Guild |cffff00bb %s", Plr->GetName(), G_PTR->GetGuildName());
  477.     sWorld.SendWorldWideScreenText(JoinGuild);
  478. }
  479. void SetupGuild_Chat(ScriptMgr * mgr)
  480. {
  481.     mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, &Guild_Chat);
  482.     mgr->register_hook(SERVER_HOOK_EVENT_ON_ZONE, &ZoneCheckHostile);
  483.     mgr->register_hook(SERVER_HOOK_EVENT_ON_ZONE, &ZoneCheckPassive);
  484.     mgr->register_hook(SERVER_HOOK_EVENT_ON_GUILD_CREATE, OnNewGuild);
  485.     mgr->register_hook(SERVER_HOOK_EVENT_ON_GUILD_JOIN, OnJoinGuild);
  486. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement