コード例 #1
0
ファイル: JoinPackets.cs プロジェクト: uvbs/DarkEmu
        public static byte[] CreateFormedParty(party pt)
        {
            //Create new packet writer
            PacketWriter Writer = new PacketWriter();

            //Add opcode to packet
            Writer.Create(Systems.SERVER_FORMED_PARTY_CREATED);
            //Static byte
            Writer.Byte(1);
            //Party id
            Writer.DWord(pt.ptid);
            //0 Dword value
            Writer.DWord(0);
            //Party type
            Writer.Byte(pt.Type);
            //Party purpose
            Writer.Byte(pt.ptpurpose);
            //Party min level required
            Writer.Byte(pt.minlevel);
            //Party max level allowed
            Writer.Byte(pt.maxlevel);
            //Party name
            Writer.Text3(pt.partyname);
            //Return all bytes to send
            return(Writer.GetBytes());
        }
コード例 #2
0
ファイル: JoinPackets.cs プロジェクト: CarlosX/DarkEmu
 public static byte[] CreateFormedParty(party pt)
 {
     //Create new packet writer
     PacketWriter Writer = new PacketWriter();
     //Add opcode to packet
     Writer.Create(Systems.SERVER_FORMED_PARTY_CREATED);
     //Static byte
     Writer.Byte(1);
     //Party id
     Writer.DWord(pt.ptid);
     //0 Dword value
     Writer.DWord(0);
     //Party type
     Writer.Byte(pt.Type);
     //Party purpose
     Writer.Byte(pt.ptpurpose);
     //Party min level required
     Writer.Byte(pt.minlevel);
     //Party max level allowed
     Writer.Byte(pt.maxlevel);
     //Party name
     Writer.Text3(pt.partyname);
     //Return all bytes to send
     return Writer.GetBytes();
 }
コード例 #3
0
ファイル: Deletion.cs プロジェクト: CarlosX/DarkEmu
        public static void RemoveOnDisconnect(party p, Systems c)
        {
            //Remove client and member if it contains our removing character
            if (p.Members.Contains(c.Character.Information.UniqueID))
            {
                p.Members.Remove(c.Character.Information.UniqueID);
                p.MembersClient.Remove(c.client);
            }
            //Send packet to each player
            foreach (int member in p.Members)
            {
                Systems playerdetail = GetPlayer(member);

                if (p.Members.Count > 1)
                {
                    playerdetail.client.Send(Packet.Party_Data(1, 0));
                }
                else
                {
                    //Send removal of party
                    playerdetail.client.Send(Packet.Party_Data(3, playerdetail.Character.Information.UniqueID));
                    //Remove party state
                    playerdetail.Character.Network.Party = null;
                }
            }
        }
コード例 #4
0
        public static void RemoveOnDisconnect(party p, Systems c)
        {
            //Remove client and member if it contains our removing character
            if (p.Members.Contains(c.Character.Information.UniqueID))
            {
                p.Members.Remove(c.Character.Information.UniqueID);
                p.MembersClient.Remove(c.client);
            }
            //Send packet to each player
            foreach (int member in p.Members)
            {
                Systems playerdetail = GetPlayer(member);

                if (p.Members.Count > 1)
                {
                    playerdetail.client.Send(Packet.Party_Data(1, 0));
                }
                else
                {
                    //Send removal of party
                    playerdetail.client.Send(Packet.Party_Data(3, playerdetail.Character.Information.UniqueID));
                    //Remove party state
                    playerdetail.Character.Network.Party = null;
                }
            }
        }
コード例 #5
0
ファイル: PartyDataPackets.cs プロジェクト: CarlosX/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();
 }
コード例 #6
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());
        }
