예제 #1
0
 public static void updateTattoos(this ClassicPlayer player)
 {
     if (player == null || !player.Exists || player.CharacterId <= 0)
     {
         return;
     }
     player.EmitAsync("Client:Utilities:setTattoos", Model.CharactersTattoos.GetAccountTattoos(player.CharacterId));
 }
예제 #2
0
        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));
        }
예제 #3
0
        public static async void GetAllTattoos(ClassicPlayer player)
        {
            try
            {
                if (player == null || !player.Exists || player.CharacterId <= 0)
                {
                    return;
                }
                int gender      = Convert.ToInt32(Characters.GetCharacterGender(player.CharacterId));
                var tattooItems = ServerTattoos_.ToList().Where(x => x.gender == gender).Select(x => new
                {
                    x.id,
                    x.name,
                    x.nameHash,
                    x.part,
                    x.price,
                    x.collection,
                }).OrderBy(x => x.name).ToList();

                var itemCount  = (int)tattooItems.Count;
                var iterations = Math.Floor((decimal)(itemCount / 30));
                var rest       = itemCount % 30;
                for (var i = 0; i < iterations; i++)
                {
                    var skip = i * 30;
                    player.EmitAsync("Client:TattooShop:sendItemsToClient", System.Text.Json.JsonSerializer.Serialize(tattooItems.Skip(skip).Take(30).ToList()));
                }
                if (rest != 0)
                {
                    player.EmitAsync("Client:TattooShop:sendItemsToClient", System.Text.Json.JsonSerializer.Serialize(tattooItems.Skip((int)iterations * 30).ToList()));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"{e}");
            }
        }