Beispiel #1
0
        public static SSpawn New(SMob mob, Int16 sessionId, String paramTab)
        //: base(0x364, 0x7530)
        {
            SSpawn tmp = new SSpawn
            {
                SpawnType    = 2,/*1-efeito normal/2-efeito m**********r*/
                Position     = mob.LastPosition,
                SessionId    = sessionId,
                Name         = mob.Name,
                ItemEffect   = new SItemEF[3],
                AffectEffect = new SItemEF[3],
                Status       = mob.BaseStatus,
                AnctCode     = new Byte[16],
                TabValue     = paramTab,
                ChaosPoints  = 200,
                TotalKill    = 200,
                Unknow_100   = 0xCC00,
                GuildIndex   = 0,
            };

            for (int x = 0; x < 16; x++)
            {
                SItem item = mob.Equip[x];
                //ItemEffect.Effects[x] = (short)(Calculos.CalculoEfeito(item, x));
                // AnctCode[x] = (byte)(Calculos.CalculoAnct(mob, x));
            }
            return(tmp);
        }
Beispiel #2
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));
            }
        }
Beispiel #3
0
 // Retorna o valor da refinação
 public static byte GetItemSanc(SItem Item)
 {
     for (int i = 0; i < Item.Ef.Length; i++)
     {
         if (Item.Ef[i].Type == (byte)ItemListEf.EF_SANC || Item.Ef[i].Type >= 116 && Item.Ef[i].Type <= 125)
         {
             return(Item.Ef[i].Value);
         }
     }
     return(0);
 }
Beispiel #4
0
        public static P_182 New(Client client, SItem item, TypeSlot type, int slot)
        {
            P_182 tmp = new P_182
            {
                Header = SHeader.New(0x0182, Marshal.SizeOf <P_182>(), client.ClientId),
                Type   = (short)type,
                Slot   = (short)slot,
                Item   = item
            };

            return(tmp);
        }
        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 #6
0
        public static P_26E New(SPosition position, SItem item, byte rotate, Gate state)
        {
            P_26E tmp = new P_26E
            {
                Header   = SHeader.New(0x026E, Marshal.SizeOf <P_26E>(), 0),
                Position = position,
                ItemId   = (short)(Config.HeightMap(position) + 10000),
                Item     = item,
                Rotate   = rotate,
                Status   = (byte)state
            };

            return(tmp);
        }
Beispiel #7
0
        public static SItem New(short Id, byte T0, byte V0, byte T1, byte V1, byte T2, byte V2)
        {
            SItem tmp = new SItem {
                Id = Id,

                Ef = new SItemEF [3] {
                    SItemEF.New(T0, V0),
                    SItemEF.New(T1, V1),
                    SItemEF.New(T2, V2),
                }
            };

            return(tmp);
        }
Beispiel #8
0
        // Diminui a Quantidade do Item
        public static void SetItemAmount(Client Client, SItem Item, int Slot)
        {
            for (int i = 0; i < Item.Ef.Length; i++)
            {
                if (Item.Ef[i].Type == (byte)ItemListEf.EF_AMOUNT)
                {
                    Item.Ef[i].Value -= 1;

                    if (Item.Ef[i].Value == 0)
                    {
                        Client.Character.Mob.RemoveItemToCharacter(Client, TypeSlot.Inventory, Slot);
                    }
                }
            }
        }
Beispiel #9
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);
        }
        // Retorna o código anct do item ou sua tintura
        public static byte GetAnctCode(SItem Item, bool Mont)
        {
            byte value = 0;

            if (Mont)
            {
                return(0);
            }
            else
            {
                for (int i = 0; i < Item.Ef.Length; i++)
                {
                    if (Item.Ef [i].Type == 43)
                    {
                        value = Item.Ef [i].Value;
                        break;
                    }
                    else if (Item.Ef [i].Type >= 116 && Item.Ef [i].Type <= 125)
                    {
                        return(Item.Ef [i].Type);
                    }
                }
            }

            if (value == 0)
            {
                return(0);
            }

            if (value < 230)
            {
                return(43);
            }

            switch (value % 4)
            {
            case 0: return(0x30);

            case 1: return(0x40);

            case 2: return(0x10);

            case 3: return(0x20);

            default: return(value);
            }
        }