コード例 #7
0
ファイル: ObjectFunction.cs プロジェクト: CarlosX/DarkEmu
        public void CalcSharedPartyExpSp(int paramexp, party pt, Systems targetplayer, ref long outexp)
        {
            try
            {
                byte mlv = Data.ObjectBase[this.ID].Level;
                // party average
                int k = 0;
                List<int> NearbyMembers = new List<int>(9);
                if (pt.Members.Count != 0)
                {
                    double playerDist;
                    foreach (int memb in pt.Members)
                    {
                        Systems i = Systems.GetPlayer(memb);
                        //playerDist = Formule.gamedistance(targetplayer.Character.Position.x, targetplayer.Character.Position.y, i.Character.Position.x, i.Character.Position.y);
                        playerDist = Formule.gamedistance(targetplayer.Character.Position, i.Character.Position);
                        if (playerDist <= 75)
                        {
                            NearbyMembers.Add(i.Character.Information.UniqueID);
                        }
                    }
                    foreach (int l in NearbyMembers)
                    {
                        k += Systems.GetPlayer(l).Character.Information.Level;
                    }
                    k = (int)(k / pt.Members.Count);
                    //k = átlag.
                    foreach (int mem in NearbyMembers)
                    {

                        Systems ch = Systems.GetPlayer(mem);
                        int ptsp = 97;
                        //This isn't the right formula. TODO: We must find the right one!
                        int ptexp = (int)((((paramexp / mlv) + (mlv - k)) * mlv) / k) * ch.Character.Information.Level;
                        ptexp *= Systems.Rate.Xp;
                        byte kat = this.Kat;
                        if (kat == 20) kat = 25;
                        ptexp *= kat; //we multiply the exp according to type of the mob.
                        //TODO: premium ticket
                        //gap:
                        ptexp -= (ptexp * (ch.Character.Information.Level) - Math.Abs(ch.Character.Information.Level - ch.MasteryGetBigLevel)) * 10 / 100;
                        if (ch.Character.Information.Level == 110 && ch.Character.Information.XP >= 4000000000) ptexp = 0;
                        //we calculate the amount of sp:
                        if (Math.Abs(Data.ObjectBase[this.ID].Level - k) < 10)
                        {
                            int gap = Math.Abs(ch.Character.Information.Level - ch.MasteryGetBigLevel) * 10;
                            if (gap >= 90) gap = 90;
                            ptsp = (ptsp * (100 + gap)) / k; //Instead of 100 I share with the avareage of the party, so we get a proportionate number.
                            ptsp *= kat;
                            ptsp *= Systems.Rate.Sp;
                        }
                        //Send total to all in party (Set exp from formula)
                        SetPartyMemberExp(ch, (long)ptexp, ch.Character.Information.Attributes, (long)ptsp);
                        SetSp(ch, (long)ptsp);
                        if (ch.Character.Network.Guild.Guildid != 0)
                        {
                            if (Math.Abs(ch.Character.Network.Guild.LastDonate - ch.Character.Network.Guild.DonateGP) >= 10)
                            {
                                Systems.MsSQL.UpdateData("UPDATE guild_members SET guild_points='" + ch.Character.Network.Guild.DonateGP + "' WHERE guild_member_id='" + ch.Character.Information.CharacterID + "'");
                                ch.Character.Network.Guild.LastDonate = ch.Character.Network.Guild.DonateGP;

                                // set new amount to every guild members guild class
                                foreach (int m in ch.Character.Network.Guild.Members)
                                {
                                    int targetindex = ch.Character.Network.Guild.MembersInfo.FindIndex(i => i.MemberID == m);
                                    if (ch.Character.Network.Guild.MembersInfo[targetindex].Online)
                                    {
                                        Systems sys = Systems.GetPlayer(m);

                                        // here comes the messy way
                                        Global.guild_player mygp = new Global.guild_player();
                                        int myindex = 0;
                                        foreach (Global.guild_player gp in sys.Character.Network.Guild.MembersInfo)
                                        {
                                            if (gp.MemberID == ch.Character.Information.CharacterID)
                                            {
                                                mygp = gp;
                                                mygp.DonateGP = ch.Character.Network.Guild.DonateGP;
                                                break;
                                            }
                                            myindex++;
                                        }
                                        sys.Character.Network.Guild.MembersInfo[myindex] = mygp;
                                    }
                                }

                                ch.Character.Network.Guild.Send(Packet.GuildUpdate(ch.Character, 9, 0, 0, 0));
                            }
                        }
                        outexp = ptexp;
                    }
                }
                else return;
            }
            catch (Exception ex)
            {
                Systems.Debugger.Write(ex);
            }
        }
