Beispiel #1
0
 /// <summary>
 /// Erstellt ein neues Party-Objekt.
 /// </summary>
 /// <param name="charNo">Anfangswert der Eigenschaft CharNo.</param>
 /// <param name="masterNo">Anfangswert der Eigenschaft MasterNo.</param>
 /// <param name="partyNo">Anfangswert der Eigenschaft PartyNo.</param>
 /// <param name="partyGroup">Anfangswert der Eigenschaft PartyGroup.</param>
 public static Party CreateParty(global::System.Int32 charNo, global::System.Int32 masterNo, global::System.Int32 partyNo, global::System.Int32 partyGroup)
 {
     Party party = new Party();
     party.CharNo = charNo;
     party.MasterNo = masterNo;
     party.PartyNo = partyNo;
     party.PartyGroup = partyGroup;
     return party;
 }
Beispiel #2
0
 /// <summary>
 /// Veraltete Methode zum Hinzufügen eines neuen Objekts zum EntitySet 'Parties'. Verwenden Sie stattdessen die Methode '.Add' der zugeordneten Eigenschaft 'ObjectSet&lt;T&gt;'.
 /// </summary>
 public void AddToParties(Party party)
 {
     base.AddObject("Parties", party);
 }
Beispiel #3
0
        public static void PartyInviteFromCharacter(WorldClient client, Packet packet)
        {
            //Charname => Who send the PT inv // Nexor
            //Client => Who got the request // xRapid
            string charname;
            if(!packet.TryReadString(out charname, 16))
            {
                Log.WriteLine(LogLevel.Error, "PartySystem :: Got unknown Character from {0}", client.CharacterName);
            }

            WorldClient otherclient = ClientManager.Instance.GetClientByCharname(charname);

            if (otherclient != null)
            {
                int PartyNo = 0;

                if (Program.Entity.Parties.Count() != 0)
                {
                    Party party;
                    party = Program.Entity.Parties.OrderByDescending(c => c.PartyNo).First();
                    PartyNo = (party.PartyNo + 1);
                }

                if (Program.Entity.Parties.Count(c => c.CharNo == otherclient.Character.Character.ID) == 1)
                {
                    Party party;
                    party = Program.Entity.Parties.First(c => c.CharNo == otherclient.Character.Character.ID);
                    PartyNo = party.PartyNo;

                    party = new Party();
                    party.CharNo = client.Character.Character.ID;
                    party.MasterNo = 0;
                    party.PartyNo = PartyNo;
                    party.PartyGroup = 1;
                    Program.Entity.AddToParties(party);
                    Program.Entity.SaveChanges();
                }
                else
                {
                    Party party = new Party();
                    party.CharNo = otherclient.Character.Character.ID;
                    party.MasterNo = 0;
                    party.PartyNo = PartyNo;
                    party.PartyGroup = 1;
                    Program.Entity.AddToParties(party);
                    Program.Entity.SaveChanges();

                    party = new Party();
                    party.CharNo = client.Character.Character.ID;
                    party.MasterNo = 1;
                    party.PartyNo = PartyNo;
                    party.PartyGroup = 1;
                    Program.Entity.AddToParties(party);
                    Program.Entity.SaveChanges();
                }

                //using (var ppacket = new Packet(SH14Type.PartyInvite))
                //{
                //    ppacket.WriteUShort(0);
                //    ppacket.WriteString(client.Character.Character.Name, 16);
                //    client.SendPacket(ppacket);
                //}

                using (var ppacket = new Packet(SH14Type.PartyInviteAnswer))
                {
                    ppacket.WriteString(charname, 16);
                    ppacket.WriteByte(otherclient.Character.Character.Job);
                    ppacket.WriteUShort(1217);
                    client.SendPacket(ppacket);
                }

                //All send to the request Person who send the request

                using (var ppacket = new Packet(SH14Type.PartyInvite))
                {
                    ppacket.WriteUShort(0);
                    ppacket.WriteString(charname, 16);
                    otherclient.SendPacket(ppacket);
                }

                SendPartyList(PartyNo);
            }
            else
            {
                Log.WriteLine(LogLevel.Error, "PartySystem :: Can not found requested client {0}", charname);
            }
        }