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}"); } }
internal static async void openTattooShop(ClassicPlayer player, Server_Tattoo_Shops tattooShop) { if (player == null || !player.Exists || player.CharacterId <= 0 || player.IsCefOpen() || tattooShop == null) { return; } await LoginHandler.setCefStatus(player, true); int gender = Convert.ToInt32(Characters.GetCharacterGender(player.CharacterId)); player.EmitAsync("Client:TattooShop:openShop", gender, tattooShop.id, CharactersTattoos.GetAccountOwnTattoos(player.CharacterId)); }
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}"); } }