GetPlayer() public static method

public static GetPlayer ( int id ) : Systems
id int
return Systems
コード例 #1
0
        void ListPartyMatching(List <party> pt)
        {
            //Create new packet writer
            PacketWriter Writer = new PacketWriter();

            //Add opcode
            Writer.Create(Systems.SERVER_SEND_PARTYLIST);
            //Write static bytes
            Writer.Byte(1);
            Writer.Byte(4);
            Writer.Byte(0);
            //Write total count of partys
            Writer.Byte(pt.Count);
            //If party count higher is then zero
            if (pt.Count > 0)
            {
                //Repeat for each party in list of party's
                foreach (party currpt in pt)
                {
                    //Get player information using leaderid
                    Systems s = Systems.GetPlayer(currpt.LeaderID);
                    //Write party id
                    Writer.DWord(currpt.ptid);
                    //Write leader id
                    Writer.DWord(currpt.LeaderID);
                    //Write charactername
                    Writer.Text(s.Character.Information.Name);
                    //Write static byte 1
                    Writer.Byte(1);
                    //Write current party players count
                    Writer.Byte(currpt.Members.Count);
                    //Write party type
                    Writer.Byte(currpt.Type);
                    //Write party purpose
                    Writer.Byte(currpt.ptpurpose);
                    //Write min level required
                    Writer.Byte(currpt.minlevel);
                    //Write max level to join the party
                    Writer.Byte(currpt.maxlevel);
                    //Write party name
                    Writer.Text3(currpt.partyname);
                }
            }
            //Send bytes to the client
            client.Send(Writer.GetBytes());
        }
コード例 #2
0
ファイル: RequestPackets.cs プロジェクト: uvbs/DarkEmu
        public static byte[] PartyRequest(byte Type, int id, byte type)
        {
            //Create new packet writer
            PacketWriter Writer = new PacketWriter();

            //Add opcode
            Writer.Create(Systems.SERVER_PARTY_REQUEST);
            //Write type byte
            Writer.Byte(Type);
            //Create switch on type
            switch (Type)
            {
            case 6:
                //Union invite
                Writer.DWord(id);
                break;

            case 5:
                //Guild invitation
                Writer.DWord(id);
                Systems InvitedPlayer = Systems.GetPlayer(id);
                Writer.Word(InvitedPlayer.Character.Information.Name.Length);
                Writer.String(InvitedPlayer.Character.Information.Name);
                Writer.Word(InvitedPlayer.Character.Network.Guild.Name.Length);
                Writer.String(InvitedPlayer.Character.Network.Guild.Name);
                break;

            case 2:
                //Party invite
                Writer.DWord(id);
                Writer.Byte(type);
                break;

            case 1:
                //Exchange invite
                Writer.DWord(id);
                break;
            }

            return(Writer.GetBytes());
        }
コード例 #3
0
ファイル: PartyDataPackets.cs プロジェクト: uvbs/DarkEmu
        public static byte[] Party_DataMember(party p)
        {
            //Create new packet writer
            PacketWriter Writer = new PacketWriter();

            //Add opcode
            Writer.Create(Systems.SERVER_PARTYMEMBER_DATA);
            //Write static byte
            Writer.Byte(0xFF);
            //Write party id
            Writer.DWord(p.ptid);
            //Write leader id
            Writer.DWord(p.LeaderID);
            //Write byte party type
            Writer.Byte(p.Type);
            //Write total amount of members in party
            Writer.Byte(p.Members.Count);
            //Repeat for each member in party -1
            for (byte b = 0; b <= p.Members.Count - 1; b++)
            {
                //Get player detail information
                Systems PartyMemberInfo = Systems.GetPlayer(p.Members[b]);
                //Calculate hp and mp
                int partyPercentMP = (int)Math.Round((decimal)(PartyMemberInfo.Character.Stat.SecondMP * 10) / PartyMemberInfo.Character.Stat.Mp) << 4;
                int partyPercentHP = (int)Math.Round((decimal)(PartyMemberInfo.Character.Stat.SecondHp * 10) / PartyMemberInfo.Character.Stat.Hp);
                //Set percent
                int partyPercent = partyPercentHP | partyPercentMP;
                //Write static byte
                Writer.Byte(0xff);
                //Write unique member id
                Writer.DWord(PartyMemberInfo.Character.Information.UniqueID);
                //Write character name
                Writer.Text(PartyMemberInfo.Character.Information.Name);
                //Write character model
                Writer.DWord(PartyMemberInfo.Character.Information.Model);
                //Write character level
                Writer.Byte(PartyMemberInfo.Character.Information.Level);
                //Write stat hp mp information
                Writer.Byte((byte)partyPercent);
                //Write x and y sector
                Writer.Byte(PartyMemberInfo.Character.Position.xSec);
                Writer.Byte(PartyMemberInfo.Character.Position.ySec);
                //Write x z y
                Writer.Word(Formule.packetx(PartyMemberInfo.Character.Position.x, PartyMemberInfo.Character.Position.xSec));
                Writer.Word(PartyMemberInfo.Character.Position.z);
                Writer.Word(Formule.packety(PartyMemberInfo.Character.Position.y, PartyMemberInfo.Character.Position.ySec));
                //Write double word 1
                Writer.Word(1);
                Writer.Word(1);
                //If player has a guild
                if (PartyMemberInfo.Character.Network.Guild.Name != null)
                {
                    //Write guild name
                    Writer.Text(PartyMemberInfo.Character.Network.Guild.Name);
                }
                //If player has no guild
                else
                {
                    //Write word 0 value
                    Writer.Word(0);
                }
                //Write static byte
                Writer.Byte(0);
                //Write dword
                Writer.DWord(0);
                Writer.DWord(0);
            }
            //Return all bytes for sending
            return(Writer.GetBytes());
        }
