Exemple #1
0
        public static void SendMailsListResponse(IRealmClient client, IEnumerable <Asda2MailMessage> mailMsgs)
        {
            var msgs = new Asda2MailMessage[10];
            var ii   = 0;

            foreach (var m in mailMsgs)
            {
                if (m.DeleteTime < DateTime.Now)
                {
                    client.ActiveCharacter.MailMessages.Remove(m.Guid);
                    m.DeleteLater();
                }
                else
                {
                    msgs[ii] = m;
                }
                ii++;
            }
            using (var packet = new RealmPacketOut(RealmServerOpCode.MailsList)) //6619
            {
                packet.WriteByte(0);                                             //{page}default value : 1 Len : 1
                for (int i = 0; i < 10; i += 1)
                {
                    var msg = msgs[i];
                    packet.WriteInt32((int)(msg == null?-1:msg.Guid));                                        //{guidRec}default value : 379808 Len : 4
                    packet.WriteByte(msg == null?0:msg.IsReaded?1:0);                                         //{taked}default value : 0 Len : 1
                    packet.WriteInt32((int)(msg == null ? 0 : (msg.DeleteTime - DateTime.Now).TotalMinutes)); //{timeTodeletemins}default value : 10061 Len : 4
                    packet.WriteFixedAsciiString(msg == null?"":msg.SenderName, 20);                          //{senderName}default value :  Len : 20
                    packet.WriteFixedAsciiString(msg == null ? "" : msg.Subject, 32);                         //{title}default value :  Len : 32
                }
                client.Send(packet, addEnd: true);
            }
        }
Exemple #2
0
 public static void SendWarChatResponseResponse(Asda2Battleground btlgrnd, string senderName, string message, int factionId, Locale locale)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.WarChatResponse)) //6719
     {
         packet.WriteByte(3);                                                   //value name : unk5 default value : 3Len : 1
         packet.WriteFixedAsciiString(senderName, 20);                          //{senderName}default value :  Len : 20
         packet.WriteFixedAsciiString(message, 200, locale);                    //{message}default value :  Len : 200
         btlgrnd.Send(packet, true, (short?)factionId, locale);
     }
 }
 public static void SendWarChatResponseResponse(Asda2Battleground btlgrnd, string senderName, string message,
                                                int factionId, Locale locale)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.WarChatResponse))
     {
         packet.WriteByte(3);
         packet.WriteFixedAsciiString(senderName, 20, Locale.Start);
         packet.WriteFixedAsciiString(message, 200, locale);
         btlgrnd.Send(packet, true, new short?((short)factionId), locale);
     }
 }
Exemple #4
0
 public static void SendSomeOneKilledSomeOneResponse(Asda2Battleground btlgrnd, int killerAccId, int killerWarId,
                                                     string killerName, string victimName)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SomeOneKilledSomeOne)) //6730
     {
         packet.WriteInt32(killerAccId);                                             //{killerAccId}default value : 315044 Len : 4
         packet.WriteInt32(killerWarId);                                             //{killerWarId}default value : 8 Len : 4
         packet.WriteInt32(1);                                                       //value name : unk7 default value : 1Len : 4
         packet.WriteFixedAsciiString(killerName, 20);                               //{killerName}default value :  Len : 20
         packet.WriteFixedAsciiString(victimName, 20);                               //{vicimName}default value :  Len : 20
         btlgrnd.Send(packet, addEnd: true);
     }
 }
