吾爱尚玩资源基地

标题: WOW私服模拟器商业技能检查代码(防外挂) [打印本页]

作者: admin    时间: 2016-4-19 22:52
标题: 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


作者: 你懂的    时间: 2016-11-3 07:38
找了好久终于找到了!吾爱尚玩免费服务端下载!
作者: qq770397211    时间: 2020-8-27 02:00
感谢楼主分享,吾爱尚玩,可以免费下载网单!




欢迎光临 吾爱尚玩资源基地 (http://bbs.523play.com/) Powered by Discuz! X3.4