コード例 #8
0
ファイル: Requests.cs プロジェクト: uvbs/DarkEmu
        void CharacterRequest()
        {
            try
            {
                //Open packet reader
                PacketReader Reader = new PacketReader(PacketInformation.buffer);

                //Get targeted player information
                Systems sys = GetPlayer(Character.Network.TargetID);

                if (this.Character.State.UnionApply && sys.Character.State.UnionApply)
                {
                    if (Reader.Byte() == 1 && Reader.Byte() == 0)
                    {
                        //Need to sniff decline packet info
                        Character.State.UnionApply     = false;
                        sys.Character.State.UnionApply = false;
                    }
                    else
                    {
                        //Check for null and set unique id for union and insert our own guild.
                        if (sys.Character.Network.Guild.Unions == null)
                        {
                            int uniqueid = MsSQL.GetRowsCount("SELECT * FROM guild_unions");
                            sys.Character.Network.Guild.UniqueUnion = uniqueid + 1;
                            MsSQL.InsertData("INSERT INTO guild_unions (union_leader, union_guildid, union_unique_id) VALUES ('" + sys.Character.Network.Guild.Guildid + "','" + sys.Character.Network.Guild.Guildid + "','" + sys.Character.Network.Guild.UniqueUnion + "')");
                        }
                        //Update database
                        MsSQL.InsertData("INSERT INTO guild_unions (union_leader, union_guildid, union_unique_id) VALUES ('" + sys.Character.Network.Guild.Guildid + "','" + Character.Network.Guild.Guildid + "','" + sys.Character.Network.Guild.UniqueUnion + "')");

                        //Send union packet to newly joined player
                        client.Send(Packet.UnionInfo(this));

                        //Send update packet to all guilds in union
                        foreach (int member in Character.Network.Guild.Members)
                        {
                            //Make sure the member is there
                            if (member != 0)
                            {
                                //If the user is not the newly invited member get player info
                                Systems tomember = GetPlayerMainid(member);
                                //Send guild update packet
                                if (tomember != null)
                                {
                                    if (!tomember.Character.Network.Guild.SingleSend)
                                    {
                                        if (Character.Information.CharacterID != tomember.Character.Information.CharacterID)
                                        {
                                            tomember.Character.Network.Guild.SingleSend = true;
                                            tomember.client.Send(Packet.GuildUpdate(Character, 14, 0, 0, 0));
                                        }
                                    }
                                }
                            }
                        }
                        foreach (int member in Character.Network.Guild.UnionMembers)
                        {
                            //Make sure the member is there
                            if (member != 0)
                            {
                                //If the user is not the newly invited member get player info
                                Systems tomember = GetPlayerMainid(member);
                                //Send guild update packet
                                if (tomember != null)
                                {
                                    if (!tomember.Character.Network.Guild.SingleSend)
                                    {
                                        tomember.Character.Network.Guild.SingleSend = true;
                                        tomember.client.Send(Packet.GuildUpdate(Character, 14, 0, 0, 0));
                                    }
                                }
                            }
                        }
                        //Disable the bool again
                        foreach (int member in Character.Network.Guild.Members)
                        {
                            //Make sure member isnt null
                            if (member != 0)
                            {
                                //Get guildmember details
                                Systems guildmember = GetPlayerMainid(member);
                                //Make sure guildmember isnt null
                                if (guildmember != null)
                                {
                                    //Disable bool to allow resend new packets.
                                    guildmember.Character.Network.Guild.SingleSend = false;
                                }
                            }
                        }
                        //Disable the bool again
                        foreach (int member in Character.Network.Guild.UnionMembers)
                        {
                            //Make sure member isnt null
                            if (member != 0)
                            {
                                //Get guildmember details
                                Systems guildmember = GetPlayerMainid(member);
                                //Make sure guildmember isnt null
                                if (guildmember != null)
                                {
                                    //Disable bool to allow resend new packets.
                                    guildmember.Character.Network.Guild.SingleSend = false;
                                }
                            }
                        }
                        //Reset bools
                        Character.State.UnionApply     = false;
                        sys.Character.State.UnionApply = false;
                    }
                }
                //------------------------------------- [ Exchange invite ] -------------------------------------//
                else if (this.Character.State.Exchanging && sys.Character.State.Exchanging)
                {
                    if (Reader.Byte() == 1 && Reader.Byte() == 0)
                    {
                        sys.client.Send(Packet.Exchange_Cancel());
                        Character.State.Exchanging     = false;
                        sys.Character.State.Exchanging = false;
                    }
                    else
                    {
                        sys.client.Send(Packet.OpenExhangeWindow(1, this.Character.Information.UniqueID));
                        client.Send(Packet.OpenExhangeWindow(sys.Character.Information.UniqueID));

                        Character.Network.Exchange.Window       = true;
                        Character.Network.Exchange.ItemList     = new List <DarkEmu_GameServer.Global.slotItem>();
                        sys.Character.Network.Exchange.Window   = true;
                        sys.Character.Network.Exchange.ItemList = new List <DarkEmu_GameServer.Global.slotItem>();
                    }
                }
                //------------------------------------- [ Guild invite ] -------------------------------------//
                else if (this.Character.State.GuildInvite && sys.Character.State.GuildInvite)
                {
                    //If byte equals 2 the type is denied
                    if (Reader.Byte() == 2)
                    {
                        //Denied request
                        Character.State.GuildInvite     = false;
                        sys.Character.State.GuildInvite = false;
                        //Send refused packet to sender
                        sys.client.Send(Packet.IngameMessages(SERVER_GUILD, IngameMessages.UIIT_MSG_GUILDERR_JOIN_GUILD_REFUSED));
                    }
                    //If not denied we start adding the new member
                    else
                    {
                        //Invite guild member (Add member count + 1).
                        int guildmemberadd = sys.Character.Network.Guild.Members.Count + 1;
                        //Update database
                        MsSQL.InsertData("INSERT INTO guild_members (guild_id, guild_member_id, guild_rank, guild_points, guild_fortress, guild_grant, guild_perm_join, guild_perm_withdraw, guild_perm_union, guild_perm_storage, guild_perm_notice) VALUES ('" + sys.Character.Network.Guild.Guildid + "','" + Character.Information.CharacterID + "','10','0','1','" + "" + "','0','0','0','0','0')");
                        MsSQL.UpdateData("UPDATE guild SET guild_members_t='" + guildmemberadd + "' WHERE guild_name='" + sys.Character.Network.Guild.Name + "'");
                        //Reload new member and load character data for guildinfo
                        LoadPlayerGuildInfo(true);
                        //Send packets to network and spawned players
                        foreach (int member in Character.Network.Guild.Members)
                        {
                            //Make sure the member is there
                            if (member != 0)
                            {
                                //We dont send this info to the invited user.
                                if (member != Character.Information.CharacterID)
                                {
                                    //If the user is not the newly invited member get player info
                                    Systems tomember = GetPlayerMainid(member);
                                    //Send guild update packet
                                    tomember.LoadPlayerGuildInfo(true);
                                    tomember.client.Send(Packet.GuildUpdate(Character, 1, Character.Information.CharacterID, 0, 0));
                                    tomember.client.Send(Packet.GuildSetOnline(Character.Network.Guild, Character.Information.UniqueID));
                                    tomember.client.Send(Packet.GuildUpdate(Character, 6, Character.Information.CharacterID, 0, 0));
                                }
                                //Send information to the invited player
                                else
                                {
                                    //Send guild data packets to invited
                                    client.Send(Packet.SendGuildStart());
                                    client.Send(Packet.SendGuildInfo(Character.Network.Guild));
                                    client.Send(Packet.SendGuildEnd());
                                    //Load union data for new invited player
                                    LoadUnions();
                                }
                            }
                        }
                        //Set bools to false for new invite
                        Character.State.GuildInvite     = false;
                        sys.Character.State.GuildInvite = false;
                    }
                }

                //------------------------------------- [ Party invite ] -------------------------------------//
                else
                {
                    //If invitation is accepted
                    if (Reader.Byte() == 1 && Reader.Byte() == 1)
                    {
                        //First we set our main checks (Check if player is in party or not).
                        if (Character.Network.Party != null)
                        {
                            return;
                        }
                        //Set bools for check
                        Character.Information.CheckParty     = true;
                        sys.Character.Information.CheckParty = true;

                        //Set main party information
                        party JoiningParty = sys.Character.Network.Party;

                        //Check party type members allowed need message if full
                        if (JoiningParty.Type == 4 && JoiningParty.Members.Count > 3)
                        {
                            //Send party is full message to player
                            client.Send(Packet.IngameMessages(Systems.SERVER_PARTY_MESSAGES, IngameMessages.UIIT_MSG_PARTYERR_ALREADY_FULL));
                            return;
                        }
                        if (JoiningParty.Type == 5 && JoiningParty.Members.Count > 7)
                        {
                            //Send party is full message to player
                            client.Send(Packet.IngameMessages(Systems.SERVER_PARTY_MESSAGES, IngameMessages.UIIT_MSG_PARTYERR_ALREADY_FULL));
                            return;
                        }
                        //If the current count == 0 then add party and add me
                        if (JoiningParty.Members.Count == 0)
                        {
                            //Add ourselfs to the party list
                            JoiningParty.Members.Add(sys.Character.Information.UniqueID);
                            //Add our client to the party list
                            JoiningParty.MembersClient.Add(sys.client);
                            //Set party id
                            JoiningParty.ptid = Party.Count + 1;
                            //Set party network info
                            sys.Character.Network.Party = JoiningParty;
                            //Send permissions
                            sys.client.Send(Packet.Party_Member(sys.Character.Information.UniqueID));
                            //Send party data to leader
                            sys.client.Send(Packet.Party_DataMember(JoiningParty));
                            //Send party data packet to leader (Other player that joined).
                            sys.client.Send(Packet.Party_Data(2, Character.Information.UniqueID));
                            //Add invited member to the list
                            JoiningParty.Members.Add(Character.Information.UniqueID);
                            JoiningParty.MembersClient.Add(client);
                            //Set party info for invited member
                            Character.Network.Party = JoiningParty;
                            //Send permissions
                            client.Send(Packet.PartyOwnerInformation(Character.Information.UniqueID));
                            //Send party data
                            client.Send(Packet.Party_DataMember(JoiningParty));
                            //return
                            return;
                        }
                        //If there are more members in the current party
                        else
                        {
                            //Repeat for each member using count
                            for (byte b = 0; b <= JoiningParty.Members.Count - 1; b++)
                            {
                                //Get player information from [b]
                                Systems others = GetPlayer(JoiningParty.Members[b]);
                                //Send party data to member
                                others.client.Send(Packet.Party_Data(2, Character.Information.UniqueID));
                            }
                            //Add the invited member to list
                            JoiningParty.Members.Add(Character.Information.UniqueID);
                            //Add the invited client to the list
                            JoiningParty.MembersClient.Add(client);
                            //Set party
                            Character.Network.Party = JoiningParty;
                            //Send permissions
                            client.Send(Packet.PartyOwnerInformation(Character.Information.UniqueID));
                            //Send party data
                            client.Send(Packet.Party_DataMember(JoiningParty));
                            return;
                        }
                    }
                    //If denied request
                    else
                    {
                        //Send denied message to the player joining
                        client.Send(Packet.IngameMessages(Systems.SERVER_PARTY_MEMBER, IngameMessages.UIIT_MSG_PARTYERR_JOIN_PARTY_REFUSED));
                        //Set both bools to false so inviting can be done again
                        sys.Character.Information.CheckParty = false;
                        Character.Information.CheckParty     = false;
                    }
                }
            }
            //Catch bad exception errors
            catch (Exception ex)
            {
                //Write information to the console
                Console.WriteLine("Request error: {0}", ex);
                //Write information to the debug log
                Debugger.Write(ex);
            }
        }