Exemple #5
0
        public static void SendCharacterPrivateShopInfoResponse(IRealmClient client,
                                                                Asda2ViewTradeShopInfoStatus infoStatus, Asda2PrivateShop shop)
        {
            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.CharacterPrivateShopInfo))
            {
                packet.WriteByte((byte)infoStatus);
                if (infoStatus == Asda2ViewTradeShopInfoStatus.Ok)
                {
                    packet.WriteInt32(shop.Owner.AccId);
                    packet.WriteInt16(shop.Owner.SessionId);
                    packet.WriteByte(shop.ItemsCount);
                    packet.WriteFixedAsciiString(shop.Owner.Asda2TradeDescription, 50, Locale.Start);
                    packet.WriteFixedAsciiString(shop.Owner.Name, 20, Locale.Start);
                    for (int index = 0; index < 10; ++index)
                    {
                        Asda2Item asda2Item = shop.ItemsOnTrade[index] == null || shop.ItemsOnTrade[index].Item == null
                            ? (Asda2Item)null
                            : shop.ItemsOnTrade[index].Item;
                        packet.WriteInt32(asda2Item == null ? 0 : asda2Item.ItemId);
                        packet.WriteInt32(shop.ItemsOnTrade[index] == null ? -1 : shop.ItemsOnTrade[index].Amount);
                        packet.WriteByte(asda2Item == null ? 0 : (int)asda2Item.Durability);
                        packet.WriteInt16(asda2Item == null ? 0 : (int)asda2Item.Weight);
                        packet.WriteInt16(asda2Item == null ? 0 : asda2Item.Soul1Id);
                        packet.WriteInt16(asda2Item == null ? 0 : asda2Item.Soul2Id);
                        packet.WriteInt16(asda2Item == null ? 0 : asda2Item.Soul3Id);
                        packet.WriteInt16(asda2Item == null ? 0 : asda2Item.Soul4Id);
                        packet.WriteInt16(asda2Item == null ? 0 : (int)asda2Item.Enchant);
                        packet.WriteInt16(0);
                        packet.WriteByte(0);
                        packet.WriteInt16(asda2Item == null ? (short)0 : (short)asda2Item.Parametr1Type);
                        packet.WriteInt16(asda2Item == null ? 0 : (int)asda2Item.Parametr1Value);
                        packet.WriteInt16(asda2Item == null ? (short)0 : (short)asda2Item.Parametr2Type);
                        packet.WriteInt16(asda2Item == null ? 0 : (int)asda2Item.Parametr2Value);
                        packet.WriteInt16(asda2Item == null ? (short)0 : (short)asda2Item.Parametr3Type);
                        packet.WriteInt16(asda2Item == null ? 0 : (int)asda2Item.Parametr3Value);
                        packet.WriteInt16(asda2Item == null ? (short)0 : (short)asda2Item.Parametr4Type);
                        packet.WriteInt16(asda2Item == null ? 0 : (int)asda2Item.Parametr4Value);
                        packet.WriteInt16(asda2Item == null ? (short)0 : (short)asda2Item.Parametr5Type);
                        packet.WriteInt16(asda2Item == null ? 0 : (int)asda2Item.Parametr5Value);
                        packet.WriteByte(0);
                        packet.WriteInt32(shop.ItemsOnTrade[index] == null ? -1 : shop.ItemsOnTrade[index].Price);
                        packet.WriteInt32(asda2Item == null ? 0 : 264156);
                        packet.WriteInt16(asda2Item == null ? 0 : 1);
                    }
                }

                client.Send(packet, false);
            }
        }
 public static void SendTradeStartedResponse(IRealmClient client, Asda2TradeStartedStatus status,
                                             Character tradeWith, bool isRegularTrade)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.TradeStarted)) //5285
     {
         packet.WriteByte((byte)status);                                     //{status}default value : 1 Len : 1
         packet.WriteByte(isRegularTrade ? 0 : 1);                           //{tradeType}default value : 1 Len : 1
         packet.WriteInt32(1);                                               //{tradeSessionID}default value : 1 Len : 4
         packet.WriteInt16(client.ActiveCharacter.SessionId);                //value name : unk7 default value : 23Len : 2
         packet.WriteFixedAsciiString(client.ActiveCharacter.Name, 20);      //{characterName}default value :  Len : 20
         packet.WriteInt16(tradeWith.SessionId);                             //{secondSessId}default value : 34 Len : 2
         packet.WriteFixedAsciiString(tradeWith.Name, 20);                   //{secondName}default value :  Len : 20
         client.Send(packet);
     }
 }
 public static void SendTradeStartedResponse(IRealmClient client, Asda2TradeStartedStatus status,
                                             Character tradeWith, bool isRegularTrade)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.TradeStarted))
     {
         packet.WriteByte((byte)status);
         packet.WriteByte(isRegularTrade ? 0 : 1);
         packet.WriteInt32(1);
         packet.WriteInt16(client.ActiveCharacter.SessionId);
         packet.WriteFixedAsciiString(client.ActiveCharacter.Name, 20, Locale.Start);
         packet.WriteInt16(tradeWith.SessionId);
         packet.WriteFixedAsciiString(tradeWith.Name, 20, Locale.Start);
         client.Send(packet, false);
     }
 }
