Пример #1
0
        public static void Move(MapleClient c, MapleInventoryType type, short src, short dst)
        {
            byte srcSlot = (byte)src;
            byte dstSlot = (byte)dst;

            if (srcSlot > 127 || dstSlot > 127 || srcSlot > c.Player.Inventorys[type.Value].SlotLimit || dstSlot > c.Player.Inventorys[type.Value].SlotLimit)
            {
                return;
            }
            MapleItemInformationProvider ii = MapleItemInformationProvider.Instance;
            IMapleItem source;
            IMapleItem initialTarget;

            if (!c.Player.Inventorys[type.Value].Inventory.TryGetValue(srcSlot, out source))
            {
                return;
            }
            short olddstQ = -1;

            if (c.Player.Inventorys[type.Value].Inventory.TryGetValue(dstSlot, out initialTarget))
            {
                olddstQ = initialTarget.Quantity;
            }
            short oldsrcQ = source.Quantity;
            short slotMax = ii.GetSlotMax(c, source.ItemId);
            bool  op      = c.Player.Inventorys[type.Value].Move(srcSlot, dstSlot, slotMax);

            if (!op)
            {
                c.Send(PacketCreator.EnableActions());
                return;
            }
            if (type != MapleInventoryType.Equip && initialTarget != null && initialTarget.ItemId == source.ItemId && !ii.IsThrowingStar(source.ItemId) && !ii.IsBullet(source.ItemId))
            {
                c.Send(olddstQ + oldsrcQ > slotMax
                    ? PacketCreator.MoveAndMergeWithRestInventoryItem(type, srcSlot, dstSlot,
                                                                      (short)((olddstQ + oldsrcQ) - slotMax), slotMax)
                    : PacketCreator.MoveAndMergeInventoryItem(type, srcSlot, dstSlot,
                                                              ((Item)c.Player.Inventorys[type.Value].Inventory[dstSlot]).Quantity));
            }
            else
            {
                c.Send(PacketCreator.MoveInventoryItem(type, src, dst, 0));
            }
        }
Пример #2
0
        public void EnterPortal(MapleClient c)
        {
            var player = c.Player;

            var distanceSq = Position.DistanceSquare(player.Position);

            if (distanceSq > 22500)
            {
                player.AntiCheatTracker.RegisterOffense(CheatingOffense.UsingFarawayPortal, "D" + Math.Sqrt(distanceSq));
            }

            var changed = false;

            if (ScriptName != null)
            {
                //if (!FourthJobQuestsPortalHandler.handlePortal(ScriptName, player))
                //{
                changed = PortalScriptManager.Instance.Execute(this, c);
                //}
            }
            else if (TargetMapId != 999999999)
            {
                MapleMap to;
                //if (player.getEventInstance() == null)
                //{
                to = c.ChannelServer.MapFactory.GetMap(TargetMapId);
                //}
                //else {
                //    to = player.getEventInstance().getMapInstance(TargetMapID);
                //}
                var pto = to.GetPortal(TargetName);
                if (pto == null)
                {
                    // fallback for missing portals - no real life case anymore - intresting for not implemented areas
                    pto = to.GetPortal(0);
                }
                player.ChangeMap(to, pto);
                //late resolving makes this harder but prevents us from loading the whole world at once
                changed = true;
            }
            if (!changed)
            {
                c.Send(PacketCreator.EnableActions());
            }
        }
Пример #3
0
 public void Warp(MapleCharacter chr, bool toTown)
 {
     if (chr == Owner || Owner.Party != null && Owner.Party.ContainsMember(new MaplePartyCharacter(chr)))
     {
         if (!toTown)
         {
             if (!chr.Map.CanExit && chr.GmLevel == 0)
             {
                 chr.Client.Send(PacketCreator.ServerNotice(PacketCreator.ServerMessageType.PinkText, "您被禁止离开此地图"));
                 chr.Client.Send(PacketCreator.EnableActions());
                 return;
             }
             if (!TargetMap.CanEnter && chr.GmLevel == 0)
             {
                 chr.Client.Send(PacketCreator.ServerNotice(PacketCreator.ServerMessageType.PinkText,
                                                            $"您不能进入 {TargetMap.StreetName} : {TargetMap.MapName}"));
                 chr.Client.Send(PacketCreator.EnableActions());
                 return;
             }
             chr.ChangeMap(TargetMap, TargetMapPosition);
         }
         else
         {
             if (!chr.Map.CanExit && chr.GmLevel == 0)
             {
                 chr.Client.Send(PacketCreator.ServerNotice(PacketCreator.ServerMessageType.PinkText, "您被禁止离开此地图"));
                 chr.Client.Send(PacketCreator.EnableActions());
                 return;
             }
             if (!Town.CanEnter && chr.GmLevel == 0)
             {
                 chr.Client.Send(PacketCreator.ServerNotice(PacketCreator.ServerMessageType.PinkText,
                                                            $"您不能进入 {Town.StreetName} : {Town.MapName}"));
                 chr.Client.Send(PacketCreator.EnableActions());
                 return;
             }
             chr.ChangeMap(Town, TownPortal);
         }
     }
     else
     {
         chr.Client.Send(PacketCreator.EnableActions());
     }
 }
Пример #4
0
        public static void Equip(MapleClient c, short src, short dst)
        {
            MapleItemInformationProvider ii = MapleItemInformationProvider.Instance;

            byte srcSlot = (byte)src;
            byte dstSlot = (byte)dst;

            Equip source = c.Player.Inventorys[MapleInventoryType.Equip.Value].Inventory.FirstOrDefault(x => x.Key == srcSlot).Value as Equip;
            Equip target = c.Player.Inventorys[MapleInventoryType.Equipped.Value].Inventory.FirstOrDefault(x => x.Key == dstSlot).Value as Equip;

            if (source == null)
            {
                return;
            }
            if (!c.Player.IsGm)
            {
                switch (source.ItemId)
                {
                case 1002140:     // Wizet Invincible Hat
                case 1042003:     // Wizet Plain Suit
                case 1062007:     // Wizet Plain Suit Pants
                case 1322013:     // Wizet Secret Agent Suitcase
                    RemoveAllById(c, source.ItemId, false);
                    c.Player.DropMessage(PacketCreator.ServerMessageType.Popup, "无法佩带此物品");
                    return;
                }
            }
            int  reqLevel = ii.GetReqLevel(source.ItemId);
            int  reqStr   = ii.GetReqStr(source.ItemId);
            int  reqDex   = ii.GetReqDex(source.ItemId);
            int  reqInt   = ii.GetReqInt(source.ItemId);
            int  reqLuk   = ii.GetReqLuk(source.ItemId);
            bool cashSlot = false;

            if (source.ItemId == 1812006)
            {
                RemoveAllById(c, source.ItemId, false);
                c.Player.DropMessage(PacketCreator.ServerMessageType.Popup, "物品已被封印");
                return;
            }
            if (dstSlot < 0x9D)
            {
                cashSlot = true;
            }
            if (!ii.IsCash(source.ItemId))
            {
                string type = ii.GetType(source.ItemId);
                if ((type.Equals("Cp", StringComparison.CurrentCultureIgnoreCase) && dstSlot != 0xFF) ||
                    (type.Equals("Af", StringComparison.CurrentCultureIgnoreCase) && dstSlot != 0xFE) ||
                    (type.Equals("Ay", StringComparison.CurrentCultureIgnoreCase) && dstSlot != 0xFD) ||
                    (type.Equals("Ae", StringComparison.CurrentCultureIgnoreCase) && dstSlot != 0xFC) ||
                    ((type.Equals("Ma", StringComparison.CurrentCultureIgnoreCase) || type.Equals("MaPn", StringComparison.CurrentCultureIgnoreCase)) && dstSlot != 0xFB) ||
                    (type.Equals("Pn", StringComparison.CurrentCultureIgnoreCase) && dstSlot != 0xFA) ||
                    (type.Equals("So", StringComparison.CurrentCultureIgnoreCase) && dstSlot != 0xF9) ||
                    (type.Equals("Gv", StringComparison.CurrentCultureIgnoreCase) && dstSlot != 0xF8) ||
                    (type.Equals("Sr", StringComparison.CurrentCultureIgnoreCase) && dstSlot != 0xF7) ||
                    (type.Equals("Si", StringComparison.CurrentCultureIgnoreCase) && dstSlot != 0xF6) ||
                    ((type.Equals("Wp", StringComparison.CurrentCultureIgnoreCase) || type.Equals("WpSi", StringComparison.CurrentCultureIgnoreCase)) && dstSlot != 0xF5) ||
                    (type.Equals("Pe", StringComparison.CurrentCultureIgnoreCase) && dstSlot != 0xEF))
                {
                    c.Send(PacketCreator.EnableActions());
                    return;
                }
            }
            if ((ii.GetName(source.ItemId).Contains("(Male)") && !c.Player.Gender) ||
                (ii.GetName(source.ItemId).Contains("(Female)") && c.Player.Gender) ||
                reqLevel > c.Player.Level ||
                reqStr > c.Player.Localstr ||
                reqDex > c.Player.Localdex ||
                reqInt > c.Player.Localint ||
                reqLuk > c.Player.Localluk ||
                (cashSlot && !ii.IsCash(source.ItemId)))
            {
                c.Send(PacketCreator.EnableActions());
                return;
            }

            switch (dstSlot)
            {
            case 0xFA:
            {
                // unequip the overall
                IMapleItem top;
                if (c.Player.Inventorys[MapleInventoryType.Equipped.Value].Inventory.TryGetValue(0xFB, out top) && ii.IsOverall(top.ItemId))
                {
                    if (c.Player.Inventorys[MapleInventoryType.Equip.Value].IsFull())
                    {
                        c.Send(PacketCreator.GetInventoryFull());
                        c.Send(PacketCreator.GetShowInventoryFull());
                        return;
                    }
                    UnEquip(c, -5, c.Player.Inventorys[MapleInventoryType.Equip.Value].GetNextFreeSlot());
                }
            }
            break;

            case 0xFB:
            {        // unequip the bottom and top
                IMapleItem top    = c.Player.Inventorys[MapleInventoryType.Equipped.Value].Inventory.FirstOrDefault(x => x.Key == 0xFB).Value;
                IMapleItem bottom = c.Player.Inventorys[MapleInventoryType.Equipped.Value].Inventory.FirstOrDefault(x => x.Key == 0xFA).Value;
                if (top != null && ii.IsOverall(source.ItemId))
                {
                    if (c.Player.Inventorys[MapleInventoryType.Equip.Value].IsFull(bottom != null && ii.IsOverall(source.ItemId) ? 1 : 0))
                    {
                        c.Send(PacketCreator.GetInventoryFull());
                        c.Send(PacketCreator.GetShowInventoryFull());
                        return;
                    }
                    UnEquip(c, -5, c.Player.Inventorys[MapleInventoryType.Equip.Value].GetNextFreeSlot());
                }
                if (bottom != null && ii.IsOverall(source.ItemId))
                {
                    if (c.Player.Inventorys[MapleInventoryType.Equip.Value].IsFull())
                    {
                        c.Send(PacketCreator.GetInventoryFull());
                        c.Send(PacketCreator.GetShowInventoryFull());
                        return;
                    }
                    UnEquip(c, -6, c.Player.Inventorys[MapleInventoryType.Equip.Value].GetNextFreeSlot());
                }
            }
            break;

            case 0xF6:
                // check if weapon is two-handed
                IMapleItem weapon;
                if (c.Player.Inventorys[MapleInventoryType.Equipped.Value].Inventory.TryGetValue(0xF5, out weapon) && ii.IsTwoHanded(weapon.ItemId))
                {
                    if (c.Player.Inventorys[MapleInventoryType.Equip.Value].IsFull())
                    {
                        c.Send(PacketCreator.GetInventoryFull());
                        c.Send(PacketCreator.GetShowInventoryFull());
                        return;
                    }
                    UnEquip(c, -11, c.Player.Inventorys[MapleInventoryType.Equip.Value].GetNextFreeSlot());
                }
                break;

            case 0xF5:
                IMapleItem shield;
                if (c.Player.Inventorys[MapleInventoryType.Equipped.Value].Inventory.TryGetValue(0xF6, out shield) && ii.IsTwoHanded(source.ItemId))
                {
                    if (c.Player.Inventorys[MapleInventoryType.Equip.Value].IsFull())
                    {
                        c.Send(PacketCreator.GetInventoryFull());
                        c.Send(PacketCreator.GetShowInventoryFull());
                        return;
                    }
                    UnEquip(c, -10, c.Player.Inventorys[MapleInventoryType.Equip.Value].GetNextFreeSlot());
                }
                break;

            case 0xEE:
                //if (c.Player.Mount != null)
                //{
                //    c.Player.getMount().setItemId(source.ItemId);
                //}
                break;
            }

            source = c.Player.Inventorys[MapleInventoryType.Equip.Value].Inventory.FirstOrDefault(x => x.Key == srcSlot).Value as Equip;
            target = c.Player.Inventorys[MapleInventoryType.Equipped.Value].Inventory.FirstOrDefault(x => x.Key == dstSlot).Value as Equip;

            c.Player.Inventorys[MapleInventoryType.Equip.Value].RemoveSlot(srcSlot);

            if (target != null)
            {
                c.Player.Inventorys[MapleInventoryType.Equipped.Value].RemoveSlot(dstSlot);
            }

            source.Position = dstSlot;

            c.Player.Inventorys[MapleInventoryType.Equipped.Value].AddFromDb(source);

            if (target != null)
            {
                target.Position = srcSlot;
                c.Player.Inventorys[MapleInventoryType.Equip.Value].AddFromDb(target);
            }

            if (c.Player.GetBuffedValue(MapleBuffStat.Booster) != null && ii.IsWeapon(source.ItemId))
            {
                c.Player.CancelBuffStats(MapleBuffStat.Booster);
            }

            c.Send(PacketCreator.MoveInventoryItem(MapleInventoryType.Equip, src, dst, 2));
            c.Player.EquipChanged();
        }
Пример #5
0
        public static bool AddById(MapleClient c, int itemId, short quantity, string logInfo, string owner = null, int petid = -1)
        {
            if (quantity < 0)
            {
                return(false);
            }
            var ii   = MapleItemInformationProvider.Instance;
            var type = ii.GetInventoryType(itemId);

            if (type != MapleInventoryType.Equip)
            {
                var slotMax  = ii.GetSlotMax(c, itemId);
                var existing = c.Player.Inventorys[type.Value].ListById(itemId);
                if (!ii.IsThrowingStar(itemId) && !ii.IsBullet(itemId))
                {
                    if (existing.Any())
                    {
                        // first update all existing slots to slotMax

                        for (var i = 0; i < existing.Count && quantity > 0; i++)
                        {
                            var eItem = (Item)existing[i];
                            var oldQ  = eItem.Quantity;
                            if (oldQ < slotMax && (eItem.Owner == owner || owner == null))
                            {
                                var newQ = (short)Math.Min(oldQ + quantity, slotMax);
                                quantity      -= (short)(newQ - oldQ);
                                eItem.Quantity = newQ;
                                //eItem.log("Added " + (newQ - oldQ) + " items to stack, new quantity is " + newQ + " (" + logInfo + " )", false);
                                c.Send(PacketCreator.UpdateInventorySlot(type, eItem));
                            }
                        }
                    }
                    while (quantity > 0)
                    {
                        // add new slots if there is still something left
                        var newQ = Math.Min(quantity, slotMax);
                        if (newQ != 0)
                        {
                            quantity -= newQ;
                            var nItem = new Item(itemId, 0, newQ); //, petid);
                            //nItem.log("Created while adding by id. Quantity: " + newQ + " (" + logInfo + ")", false);
                            var newSlot = c.Player.Inventorys[type.Value].AddItem(nItem);
                            if (newSlot == 128)
                            {
                                c.Send(PacketCreator.GetInventoryFull());
                                c.Send(PacketCreator.GetShowInventoryFull());
                                return(false);
                            }
                            if (owner != null)
                            {
                                nItem.Owner = owner;
                            }
                            c.Send(PacketCreator.AddInventorySlot(type, nItem));
                            if ((ii.IsThrowingStar(itemId) || ii.IsBullet(itemId)) && quantity == 0)
                            {
                                break;
                            }
                        }
                        else
                        {
                            c.Send(PacketCreator.EnableActions());
                            return(false);
                        }
                    }
                }
                else
                {
                    // Throwing Stars and Bullets - Add all into one slot regardless of quantity.
                    var nItem = new Item(itemId, 0, quantity);
                    //nItem.log("Created while adding by id. Quantity: " + quantity + " (" + logInfo + " )", false);
                    var newSlot = c.Player.Inventorys[type.Value].AddItem(nItem);
                    if (newSlot == 128)
                    {
                        c.Send(PacketCreator.GetInventoryFull());
                        c.Send(PacketCreator.GetShowInventoryFull());
                        return(false);
                    }
                    c.Send(PacketCreator.AddInventorySlot(type, nItem));
                    c.Send(PacketCreator.EnableActions());
                }
            }
            else
            {
                if (quantity == 1)
                {
                    var nEquip = ii.GetEquipById(itemId);
                    //nEquip.log("Created while adding by id. (" + logInfo + " )", false);
                    if (owner != null)
                    {
                        nEquip.Owner = owner;
                    }

                    var newSlot = c.Player.Inventorys[type.Value].AddItem(nEquip);
                    if (newSlot == 128)
                    {
                        c.Send(PacketCreator.GetInventoryFull());
                        c.Send(PacketCreator.GetShowInventoryFull());
                        return(false);
                    }
                    c.Send(PacketCreator.AddInventorySlot(type, nEquip));
                }
                else
                {
                    throw new Exception("Trying to create equip with non-one quantity");
                }
            }
            return(true);
        }