コード例 #9
0
        void NormalRequest()
        {
            try
            {
                //Create new packet reader
                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                //Get invited member
                int Target = Reader.Int32();
                //Get party type
                byte PartyType = Reader.Byte();
                //Close reader
                Reader.Close();

                //Get target player information
                Systems InvitedPlayer = GetPlayer(Target);
                //First we check the our own player level
                if (Character.Information.Level < 5)
                {
                    //Send message

                    //Return
                    return;
                }
                //Check target level
                if (InvitedPlayer.Character.Information.Level < 5)
                {
                    //Send message

                    //Return
                    return;
                }
                //Set target information for invited player
                InvitedPlayer.Character.Network.TargetID = Character.Information.UniqueID;
                //If the player inviting, has no party yet.
                if (Character.Network.Party == null)
                {
                    //Create new party
                    party Party = new party();
                    //Set leader of party
                    Party.LeaderID = Character.Information.UniqueID;
                    //Set party type
                    Party.Type = PartyType;
                    //Add to party net info
                    Character.Network.Party = Party;
                }
                //If the target player has no party yet.
                if (InvitedPlayer.Character.Network.Party == null)
                {
                    //Send invitation packet
                    InvitedPlayer.client.Send(Packet.PartyRequest(2, this.Character.Information.UniqueID, PartyType));
                    //Set invite bools
                    InvitedPlayer.Character.Information.CheckParty = true;
                    Character.Information.CheckParty = true;
                }
            }
            //Catch bad exception errors
            catch (Exception ex)
            {
                //Write information to the console
                Console.WriteLine(ex);
                //Write information to the debug log
                Systems.Debugger.Write(ex);
            }
        }