Beispiel #11
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 #12
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"));
            }
        }
Beispiel #13
0
        // Adiciona o valor da refinação
        public static void SetItemSanc(SItem Item)
        {
            int sanc = GetItemSanc(Item);

            if (sanc < 9)
            {
                sanc += 1;
            }
            if (sanc == 10)
            {
                sanc = 12;
            }
            else if (sanc == 11)
            {
                sanc = 15;
            }
            else if (sanc == 12)
            {
                sanc = 18;
            }
            else if (sanc == 13)
            {
                sanc = 22;
            }
            else if (sanc == 14)
            {
                sanc = 27;
            }

            for (int i = 0; i < Item.Ef.Length; i++)
            {
                if (Item.Ef[i].Type == (byte)ItemListEf.EF_SANC || Item.Ef[i].Type >= 116 && Item.Ef[i].Type <= 125)
                {
                    Item.Ef[i].Value = (byte)sanc;
                }
            }
        }
        // Retorna o ID do item pra visão
        public static short GetItemID(SItem Item, bool Mont)
        {
            bool colored = false;
            byte value   = 0;

            if (Mont)
            {
                value = ( byte )(Math.Floor(( double )(Item.Ef [1].Type / 10)));
            }
            else
            {
                for (int i = 0; i < Item.Ef.Length; i++)
                {
                    if (Item.Ef [i].Type == 43)
                    {
                        value = Item.Ef [i].Value;
                        break;
                    }
                    else if (Item.Ef [i].Type >= 116 && Item.Ef [i].Type <= 125)
                    {
                        value   = Item.Ef [i].Value;
                        colored = true;
                        break;
                    }
                }

                if (value > 9 && !colored)
                {
                    if (value >= 230 && value <= 233)
                    {
                        value = 10;
                    }
                    else if (value >= 234 && value <= 237)
                    {
                        value = 11;
                    }
                    else if (value >= 238 && value <= 241)
                    {
                        value = 12;
                    }
                    else if (value >= 242 && value <= 245)
                    {
                        value = 13;
                    }
                    else if (value >= 246 && value <= 249)
                    {
                        value = 14;
                    }
                    else if (value >= 250 && value <= 253)
                    {
                        value = 15;
                    }
                    else
                    {
                        value = 0;
                    }
                }
                else if (colored)
                {
                    if (value > 9)
                    {
                        value = 9;
                    }
                }
            }

            return(( short )(Item.Id + (value * 4096)));
        }
Beispiel #15
0
        // Retorna o ID do item pra visão
        public static short GetVisualItemCode(SItem Item, bool Mont)
        {
            int value = 0;

            if (Mont)
            {// montaria
                if (Item.Id >= 3980 && Item.Id < 3995)
                {
                    return(Item.Id);
                }

                if (Item.Id == 2360)
                {
                    if (Item.Ef[0].Value > 0)
                    {
                        value = Item.Ef[1].Type / 10;
                    }
                    else
                    {
                        return(0);
                    }
                }

                return((short)(Item.Id | (value * 0x1000)));
            }
            else
            {
                if (Item.Ef[0].Type == 43)
                {
                    value = Item.Ef[0].Value;
                }
                else if (Item.Ef[1].Type == 43)
                {
                    value = Item.Ef[1].Value;
                }
                else if (Item.Ef[2].Type == 43)
                {
                    value = Item.Ef[2].Value;
                }

                else if (Item.Ef[0].Type >= 116 && Item.Ef[0].Type <= 125)
                {
                    return((short)(Item.Id | (12 * 0x1000)));
                }

                else if (Item.Ef[1].Type >= 116 && Item.Ef[1].Type <= 125)
                {
                    return((short)(Item.Id | (12 * 0x1000)));
                }

                else if (Item.Ef[2].Type >= 116 && Item.Ef[2].Type <= 125)
                {
                    return((short)(Item.Id | (12 * 0x1000)));
                }

                else
                {
                    return(Item.Id);
                }
            }

            if (value < 230)
            {
                value %= 10;
            }

            else if (value < 234)
            {
                value = 10;
            }
            else if (value < 238)
            {
                value = 11;
            }
            else if (value < 242)
            {
                value = 12;
            }
            else if (value < 246)
            {
                value = 13;
            }
            else if (value < 250)
            {
                value = 14;
            }
            else if (value < 254)
            {
                value = 15;
            }
            else// value < 256
            {
                value = 16;
            }

            return((short)(Item.Id | (value * 0x1000)));
        }