Exemple #8
0
 public static void SendInitPetInfoOnLoginResponse(IRealmClient client, Asda2PetRecord pet)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.InitPetInfoOnLogin))
     {
         packet.WriteInt32(client.ActiveCharacter.AccId);
         packet.WriteByte(0);
         packet.WriteInt32(pet.Guid);
         packet.WriteInt16(pet.Id);
         packet.WriteFixedAsciiString(pet.Name, 16, Locale.Start);
         packet.WriteByte(pet.HungerPrc);
         packet.WriteByte(pet.Level);
         packet.WriteByte(pet.MaxLevel);
         packet.WriteInt16(pet.Expirience);
         packet.WriteByte(pet.Level);
         packet.WriteInt16((short)pet.Stat1Type);
         packet.WriteInt32(pet.Stat1Value);
         packet.WriteInt16((short)pet.Stat2Type);
         packet.WriteInt32(pet.Stat2Value);
         packet.WriteInt16((short)pet.Stat3Type);
         packet.WriteInt32(pet.Stat3Value);
         packet.WriteByte(client.ActiveCharacter.Asda2Pet == null
             ? 0
             : (client.ActiveCharacter.Asda2Pet.Guid == pet.Guid ? 1 : 0));
         client.Send(packet, false);
     }
 }
Exemple #9
0
 public static void SendEnterChatRoomResultResponse(IRealmClient client, EnterChatRoomStatus status,
                                                    Asda2Chatroom room)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.EnterChatRoomResult)) //6243
     {
         packet.WriteByte((byte)status);                                            //{status}default value : 1 Len : 1
         packet.WriteByte(room == null ? 0 : room.IsPrivate ? 1 : 2);
         //{privateOnePublicTwo}default value : 0 Len : 1
         packet.WriteByte(room == null ? 0 : room.MaxMembersCount); //{maxMembers}default value : 15 Len : 1
         packet.WriteByte(room == null ? 0 : room.Members.Count);   //{currentMembers}default value : 2 Len : 1
         packet.WriteFixedAsciiString(room == null ? "" : room.Name, 28);
         //{roomName}default value :  Len : 28
         packet.WriteByte(0);  //value name : unk10 default value : 0Len : 1
         packet.WriteByte(99); //value name : unk11 default value : 99Len : 1
         var mombers = room == null ? new Character[0] : room.Members.Values.ToArray();
         for (int i = 0; i < 20; i += 1)
         {
             var chr = mombers.Length <= i ? null : mombers[i];
             packet.WriteByte(chr == null ? 0 : room != null && (chr == room.Owner) ? 1 : 0);
             //{isLeader}default value : 1 Len : 1
             packet.WriteInt32(chr == null ? -1 : (int)chr.AccId); //{accId}default value : 361343 Len : 4
             packet.WriteInt16(chr == null ? -1 : chr.SessionId);  //{sessId}default value : 28 Len : 2
         }
         client.Send(packet, addEnd: true);
     }
 }