コード例 #10
0
        void CreateFormedParty()
        {
            try
            {
                //Get packet data
                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                //First and second dword are static
                Reader.Int32();
                Reader.Int32();
                //First byte is our party type
                byte PartyType = Reader.Byte();
                //Second byte is purpose information
                byte PartyPurpose = Reader.Byte();
                //3rd byte is minimal level required to join
                byte PartyMinLevelReq = Reader.Byte();
                //4th byte is max level to join
                byte PartyMaxLevelReq = Reader.Byte();
                //5th is short, party name lenght
                //6th is party name
                string PartyName = Reader.Text3();
                //Close our reader
                Reader.Close();

                //Make sure the user isnt in a party yet.
                if (Character.Network.Party != null)
                {
                    //If party is formed allready return
                    if (Character.Network.Party.IsFormed)
                    {
                        return;
                    }
                    //If party is not formed
                    else
                    {
                        //Get current party information
                        party CurrentParty = Character.Network.Party;
                        //Set formed state
                        CurrentParty.IsFormed = true;
                        //Party type
                        CurrentParty.Type = PartyType;
                        //Party purpose
                        CurrentParty.ptpurpose = PartyPurpose;
                        //Party minimal level
                        CurrentParty.minlevel = PartyMinLevelReq;
                        //Party maximum level
                        CurrentParty.maxlevel = PartyMaxLevelReq;
                        //Party name
                        CurrentParty.partyname = PartyName;
                        //Party owner
                        CurrentParty.LeaderID = Character.Information.UniqueID;
                        //Add party eu / ch information by model
                        CurrentParty.Race = Character.Information.Model;
                        //Send packet information to user
                        client.Send(Packet.CreateFormedParty(CurrentParty));
                        //Add party to list
                        Party.Add(CurrentParty);
                    }
                }
                //If a new formed party is created from 0
                else
                {
                    //New party for details
                    party newparty = new party();
                    //Set formed state
                    newparty.IsFormed = true;
                    //Party type
                    newparty.Type = PartyType;
                    //Party purpose
                    newparty.ptpurpose = PartyPurpose;
                    //Party minimal level
                    newparty.minlevel = PartyMinLevelReq;
                    //Party maximum level
                    newparty.maxlevel = PartyMaxLevelReq;
                    //Party name
                    newparty.partyname = PartyName;
                    //Party owner
                    newparty.LeaderID = Character.Information.UniqueID;
                    //Add party eu / ch information by model
                    newparty.Race = Character.Information.Model;
                    //Add our player to the member list
                    newparty.Members.Add(Character.Information.UniqueID);
                    //Add player client to party list information
                    newparty.MembersClient.Add(client);
                    //Party id , is current count of party's + 1
                    newparty.ptid = Party.Count + 1;
                    //Add the new party list
                    Party.Add(newparty);
                    //Set party to player
                    Character.Network.Party = newparty;
                    //bool set player in party
                    Character.Network.Party.InParty = true;
                    //Send packet information to user
                    client.Send(Packet.CreateFormedParty(newparty));
                }
            }
            //Catch bad exception errors
            catch (Exception ex)
            {
                //Write information to the console
                Console.WriteLine("Create formed party error {0}", ex);
                //Write info to the debug log
                Systems.Debugger.Write(ex);
            }
        }
