Пример #1
0
        public static bool permicaoEquipItem(SItem paramItemAEquipar, SMob userMob, int slot)
        {
            if (paramItemAEquipar.Id != 0)
            {
                SItemList itemList = Config.Itemlist[paramItemAEquipar.Id];

                if (userMob.BaseStatus.Level >= itemList.Level && userMob.BaseStatus.Str >= itemList.Str &&
                    userMob.BaseStatus.Int >= itemList.Int && userMob.BaseStatus.Dex >= itemList.Dex &&
                    userMob.BaseStatus.Con >= itemList.Con)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #2
0
        public static bool AgrupaVolatile(Client client, ref P_376 p376)
        {
            SItemList itemListOrigem  = Config.Itemlist[client.Character.Mob.Inventory[p376.SrcSlot].Id];
            SItemList itemListDestino = Config.Itemlist[client.Character.Mob.Inventory[p376.DestSlot].Id];

            bool volatileOrigem  = itemListOrigem.Ef.Where(a => a.Index == (byte)ItemListEf.EF_VOLATILE).FirstOrDefault().Value == 190;
            bool volatileDestino = itemListDestino.Ef.Where(a => a.Index == (byte)ItemListEf.EF_VOLATILE).FirstOrDefault().Value == 190;

            if (volatileOrigem && volatileDestino)
            {
                SItem itemDestino = SItem.New(client.Character.Mob.Inventory[p376.DestSlot]);
                itemDestino.Ef[1].Type = (byte)ItemListEf.EF_AMOUNT;

                if (client.Character.Mob.Inventory[p376.SrcSlot].Ef.Where(a => a.Type == (byte)ItemListEf.EF_AMOUNT).Count() > 0)
                {
                    itemDestino.Ef[1].Value += client.Character.Mob.Inventory[p376.SrcSlot].Ef.Where(a => a.Type == (byte)ItemListEf.EF_AMOUNT).FirstOrDefault().Value;
                }

                if (client.Character.Mob.Inventory[p376.SrcSlot].Ef.Where(a => a.Type == (byte)ItemListEf.EF_AMOUNT).FirstOrDefault().Value == 0 ||
                    client.Character.Mob.Inventory[p376.DestSlot].Ef.Where(a => a.Type == (byte)ItemListEf.EF_AMOUNT).FirstOrDefault().Value == 0)
                {
                    itemDestino.Ef[1].Value += 1;
                }

                if (client.Character.Mob.Inventory[p376.SrcSlot].Ef.Where(a => a.Type == (byte)ItemListEf.EF_AMOUNT).FirstOrDefault().Value == 0 &&
                    client.Character.Mob.Inventory[p376.DestSlot].Ef.Where(a => a.Type == (byte)ItemListEf.EF_AMOUNT).FirstOrDefault().Value == 0)
                {
                    itemDestino.Ef[1].Value += 1;
                }

                client.Character.Mob.RemoveItemToCharacter(client, TypeSlot.Inventory, p376.SrcSlot);
                client.Character.Mob.Inventory[p376.DestSlot] = itemDestino;

                //Alterao a posicao de origem para o destino, pois qnd o packet enviar para o wyd ele troca a posicao automatica
                p376.SrcSlot = p376.DestSlot;

                //Adiciona o item no char do Mob
                client.Character.Mob.AddItemToCharacter(client, itemDestino, TypeSlot.Inventory, p376.DestSlot);

                return(false);
            }
            return(true);
        }
Пример #3
0
        public static void controller(Client client, P_379 p379)
        {
            SMob      Npc    = Config.MobList.Where(a => a.Mob.ClientId == p379.NpcId).FirstOrDefault().Mob;
            SItem     itemId = Config.MobList.Where(a => a.Mob.ClientId == p379.NpcId).FirstOrDefault().Mob.Inventory[p379.SlotNpc];
            SItemList item   = Config.Itemlist[itemId.Id];

            if (item.Price <= client.Character.Mob.Gold)
            {
                int tamanho = 30;
                if (client.Character.Mob.Andarilho[0].Id != 0)
                {
                    tamanho += 15;
                }
                if (client.Character.Mob.Andarilho[1].Id != 0)
                {
                    tamanho += 15;
                }

                //checa se o inventario esta cheio
                if (client.Character.Mob.Inventory.Where(a => a.Id != 0).Count() == tamanho)
                {
                    client.Send(P_101.New("O inventario esta cheio."));
                }
                else
                {
                    client.Character.Mob.Gold -= item.Price;
                    client.Character.Mob.Inventory[p379.InventorySlot] = itemId;

                    //Adiciona o item no inventorio
                    client.Character.Mob.AddItemToCharacter(client, itemId, TypeSlot.Inventory, p379.InventorySlot);

                    //atualiza o gold do mob
                    client.Send(P_3AF.New(client, client.Character.Mob.Gold));
                }
            }
            else
            {
                client.Send(P_101.New("Gold insuficiente"));
            }
        }
Пример #4
0
        // Carrega a ItemList.bin
        public static void LoadItemlist()
        {
            DateTime start = Time;

            byte[] read = File.ReadAllBytes($"{Dir}ItemList.bin");
            int    size = read.Length / Marshal.SizeOf <SItemList>();

            Itemlist = new SItemList[size];

            for (int i = 0; i < read.Length; i++)
            {
                read[i] ^= 0x5A;
            }

            for (int i = 0; i < Itemlist.Length; i++)
            {
                Itemlist[i] = PConvert.ToStruct <SItemList>(read, i * 140);
            }

            read = null;

            Log.Information($"ItemList, com {size:N0} itens, carregada em [{Time - start}]");
        }