Exemple #10
0
 public static void SendChatRoomVisibleResponse(Character owner, ChatRoomVisibilityStatus status, Asda2Chatroom room, Character character = null)
 {
     if (character != null)
     {
         using (var packet = new RealmPacketOut(RealmServerOpCode.ChatRoomVisible)) //6248
         {
             packet.WriteByte((byte)status);                                        //{status}default value : 2 Len : 1
             packet.WriteInt32(owner.AccId);                                        //{initerAccId}default value : 361343 Len : 4
             packet.WriteByte(room == null ? 0 : room.IsPrivate ? 1 : 0);
             //{zeroPublicOnePrivate}default value : 1 Len : 1
             packet.WriteInt16(room == null ? 0 : room.MaxMembersCount); //{maxMemberCount}default value : 15 Len : 1
             packet.WriteFixedAsciiString(room == null ? "" : room.Name, 28);
             //{roomName}default value :  Len : 28
             packet.WriteInt16(0); //value name : unk11 default value : 0Len : 2
             packet.WriteByte(0);  //value name : unk1 default value : 0Len : 1
             character.Send(packet, addEnd: true);
         }
         return;
     }
     using (var packet = new RealmPacketOut(RealmServerOpCode.ChatRoomVisible)) //6248
     {
         packet.WriteByte((byte)status);                                        //{status}default value : 2 Len : 1
         packet.WriteInt32(owner.AccId);                                        //{initerAccId}default value : 361343 Len : 4
         packet.WriteByte(room == null ? 0 : room.IsPrivate ? 1 : 0);           //{zeroPublicOnePrivate}default value : 1 Len : 1
         packet.WriteInt16(room == null ? 0 : room.MaxMembersCount);            //{maxMemberCount}default value : 15 Len : 1
         packet.WriteFixedAsciiString(room == null ? "" : room.Name, 28);
         //{roomName}default value :  Len : 28
         packet.WriteInt16(0); //value name : unk11 default value : 0Len : 2
         packet.WriteByte(0);  //value name : unk1 default value : 0Len : 1
         owner.SendPacketToArea(packet);
     }
 }
Exemple #11
0
        public static void SendDuelEndedResponse(Character winer, Character looser)
        {
            AchievementProgressRecord progressRecord = winer.Achievements.GetOrCreateProgressRecord(19U);

            switch (++progressRecord.Counter)
            {
            case 13:
                winer.DiscoverTitle(Asda2TitleId.Duelist122);
                break;

            case 25:
                winer.GetTitle(Asda2TitleId.Duelist122);
                break;

            case 50:
                winer.DiscoverTitle(Asda2TitleId.Brawler123);
                break;

            case 100:
                winer.GetTitle(Asda2TitleId.Brawler123);
                break;

            case 500:
                winer.DiscoverTitle(Asda2TitleId.Undefeated124);
                break;

            case 1000:
                winer.GetTitle(Asda2TitleId.Undefeated124);
                break;
            }

            progressRecord.SaveAndFlush();
            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.DuelEnded))
            {
                packet.WriteByte(0);
                packet.WriteByte(0);
                packet.WriteInt16(winer.SessionId);
                packet.WriteInt32(winer.AccId);
                packet.WriteInt16(looser.SessionId);
                packet.WriteInt32(looser.AccId);
                packet.WriteByte(2);
                packet.WriteFixedAsciiString(winer.Name, 20, Locale.Start);
                packet.WriteFixedAsciiString(looser.Name, 20, Locale.Start);
                winer.SendPacketToArea(packet, true, true, Locale.Any, new float?());
                looser.Send(packet, true);
            }
        }