コード例 #11
0
ファイル: Creation.cs プロジェクト: CarlosX/DarkEmu
        void CreateFormedParty()
        {
            try
            {
                //Get packet data
                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                //First and second dword are static
                Reader.Int32();
                Reader.Int32();
                //First byte is our party type
                byte PartyType = Reader.Byte();
                //Second byte is purpose information
                byte PartyPurpose = Reader.Byte();
                //3rd byte is minimal level required to join
                byte PartyMinLevelReq = Reader.Byte();
                //4th byte is max level to join
                byte PartyMaxLevelReq = Reader.Byte();
                //5th is short, party name lenght
                //6th is party name
                string PartyName = Reader.Text3();
                //Close our reader
                Reader.Close();

                //Make sure the user isnt in a party yet.
                if (Character.Network.Party != null)
                {
                    //If party is formed allready return
                    if (Character.Network.Party.IsFormed)
                    {
                        return;
                    }
                    //If party is not formed
                    else
                    {
                        //Get current party information
                        party CurrentParty = Character.Network.Party;
                        //Set formed state
                        CurrentParty.IsFormed = true;
                        //Party type
                        CurrentParty.Type = PartyType;
                        //Party purpose
                        CurrentParty.ptpurpose = PartyPurpose;
                        //Party minimal level
                        CurrentParty.minlevel = PartyMinLevelReq;
                        //Party maximum level
                        CurrentParty.maxlevel = PartyMaxLevelReq;
                        //Party name
                        CurrentParty.partyname = PartyName;
                        //Party owner
                        CurrentParty.LeaderID = Character.Information.UniqueID;
                        //Add party eu / ch information by model
                        CurrentParty.Race = Character.Information.Model;
                        //Send packet information to user
                        client.Send(Packet.CreateFormedParty(CurrentParty));
                        //Add party to list
                        Party.Add(CurrentParty);
                    }
                }
                //If a new formed party is created from 0
                else
                {
                    //New party for details
                    party newparty = new party();
                    //Set formed state
                    newparty.IsFormed = true;
                    //Party type
                    newparty.Type = PartyType;
                    //Party purpose
                    newparty.ptpurpose = PartyPurpose;
                    //Party minimal level
                    newparty.minlevel = PartyMinLevelReq;
                    //Party maximum level
                    newparty.maxlevel = PartyMaxLevelReq;
                    //Party name
                    newparty.partyname = PartyName;
                    //Party owner
                    newparty.LeaderID = Character.Information.UniqueID;
                    //Add party eu / ch information by model
                    newparty.Race = Character.Information.Model;
                    //Add our player to the member list
                    newparty.Members.Add(Character.Information.UniqueID);
                    //Add player client to party list information
                    newparty.MembersClient.Add(client);
                    //Party id , is current count of party's + 1
                    newparty.ptid = Party.Count + 1;
                    //Add the new party list
                    Party.Add(newparty);
                    //Set party to player
                    Character.Network.Party = newparty;
                    //bool set player in party
                    Character.Network.Party.InParty = true;
                    //Send packet information to user
                    client.Send(Packet.CreateFormedParty(newparty));
                }

            }
            //Catch bad exception errors
            catch (Exception ex)
            {
                //Write information to the console
                Console.WriteLine("Create formed party error {0}", ex);
                //Write info to the debug log
                Systems.Debugger.Write(ex);
            }
        }
