123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using CommonAI.Data;
- using CommonAI.Zone;
- using CommonAI.Zone.Formula;
- using CommonAI.Zone.Helper;
- using CommonAI.Zone.Instance;
- using CommonLang.Log;
- using CommonLang.Vector;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- using static CommonAI.ZoneClient.ClientStruct;
- //using System.Threading.Tasks;
- namespace CommonAI.ZoneServer.JSGModule
- {
- public class JSGHackerModule
- {
- protected static readonly Logger log = LoggerFactory.GetLogger("JSGHackerModule");
- public static void OnPlayerKillMonster(InstanceUnit attacker, InstanceUnit monster)
- {
- #if JSGProfile
- try
- {
- InstancePlayer player = (InstancePlayer)(attacker.IsPlayer ? attacker : attacker.Virtual.GetMasterUnit());
- if (player == null)
- {
- log.Info("OnPlayerKillMonster player not exist:" + attacker.Parent.GetSceneID() + ", mID:" + monster.Info.ID + ", PID: " + attacker.PlayerUUID);
- return;
- }
- player.Virtual.OnPlayerKillMonster(monster);
- }
- catch (Exception e)
- {
- log.Warn("CI OnPlayerKillMonster catch:", e);
- }
- #endif
- }
- public static void PrintDmgInfo(InstanceUnit unit, InstanceUnit sender, AttackSource source, int hp, int finalHP)
- {
- #if JSGProfile
- try
- {
- if (!unit.IsPlayer){ return;}
- int atkPropID = (source == null || source.Attack == null || source.Attack.Properties == null) ? 0 : source.Attack.Properties.GetAttackID();
- if (atkPropID != 9999901 && (finalHP < -100000000 || finalHP > 100000000) && !(unit.IsMonster && hp == unit.MaxHP))
- {
- string stackInfo = new StackTrace().ToString();
- log.Error("伤害异常: " + finalHP + ", ID" + unit.Info.ID + ", " + (sender == null ? "-1" : sender.PlayerUUID)
- + JSGModule.GetAttackSourceDes(source) + ", " + stackInfo);
- }
- }
- catch (Exception e)
- {
- log.Warn("JSGHackerModule PrintDmgInfo:", e);
- }
- #endif
- }
- }
- }
|