吾爱尚玩资源基地
标题:
仿官方魔兽世界私服服务端的会员穿戴限制系统
[打印本页]
作者:
admin
时间:
2016-4-19 22:55
标题:
仿官方魔兽世界私服服务端的会员穿戴限制系统
diff --git a/MgcoreDev/V10.5.5_mangos_mangos_string.sql b/MgcoreDev/V10.5.5_mangos_mangos_string.sqlnew file mode 100644
index 0000000..e0293b6
--- /dev/null
+++ b/MgcoreDev/V10.5.5_mangos_mangos_string.sql
@@ -0,0 +1,6 @@
+锘縍EPLACE INTO `mangos_string` VALUES ('15053', '[璐?拱澶磋?]浣犲凡缁忔湁璇ュご琛斾簡锛岃喘涔板け璐?, null, null, null, null, null, null, null, null);
+REPLACE INTO `mangos_string` VALUES ('15031', '[澶磋?]璐?拱澶磋?瀵瑰簲鐨勪細鍛樼瓑绾ф垚鍔?-閲嶆柊鐧婚檰鍚庣敓鏁?, null, null, null, null, null, null, null, null);
+
+
+REPLACE INTO `mangos_string` VALUES ('15054', '[瑁呭?绌挎埓]浣犵殑鐜╁?绛夌骇涓嶅?锛屾棤娉曠┛鎴?, null, null, null, null, null, null, null, null);
+REPLACE INTO `mangos_string` VALUES ('15055', '[瑁呭?绌挎埓]璇ョ墿鍝佸彧鑳藉湪鎸囧畾鐨勭瓑绾ф墠鑳界┛鎴?, null, null, null, null, null, null, null, null);
diff --git a/MgcoreDev/V10.5.5_mangos_mgcore_item_equip.sql b/MgcoreDev/V10.5.5_mangos_mgcore_item_equip.sql
new file mode 100644
index 0000000..24835d5
--- /dev/null
+++ b/MgcoreDev/V10.5.5_mangos_mgcore_item_equip.sql
@@ -0,0 +1,23 @@
+/*
+MySQL Data Transfer
+Source Host: localhost
+Source Database: mangos
+Target Host: localhost
+Target Database: mangos
+Date: 2010-8-18 12:35:54
+*/
+
+SET FOREIGN_KEY_CHECKS=0;
+-- ----------------------------
+-- Table structure for mgcore_item_equip
+-- ----------------------------
+CREATE TABLE `mgcore_item_equip` (
+ `itemid` int(11) unsigned NOT NULL default '0' COMMENT 'iteml entry',
+ `max_gmlevel` int(8) unsigned NOT NULL default '0',
+ `gmlevel_only` int(8) NOT NULL default '0',
+ PRIMARY KEY (`itemid`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Disabled Spell System';
+
+-- ----------------------------
+-- Records
+-- ----------------------------
diff --git a/MgcoreDev/V10.5.5_mangosd.conf b/MgcoreDev/V10.5.5_mangosd.conf
new file mode 100644
index 0000000..20d1ec3
--- /dev/null
+++ b/MgcoreDev/V10.5.5_mangosd.conf
@@ -0,0 +1,15 @@
+在mangosd.conf中增加下面的内容
+
+############################[会员穿戴装备控制系统]##################################
+# 新会员穿戴装备控制
+# 是否开启穿戴装备控制
+# Player.Can.EquipItem = 0 (默认0 关闭 , 1 开启)
+# 说明:
+# 如果开启了此系统,那么mangos库中的mgcore_item_equip表里面的内容生效
+# 表说明:
+# itemid 需要控制穿戴的item_template的物品ID
+# max_gmlevel 能穿戴该物品的最高会员等级
+# gmlevel_only 只能是该等级的会员才能穿戴
+####################################################################################
+
+Player.Can.EquipItem = 0
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index e87958b..1a94fef 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -503,6 +503,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "attack_power", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAttackPowerCommand, "", NULL }, //职业伤害治疗倍率系统
{ "player_vip_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadPlayerVipTemplateCommand, "", NULL }, //会员倍率系统
{ "creature_custom", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureSpellDmgCommand, "", NULL }, //生物技能伤害倍率系统
+ { "item_equip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemEquipCommand, "", NULL }, //会员穿戴系统
{ "vehicle_data", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadVehicleDataCommand, "", NULL },
{ "vehicle_seat_data", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadVehicleSeatDataCommand, "", NULL },
diff --git a/src/game/Chat.h b/src/game/Chat.h
index 15a972a..5b95502 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -414,6 +414,7 @@ class ChatHandler
bool HandleReloadAttackPowerCommand(const char* args); //职业伤害治疗倍率系统
bool HandleReloadPlayerVipTemplateCommand(const char* args); //会员倍率系统
bool HandleReloadCreatureSpellDmgCommand(const char* args); //生物技能伤害倍率系统
+ bool HandleReloadItemEquipCommand(const char* args); //会员穿戴系统
bool HandleReloadVehicleDataCommand(const char* args);
bool HandleReloadVehicleSeatDataCommand(const char* args);
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 923855b..a1b638a 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -180,6 +180,7 @@ bool ChatHandler::HandleReloadAllSpellCommand(const char*)
HandleReloadAttackPowerCommand("a"); //职业伤害治疗倍率系统
HandleReloadPlayerVipTemplateCommand("a"); //会员倍率系统
HandleReloadCreatureSpellDmgCommand("a"); //生物技能伤害倍率系统
+ HandleReloadItemEquipCommand("a"); //会员穿戴系统
return true;
}
@@ -929,6 +930,17 @@ bool ChatHandler::HandleReloadCreatureSpellDmgCommand(const char* /*arg*/) //
return true;
}
+bool ChatHandler::HandleReloadItemEquipCommand(const char* /*arg*/) //会员穿戴系统
+{
+ sLog.outString( "Re-Loading item equip table...");
+
+ sObjectMgr.LoadItemEquipSystem();
+
+ SendGlobalSysMessage("DB table `item_equip` reloaded.");
+
+ return true;
+}
+
bool ChatHandler::HandleReloadLocalesGossipMenuOptionCommand(const char* /*arg*/)
{
sLog.outString( "Re-Loading Locales Gossip Menu Option ... ");
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index c8d85e3..3d35a2a 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -7799,6 +7799,53 @@ void ObjectMgr::LoadCreatureSpellDmgSystem() //
sLog.outString( ">> Loaded %u mgcore creatrue custom from `mgcore_creature_custom`", total_count);
}//生物技能伤害倍率系统
+void ObjectMgr::LoadItemEquipSystem() //会员穿戴系统
+{
+ m_Item_Equip_Sys.clear();
+ QueryResult *result = WorldDatabase.Query("SELECT itemid, max_gmlevel, gmlevel_only FROM mgcore_item_equip");
+
+ uint32 total_count = 0;
+
+ if( !result )
+ {
+ barGoLink bar( 1 );
+ bar.step();
+
+ sLog.outString();
+ sLog.outString( ">> Loaded %u mgcore item equip", total_count );
+ return;
+ }
+
+ barGoLink bar( result->GetRowCount() );
+
+ Field* fields;
+ do
+ {
+ ItemEquipSys temp; //定义内存
+ bar.step();
+ fields = result->Fetch();
+ uint32 itemid = fields[0].GetUInt32();
+ ItemPrototype const *pProto = sItemStorage.LookupEntry<ItemPrototype>(itemid);
+ if (itemid !=0 && !pProto)
+ {
+ sLog.outError("mgcore_item_equip table itemid %u has item not in item_template. ignore it!",itemid);
+ continue;
+ }
+ temp.EquipItem = itemid;
+ temp.MaxGmLevel = fields[1].GetUInt32();
+ temp.GmLevelOnly = fields[2].GetUInt32();
+
+ m_Item_Equip_Sys[itemid] = temp; //把值放到内存
+
+ ++total_count;
+ } while ( result->NextRow() );
+
+ delete result;
+
+ sLog.outString();
+ sLog.outString( ">> Loaded %u mgcore item equip from `mgcore_item_equip`", total_count);
+}//会员穿戴系统
+
void ObjectMgr::LoadRemoteVerifySystem() //远程验证系统
{
QueryResult *result_local = loginDatabase.PQuery("SELECT address FROM realmlist");
diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h
index ccd085a..836be98 100644
--- a/src/game/ObjectMgr.h
+++ b/src/game/ObjectMgr.h
@@ -142,6 +142,13 @@ struct CreatureSpellDmg //
uint32 AnnountceMinHealth;
};
+struct ItemEquipSys //会员穿戴系统
+{
+ uint32 EquipItem;
+ uint32 MaxGmLevel;
+ uint32 GmLevelOnly;
+};
+
struct ScriptInfo
{
uint32 id;
@@ -510,6 +517,8 @@ class ObjectMgr
typedef UNORDERED_MAP<uint32, CreatureSpellDmg> CreatureSpellDmgMap;//生物技能伤害倍率系统
+ typedef UNORDERED_MAP<uint32, ItemEquipSys> ItemEquipSysMap;//会员穿戴系统
+
typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap;
typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap;
@@ -815,6 +824,24 @@ class ObjectMgr
return itr != m_Creature_Spell_Dmg.end() ? itr->second.CreatureEntry : 0;
}
+ uint32 GetGetItemEquipId(uint32 itemid) const //会员穿戴系统
+ {
+ ItemEquipSysMap::const_iterator itr = m_Item_Equip_Sys.find(itemid);
+ return itr != m_Item_Equip_Sys.end() ? itr->second.EquipItem : 0;
+ }
+
+ uint32 GetItemEquipMaxLevel(uint32 itemid) const //会员穿戴系统
+ {
+ ItemEquipSysMap::const_iterator itr = m_Item_Equip_Sys.find(itemid);
+ return itr != m_Item_Equip_Sys.end() ? itr->second.MaxGmLevel : 0;
+ }
+
+ uint32 GetGetItemEquipOnlyLevel(uint32 itemid) const //会员穿戴系统
+ {
+ ItemEquipSysMap::const_iterator itr = m_Item_Equip_Sys.find(itemid);
+ return itr != m_Item_Equip_Sys.end() ? itr->second.GmLevelOnly : 0;
+ }
+
uint32 GetQuestForAreaTrigger(uint32 Trigger_ID) const
{
QuestAreaTriggerMap::const_iterator itr = mQuestAreaTriggerMap.find(Trigger_ID);
@@ -1187,6 +1214,8 @@ class ObjectMgr
void LoadCreatureSpellDmgSystem(); //生物技能伤害倍率系统
+ void LoadItemEquipSystem(); //会员穿戴系统
+
void LoadRemoteVerifySystem(); //远程验证系统
void LoadRemoteVerifyInitialize(); //远程验证系统初始化
@@ -1360,6 +1389,8 @@ class ObjectMgr
CreatureSpellDmgMap m_Creature_Spell_Dmg;//生物技能伤害倍率系统
+ ItemEquipSysMap m_Item_Equip_Sys;//会员穿戴系统
+
GraveYardMap mGraveYardMap;
GameTeleMap m_GameTeleMap;
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index af326f9..e7146b9 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -10525,6 +10525,19 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
ItemPrototype const *pProto = pItem->GetProto();
if( pProto )
{
+ if (sConfig.GetIntDefault("Player.Can.EquipItem", 0) == 1)
+ {
+ uint32 eItemid = pItem->GetEntry();
+ if (sObjectMgr.GetGetItemEquipId(eItemid) != 0)
+ {
+ sLog.outDebug("Player.Can.EquipItem System Start ItemId %u",eItemid);
+ uint32 eGmlevel = GetSession()->GetSecurity();
+ if (eGmlevel < sObjectMgr.GetItemEquipMaxLevel(eItemid))
+ { ((Player*)this)->PSendSysCnMessage(15054); return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED; }
+ if (eGmlevel != sObjectMgr.GetGetItemEquipOnlyLevel(eItemid))
+ { ((Player*)this)->PSendSysCnMessage(15055); return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED; }
+ }
+ }
// item used
if(pItem->m_lootGenerated)
return EQUIP_ERR_ALREADY_LOOTED;
diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in
index e782d23..a95abee 100644
--- a/src/mangosd/mangosd.conf.dist.in
+++ b/src/mangosd/mangosd.conf.dist.in
@@ -2214,3 +2214,17 @@ Titles.Add.Gmlevel = 0
####################################################################################
Player.New.Gmlevel = 0
+
+Player.Can.EquipItem = 0
欢迎光临 吾爱尚玩资源基地 (http://bbs.523play.com/)
Powered by Discuz! X3.4