Exemple #12
0
 public static void SendDuelEndedResponse(Character winer, Character looser)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.DuelEnded)) //4304
     {
         packet.WriteByte(0);                                             //value name : unk1 default value : 0Len : 1
         packet.WriteByte(0);                                             //value name : unk5 default value : 0Len : 1
         packet.WriteInt16(winer.SessionId);                              //{winerSessId}default value : 96 Len : 2
         packet.WriteInt32(winer.AccId);                                  //{winerAccNum}default value : 340701 Len : 4
         packet.WriteInt16(looser.SessionId);                             //{loosetSessId}default value : 79 Len : 2
         packet.WriteInt32(looser.AccId);                                 //{looserAccNum}default value : 354889 Len : 4
         packet.WriteByte(2);                                             //value name : unk1 default value : 2Len : 1
         packet.WriteFixedAsciiString(winer.Name, 20);                    //{winerName}default value :  Len : 20
         packet.WriteFixedAsciiString(looser.Name, 20);                   //{LooserName}default value :  Len : 20
         winer.SendPacketToArea(packet, true, true);
         looser.Send(packet, addEnd: true);
     }
 }
        public static void SendSomeOneKilledSomeOneResponse(Asda2Battleground btlgrnd, int killerAccId, int killerWarId,
                                                            string killerName, string victimName)
        {
            Character characterByAccId = WCell.RealmServer.Global.World.GetCharacterByAccId((uint)killerAccId);
            AchievementProgressRecord progressRecord = characterByAccId.Achievements.GetOrCreateProgressRecord(21U);

            switch (++progressRecord.Counter)
            {
            case 13:
                characterByAccId.DiscoverTitle(Asda2TitleId.Soldier129);
                break;

            case 25:
                characterByAccId.GetTitle(Asda2TitleId.Soldier129);
                break;

            case 75:
                characterByAccId.DiscoverTitle(Asda2TitleId.Killer130);
                break;

            case 100:
                characterByAccId.GetTitle(Asda2TitleId.Killer130);
                break;

            case 500:
                characterByAccId.DiscoverTitle(Asda2TitleId.Assassin131);
                break;

            case 1000:
                characterByAccId.GetTitle(Asda2TitleId.Assassin131);
                break;
            }

            progressRecord.SaveAndFlush();
            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SomeOneKilledSomeOne))
            {
                packet.WriteInt32(killerAccId);
                packet.WriteInt32(killerWarId);
                packet.WriteInt32(1);
                packet.WriteFixedAsciiString(killerName, 20, Locale.Start);
                packet.WriteFixedAsciiString(victimName, 20, Locale.Start);
                btlgrnd.Send(packet, true, new short?(), Locale.Any);
            }
        }
 public static void SendWiningFactionInfoResponse(Asda2BattlegroundTown townId, int factionId, string mvpName)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.WiningFactionInfo))
     {
         packet.WriteInt32((int)townId);
         packet.WriteInt32(factionId);
         packet.WriteFixedAsciiString(mvpName, 20, Locale.Start);
         WCell.RealmServer.Global.World.Broadcast(packet, true, Locale.Any);
     }
 }
Exemple #15
0
        public static RealmPacketOut CreatePrivateShopChatResResponse(Character sender, string message, Locale locale)
        {
            RealmPacketOut realmPacketOut = new RealmPacketOut(RealmServerOpCode.PrivateShopChatRes);

            realmPacketOut.WriteInt32(1);
            realmPacketOut.WriteFixedAsciiString(sender.Name, 20, locale);
            realmPacketOut.WriteAsciiString(message, locale);
            realmPacketOut.WriteByte(0);
            return(realmPacketOut);
        }
Exemple #16
0
 public static void SendtradeStatusTextWindowResponse(Character chr)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.TradeStatusTextWindow))
     {
         packet.WriteByte(chr.IsAsda2TradeDescriptionEnabled ? 1 : 0);
         packet.WriteByte(chr.IsAsda2TradeDescriptionPremium ? 1 : 0);
         packet.WriteInt32(chr.AccId);
         packet.WriteFixedAsciiString(chr.Asda2TradeDescription, 50, Locale.Start);
         chr.SendPacketToArea(packet, true, true, Locale.Any, new float?());
     }
 }
Exemple #17
0
 public static void SendWiningFactionInfoResponse(Asda2BattlegroundTown townId,
                                                  int factionId, string mvpName)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.WiningFactionInfo)) //6257
     {
         packet.WriteInt32((int)townId);                                          //{townId}default value : 0 Len : 4
         packet.WriteInt32(factionId);                                            //{factionId}default value : 0 Len : 4
         packet.WriteFixedAsciiString(mvpName, 20);                               //{MVPName}default value :  Len : 20
         World.Broadcast(packet, true, Locale.Any);
     }
 }
Exemple #18
0
        public static RealmPacketOut CreateNormalChatMessagePacket(string sender, string message, Locale locale)
        {
            var packet = new RealmPacketOut(RealmServerOpCode.NormalChatResponse); //5085

            packet.WriteInt16(0);                                                  //sender sessIddefault value : 37
            packet.WriteInt32(0);                                                  //sender accId
            packet.WriteFixedAsciiString(sender, 20, locale);                      //{sender}default value :
            packet.WriteAsciiString(message, locale);                              //{msg}default value :

            return(packet);
        }