Beispiel #16
0
 public static void controller(Client client, P_2E4 p2e4)
 {
     client.Character.Mob.Inventory[p2e4.Slot] = SItem.New();
 }
Beispiel #17
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 #18
0
        // Retorna o código anct do item ou sua tintura
        public static byte GetVisualAnctCode(SItem Item)
        {
            byte value = 0;

            if (Item.Id >= 2360 && Item.Id <= 2390 && Item.Ef[0].Value > 0)
            {
                switch (Item.Ef[2].Value)
                {
                case 11:
                    return(Convert.ToByte(0x10B));

                case 12:
                    return(Convert.ToByte(0x10C));

                case 13:
                    return(Convert.ToByte(0x10D));

                case 14:
                    return(Convert.ToByte(0x10E));

                case 15:
                    return(Convert.ToByte(0x10F));

                case 16:
                    return(Convert.ToByte(0x110));

                case 17:
                    return(Convert.ToByte(0x111));

                case 18:
                    return(Convert.ToByte(0x112));

                case 19:
                    return(Convert.ToByte(0x113));

                case 20:
                    return(Convert.ToByte(0x114));

                case 35:
                    if (Item.Id == 2363 || Item.Id == 2377)
                    {
                        return(Convert.ToByte(0x115));
                    }
                    break;

                default:
                    return(0x00);
                }

                return(0);
            }
            if (Item.Ef[0].Type == 43)
            {
                value = Item.Ef[0].Value;
            }
            else if (Item.Ef[1].Type == 43)
            {
                value = Item.Ef[1].Value;
            }
            else if (Item.Ef[2].Type == 43)
            {
                value = Item.Ef[2].Value;
            }


            if (Item.Ef[0].Type >= 116 && Item.Ef[0].Type <= 125)
            {
                return(value = (byte)(Convert.ToInt32(Item.Ef[0].Type) - 3));
            }
            if (Item.Ef[1].Type >= 116 && Item.Ef[1].Type <= 125)
            {
                return(value = (byte)(Convert.ToInt32(Item.Ef[1].Type) - 3));
            }
            if (Item.Ef[2].Type >= 116 && Item.Ef[2].Type <= 125)
            {
                return(value = (byte)(Convert.ToInt32(Item.Ef[2].Type) - 3));
            }

            if (value == 0)
            {
                return(0);
            }

            if (value < 230)
            {
                return(43);
            }

            switch (value % 4)
            {
            case 0: return(0x30);

            case 1: return(0x40);

            case 2: return(0x10);

            default: return(0x20);
            }
        }
