Beispiel #1
0
        public static void controller(Client client)
        {
            foreach (InitItem item in Config.InitItemList)
            {
                SItem vaItem = SItem.New(item.ItemId);

                //TODO: nao aparece os objetos descobrir o motivo
                client.Send(P_26E.New(SPosition.New(item.PosX, item.PosY), vaItem, (byte)item.Rotate, Gate.Closed));
            }
        }
        public SItem [] Slot;           // 0 a 127	= 128

        // Atributos
        public static SCharListEquip New( )
        {
            SCharListEquip tmp = new SCharListEquip {
                Slot = new SItem [16]
            };

            for (int i = 0; i < tmp.Slot.Length; i++)
            {
                tmp.Slot [i] = SItem.New( );
            }

            return(tmp);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public static void controller(Client client, short mobId, ulong xpAdd)
        {
            //mata o mob
            client.Send(P_338.New(client, mobId, xpAdd));

            //obtem os itens do mob
            SMobList mob = client.MobView.Where(a => a.Mob.ClientId == mobId).FirstOrDefault();

            //regra de drop:
            //0  a 14 slot sao drop normal      Tx 90%
            //15 a 29 slot drop dificil         Tx 65%
            //30 a 44 slot drop raro            TX 40%
            //45 a 60 slot drop super raro      Tx 15%


            int   TaxaDrop    = new Random().Next(0, 100);
            SItem itemDropado = SItem.New();

            //inicia o slot com 60 pois para dar a probalidade de nao receber nenhum item
            int slot = 60;

            if (TaxaDrop >= 0 && TaxaDrop <= 15)
            {
                slot = new Random().Next(45, GetSlotAvailable(mob.Mob.Inventory, 45, 59));
            }

            if (TaxaDrop >= 16 && TaxaDrop <= 40)
            {
                slot = new Random().Next(30, GetSlotAvailable(mob.Mob.Inventory, 30, 44));
            }

            if (TaxaDrop >= 41 && TaxaDrop <= 65)
            {
                slot = new Random().Next(15, GetSlotAvailable(mob.Mob.Inventory, 15, 29));
            }

            if (TaxaDrop >= 66 && TaxaDrop <= 100)
            {
                slot = new Random().Next(0, GetSlotAvailable(mob.Mob.Inventory, 0, 14));
            }

            itemDropado = mob.Mob.Inventory[slot];

            if (itemDropado.Id != 0)
            {
                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 (mob.Mob.Inventory.Where(a => a.Id != 0).Count() == tamanho)
                {
                    client.Send(P_101.New("O inventario esta cheio."));
                }
                else
                {
                    client.Character.Mob.Gold += mob.Mob.Gold < 0 ? mob.Mob.Gold * -1 : mob.Mob.Gold;
                    client.Character.Mob.Inventory.ToList().ForEach(a => { slot = 0; if (a.Id == 0)
                                                                           {
                                                                               return;
                                                                           }
                                                                           else
                                                                           {
                                                                               slot += 1;
                                                                           } });
                    client.Character.Mob.AddItemToCharacter(client, itemDropado, TypeSlot.Inventory, slot);
                }
            }
            Log.Normal($"Teve: {TaxaDrop}% de conseguir algum item");
        }
Beispiel #5
0
 public static void controller(Client client, P_2E4 p2e4)
 {
     client.Character.Mob.Inventory[p2e4.Slot] = SItem.New();
 }