Exemple #1
0
        public static P_36C New(int ClientId, SPosition Src, SPosition Dst, int Type, int Speed, byte[] Directions)
        {
            P_36C tmp = new P_36C
            {
                Header = SHeader.New(0x36C, Marshal.SizeOf <P_36C>(), ClientId),

                Src = Src,

                Type  = Type,
                Speed = Speed,

                Directions = new byte[12],

                Unk1 = new byte[12],

                Dst = Dst,
            };

            if (Directions != null)
            {
                Array.Copy(Directions, tmp.Directions, tmp.Directions.Length);
            }

            return(tmp);
        }
        public static P_39D New(Client client, P_39D p39D)
        {
            P_39D tmp = new P_39D
            {
                Header         = SHeader.New(0x039D, Marshal.SizeOf <P_39D>(), client.ClientId),
                Client         = p39D.Client,
                ClientID       = p39D.ClientID,
                CurrentExp     = client.Character.Mob.Exp,
                CurrentHp      = client.Character.Mob.GameStatus.CurHP,
                CurrentMp      = client.Character.Mob.GameStatus.CurMP,
                Damage         = p39D.Damage,
                DoubleCritical = p39D.DoubleCritical,
                FlagLocal      = p39D.FlagLocal,
                Mob            = p39D.Mob,
                Motion         = p39D.Motion,
                Progress       = p39D.Progress,
                ReqMp          = p39D.ReqMp,
                Rsv            = p39D.Rsv,
                SkillIndex     = p39D.SkillIndex,
                SkillParm      = p39D.SkillParm,
                unk0           = p39D.unk0,
                Unk_1          = p39D.Unk_1,
                Unk_2          = p39D.Unk_2
            };

            return(tmp);
        }
Exemple #3
0
        public SHeader Header;          // 0 a 11		= 12

        public static P_215 New(Client client)
        {
            P_215 tmp = new P_215
            {
                Header = SHeader.New(0x0116, Marshal.SizeOf <P_215>(), client.ClientId),
            };

            return(tmp);
        }
Exemple #4
0
        public SCharList CharList;          // 12 a 855	= 844

        // Construtores
        public static P_112 New(Client client)
        {
            P_112 tmp = new P_112 {
                Header   = SHeader.New(0x112, Marshal.SizeOf <P_112> ( ), client.ClientId),
                CharList = SCharList.New(client)
            };

            return(tmp);
        }
Exemple #5
0
        public SCharList CharList;          // 12 a 855	= 844

        // Construtores
        public static P_110 New(Client client)
        {
            P_110 tmp = new P_110 {
                Header   = SHeader.New(0x110, Marshal.SizeOf <P_110> ( ), 30001),
                CharList = SCharList.New(client)
            };

            return(tmp);
        }
Exemple #6
0
        public static P_3B9 New(Client client)
        {
            P_3B9 tmp = new P_3B9
            {
                Header  = SHeader.New(0x03B9, Marshal.SizeOf <P_3B9>(), client.ClientId),
                Affects = client.Character.Mob.Affects
            };

            return(tmp);
        }
        public static P_388 New(Client client, int pValor)
        {
            P_388 tmp = new P_388
            {
                Header = SHeader.New(0x0388, Marshal.SizeOf <P_388>(), client.ClientId),
                Gold   = pValor
            };

            return(tmp);
        }
Exemple #8
0
        public static P_3AF New(Client client, int pGold)
        {
            P_3AF tmp = new P_3AF
            {
                Header = SHeader.New(0x03AF, Marshal.SizeOf <P_3AF>(), client.ClientId),
                Gold   = pGold
            };

            return(tmp);
        }
Exemple #9
0
        public LeaveVision Type;          // 12 a 15	= 4

        // Construtores
        public static P_165 New(int ClientID, LeaveVision Type)
        {
            P_165 tmp = new P_165 {
                Header = SHeader.New(0x165, Marshal.SizeOf <P_165> ( ), ClientID),

                Type = Type
            };

            return(tmp);
        }
        public static P_37E New(short ClientId)
        {
            P_37E tmp = new P_37E
            {
                Header   = SHeader.New(0x037E, Marshal.SizeOf <P_37E>(), 0),
                ClientId = ClientId
            };

            return(tmp);
        }
