当前位置:首页>>魔兽单机>>正文
WOW单机端商业技能检查代码(防外挂)
2013-07-05 17:44:35 作者:网络 来源: 浏览次数:0
摘要:WOW单机端商业技能检查代码(防外挂)
比较老的M端代码了。。参考使用(貌似没什么太大的用处了,。参考参考)


58c63c4b66b9dfe69306a3399b68f09aa951d90f
 src/game/Player.cpp              |   33 +++++++++++++++++++++++++++++++++
 src/game/World.cpp               |    1 +
 src/game/World.h                 |    1 +
 src/mangosd/mangosd.conf.dist.in |    1 +
 4 files changed, 36 insertions(+), 0 deletions(-)
 
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 8d4e3ff..29c95b7 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -15840,6 +15840,39 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
 
     _LoadEquipmentSets(holder->GetResult(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS));
 
+    // Check professions
+    if(sWorld.getConfig(CONFIG_CHECK_PROF_AT_LOGIN) && GetSession()->GetSecurity() < SEC_GAMEMASTER)
+    {
+        uint32 prof_count = 0;
+        std::vector<uint32> prof_skills;
+        prof_skills.push_back(164);     // Blacksmithing
+        prof_skills.push_back(165);     // Leatherworking
+        prof_skills.push_back(171);     // Alchemy
+        prof_skills.push_back(182);     // Herbalism
+        prof_skills.push_back(186);     // Mining
+        prof_skills.push_back(197);     // Tailoring
+        prof_skills.push_back(202);     // Engineering
+        prof_skills.push_back(333);     // Enchanting
+        prof_skills.push_back(393);     // Skinning
+        prof_skills.push_back(755);     // Jewelcrafting
+        prof_skills.push_back(773);     // Inscription
+
+        for(std::vector<uint32>::iterator itr = prof_skills.begin(); itr != prof_skills.end(); ++itr)
+        {
+            uint32 skill_id = *itr;
+            if(HasSkill(skill_id))
+            {
+                ++prof_count;
+                if(prof_count > 2)
+                {
+                    SetSkill(skill_id,0 , 0, 0);
+                    sLog.outError("Player %s has more than two professions. Skill %u removed",GetName(),skill_id);
+                    sWorld.BanAccount(BAN_CHARACTER, GetName(), "7d" , "Not bad more proff? xD", "Server-anticheat");
+                }
+            }    
+        }
+    }
+
     return true;
 }
 
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 68ae46f..7aa0fc9 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -638,6 +638,7 @@ void World::LoadConfigSettings(bool reload)
 
     setConfig(CONFIG_BOOL_SKILL_PROSPECTING, "SkillChance.Prospecting", false);
     setConfig(CONFIG_BOOL_SKILL_MILLING,     "SkillChance.Milling",     false);
+    setConfig(CONFIG_CHECK_PROF_AT_LOGIN,    "CheckProfAtLogin",        false);
 
     setConfigPos(CONFIG_UINT32_SKILL_GAIN_CRAFTING,  "SkillGain.Crafting",  1);
     setConfigPos(CONFIG_UINT32_SKILL_GAIN_DEFENSE,   "SkillGain.Defense",   1);
diff --git a/src/game/World.h b/src/game/World.h
index a472f88..c888ce6 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -314,6 +314,7 @@ enum eConfigBoolValues
     CONFIG_BOOL_ARENA_AUTO_DISTRIBUTE_POINTS,
     CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_JOIN,
     CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_EXIT,
+    CONFIG_CHECK_PROF_AT_LOGIN,
     CONFIG_BOOL_KICK_PLAYER_ON_BAD_PACKET,
     CONFIG_BOOL_STATS_SAVE_ONLY_ON_LOGOUT,
     CONFIG_BOOL_CLEAN_CHARACTER_DB,
diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in
index 24ebb10..09ea4cd 100644
--- a/src/mangosd/mangosd.conf.dist.in
+++ b/src/mangosd/mangosd.conf.dist.in
@@ -210,6 +210,7 @@ UpdateUptimeInterval = 10
 MaxCoreStuckTime = 0
 AddonChannel = 1
 CleanCharacterDB = 1
+CheckProfAtLogin = 1
 
 ###################################################################################################################
 # SERVER LOGGING
 


相关报道:

[关闭] [返回顶部]


  返回首页 | 最新资讯 | 资源下载 | 魔兽图片 | 单机文档 | 技术攻略 | 玩家视频
备案号:蜀ICP备2024062380号-1
免责声明:本网站为热爱怀旧WOW的玩家们建立的魔兽世界资料网站,仅供交流和学习使用,非盈利和商用.如有侵权之处,请联系我们,我们会在24小时内确认删除侵权内容,谢谢合作。
Copyright © 2024 - 2024 WOWAII.COM Corporation, All Rights Reserved

机器人国度