Exemple #19
0
 public static void SendtradeStatusTextWindowResponseToOne(Character chr, IRealmClient rcv)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.TradeStatusTextWindow))
     {
         packet.WriteByte(chr.IsAsda2TradeDescriptionEnabled ? 1 : 0);
         packet.WriteByte(chr.IsAsda2TradeDescriptionPremium ? 1 : 0);
         packet.WriteInt32(chr.AccId);
         packet.WriteFixedAsciiString(chr.Asda2TradeDescription, 50, Locale.Start);
         rcv.Send(packet, true);
     }
 }
 public static void SendTradeRequestResponse(IRealmClient client, Character sender, Asda2TradeType tradeType)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.TradeRequestResponse)) //5283
     {
         packet.WriteByte(1);                                                        //value name : unk4 default value : 1Len : 1
         packet.WriteInt16(sender.SessionId);                                        //{sessId}default value : 3 Len : 2
         packet.WriteFixedAsciiString(sender.Name, 20);                              //{fromName}default value :  Len : 20
         packet.WriteByte((byte)tradeType);                                          //{tradeType}default value : 0 Len : 1
         client.Send(packet, addEnd: false);
     }
 }
 public static void SendTradeRequestResponse(IRealmClient client, Character sender, Asda2TradeType tradeType)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.TradeRequestResponse))
     {
         packet.WriteByte(1);
         packet.WriteInt16(sender.SessionId);
         packet.WriteFixedAsciiString(sender.Name, 20, Locale.Start);
         packet.WriteByte((byte)tradeType);
         client.Send(packet, false);
     }
 }
Exemple #22
0
 public static void SendPetNameChangedResponse(IRealmClient client, Asda2PetNamehangeResult status, Asda2PetRecord pet, Asda2Item changeNameItem)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.PetNameChanged)) //6119
     {
         packet.WriteByte((byte)status);                                       //{status}default value : 1 Len : 1
         packet.WriteInt32(client.ActiveCharacter.AccId);                      //{accId}default value : 355335 Len : 4
         packet.WriteInt32(pet == null ? 0 : pet.Guid);                        //{petId}default value : 54857 Len : 4
         packet.WriteFixedAsciiString(pet == null ? "" : pet.Name, 16);        //{petName}default value :  Len : 21
         Asda2InventoryHandler.WriteItemInfoToPacket(packet, changeNameItem, false);
         client.Send(packet, addEnd: true);
     }
 }
 public static void SendCharacterHasLeftWarResponse(Asda2Battleground btlgrnd, int leaverAccId, byte leaverWarId,
                                                    string leaverName, int factionId)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.CharacterHasLeftWar))
     {
         packet.WriteByte(0);
         packet.WriteInt32(leaverAccId);
         packet.WriteByte(leaverWarId);
         packet.WriteFixedAsciiString(leaverName, 20, Locale.Start);
         btlgrnd.Send(packet, true, new short?((short)factionId), Locale.Any);
     }
 }
Exemple #24
0
 public static RealmPacketOut SendTalkMessage(string msg, Color c)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.MessageServerAboutWarStarts)) //3113
     {
         packet.WriteInt16(0);                                                              //value name : unk4 default value : 0Len : 2
         packet.WriteInt16(0);                                                              //value name : unk5 default value : 100Len : 2
         packet.WriteFixedAsciiString(msg, 36);                                             //{Message}default value : 48 Len : 36
         packet.WriteSkip(unk80);                                                           //value name : unk80 default value : unk80Len : 107
         World.Broadcast(packet, true, Locale.Any);
         return(packet);
     }
 }
Exemple #25
0
 public static void SendCharacterHasLeftWarResponse(Asda2Battleground btlgrnd, int leaverAccId, byte leaverWarId,
                                                    string leaverName, int factionId)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.CharacterHasLeftWar)) //6721
     {
         packet.WriteByte(0);                                                       //value name : unk5 default value : 0Len : 1
         packet.WriteInt32(leaverAccId);                                            //{accId}default value : -1 Len : 4
         packet.WriteByte(leaverWarId);                                             //{warId}default value : 10 Len : 1
         packet.WriteFixedAsciiString(leaverName, 20);                              //{lefterName}default value :  Len : 20
         btlgrnd.Send(packet, true, (short?)factionId);
     }
 }