Beispiel #19
0
        public static void controller(Client client, P_376 p376)
        {
            SItem tempItem = new SItem();

            switch (p376.TypeSrc)
            {
            case (byte)TypeSlot.Storage:
                tempItem = client.Account.Storage.Item[p376.SrcSlot];
                switch (p376.TypeDest)
                {
                case (byte)TypeSlot.Storage:         // bau para o bau
                                                     //Se eh volatile nao faz a alteracao de posicao e sim agrupa-os
                    if (AgrupaVolatile(client, ref p376))
                    {
                        client.Account.Storage.Item[p376.SrcSlot]  = client.Account.Storage.Item[p376.DestSlot];
                        client.Account.Storage.Item[p376.DestSlot] = tempItem;
                    }
                    break;

                case (byte)TypeSlot.Inventory:         // bau para o inventorio

                    //Se eh volatile nao faz a alteracao de posicao e sim agrupa-os
                    if (AgrupaVolatile(client, ref p376))
                    {
                        client.Account.Storage.Item[p376.SrcSlot]     = client.Character.Mob.Inventory[p376.DestSlot];
                        client.Character.Mob.Inventory[p376.DestSlot] = tempItem;
                    }
                    break;

                case (byte)TypeSlot.Equip:         // bau para o equip

                    if (permicaoEquipItem(tempItem, client.Character.Mob, p376.DestSlot))
                    {
                        client.Account.Storage.Item[p376.SrcSlot] = client.Character.Mob.Equip[p376.DestSlot];
                        client.Character.Mob.Equip[p376.DestSlot] = tempItem;
                    }
                    else
                    {
                        client.Send(P_101.New("Não é permitido usar o item"));
                    }

                    Functions.GetCurrentScore(client, false);
                    break;
                }
                break;

            case (byte)TypeSlot.Inventory:
                tempItem = client.Character.Mob.Inventory[p376.SrcSlot];
                switch (p376.TypeDest)
                {
                case (byte)TypeSlot.Storage:         //Iventorio para o bau
                    //Se eh volatile nao faz a alteracao de posicao e sim agrupa-os
                    if (AgrupaVolatile(client, ref p376))
                    {
                        client.Character.Mob.Inventory[p376.SrcSlot] = client.Account.Storage.Item[p376.DestSlot];
                        client.Account.Storage.Item[p376.DestSlot]   = tempItem;
                    }
                    break;

                case (byte)TypeSlot.Inventory:         //Iventorio para o inventorio

                    //Se eh volatile nao faz a alteracao de posicao e sim agrupa-os
                    if (AgrupaVolatile(client, ref p376))
                    {
                        client.Character.Mob.Inventory[p376.SrcSlot]  = client.Character.Mob.Inventory[p376.DestSlot];
                        client.Character.Mob.Inventory[p376.DestSlot] = tempItem;
                    }

                    break;

                case (byte)TypeSlot.Equip:        //Iventorio para o equip

                    if (permicaoEquipItem(tempItem, client.Character.Mob, p376.DestSlot))
                    {
                        client.Character.Mob.Inventory[p376.SrcSlot] = client.Character.Mob.Equip[p376.DestSlot];
                        client.Character.Mob.Equip[p376.DestSlot]    = tempItem;
                    }
                    else
                    {
                        client.Send(P_101.New("Não é permitido usar o item"));
                    }

                    Functions.GetCurrentScore(client, false);
                    break;
                }
                break;

            case (byte)TypeSlot.Equip:
                tempItem = client.Character.Mob.Equip[p376.SrcSlot];
                switch (p376.TypeDest)
                {
                case (byte)TypeSlot.Storage:         //Equipe para o bau
                    client.Character.Mob.Equip[p376.SrcSlot]   = client.Account.Storage.Item[p376.DestSlot];
                    client.Account.Storage.Item[p376.DestSlot] = tempItem;
                    break;

                case (byte)TypeSlot.Inventory:         //Equipe para o iventario
                    client.Character.Mob.Equip[p376.SrcSlot]      = client.Character.Mob.Inventory[p376.DestSlot];
                    client.Character.Mob.Inventory[p376.DestSlot] = tempItem;
                    break;

                case (byte)TypeSlot.Equip:         // Equipe para equipe
                    client.Character.Mob.Equip[p376.SrcSlot]  = client.Character.Mob.Equip[p376.DestSlot];
                    client.Character.Mob.Equip[p376.DestSlot] = tempItem;
                    break;
                }
                Functions.GetCurrentScore(client, false);
                break;
            }
            client.Send(P_376.New(client, p376));
        }
Beispiel #20
0
 public static SItem New(SItem i) => New(i.Id, i.Ef [0].Type, i.Ef [0].Value, i.Ef [1].Type, i.Ef [1].Value, i.Ef [2].Type, i.Ef [2].Value);