Exemple #11
0
        public static P_387 New(Client client, int pValor)
        {
            P_387 tmp = new P_387
            {
                Header = SHeader.New(0x0387, Marshal.SizeOf <P_387>(), client.ClientId),
                Valor  = pValor
            };

            return(tmp);
        }
        public byte[]  AnctCode; // 2 a 7	= 6

        public static P_36B New(Client client, short[] paSancCodEquip, byte[] paAnctCode)
        {
            P_36B tmp = new P_36B
            {
                Header       = SHeader.New(0x036B, Marshal.SizeOf <P_36B>(), client.ClientId),
                SancCodEquip = paSancCodEquip,
                AnctCode     = paAnctCode
            };

            return(tmp);
        }
        public static P_2E4 New(Client client, int slot, int itemId)
        {
            P_2E4 tmp = new P_2E4
            {
                Header = SHeader.New(0x02E4, Marshal.SizeOf <P_2E4>(), client.ClientId),
                Slot   = (short)slot,
                ItemId = itemId
            };

            return(tmp);
        }
Exemple #14
0
        public short   unknown; //18 a 19 = 2

        public static P_37A New(Client client, P_37A p379)
        {
            P_37A tmp = new P_37A
            {
                Header  = SHeader.New(0x0379, Marshal.SizeOf <P_37A>(), client.ClientId),
                NpcId   = p379.NpcId,
                SlotMob = p379.SlotMob,
                unknown = p379.unknown
            };

            return(tmp);
        }
Exemple #15
0
        public static P_36A New(Client client, Emotion emo, short parm)
        {
            P_36A tmp = new P_36A
            {
                Header  = SHeader.New(0x036A, Marshal.SizeOf <P_36A>(), client.ClientId),
                Motion  = emo,
                Parm    = parm,
                NotUsed = 0
            };

            return(tmp);
        }
        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 static P_379 New(Client client, P_379 p379)
        {
            P_379 tmp = new P_379
            {
                Header        = SHeader.New(0x0379, Marshal.SizeOf <P_379>(), client.ClientId),
                NpcId         = p379.NpcId,
                SlotNpc       = p379.SlotNpc,
                InventorySlot = p379.InventorySlot,
                Gold          = p379.Gold
            };

            return(tmp);
        }
        public static P_338 New(Client client, short mobId, ulong xpAdd)
        {
            P_338 tmp = new P_338
            {
                Header   = SHeader.New(0x0338, Marshal.SizeOf <P_338>(), client.ClientId),
                CPoint   = client.Character.Mob.CPoint == 0 ? 0 : (int)xpAdd,
                MobId    = mobId,
                ClientId = (short)client.ClientId,
                Exp      = xpAdd
            };

            return(tmp);
        }
        public byte[]    Unk1;            // 1352 a 1711	= 360

        // Construtores
        public static P_114 New(Character character)
        {
            P_114 tmp = new P_114 {
                Header = SHeader.New(0x114, Marshal.SizeOf <P_114> ( ), character.Mob.ClientId),

                Position = character.Mob.LastPosition,

                Mob = character.Mob,

                Unk1 = new byte [360]
            };

            return(tmp);
        }
        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);
        }
Exemple #21
0
        public static P_376 New(Client client, P_376 p376)
        {
            P_376 tmp = new P_376
            {
                Header   = SHeader.New(0x0376, Marshal.SizeOf <P_376>(), client.ClientId),
                TypeDest = p376.TypeDest,
                DestSlot = p376.DestSlot,
                TypeSrc  = p376.TypeSrc,
                SrcSlot  = p376.SrcSlot,
                WarpID   = p376.WarpID
            };

            return(tmp);
        }
Exemple #22
0
        // Controlador
        public static void Controller(Client client, P_FDE rcv)
        {
            if (!Regex.IsMatch(rcv.Numeric, @"^[0-9]{4,6}$"))
            {
                client.Close("Senha numérica inválida!");
            }
            else
            {
                Log.Information($"Numeric: {rcv.Numeric}, {rcv.Numeric.Length}");

                if (client.Status == ClientStatus.Numeric)
                {
                    if (client.Account.Numeric == string.Empty)
                    {
                        client.Account.Numeric = rcv.Numeric;
                        UserAccountDAO.CreateOrUpdateAccount(client.Account);
                    }
                    if (rcv.Numeric != client.Account.Numeric)
                    {
                        client.Send(SHeader.New(0x0FDF, Marshal.SizeOf <SHeader>(), 0));
                        client.Send(P_101.New($"Senha numérica inválida!"));
                    }
                    else
                    {
                        client.Send(SHeader.New(0x0FDE, Marshal.SizeOf <SHeader>(), 0));
                        client.Send(P_101.New("Seja bem-vindo ao Open WYD Server!"));

                        client.Status = ClientStatus.Characters;
                    }
                }
                else if (client.Status == ClientStatus.Characters)
                {
                    if (rcv.Change != 1)
                    {
                        client.Close();
                    }
                    else
                    {
                        client.Send(P_101.New("Alterar senha numérica em desenvolvimento!"));
                    }
                }
                else
                {
                    client.Close();
                }
            }
        }
Exemple #23
0
        public static P_337 New(Client client)
        {
            P_337 tmp = new P_337
            {
                Header      = SHeader.New(0x0337, Marshal.SizeOf <P_337>(), client.ClientId),
                CPoint      = client.Character.Mob.CPoint == 0 ? 0 : (uint)client.Character.Mob.Exp,
                Exp         = client.Character.Mob.Exp,
                Learn       = client.Character.Mob.LearnedSkill,
                StatusPoint = client.Character.Mob.StatusPoint,
                MasterPoint = client.Character.Mob.MasterPoint,
                GoldMob     = client.Character.Mob.Gold,
                SkillPoint  = client.Character.Mob.SkillPoint,
                Magic       = client.Character.Mob.MagicIncrement,
            };

            return(tmp);
        }
Exemple #24
0
        public static P_185 New(Client client)
        {
            P_185 tmp = new P_185
            {
                Header    = SHeader.New(0x0185, Marshal.SizeOf <P_185>(), client.ClientId),
                Inventory = new SItem[60],
                Andarilho = new SItem[2],
                Gold      = client.Character.Mob.Gold
            };

            for (int i = 0; i < tmp.Inventory.Length; i++)
            {
                tmp.Inventory[i] = client.Character.Mob.Inventory[i];
            }
            for (int i = 0; i < tmp.Andarilho.Length; i++)
            {
                tmp.Andarilho[i] = client.Character.Mob.Andarilho[i];
            }

            return(tmp);
        }
        public static P_336 New(Client client)
        {
            SMob  mob = client.Character.Mob;
            P_336 tmp = new P_336
            {
                Header     = SHeader.New(0x0336, Marshal.SizeOf <P_336>(), client.ClientId),
                Status     = new SStatus(),
                Critical   = mob.Critical,
                SaveMana   = mob.SaveMana,
                Affect     = Functions.GetAffect(mob.Affects),
                Guild      = mob.GuildIndex,
                GuildLevel = mob.GuildIndex,
                Resist     = mob.Resistencia,
                Magic      = mob.MagicIncrement,
                Special    = new byte[4],
                CurrMp     = mob.GameStatus.CurMP,
                CurrHp     = mob.GameStatus.CurHP
            };

            tmp.Status.Level    = mob.GameStatus.Level;
            tmp.Status.Defense  = mob.GameStatus.Defense;
            tmp.Status.Attack   = mob.GameStatus.Attack;
            tmp.Status.MobSpeed = mob.GameStatus.MobSpeed;
            tmp.Status.MaxHP    = mob.GameStatus.MaxHP;
            tmp.Status.MaxMP    = mob.GameStatus.MaxMP;
            tmp.Status.CurHP    = mob.GameStatus.CurHP;
            tmp.Status.CurMP    = mob.GameStatus.CurMP;
            tmp.Status.Str      = mob.GameStatus.Str;
            tmp.Status.Int      = mob.GameStatus.Int;
            tmp.Status.Dex      = mob.GameStatus.Dex;
            tmp.Status.Con      = mob.GameStatus.Con;
            tmp.Status.Master   = mob.GameStatus.Master;

            for (int i = 0; i < tmp.Special.Length; i++)
            {
                tmp.Special[i] = (byte)mob.GameStatus.Master[i];
            }

            return(tmp);
        }
        public int      Tax;            //231 a 235     = 4

        public static P_17C New(SMob mob, ShopType janela)
        {
            P_17C tmp = new P_17C
            {
                Header    = SHeader.New(0x017c, Marshal.SizeOf <P_17C>(), mob.ClientId),
                ShopType  = janela,
                Inventory = new SItem[27],
                Tax       = 5,
            };

            int count = 0;

            SItem[] inventario = mob.Inventory.Where(a => a.Id != 0).ToArray();
            if (janela == ShopType.Skill)
            {
                for (int i = 0; i < inventario.Length; i++)
                {
                    if (i == 8 || i == 16)
                    {
                        tmp.Inventory[i + count] = new SItem();
                        count = count + 1;
                        tmp.Inventory[i + count] = inventario[i];
                    }
                    else
                    {
                        tmp.Inventory[i + count] = inventario[i];
                    }
                }
            }
            else
            {
                for (int i = 0; i < inventario.Length; i++)
                {
                    tmp.Inventory[i] = inventario[i];
                }
            }

            return(tmp);
        }