コード例 #4
0
ファイル: PartyDataPackets.cs プロジェクト: uvbs/DarkEmu
        public static byte[] Party_Data(byte type, int id)
        {
            //Create new packet writer
            PacketWriter Writer = new PacketWriter();

            //Add opcode
            Writer.Create(Systems.SERVER_PARTY_DATA);
            //Write type byte
            Writer.Byte(type);
            //Create switch for type given
            switch (type)
            {
            case 1:
                //Remove party state
                Writer.Byte(0x0b);
                Writer.Byte(0);
                //Return all bytes for sending
                return(Writer.GetBytes());

            case 2:
                //Formed party new member update
                Systems CharacterInformation = Systems.GetPlayer(id);
                //Write static byte
                Writer.Byte(0xFF);
                //Write unique character id
                Writer.DWord(CharacterInformation.Character.Information.UniqueID);
                //Write character name
                Writer.Text(CharacterInformation.Character.Information.Name);
                //Write character model
                Writer.DWord(CharacterInformation.Character.Information.Model);
                //Write character level
                Writer.Byte(CharacterInformation.Character.Information.Level);
                //Write static byte
                Writer.Byte(0xAA);
                //Write x and y sector
                Writer.Byte(CharacterInformation.Character.Position.xSec);
                Writer.Byte(CharacterInformation.Character.Position.ySec);
                //Write x z y
                Writer.Word(Formule.packetx(CharacterInformation.Character.Position.x, CharacterInformation.Character.Position.xSec));
                Writer.Word(CharacterInformation.Character.Position.z);
                Writer.Word(Formule.packety(CharacterInformation.Character.Position.y, CharacterInformation.Character.Position.ySec));
                //Write double word 1
                Writer.Word(1);
                Writer.Word(1);
                //If character is in a guild
                if (CharacterInformation.Character.Network.Guild.Name != null)
                {
                    //Write guild name
                    Writer.Text(CharacterInformation.Character.Network.Guild.Name);
                }
                //If character has no guild
                else
                {
                    //Write 0 word value
                    Writer.Word(0);
                }
                //Static byte
                Writer.Byte(0);
                //Permissions
                Writer.DWord(0);
                Writer.DWord(0);
                //Return all bytes for sending
                return(Writer.GetBytes());

            case 3:
                //Write character id
                Writer.DWord(id);
                //Write static byte 4
                Writer.Byte(4);
                //Return all bytes for sending
                return(Writer.GetBytes());

            case 6:
                //Update player location and stat
                CharacterInformation = Systems.GetPlayer(id);
                //Calculate hp and mp
                int partyPercentMP = (int)Math.Round((decimal)(CharacterInformation.Character.Stat.SecondMP * 10) / CharacterInformation.Character.Stat.Mp) << 4;
                int partyPercentHP = (int)Math.Round((decimal)(CharacterInformation.Character.Stat.SecondHp * 10) / CharacterInformation.Character.Stat.Hp);
                //Set percent information
                int partyPercent = partyPercentHP | partyPercentMP;
                //Write character id
                Writer.DWord(id);
                //If character is moving
                if (CharacterInformation.Character.Position.Walking)
                {
                    //Write byte 20
                    Writer.Byte(0x20);
                    //Write location information
                    Writer.Byte(CharacterInformation.Character.Position.packetxSec);
                    Writer.Byte(CharacterInformation.Character.Position.packetySec);
                    Writer.Word(CharacterInformation.Character.Position.packetX);
                    Writer.Word(CharacterInformation.Character.Position.packetZ);
                    Writer.Word(CharacterInformation.Character.Position.packetY);
                    //Write double word 1
                    Writer.Word(1);
                    Writer.Word(1);
                }
                //If not walking
                else
                {
                    //Write static byte 4
                    Writer.Byte(4);
                    //Write hp mp information
                    Writer.Byte((byte)partyPercent);
                }
                //Return all bytes for sending
                return(Writer.GetBytes());

            case 9:
                //New leader id
                Writer.DWord(id);
                //Return all bytes for sending
                return(Writer.GetBytes());
            }
            //Return all bytes for sending
            return(Writer.GetBytes());
        }