コード例 #12
0
ファイル: Creation.cs プロジェクト: CarlosX/DarkEmu
        void NormalRequest()
        {
            try
            {
                //Create new packet reader
                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                //Get invited member
                int Target = Reader.Int32();
                //Get party type
                byte PartyType = Reader.Byte();
                //Close reader
                Reader.Close();

                //Get target player information
                Systems InvitedPlayer = GetPlayer(Target);
                //First we check the our own player level
                if (Character.Information.Level < 5)
                {
                    //Send message

                    //Return
                    return;
                }
                //Check target level
                if (InvitedPlayer.Character.Information.Level < 5)
                {
                    //Send message

                    //Return
                    return;
                }
                //Set target information for invited player
                InvitedPlayer.Character.Network.TargetID = Character.Information.UniqueID;
                //If the player inviting, has no party yet.
                if (Character.Network.Party == null)
                {
                    //Create new party
                    party Party = new party();
                    //Set leader of party
                    Party.LeaderID = Character.Information.UniqueID;
                    //Set party type
                    Party.Type = PartyType;
                    //Add to party net info
                    Character.Network.Party = Party;
                }
                //If the target player has no party yet.
                if (InvitedPlayer.Character.Network.Party == null)
                {
                    //Send invitation packet
                    InvitedPlayer.client.Send(Packet.PartyRequest(2, this.Character.Information.UniqueID, PartyType));
                    //Set invite bools
                    InvitedPlayer.Character.Information.CheckParty = true;
                    Character.Information.CheckParty = true;
                }
            }
            //Catch bad exception errors
            catch (Exception ex)
            {
                //Write information to the console
                Console.WriteLine(ex);
                //Write information to the debug log
                Systems.Debugger.Write(ex);
            }
        }