Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Required SQL Tables. Load these into your Character DataBase.
- */
- /*
- # HeidiSQL Dump
- #
- # --------------------------------------------------------
- # Host: 127.0.0.1
- # Database: logon_conquest
- # Server version: 5.1.30-community
- # Server OS: Win32
- # Target compatibility: ANSI SQL
- # HeidiSQL version: 4.0
- # Date/time: 2009-07-31 04:32:26
- # --------------------------------------------------------
- /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI,NO_BACKSLASH_ESCAPES';*/
- /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;*/
- DROP TABLE IF EXISTS "ab_guild_lands";
- #
- # Table structure for table 'ab_guild_lands'
- #
- CREATE TABLE "ab_guild_lands" (
- "guild_id" int(6) unsigned NOT NULL DEFAULT '0',
- "posX" float NOT NULL DEFAULT '0',
- "posY" float NOT NULL DEFAULT '0',
- "posZ" float NOT NULL DEFAULT '0',
- "mapId" int(10) unsigned NOT NULL DEFAULT '0',
- "zoneid" int(10) unsigned NOT NULL COMMENT 'zone id',
- "areaid" int(10) unsigned NOT NULL COMMENT 'area id',
- PRIMARY KEY ("zoneid")
- );
- DROP TABLE IF EXISTS "ab_land_data";
- #
- # Table structure for table 'ab_land_data'
- #
- CREATE TABLE "ab_land_data" (
- "guild_id" int(6) unsigned NOT NULL,
- "hostility" enum('HOSTILE','PASSIVE') NOT NULL DEFAULT 'PASSIVE' COMMENT 'Hostility checks',
- "deed" enum('NOTFORSALE','FORSALE') NOT NULL DEFAULT 'NOTFORSALE',
- "landtax" enum('0','1','2','3','4','5','6','7','8','9','10') NOT NULL DEFAULT '0',
- "SalePrice" enum('10K','15K','20K','25K','50K','75K','100k','125K','150K','175K','200K') NOT NULL DEFAULT '10K' COMMENT 'sales checks',
- "mapid" int(10) unsigned NOT NULL,
- "areaid" int(10) unsigned NOT NULL,
- "zoneid" int(10) unsigned NOT NULL,
- PRIMARY KEY ("zoneid")
- );
- /*!40101 SET SQL_MODE=@OLD_SQL_MODE;*/
- /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;*/
- */
- #include "StdAfx.h"
- #include "Setup.h"
- // The Defines below are not yet implemented, please be patient, its hot and muggy
- // out here in Tac Town
- #define GUILD_MASTER_ITEM 62810 // Guild Control Item
- #define REQ_COINAGE 1500000000 // 1500000000 = 150k Gold
- #define PORT_REQ_COINAGE 15000 // ??
- #define FOOD_ID 45932
- //#define SETPRICE_10 10K
- //#define SETPRICE_15 15K
- //#define SETPRICE_20 20K
- //#define SETPRICE_25 25K
- //#define SETPRICE_50 50K
- //#define SETPRICE_75 75K
- //#define SETPRICE_100 100K
- //#define SETPRICE_125 125K
- //#define SETPRICE_150 150K
- //#define SETPRICE_175 175K
- //#define SETPRICE_200 200K
- //#define GUILD_SHOP_NPC 993311 // Jotoxs Sick Automated Vendor.(look on mmowned for the updated script)
- //#define SPELL_BUFF 22888 // I chose Rallying Cry of the Dragon
- // Chat Commands
- static string COMS = "#help"; // Lists commands
- static string BUYLAND = "#buyland"; // Buys land if its available for purchase in world.
- static string G_HEARTH = "#guild hearth"; // Ports player to closest Guild house if in a Zone owned by Guild
- static string ADD_FOOD = "#add food"; // Gives player food/drink
- static string ADD_ITEM = "#add item";
- static string SET_G_HEARTH = "#set guildhearth";
- // commented out statics will be usable functions in the near future.
- static string WORLD_CHAT = "#world";
- static string SHOP = "#guild shop"; //will spawn Jotox's NPC ID - I will not provide his script, I just really love his Vendor Script :)
- //static string BUFFME = "#buffme"; // Gives player buffs - dont have correct functions for adding buffs properly yet
- static string SET_4_SALE = "#set forsale"; // sets land for sale
- static string SET_NOT_4_SALE = "#set notforsale"; // sets not for sale
- void AddItem(PlayerPointer Plr, const uint32 &ItemID, const uint32 &Amt, const bool &Stack)
- {
- ItemPointer ITEM_PTR;
- SlotResult SlotID;
- if(Plr == NULL)
- return;
- if(Stack)
- {
- ITEM_PTR = Plr->GetItemInterface()->FindItemLessMax(ItemID, Amt, false);
- if(ITEM_PTR != NULLITEM)
- {
- ITEM_PTR->ModUnsigned32Value(ITEM_FIELD_STACK_COUNT, Amt);
- ITEM_PTR->m_isDirty = true;
- Plr->BroadcastMessage("You have recieved %s%s x%u.", MSG_COLOR_GREEN, ITEM_PTR->GetProto()->Name1, Amt);
- return;
- }
- }
- for(uint32 i = 1;i <= Amt;i++)
- {
- ITEM_PTR = objmgr.CreateItem(ItemID, Plr);
- if(ITEM_PTR == NULLITEM)
- return;
- SlotID = Plr->GetItemInterface()->FindFreeInventorySlot(ITEM_PTR->GetProto());
- if(SlotID.Result)
- {
- Plr->GetItemInterface()->SafeAddItem(ItemID, SlotID.ContainerSlot, SlotID.Slot);
- Plr->BroadcastMessage("You have recieved %s%s x%u.", MSG_COLOR_GREEN, ITEM_PTR->GetProto()->Name1, Amt);
- }
- else
- Plr->SendAreaTriggerMessage("You Do not have enough Free Space.");
- }
- }
- bool Guild_Chat(PlayerPointer Plr, uint32 Type, uint32 Lang, string Message, string Misc)
- {
- if(Message == COMS)
- {
- Plr->BroadcastMessage("[Commands List]");
- Plr->BroadcastMessage("#help - Shows available Commands.");
- Plr->BroadcastMessage("#buyland - Use this command to purchase Land for your Guild.");
- Plr->BroadcastMessage("#set forsale - Sets your land For Sale");
- Plr->BroadcastMessage("#set notforsale - Resets your land Sale - Must be done before another player purchases land.");
- Plr->BroadcastMessage("#guild hearth - Teleports you to nearest Guild House on Land you own.");
- Plr->BroadcastMessage("#set guildhearth - Resets Your Guilds Hearth Location per Zone.");
- Plr->BroadcastMessage("#add food - Adds Food to your Bags.");
- return true;
- }
- else if(Message == BUYLAND)
- {
- QueryResult * Q_RES_BUY_COM = CharacterDatabase.Query("SELECT * FROM ab_guild_lands WHERE guild_id = %u AND zoneid = %u", Plr->GetGuildId(), Plr->GetZoneId());
- uint32 PLR_COINAGE = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
- QueryResult * Q_RES_BUY_FORSALE = CharacterDatabase.Query("SELECT * FROM ab_land_data WHERE zoneid = %u AND deed = FORSALE", Plr->GetZoneId());
- if(Plr->GetMapId() != 0 && Plr->GetMapId() != 1 && Plr->GetMapId() != 530 && Plr->GetMapId() != 571)
- {
- Plr->BroadcastMessage("You can't purchase Instances!");
- return true;
- }
- if(
- Plr->CombatStatus.IsInCombat())
- {
- Plr->BroadcastMessage("You are in Combat!");
- return true;
- }
- if(
- Plr->getLevel() < 10)
- {
- Plr->BroadcastMessage("You must be level 10.");
- return true;
- }
- if(
- Plr->GetGuildId() == NULL)
- {
- Plr->BroadcastMessage("You are not in a Guild.");
- return true;
- }
- if(
- Plr->GetGuild()->GetGuildLeader() != Plr->GetGUID())
- {
- Plr->BroadcastMessage("You are not the Guild Master.");
- return true;
- }
- if(Q_RES_BUY_FORSALE != NULL)
- {
- Plr->BroadcastMessage("This area is not for sale.");
- }
- if(Q_RES_BUY_FORSALE == NULL)
- {
- CharacterDatabase.Execute("REPLACE INTO ab_land_data VALUES('%u', 'PASSIVE', 'NOTFORSALE', '0', '10K', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetMapId(), Plr->GetAreaID(), Plr->GetZoneId());
- 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());
- Plr->BroadcastMessage("Congrats! You just purchased this Zone From another Guild.");
- }
- if(Q_RES_BUY_COM != NULL)
- {
- Plr->BroadcastMessage("This area has already been purchased.");
- }
- if(PLR_COINAGE < (REQ_COINAGE))
- {
- Plr->BroadcastMessage("You don't have enough gold to purchase this Land.");
- }
- if(Q_RES_BUY_COM == NULL)
- {
- 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());
- CharacterDatabase.Execute("INSERT INTO ab_land_data VALUES('%u', 'PASSIVE', 'NOTFORSALE', '0', '10K', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetMapId(), Plr->GetAreaID(), Plr->GetZoneId());
- Plr->BroadcastMessage("Gratz! Your Guild now Owns this area.");
- }
- return true;
- }
- else if(Message == SET_G_HEARTH)
- {
- QueryResult * Q_RES_G_HEARTH_SET = CharacterDatabase.Query("SELECT * FROM ab_guild_lands WHERE guild_id = %u AND zoneid = %u", Plr->GetGuildId(), Plr->GetZoneId());
- uint32 PLR_COINAGE = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
- if(Plr->GetMapId() != 0 && Plr->GetMapId() != 1 && Plr->GetMapId() != 530 && Plr->GetMapId() != 571)
- {
- Plr->BroadcastMessage("You can't use this command in Instances!");
- return true;
- }
- if(
- Plr->CombatStatus.IsInCombat())
- {
- Plr->BroadcastMessage("You are in Combat!");
- return true;
- }
- if(
- Plr->getLevel() < 10)
- {
- Plr->BroadcastMessage("You must be level 10.");
- return true;
- }
- if(
- Plr->GetGuildId() == NULL)
- {
- Plr->BroadcastMessage("You are not in a Guild.");
- return true;
- }
- if(
- Plr->GetGuild()->GetGuildLeader() != Plr->GetGUID())
- {
- Plr->BroadcastMessage("You are not the Guild Master.");
- return true;
- }
- if(Q_RES_G_HEARTH_SET == NULL)
- {
- Plr->BroadcastMessage("Your Guild does not Own Land in this Area.");
- }
- if(PLR_COINAGE < (PORT_REQ_COINAGE))
- {
- Plr->BroadcastMessage("You don't have enough gold to set your Guild Hearth.");
- }
- if(Q_RES_G_HEARTH_SET != NULL)
- {
- 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());
- Plr->BroadcastMessage("Your Guild Hearth Is Now Set.");
- }
- return true;
- }
- else if(Message == SET_4_SALE)
- {
- QueryResult * Q_RES_SET_4_SALE = CharacterDatabase.Query("SELECT * FROM ab_guild_lands WHERE guild_id = %u AND zoneid = %u", Plr->GetGuildId(), Plr->GetZoneId());
- uint32 PLR_COINAGE = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
- 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());
- if(Plr->GetMapId() != 0 && Plr->GetMapId() != 1 && Plr->GetMapId() != 530 && Plr->GetMapId() != 571)
- {
- Plr->BroadcastMessage("You can't use this command in Instances!");
- return true;
- }
- if(
- Plr->CombatStatus.IsInCombat())
- {
- Plr->BroadcastMessage("You are in Combat!");
- return true;
- }
- if(
- Plr->getLevel() < 10)
- {
- Plr->BroadcastMessage("You must be level 10.");
- return true;
- }
- if(
- Plr->GetGuildId() == NULL)
- {
- Plr->BroadcastMessage("You are not in a Guild.");
- return true;
- }
- if(
- Plr->GetGuild()->GetGuildLeader() != Plr->GetGUID())
- {
- Plr->BroadcastMessage("You are not the Guild Master.");
- return true;
- }
- if(Q_RES_SET_4_SALE == NULL)
- {
- Plr->BroadcastMessage("Your Guild does not Own Land in this Area.");
- }
- if(Q_RES_SET_DATA == NULL)
- {
- Plr->BroadcastMessage("Your Guild does not Own Land in this Area.");
- }
- if(Q_RES_SET_4_SALE != NULL)
- {
- CharacterDatabase.Execute("REPLACE INTO ab_land_data VALUES('%u', 'PASSIVE', 'FORSALE', '0', '10K', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetMapId(), Plr->GetAreaID(), Plr->GetZoneId());
- 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.");
- }
- if(Q_RES_SET_DATA != NULL)
- {
- CharacterDatabase.Execute("REPLACE INTO ab_land_data VALUES('%u', 'PASSIVE', 'FORSALE', '0', '10K', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetMapId(), Plr->GetAreaID(), Plr->GetZoneId());
- 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.");
- }
- return true;
- }
- else if(Message == SET_NOT_4_SALE)
- {
- 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());
- uint32 PLR_COINAGE = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
- 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());
- if(Plr->GetMapId() != 0 && Plr->GetMapId() != 1 && Plr->GetMapId() != 530 && Plr->GetMapId() != 571)
- {
- Plr->BroadcastMessage("You can't use this command in Instances!");
- return true;
- }
- if(
- Plr->CombatStatus.IsInCombat())
- {
- Plr->BroadcastMessage("You are in Combat!");
- return true;
- }
- if(
- Plr->getLevel() < 10)
- {
- Plr->BroadcastMessage("You must be level 10.");
- return true;
- }
- if(
- Plr->GetGuildId() == NULL)
- {
- Plr->BroadcastMessage("You are not in a Guild.");
- return true;
- }
- if(
- Plr->GetGuild()->GetGuildLeader() != Plr->GetGUID())
- {
- Plr->BroadcastMessage("You are not the Guild Master.");
- return true;
- }
- if(Q_RES_SET_NOT_4_SALE == NULL)
- {
- Plr->BroadcastMessage("Your Guild does not Own Land in this Area.");
- }
- if(Q_RES_SET_DATA2 == NULL)
- {
- Plr->BroadcastMessage("Your Guild does not Own Land in this Area.");
- }
- if(Q_RES_SET_NOT_4_SALE != NULL)
- {
- CharacterDatabase.Execute("REPLACE INTO ab_land_data VALUES('%u', 'PASSIVE', 'NOTFORSALE', '0', '10K', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetMapId(), Plr->GetAreaID(), Plr->GetZoneId());
- Plr->BroadcastMessage("Your Land is no longer for sale.");
- }
- if(Q_RES_SET_DATA2 != NULL)
- {
- CharacterDatabase.Execute("REPLACE INTO ab_land_data VALUES('%u', 'PASSIVE', 'NOTFORSALE', '0', '10K', '%u', '%u', '%u')", Plr->GetGuildId(), Plr->GetMapId(), Plr->GetAreaID(), Plr->GetZoneId());
- Plr->BroadcastMessage("Your Land is no longer for sale.");
- }
- return true;
- }
- else if(Message == ADD_FOOD)
- {
- AddItem(Plr, FOOD_ID, 1, true);// "1" is the amount of the item to give - True means we stack item
- return true;
- }
- else if(Message == G_HEARTH)
- {
- QueryResult * Q_RES_LOWBIE = CharacterDatabase.Query("SELECT * FROM ab_guild_lands WHERE guild_id = %u AND zoneid = %u", Plr->GetGuildId(), Plr->GetZoneId());
- uint32 PLR_COINAGE = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
- if(Q_RES_LOWBIE == NULL)
- {
- Plr->BroadcastMessage("Your Guild does not own any Land Nearby.");
- Plr->Gossip_Complete();
- return true;
- }
- if(Q_RES_LOWBIE->GetRowCount() > 1)
- {
- Plr->BroadcastMessage("Error 421 - Please Report this on the Forums - MYSQL Error - Too much Data to Input");
- Plr->Gossip_Complete();
- return true;
- }
- if(PLR_COINAGE < (PORT_REQ_COINAGE))
- {
- Plr->BroadcastMessage("You don't have enough gold to teleport to your house.");
- Plr->Gossip_Complete();
- return true;
- }
- float x, y, z;
- uint32 MapID;
- Field * F_RES = Q_RES_LOWBIE->Fetch();
- x = F_RES[1].GetFloat();
- y = F_RES[2].GetFloat();
- z = F_RES[3].GetFloat();
- MapID = F_RES[4].GetUInt32();
- Plr->EventTeleport(MapID, x, y, z);
- }
- return true;
- }
- void SetupGuild_Chat(ScriptMgr * mgr)
- {
- mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, &Guild_Chat);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement