예제 #1
0
 public static void StartDigRequest(IRealmClient client, RealmPacketIn packet)
 {
     if (client.ActiveCharacter.IsDigging)
     {
         client.ActiveCharacter.SendSystemMessage("You already digging.");
         SendStartDigResponseResponse(client, Asda2DigResult.DiggingFail);
     }
     else if (client.ActiveCharacter.IsInCombat || client.ActiveCharacter.IsMoving)
     {
         client.ActiveCharacter.SendSystemMessage("You can't dig while moving or fighting.");
         SendStartDigResponseResponse(client, Asda2DigResult.DiggingFail);
     }
     else
     {
         Asda2Item mainWeapon = client.ActiveCharacter.MainWeapon as Asda2Item;
         if (mainWeapon == null || mainWeapon.Category != Asda2ItemCategory.Showel)
         {
             SendStartDigResponseResponse(client, Asda2DigResult.YouHaveNoShowel);
         }
         else
         {
             Asda2Item asda2Item = client.ActiveCharacter.Asda2Inventory.Equipment[10];
             bool      flag      = asda2Item != null && asda2Item.Category == Asda2ItemCategory.DigOil;
             if ((flag
        ? (client.ActiveCharacter.MapId < (MapId)Asda2DigMgr.PremiumMapDiggingTemplates.Count
          ? 1
          : 0)
        : (client.ActiveCharacter.MapId < (MapId)Asda2DigMgr.MapDiggingTemplates.Count ? 1 : 0)) ==
                 0)
             {
                 client.ActiveCharacter.YouAreFuckingCheater(
                     "Trying to dig in unknown location : " + client.ActiveCharacter.MapId, 10);
                 SendStartDigResponseResponse(client, Asda2DigResult.DiggingFail);
             }
             else if ((flag
             ? Asda2DigMgr.PremiumMapDiggingTemplates[(byte)client.ActiveCharacter.MapId]
             : Asda2DigMgr.MapDiggingTemplates[(byte)client.ActiveCharacter.MapId]).MinLevel >
                      client.ActiveCharacter.Level)
             {
                 SendStartDigResponseResponse(client,
                                              Asda2DigResult.YouUnableToDigInThisLocationDueLowLevel);
             }
             else
             {
                 client.ActiveCharacter.CancelAllActions();
                 client.ActiveCharacter.IsDigging = true;
                 ++client.ActiveCharacter.Stunned;
                 client.ActiveCharacter.Map.CallDelayed(6000, () => Asda2DigMgr.ProcessDig(client));
                 Asda2CharacterHandler.SendEmoteResponse(client.ActiveCharacter, 110, 0, 0.0f,
                                                         0.0f);
                 SendStartDigResponseResponse(client, Asda2DigResult.Ok);
             }
         }
     }
 }
예제 #2
0
        [PacketHandler(RealmServerOpCode.StartDig)]//5428
        public static void StartDigRequest(IRealmClient client, RealmPacketIn packet)
        {
            //var accId = packet.ReadInt32();//default : 340701Len : 4
            if (client.ActiveCharacter.IsDigging)
            {
                client.ActiveCharacter.SendSystemMessage("You already digging.");
                SendStartDigResponseResponse(client, Asda2DigResult.DiggingFail);
                return;
            }
            if (client.ActiveCharacter.IsInCombat || client.ActiveCharacter.IsMoving)
            {
                client.ActiveCharacter.SendSystemMessage("You can't dig while moving or fighting.");
                SendStartDigResponseResponse(client, Asda2DigResult.DiggingFail);
                return;
            }
            var showel = client.ActiveCharacter.MainWeapon as Asda2Item;

            if (showel == null || showel.Category != Asda2ItemCategory.Showel)
            {
                SendStartDigResponseResponse(client, Asda2DigResult.YouHaveNoShowel);
                return;
            }
            var oilItem  = client.ActiveCharacter.Asda2Inventory.Equipment[10];
            var isUseOil = oilItem != null && oilItem.Category == Asda2ItemCategory.DigOil;

            if (!(isUseOil ? client.ActiveCharacter.MapId < (MapId)Asda2DigMgr.PremiumMapDiggingTemplates.Count : client.ActiveCharacter.MapId < (MapId)Asda2DigMgr.MapDiggingTemplates.Count))
            {
                client.ActiveCharacter.YouAreFuckingCheater("Trying to dig in unknown location : " + client.ActiveCharacter.MapId, 10);
                SendStartDigResponseResponse(client, Asda2DigResult.DiggingFail);
                return;
            }

            if (isUseOil)
            {
                Asda2TitleChecker.OnUseAutoFishDig(client.ActiveCharacter);
            }
            var templ = isUseOil
                                 ? Asda2DigMgr.PremiumMapDiggingTemplates[(byte)client.ActiveCharacter.MapId]
                                 : Asda2DigMgr.MapDiggingTemplates[(byte)client.ActiveCharacter.MapId];

            if (templ.MinLevel > client.ActiveCharacter.Level)
            {
                SendStartDigResponseResponse(client, Asda2DigResult.YouUnableToDigInThisLocationDueLowLevel);
                return;
            }
            client.ActiveCharacter.CancelAllActions();
            client.ActiveCharacter.IsDigging = true;
            client.ActiveCharacter.Stunned++;
            client.ActiveCharacter.Map.CallDelayed(6000, () => Asda2DigMgr.ProcessDig(client));
            Asda2CharacterHandler.SendEmoteResponse(client.ActiveCharacter, 110, 0, 0, 0);
            SendStartDigResponseResponse(client, Asda2DigResult.Ok);
        }