Esempio n. 1
0
 public static void StartDigRequest(IRealmClient client, RealmPacketIn packet)
 {
     if (client.ActiveCharacter.IsDigging)
     {
         client.ActiveCharacter.SendSystemMessage("You already digging.");
         Asda2DiggingHandler.SendStartDigResponseResponse(client, Asda2DigResult.DiggingFail);
     }
     else if (client.ActiveCharacter.IsInCombat || client.ActiveCharacter.IsMoving)
     {
         client.ActiveCharacter.SendSystemMessage("You can't dig while moving or fighting.");
         Asda2DiggingHandler.SendStartDigResponseResponse(client, Asda2DigResult.DiggingFail);
     }
     else
     {
         Asda2Item mainWeapon = client.ActiveCharacter.MainWeapon as Asda2Item;
         if (mainWeapon == null || mainWeapon.Category != Asda2ItemCategory.Showel)
         {
             Asda2DiggingHandler.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 : " + (object)client.ActiveCharacter.MapId, 10);
                 Asda2DiggingHandler.SendStartDigResponseResponse(client, Asda2DigResult.DiggingFail);
             }
             else if ((flag
                          ? Asda2DigMgr.PremiumMapDiggingTemplates[(byte)client.ActiveCharacter.MapId]
                          : Asda2DigMgr.MapDiggingTemplates[(byte)client.ActiveCharacter.MapId]).MinLevel >
                      client.ActiveCharacter.Level)
             {
                 Asda2DiggingHandler.SendStartDigResponseResponse(client,
                                                                  Asda2DigResult.YouUnableToDigInThisLocationDueLowLevel);
             }
             else
             {
                 client.ActiveCharacter.CancelAllActions();
                 client.ActiveCharacter.IsDigging = true;
                 ++client.ActiveCharacter.Stunned;
                 client.ActiveCharacter.Map.CallDelayed(6000, (Action)(() => Asda2DigMgr.ProcessDig(client)));
                 Asda2CharacterHandler.SendEmoteResponse(client.ActiveCharacter, (short)110, (byte)0, 0.0f,
                                                         0.0f);
                 Asda2DiggingHandler.SendStartDigResponseResponse(client, Asda2DigResult.Ok);
             }
         }
     }
 }