Exemple #26
0
 public static void SendMailMessageInfoResponse(IRealmClient client, ShowMailMessageStatus status, Asda2MailMessage msg)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.MailMessageInfo)) //6623
     {
         packet.WriteByte((byte)status);                                        //{status}default value : 1 Len : 1
         packet.WriteInt32((int)(msg == null?0:msg.Guid));                      //{msgGuid}default value : 379808 Len : 4
         packet.WriteInt32(msg == null ? 0 : msg.Gold);                         //{goldAmount}default value : 5600 Len : 4
         Asda2InventoryHandler.WriteItemInfoToPacket(packet, msg == null ? null:msg.Item, true);
         packet.WriteFixedAsciiString(msg == null ?"":msg.Body, 128);           //{message}default value :  Len : 128
         client.Send(packet, addEnd: true);
     }
 }
        public static void SendMailsListResponse(IRealmClient client, IEnumerable <Asda2MailMessage> mailMsgs)
        {
            Asda2MailMessage[] asda2MailMessageArray = new Asda2MailMessage[10];
            int index1 = 0;

            foreach (Asda2MailMessage mailMsg in mailMsgs)
            {
                if (mailMsg.DeleteTime < DateTime.Now)
                {
                    client.ActiveCharacter.MailMessages.Remove(mailMsg.Guid);
                    mailMsg.DeleteLater();
                }
                else
                {
                    asda2MailMessageArray[index1] = mailMsg;
                }

                ++index1;
            }

            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.MailsList))
            {
                packet.WriteByte(0);
                for (int index2 = 0; index2 < 10; ++index2)
                {
                    Asda2MailMessage asda2MailMessage = asda2MailMessageArray[index2];
                    packet.WriteInt32(asda2MailMessage == null ? -1 : (int)asda2MailMessage.Guid);
                    packet.WriteByte(asda2MailMessage == null ? 0 : (asda2MailMessage.IsReaded ? 1 : 0));
                    packet.WriteInt32(asda2MailMessage == null
            ? 0
            : (int)(asda2MailMessage.DeleteTime - DateTime.Now).TotalMinutes);
                    packet.WriteFixedAsciiString(asda2MailMessage == null ? "" : asda2MailMessage.SenderName, 20,
                                                 Locale.Start);
                    packet.WriteFixedAsciiString(asda2MailMessage == null ? "" : asda2MailMessage.Subject, 32,
                                                 Locale.Start);
                }

                client.Send(packet, true);
            }
        }
Exemple #28
0
 public static void SendPvpRequestToCharFromSrvResponse(Character sender, Character rcv)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.PvpRquest))
     {
         packet.WriteInt16(sender.SessionId);
         packet.WriteInt32(sender.AccId);
         packet.WriteFixedAsciiString(sender.Name, 20, Locale.Start);
         packet.WriteInt16(rcv.SessionId);
         packet.WriteInt32(rcv.AccId);
         packet.WriteInt16(0);
         rcv.Send(packet, false);
     }
 }
Exemple #29
0
 public static void SendPvpRequestToCharFromSrvResponse(Character sender, Character rcv)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.PvpRquest)) //4302
     {
         packet.WriteInt16(sender.SessionId);                             //{senderSessId}default value : 39 Len : 2
         packet.WriteInt32(sender.AccId);                                 //{senderAccId}default value : 355335 Len : 4
         packet.WriteFixedAsciiString(sender.Name, 20);                   //{senderName}default value :  Len : 20
         packet.WriteInt16(rcv.SessionId);                                //{rcvSessId}default value : 45 Len : 2
         packet.WriteInt32(rcv.AccId);                                    //{rcvAccId}default value : 340701 Len : 4
         packet.WriteInt16(0);                                            //value name : unk10 default value : 0Len : 2
         rcv.Send(packet, addEnd: false);
     }
 }
Exemple #30
0
        public static void SendPartyChatResponse(Character sender, string msg)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.PartyChatResponse)) //5106
            {
                packet.WriteInt16(sender.SessionId);                                     //{sessId}default value : 37 Len : 2
                packet.WriteFixedAsciiString(CreateSenderName(sender), 20);              //{sender}default value :  Len : 20
                packet.WriteInt16(sender.SessionId);                                     //{sessId}default value : 37 Len : 2
                packet.WriteByte(0);
                packet.WriteAsciiString(msg, sender.Client.Locale);                      //{msg}default value :  Len : 0

                sender.Group.Send(packet, addEnd: false);
            }
        }