Пример #6
0
        public static bool AddFromDrop(MapleClient c, IMapleItem item, bool show, string loginfo = "")
        {
            var ii   = MapleItemInformationProvider.Instance;
            var type = ii.GetInventoryType(item.ItemId);

            if (!c.ChannelServer.AllowMoreThanOne && ii.IsPickupRestricted(item.ItemId) &&
                c.Player.HaveItem(item.ItemId, 1, true, false))
            {
                c.Send(PacketCreator.GetInventoryFull());
                c.Send(PacketCreator.ShowItemUnavailable());
                return(false);
            }
            var quantity = item.Quantity;

            if (quantity >= 4000 || quantity < 0)
            {
                AutobanManager.Instance.Autoban(c, $"XSource| PE Item: {quantity} x {item.ItemId}");
                return(false);
            }
            if (type != MapleInventoryType.Equip)
            {
                var slotMax  = ii.GetSlotMax(c, item.ItemId);
                var existing = c.Player.Inventorys[type.Value].ListById(item.ItemId);
                if (!ii.IsThrowingStar(item.ItemId) && !ii.IsBullet(item.ItemId))
                {
                    if (existing.Any())
                    {
                        var i = existing.GetEnumerator();
                        while (quantity > 0)
                        {
                            if (i.MoveNext())
                            {
                                var eItem = (Item)i.Current;
                                if (eItem != null)
                                {
                                    var oldQ = eItem.Quantity;
                                    if (oldQ < slotMax && item.Owner == eItem.Owner)
                                    {
                                        var newQ = (short)Math.Min(oldQ + quantity, slotMax);
                                        quantity      -= (short)(newQ - oldQ);
                                        eItem.Quantity = newQ;
                                        c.Send(PacketCreator.UpdateInventorySlot(type, eItem, true));
                                    }
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                    // add new slots if there is still something left
                    while (quantity > 0 || ii.IsThrowingStar(item.ItemId) || ii.IsBullet(item.ItemId))
                    {
                        var newQ = Math.Min(quantity, slotMax);
                        quantity -= newQ;
                        var nItem = new Item(item.ItemId, 0, newQ)
                        {
                            Owner = item.Owner
                        };
                        var newSlot = c.Player.Inventorys[type.Value].AddItem(nItem);
                        if (newSlot == 0xFF)
                        {
                            c.Send(PacketCreator.GetInventoryFull());
                            c.Send(PacketCreator.GetShowInventoryFull());
                            item.Quantity = (short)(quantity + newQ);
                            return(false);
                        }
                        c.Send(PacketCreator.AddInventorySlot(type, nItem, true));
                    }
                }
                else
                {
                    // Throwing Stars and Bullets - Add all into one slot regardless of quantity.
                    var nItem   = new Item(item.ItemId, 0, quantity);
                    var newSlot = c.Player.Inventorys[type.Value].AddItem(nItem);
                    if (newSlot == 0xFF)
                    {
                        c.Send(PacketCreator.GetInventoryFull());
                        c.Send(PacketCreator.GetShowInventoryFull());
                        return(false);
                    }
                    c.Send(PacketCreator.AddInventorySlot(type, nItem));
                    c.Send(PacketCreator.EnableActions());
                }
            }
            else
            {
                if (quantity == 1)
                {
                    var newSlot = c.Player.Inventorys[type.Value].AddItem(item);

                    if (newSlot == 0xFF)
                    {
                        c.Send(PacketCreator.GetInventoryFull());
                        c.Send(PacketCreator.GetShowInventoryFull());
                        return(false);
                    }
                    c.Send(PacketCreator.AddInventorySlot(type, item, true));
                }
                else
                {
                    throw new Exception("Trying to create equip with non-one quantity");
                }
            }
            if (show)
            {
                c.Send(PacketCreator.GetShowItemGain(item.ItemId, item.Quantity));
            }
            return(true);
        }
Пример #7
0
        public static void ApplyAttack(AttackInfo attack, MapleCharacter player, int maxDamagePerMonster,
                                       int attackCount)
        {
            //应用攻击
            player.AntiCheatTracker.ResetHpRegen();
            //player.resetAfkTimer();
            player.AntiCheatTracker.CheckAttack(attack.Skill);

            ISkill          theSkill     = null;
            MapleStatEffect attackEffect = null;

            if (attack.Skill != 0)
            {
                theSkill     = SkillFactory.GetSkill(attack.Skill);
                attackEffect = attack.GetAttackEffect(player, theSkill);
                if (attackEffect == null)
                {
                    AutobanManager.Instance.Autoban(player.Client, $"使用了没有的技能ID:{attack.Skill}");
                }
                else if (attack.Skill != 2301002)
                {
                    if (player.IsAlive)
                    {
                        attackEffect.ApplyTo(player);
                    }
                    else
                    {
                        player.Client.Send(PacketCreator.EnableActions());
                    }
                }
            }

            if (!player.IsAlive)
            {
                player.AntiCheatTracker.RegisterOffense(CheatingOffense.AttackingWhileDead);
                return;
            }

            if (attackCount != attack.NumDamage && attack.Skill != 4211006 && attack.NumDamage != attackCount * 2)
            {
                player.AntiCheatTracker.RegisterOffense(CheatingOffense.MismatchingBulletcount,
                                                        attack.NumDamage + "/" + attackCount);
                return;
            }

            var totDamage = 0;
            var map       = player.Map;

            if (attack.Skill == 4211006)
            {
                // meso explosion
                long delay = 0;
                foreach (var oned in attack.AllDamage)
                {
                    var mapobject = map.Mapobjects[oned.Item1];
                    if (mapobject != null && mapobject.GetType() == MapleMapObjectType.Item)
                    {
                        var mapitem = (MapleMapItem)mapobject;
                        if (mapitem.Meso > 0)
                        {
                            lock (mapitem)
                            {
                                if (mapitem.IsPickedUp)
                                {
                                    return;
                                }
                                TimerManager.Instance.RunOnceTask(() =>
                                {
                                    map.RemoveMapObject(mapitem);
                                    map.BroadcastMessage(PacketCreator.RemoveItemFromMap(mapitem.ObjectId, 4, 0),
                                                         mapitem.Position);
                                    mapitem.IsPickedUp = true;
                                }, delay);
                                delay += 100;
                            }
                        }
                        else if (mapitem.Meso == 0)
                        {
                            player.AntiCheatTracker.RegisterOffense(CheatingOffense.EtcExplosion);
                            return;
                        }
                    }
                    else if (mapobject != null && mapobject.GetType() != MapleMapObjectType.Monster)
                    {
                        player.AntiCheatTracker.RegisterOffense(CheatingOffense.ExplodingNonexistant);
                        return; // etc explosion, exploding nonexistant things, etc.
                    }
                }
            }

            foreach (var oned in attack.AllDamage)
            {
                var monster = map.GetMonsterByOid(oned.Item1);

                if (monster != null)
                {
                    var totDamageToOneMonster = 0;
                    foreach (var eachd in oned.Item2)
                    {
                        totDamageToOneMonster += eachd;
                    }
                    totDamage += totDamageToOneMonster;


                    player.CheckMonsterAggro(monster);
                    if (totDamageToOneMonster > attack.NumDamage + 1)
                    {
                        var dmgCheck = player.AntiCheatTracker.CheckDamage(totDamageToOneMonster);
                        if (dmgCheck > 5 && totDamageToOneMonster < 99999 && monster.Id < 9500317 &&
                            monster.Id > 9500319)
                        {
                            player.AntiCheatTracker
                            .RegisterOffense(CheatingOffense.SameDamage,
                                             dmgCheck + " times: " + totDamageToOneMonster);
                        }
                    }
                    // �?测单次攻击�?�,这里不会�?!
                    if (player.IsGm || player.Job == MapleJob.Ares && player.Level <= 10)
                    {
                        //log.info("这里不进行操�?");
                    }
                    else
                    {
                        if (player.Level < 10)
                        {
                            if (totDamageToOneMonster > 10000)
                            {
                                AutobanManager.Instance.BroadcastMessage(player.Client,
                                                                         player.Name + " 被系统封�?.(异常攻击伤害�?: " + totDamageToOneMonster + " 当前等级 " +
                                                                         player.Level + ")");
                                //player.ban(player.Name + " 被系统封�?.(异常攻击伤害�?: " + totDamageToOneMonster + " 当前等级 " + player.Level + " (IP: " + player.Client.getSession().getRemoteAddress().toString().split(":")[0] + ")");
                                return;
                            }
                        }
                        if (player.Level < 20)
                        {
                            if (totDamageToOneMonster > 20000)
                            {
                                AutobanManager.Instance.BroadcastMessage(player.Client,
                                                                         player.Name + " 被系统封�?.(异常攻击伤害�?: " + totDamageToOneMonster + " 当前等级 " +
                                                                         player.Level + ")");
                                //player.ban(player.Name + " 被系统封�?.(异常攻击伤害�?: " + totDamageToOneMonster + " 当前等级 " + player.Level + " (IP: " + player.Client.getSession().getRemoteAddress().toString().split(":")[0] + ")");
                                return;
                            }
                        }
                        if (player.Level < 30)
                        {
                            if (totDamageToOneMonster > 30000)
                            {
                                AutobanManager.Instance.BroadcastMessage(player.Client,
                                                                         player.Name + " 被系统封�?.(异常攻击伤害�?: " + totDamageToOneMonster + " 当前等级 " +
                                                                         player.Level + ")");
                                //player.ban(player.Name + " 被系统封�?.(异常攻击伤害�?: " + totDamageToOneMonster + " 当前等级 " + player.Level + " (IP: " + player.Client.getSession().getRemoteAddress().toString().split(":")[0] + ")");
                                return;
                            }
                        }
                        if (player.Level < 50)
                        {
                            if (totDamageToOneMonster > 50000)
                            {
                                AutobanManager.Instance.BroadcastMessage(player.Client,
                                                                         player.Name + " 被系统封�?.(异常攻击伤害�?: " + totDamageToOneMonster + " 当前等级 " +
                                                                         player.Level + ")");
                                //player.ban(player.Name + " 被系统封�?.(异常攻击伤害�?: " + totDamageToOneMonster + " 当前等级 " + player.Level + " (IP: " + player.Client.getSession().getRemoteAddress().toString().split(":")[0] + ")");
                                return;
                            }
                        }
                        if (player.Level < 70)
                        {
                            if (totDamageToOneMonster > 150000)
                            {
                                AutobanManager.Instance.BroadcastMessage(player.Client,
                                                                         player.Name + " 被系统封�?.(异常攻击伤害�?: " + totDamageToOneMonster + " 当前等级 " +
                                                                         player.Level + ")");
                                //player.ban(player.Name + " 被系统封�?.(异常攻击伤害�?: " + totDamageToOneMonster + " 当前等级 " + player.Level + " (IP: " + player.Client.getSession().getRemoteAddress().toString().split(":")[0] + ")");
                                return;
                            }
                        }
                        if (player.Level < 150)
                        {
                            if (totDamageToOneMonster > 350000)
                            {
                                AutobanManager.Instance.BroadcastMessage(player.Client,
                                                                         player.Name + " 被系统封�?.(异常攻击伤害�?: " + totDamageToOneMonster + " 当前等级 " +
                                                                         player.Level + ")");
                                //player.ban(player.Name + " 被系统封�?.(异常攻击伤害�?: " + totDamageToOneMonster + " 当前等级 " + player.Level + " (IP: " + player.Client.getSession().getRemoteAddress().toString().split(":")[0] + ")");
                                return;
                            }
                        }
                    }

                    CheckHighDamage(player, monster, attack, theSkill, attackEffect, totDamageToOneMonster,
                                    maxDamagePerMonster);
                    var distance = player.Position.DistanceSquare(monster.Position);
                    if (distance > 400000.0)
                    {
                        // 600^2, 550 is approximatly the range of ultis
                        player.AntiCheatTracker.RegisterOffense(CheatingOffense.AttackFarawayMonster,
                                                                Math.Sqrt(distance).ToString(CultureInfo.InvariantCulture));
                    } //遥远的�?�物袭击

                    if (attack.Skill == 5111004)
                    {
                        // 能量转换
                        var edrain = SkillFactory.GetSkill(5111004);
                        var gainhp = (int)
                                     (totDamage * (double)edrain.GetEffect(player.GetSkillLevel(edrain)).X / 100.0);
                        gainhp     = Math.Min(monster.MaxHp, Math.Min(gainhp, player.MaxHp / 2));
                        player.Hp += (short)gainhp;
                    }
                    else if (attack.Skill == 15100004)
                    {
                        //光�?�拳
                        var edrain = SkillFactory.GetSkill(15100004);
                        var gainhp = (int)
                                     (totDamage * (double)edrain.GetEffect(player.GetSkillLevel(edrain)).X / 100.0);
                        gainhp     = Math.Min(monster.MaxHp, Math.Min(gainhp, player.MaxHp / 2));
                        player.Hp += (short)gainhp;
                    }

                    if (!monster.ControllerHasAggro)
                    {
                        if (monster.GetController() == player)
                        {
                            monster.ControllerHasAggro = true;
                        }
                        else
                        {
                            monster.SwitchController(player, true);
                        }
                    }
                    if (attack.Skill == 2301002 && !monster.Stats.IsUndead)
                    {
                        player.AntiCheatTracker.RegisterOffense(CheatingOffense.HealAttackingUndead); //医治攻击亡灵
                        return;
                    }
                    // Pickpocket
                    if ((attack.Skill == 4001334 || attack.Skill == 4201005 || attack.Skill == 0 ||
                         attack.Skill == 4211002 || attack.Skill == 4211004) &&
                        player.GetBuffedValue(MapleBuffStat.Pickpocket) != null)
                    {
                        HandlePickPocket(player, monster, oned);
                    }
                    if (attack.Skill == 21100005)
                    {
                        // 生命吸收21100005
                        var drain  = SkillFactory.GetSkill(21100005);
                        var gainhp =
                            (int)
                            (totDamageToOneMonster *
                             (double)drain.GetEffect(player.GetSkillLevel(drain)).X / 100.0);
                        gainhp     = Math.Min(monster.MaxHp, Math.Min(gainhp, player.MaxHp / 2));
                        player.Hp += (short)gainhp;
                    }
                    if (attack.Skill == 4101005)
                    {
                        // 生命吸收21100005
                        var drain  = SkillFactory.GetSkill(4101005);
                        var gainhp =
                            (int)
                            (totDamageToOneMonster *
                             (double)drain.GetEffect(player.GetSkillLevel(drain)).X / 100.0);
                        gainhp     = Math.Min(monster.MaxHp, Math.Min(gainhp, player.MaxHp / 2));
                        player.Hp += (short)gainhp;
                    }
                    if (attack.Skill == 14101006)
                    {
                        // 吸血
                        var drain  = SkillFactory.GetSkill(14101006);
                        var gainhp =
                            (int)
                            (totDamageToOneMonster *
                             (double)drain.GetEffect(player.GetSkillLevel(drain)).X / 100.0);
                        gainhp     = Math.Min(monster.MaxHp, Math.Min(gainhp, player.MaxHp / 2));
                        player.Hp += (short)gainhp;
                    }
                    if (player.GetBuffedValue(MapleBuffStat.Hamstring) != null)
                    {
                        var hamstring = SkillFactory.GetSkill(3121007); //降低速度的击�?�?
                        if (hamstring.GetEffect(player.GetSkillLevel(hamstring)).MakeChanceResult())
                        {
                            var monsterStatusEffect =
                                new MonsterStatusEffect(
                                    new Dictionary <MonsterStatus, int>
                            {
                                {
                                    MonsterStatus.Speed,
                                    hamstring.GetEffect(player.GetSkillLevel(hamstring)).X
                                }
                            }, hamstring, false);
                            monster.ApplyStatus(player, monsterStatusEffect, false,
                                                hamstring.GetEffect(player.GetSkillLevel(hamstring)).Y *1000);
                        }
                    }

                    if (player.GetBuffedValue(MapleBuffStat.Blind) != null)
                    {
                        //刺眼�?
                        var blind = SkillFactory.GetSkill(3221006);
                        if (blind.GetEffect(player.GetSkillLevel(blind)).MakeChanceResult())
                        {
                            var monsterStatusEffect =
                                new MonsterStatusEffect(
                                    new Dictionary <MonsterStatus, int>
                            {
                                {
                                    MonsterStatus.Acc,
                                    blind.GetEffect(player.GetSkillLevel(blind)).X
                                }
                            }
                                    , blind, false);
                            monster.ApplyStatus(player, monsterStatusEffect, false,
                                                blind.GetEffect(player.GetSkillLevel(blind)).Y *1000);
                        }
                    }

                    if (player.Job == MapleJob.Whiteknight)
                    {
                        int[] charges = { 1211005, 1211006 }; //寒冰钝器
                        foreach (var charge in charges)
                        {
                            var chargeSkill = SkillFactory.GetSkill(charge);

                            if (player.IsBuffFrom(MapleBuffStat.WkCharge, chargeSkill))
                            {
                                var iceEffectiveness = monster.GetEffectiveness(Element.Ice);
                                if (totDamageToOneMonster > 0 && iceEffectiveness == ElementalEffectiveness.Normal ||
                                    iceEffectiveness == ElementalEffectiveness.Weak)
                                {
                                    var chargeEffect =
                                        chargeSkill.GetEffect(player.GetSkillLevel(chargeSkill));
                                    var monsterStatusEffect =
                                        new MonsterStatusEffect(
                                            new Dictionary <MonsterStatus, int> {
                                        { MonsterStatus.Freeze, 1 }
                                    },
                                            chargeSkill, false);
                                    monster.ApplyStatus(player, monsterStatusEffect, false, chargeEffect.Y * 2000);
                                }
                                break;
                            }
                        }
                    }
                    var venomNl = SkillFactory.GetSkill(4120005); //武器用毒�?
                    if (player.GetSkillLevel(venomNl) <= 0)
                    {
                        venomNl = SkillFactory.GetSkill(14110004); //武器用毒�?
                    }
                    var venomShadower = SkillFactory.GetSkill(4220005);
                    if (player.GetSkillLevel(venomNl) > 0)
                    {
                        var venomEffect = venomNl.GetEffect(player.GetSkillLevel(venomNl));
                        for (var i = 0; i < attackCount; i++)
                        {
                            if (venomEffect.MakeChanceResult())
                            {
                                if (monster.VenomMultiplier < 3)
                                {
                                    monster.VenomMultiplier += 1;
                                    var monsterStatusEffect =
                                        new MonsterStatusEffect(
                                            new Dictionary <MonsterStatus, int> {
                                        { MonsterStatus.Poison, 1 }
                                    },
                                            venomNl, false);
                                    monster.ApplyStatus(player, monsterStatusEffect, false, venomEffect.Duration,
                                                        true);
                                }
                            }
                        }
                    }
                    else if (player.GetSkillLevel(venomShadower) > 0)
                    {
                        var venomEffect = venomShadower.GetEffect(player.GetSkillLevel(venomShadower));
                        for (var i = 0; i < attackCount; i++)
                        {
                            if (venomEffect.MakeChanceResult())
                            {
                                if (monster.VenomMultiplier < 3)
                                {
                                    monster.VenomMultiplier += 1;
                                    var monsterStatusEffect =
                                        new MonsterStatusEffect(
                                            new Dictionary <MonsterStatus, int> {
                                        { MonsterStatus.Poison, 1 }
                                    },
                                            venomShadower, false);
                                    monster.ApplyStatus(player, monsterStatusEffect, false, venomEffect.Duration,
                                                        true);
                                }
                            }
                        }
                    }
                    if (totDamageToOneMonster > 0 && attackEffect != null && attackEffect.MonsterStatus.Any())
                    {
                        if (attackEffect.MakeChanceResult())
                        {
                            var monsterStatusEffect =
                                new MonsterStatusEffect(attackEffect.MonsterStatus, theSkill, false);
                            monster.ApplyStatus(player, monsterStatusEffect, attackEffect.IsPoison(),
                                                attackEffect.Duration);
                        }
                    }
                    if (attack.IsHh && !monster.IsBoss)
                    {
                        map.DamageMonster(player, monster, monster.Hp - 1);
                    }
                    else if (attack.IsHh && monster.IsBoss)
                    {
                        var weaponItem = player.Inventorys[MapleInventoryType.Equipped.Value].Inventory[0xF5]; //装备
                        MapleItemInformationProvider.Instance.GetWeaponType(weaponItem.ItemId);
                    }
                    else
                    {
                        map.DamageMonster(player, monster, totDamageToOneMonster);
                    }
                }
            }
            if (totDamage > 1)
            {
                player.AntiCheatTracker.SetAttacksWithoutHit(player.AntiCheatTracker.GetAttacksWithoutHit() + 1);
                int offenseLimit;
                if (attack.Skill != 3121004)
                {
                    //暴风箭雨
                    offenseLimit = 100;
                }
                else
                {
                    offenseLimit = 300;
                }
                if (player.AntiCheatTracker.GetAttacksWithoutHit() > offenseLimit)
                {
                    player.AntiCheatTracker
                    .RegisterOffense(CheatingOffense.AttackWithoutGettingHit,
                                     player.AntiCheatTracker.GetAttacksWithoutHit().ToString());
                }
                //没有受到撞击攻击
                //if (player.hasEnergyCharge())
                //{
                //    player.increaseEnergyCharge(attack.numAttacked);
                //}
            }
        }