Exemple #1
0
 public async Task ClientEvent_buyTattoo(ClassicPlayer player, int shopId, int tattooId)
 {
     try
     {
         if (player == null || !player.Exists || player.CharacterId <= 0 || shopId <= 0 || tattooId <= 0 || !ServerTattoos.ExistTattoo(tattooId) || CharactersTattoos.ExistAccountTattoo(player.CharacterId, tattooId) || !ServerTattooShops.ExistTattooShop(shopId))
         {
             return;
         }
         int price = ServerTattoos.GetTattooPrice(tattooId);
         if (!CharactersInventory.ExistCharacterItem(player.CharacterId, "Bargeld", "inventory") || CharactersInventory.GetCharacterItemAmount(player.CharacterId, "Bargeld", "inventory") < price)
         {
             HUDHandler.SendNotification(player, 4, 5000, $"Fehler: Du hast nicht genügend Geld dabei ({price}$).");
             return;
         }
         CharactersInventory.RemoveCharacterItemAmount(player.CharacterId, "Bargeld", price, "inventory");
         ServerTattooShops.SetTattooShopBankMoney(shopId, ServerTattooShops.GetTattooShopBank(shopId) + price);
         CharactersTattoos.CreateNewEntry(player.CharacterId, tattooId);
         HUDHandler.SendNotification(player, 2, 1500, $"Du hast das Tattoo '{ServerTattoos.GetTattooName(tattooId)}' für {price}$ gekauft.");
         player.updateTattoos();
     }
     catch (Exception e)
     {
         Console.WriteLine($"{e}");
     }
 }
Exemple #2
0
 public async Task ClientEvent_deleteTattoo(ClassicPlayer player, int tattooId)
 {
     try
     {
         if (player == null || !player.Exists || player.CharacterId <= 0 || tattooId <= 0 || !CharactersTattoos.ExistAccountTattoo(player.CharacterId, tattooId))
         {
             return;
         }
         CharactersTattoos.RemoveAccountTattoo(player.CharacterId, tattooId);
         HUDHandler.SendNotification(player, 2, 1500, $"Du hast das Tattoo '{ServerTattoos.GetTattooName(tattooId)}' erfolgreich entfernen lassen.");
         player.updateTattoos();
     }
     catch (Exception e)
     {
         Console.WriteLine($"{e}");
     }
 }