public static void SendFishingStartedResponse(IRealmClient client, Asda2StartFishStatus status, Int16 interator = 0, uint fishId = 0)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.FishingStarted)) //6168
     {
         packet.WriteByte((byte)status);                                       //{status}default value : 1 Len : 1
         packet.WriteUInt32(fishId);                                           //{fishId}default value : 31720 Len : 4
         packet.WriteInt16(interator);                                         //{interator}default value : 5 Len : 2
         client.Send(packet, addEnd: true);
     }
 }
 public static void SendAttackerStateUpdate(DamageAction action)
 {
     if (action.Attacker is Character && action.Victim is NPC)
     {
         var atacker = (Character)action.Attacker;
         var victim  = (NPC)action.Victim;
         using (var packet = new RealmPacketOut(RealmServerOpCode.MonstrTakeDmg)) //4029
         {
             packet.WriteInt16(atacker.SessionId);                                //{killerSessId}default value : 17 Len : 2
             packet.WriteInt16(victim.UniqIdOnMap);                               //{monstrMapId}default value : 125 Len : 2
             packet.WriteInt32(victim.UniqWorldEntityId);                         //value name : unk6 default value : 0Len : 4
             if (action.VictimState == VictimState.Evade)
             {
                 packet.WriteInt32(-1);
             }
             else if (action.VictimState == VictimState.Block)
             {
                 packet.WriteInt32(-2);
             }
             else if (action.VictimState == VictimState.Immune)
             {
                 packet.WriteInt32(-3);
             }
             else if (action.VictimState == VictimState.Deflect || action.VictimState == VictimState.Dodge || action.VictimState == VictimState.Interrupt || action.VictimState == VictimState.Parry)
             {
                 packet.WriteInt32(-1);
             }
             else
             {
                 packet.WriteUInt32(action.ActualDamage + (action.IsCritical?2147483648:0)); //{AmountOfDmg}default value : 482 Len : 4
             }
             packet.WriteSkip(unk8);                                                         //value name : unk8 default value : unk8Len : 21
             victim.SendPacketToArea(packet);
         }
         return;
     }
     else if (action.Attacker is NPC && action.Victim is Character)
     {
         var atacker = (NPC)action.Attacker;
         var victim  = (Character)action.Victim;
         var dmg     = 0;
         if (action.VictimState == VictimState.Evade)
         {
             dmg = -1;
         }
         else if (action.VictimState == VictimState.Block)
         {
             dmg = -2;
         }
         else if (action.VictimState == VictimState.Immune)
         {
             dmg = -3;
         }
         else if (action.VictimState == VictimState.Miss || action.VictimState == VictimState.Deflect || action.VictimState == VictimState.Dodge || action.VictimState == VictimState.Interrupt || action.VictimState == VictimState.Parry)
         {
             dmg = 0;
         }
         else
         {
             dmg = (int)(action.ActualDamage + (action.IsCritical?2147483648:0));     //{AmountOfDmg}default value : 482 Len : 4
         }
         Asda2MovmentHandler.SendMonstMoveOrAtackResponse(victim.SessionId, atacker, dmg, atacker.Asda2Position, true);
     }
     else if (action.Attacker is Character && action.Victim is Character)
     {
         var dmg = 0;
         if (action.VictimState == VictimState.Evade)
         {
             dmg = -1;
         }
         else if (action.VictimState == VictimState.Block)
         {
             dmg = -2;
         }
         else if (action.VictimState == VictimState.Immune)
         {
             dmg = -3;
         }
         else if (action.VictimState == VictimState.Miss || action.VictimState == VictimState.Deflect || action.VictimState == VictimState.Dodge || action.VictimState == VictimState.Interrupt || action.VictimState == VictimState.Parry)
         {
             dmg = 0;
         }
         else
         {
             dmg = (int)(action.ActualDamage + (action.IsCritical ? 2147483648 : 0)); //{AmountOfDmg}default value : 482 Len : 4
         }
         using (var packet = new RealmPacketOut(RealmServerOpCode.AtackCharacterRes)) //4204
         {
             packet.WriteInt16(action.Attacker.CharacterMaster.SessionId);            //{atackerSessId}default value : 11 Len : 2
             packet.WriteInt16(action.Victim.CharacterMaster.SessionId);              //{victimSessId}default value : 105 Len : 2
             packet.WriteInt32(0);                                                    //value name : unk6 default value : 0Len : 4
             packet.WriteInt32(dmg);                                                  //{dmg}default value : 1 Len : 4
             packet.WriteByte(0);                                                     //value name : unk8 default value : 0Len : 1
             packet.WriteInt16(-1);                                                   //value name : unk9 default value : -1Len : 2
             packet.WriteInt32(0);                                                    //value name : unk4 default value : 0Len : 4
             action.Victim.CharacterMaster.SendPacketToArea(packet, true, true);
         }
     }
 }
Beispiel #3
0
        public static void SendEnterGameResposeResponse(IRealmClient client)
        {
            if (client.Account == null)
            {
                return;
            }
            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.EnterGameRespose))
            {
                RealmAccount account         = client.Account;
                Character    activeCharacter = account.ActiveCharacter;
                if (activeCharacter == null)
                {
                    return;
                }
                packet.WriteInt32(account.AccountId);
                packet.WriteFixedAsciiString(activeCharacter.Name, 20, Locale.Start);
                packet.WriteInt16(activeCharacter.Record.CharNum);
                packet.WriteByte(activeCharacter.Record.Zodiac);
                packet.WriteByte((byte)activeCharacter.Gender);
                packet.WriteByte(activeCharacter.ProfessionLevel);
                packet.WriteByte((byte)activeCharacter.Archetype.ClassId);
                packet.WriteByte(activeCharacter.Level);
                packet.WriteUInt32(activeCharacter.Experience);
                packet.WriteInt32(0);
                packet.WriteInt16(activeCharacter.Spells.AvalibleSkillPoints);
                packet.WriteInt16(0);
                packet.WriteByte(0);
                packet.WriteInt16(15000);
                packet.WriteInt16(1000);
                packet.WriteInt64(0L);
                packet.WriteByte(0);
                packet.WriteByte(3);
                packet.WriteInt16((client.ActiveCharacter.Record.PremiumWarehouseBagsCount + 1) * 30);
                packet.WriteInt16(
                    client.ActiveCharacter.Asda2Inventory.WarehouseItems.Count(
                        i => i != null));
                packet.WriteInt16((client.ActiveCharacter.Record.PremiumAvatarWarehouseBagsCount + 1) * 30);
                packet.WriteInt16(
                    client.ActiveCharacter.Asda2Inventory.AvatarWarehouseItems
                    .Count(i => i != null));
                packet.WriteByte(0);
                packet.WriteByte(1);
                packet.WriteInt16(-1);
                packet.WriteInt16(0);
                packet.WriteByte(activeCharacter.Record.Zodiac);
                packet.WriteByte(activeCharacter.HairStyle);
                packet.WriteByte(activeCharacter.HairColor);
                packet.WriteByte(activeCharacter.Facial);
                packet.WriteInt32(activeCharacter.Health);
                packet.WriteInt16(activeCharacter.Power);
                packet.WriteInt32(activeCharacter.MaxHealth);
                packet.WriteInt16(activeCharacter.MaxPower);
                packet.WriteInt16((short)activeCharacter.MinDamage);
                packet.WriteInt16((short)activeCharacter.MaxDamage);
                packet.WriteInt16((short)activeCharacter.RangedAttackPower);
                packet.WriteInt16((short)activeCharacter.RangedAttackPower);
                packet.WriteInt16(activeCharacter.ArcaneResist);
                packet.WriteInt16(activeCharacter.Defense);
                packet.WriteInt16(activeCharacter.Defense);
                packet.WriteInt32(activeCharacter.BlockValue);
                packet.WriteInt32(activeCharacter.BlockValue);
                packet.WriteInt16(15);
                packet.WriteInt16(7);
                packet.WriteInt16(4);
                packet.WriteSkip(unk51);
                packet.WriteSkip(activeCharacter.SettingsFlags);
                packet.WriteInt32(activeCharacter.AvatarMask);
                for (int index = 11; index < 20; ++index)
                {
                    Asda2Item asda2Item = client.ActiveCharacter.Asda2Inventory.Equipment[index];
                    Asda2InventoryHandler.WriteItemInfoToPacket(packet, asda2Item, false);
                }

                client.Send(packet, false);
            }
        }
Beispiel #4
0
 public static void SendAttackerStateUpdate(DamageAction action)
 {
     if (action.Attacker is Character && action.Victim is NPC)
     {
         Character attacker = (Character)action.Attacker;
         NPC       victim   = (NPC)action.Victim;
         using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.MonstrTakeDmg))
         {
             packet.WriteInt16(attacker.SessionId);
             packet.WriteInt16(victim.UniqIdOnMap);
             packet.WriteInt32(victim.UniqWorldEntityId);
             if (action.VictimState == VictimState.Evade)
             {
                 packet.WriteInt32(-1);
             }
             else if (action.VictimState == VictimState.Block)
             {
                 packet.WriteInt32(-2);
             }
             else if (action.VictimState == VictimState.Immune)
             {
                 packet.WriteInt32(-3);
             }
             else if (action.VictimState == VictimState.Deflect || action.VictimState == VictimState.Dodge ||
                      (action.VictimState == VictimState.Interrupt || action.VictimState == VictimState.Parry))
             {
                 packet.WriteInt32(-1);
             }
             else
             {
                 packet.WriteUInt32((long)action.ActualDamage + (action.IsCritical ? 2147483648L : 0L));
             }
             packet.WriteSkip(Asda2CombatHandler.unk8);
             victim.SendPacketToArea(packet, true, true, Locale.Any, new float?());
         }
     }
     else if (action.Attacker is NPC && action.Victim is Character)
     {
         NPC       attacker = (NPC)action.Attacker;
         Character victim   = (Character)action.Victim;
         int       dmg      = action.VictimState != VictimState.Evade
             ? (action.VictimState != VictimState.Block
                 ? (action.VictimState != VictimState.Immune
                     ? (action.VictimState == VictimState.Miss || action.VictimState == VictimState.Deflect ||
                        (action.VictimState == VictimState.Dodge ||
                         action.VictimState == VictimState.Interrupt) || action.VictimState == VictimState.Parry
                         ? 0
                         : (int)((long)action.ActualDamage + (action.IsCritical ? 2147483648L : 0L)))
                     : -3)
                 : -2)
             : -1;
         Asda2MovmentHandler.SendMonstMoveOrAtackResponse(victim.SessionId, attacker, dmg,
                                                          attacker.Asda2Position, true);
     }
     else
     {
         if (!(action.Attacker is Character) || !(action.Victim is Character))
         {
             return;
         }
         int val = action.VictimState != VictimState.Evade
             ? (action.VictimState != VictimState.Block
                 ? (action.VictimState != VictimState.Immune
                     ? (action.VictimState == VictimState.Miss || action.VictimState == VictimState.Deflect ||
                        (action.VictimState == VictimState.Dodge ||
                         action.VictimState == VictimState.Interrupt) || action.VictimState == VictimState.Parry
                         ? 0
                         : (int)((long)action.ActualDamage + (action.IsCritical ? 2147483648L : 0L)))
                     : -3)
                 : -2)
             : -1;
         using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.AtackCharacterRes))
         {
             packet.WriteInt16(action.Attacker.CharacterMaster.SessionId);
             packet.WriteInt16(action.Victim.CharacterMaster.SessionId);
             packet.WriteInt32(0);
             packet.WriteInt32(val);
             packet.WriteByte(0);
             packet.WriteInt16(-1);
             packet.WriteInt32(0);
             action.Victim.CharacterMaster.SendPacketToArea(packet, true, true, Locale.Any, new float?());
         }
     }
 }
        public static void SendEnterGameResposeResponse(IRealmClient client)
        {
            if (client.Account == null)
            {
                return;
            }
            using (var packet = new RealmPacketOut(RealmServerOpCode.EnterGameRespose))//1017
            {
                var acc = client.Account;
                var ch  = acc.ActiveCharacter;
                if (ch == null)
                {
                    return;
                }
                packet.WriteInt32(acc.AccountId);                                                                    //{accId}default value : 6256236
                packet.WriteFixedAsciiString(ch.Name, 20);                                                           //{name}default value :
                packet.WriteInt16(ch.Record.CharNum);                                                                //{charNum}default value : 11
                packet.WriteByte(ch.Record.Zodiac);                                                                  //{zodiac}default value : 0
                packet.WriteByte((byte)ch.Gender);                                                                   //{gender}default value : 1
                packet.WriteByte(ch.ProfessionLevel);                                                                //value name : unk9 default value : 0
                packet.WriteByte((byte)ch.Archetype.ClassId);                                                        //value name : unk10 default value : 0
                packet.WriteByte(ch.Level);                                                                          //{level}default value : 1
                packet.WriteUInt32(ch.Experience);                                                                   //{expCount}default value : 0
                packet.WriteInt32(0);                                                                                //value name : unk13 default value : 0
                packet.WriteInt16(ch.Spells.AvalibleSkillPoints);                                                    //value name : unk14 default value : 0
                packet.WriteInt16(0);                                                                                //value name : unk15 default value : 0
                packet.WriteByte(0);                                                                                 //value name : unk16 default value : 0
                packet.WriteInt16(15000);                                                                            //{weightMax}default value : 15000
                packet.WriteInt16(1000);                                                                             //{weightMin}default value : 2011
                packet.WriteInt64(0);                                                                                //value name : unk19 default value : 0Len : 8
                packet.WriteByte(0);                                                                                 //value name : unk20 default value : 0Len : 1
                packet.WriteByte(3);                                                                                 //value name : unk21 default value : 3Len : 1
                packet.WriteInt16((client.ActiveCharacter.Record.PremiumWarehouseBagsCount + 1) * 30);               //value name : unk22 default value : 30Len : 1
                packet.WriteInt16(client.ActiveCharacter.Asda2Inventory.WarehouseItems.Count(i => i != null));       //value name : wh zanyato default value : 4Len : 2
                packet.WriteInt16((client.ActiveCharacter.Record.PremiumAvatarWarehouseBagsCount + 1) * 30);         //value name : unk26 default value : 30Len : 1
                packet.WriteInt16(client.ActiveCharacter.Asda2Inventory.AvatarWarehouseItems.Count(i => i != null)); //value name : wh zanyato default value : 4Len : 2
                packet.WriteByte(0);                                                                                 //value name : unk240 default value : 1Len : 1
                packet.WriteByte(1);                                                                                 //value name : unk240 default value : 1Len : 1
                packet.WriteInt16(-1);                                                                               //value name : unk250 default value : -1Len : 2
                packet.WriteInt16(0);                                                                                //value name : unk260 default value : 0Len : 2
                packet.WriteByte(ch.Record.Zodiac);                                                                  //{zodiac0}default value : 11
                packet.WriteByte(ch.HairStyle);                                                                      //{hairStyle}default value : 4
                packet.WriteByte(ch.HairColor);                                                                      //{hairColor}default value : 5
                packet.WriteByte(ch.Facial);                                                                         //{face0}default value : 27
                packet.WriteInt32(ch.Health);                                                                        //{maxHp}default value : 100
                packet.WriteInt16(ch.Power);                                                                         //{maxMp}default value : 100
                packet.WriteInt32(ch.MaxHealth);                                                                     //{curHp}default value : 100
                packet.WriteInt16(ch.MaxPower);                                                                      //{curMp}default value : 100
                packet.WriteInt16((short)ch.MinDamage);                                                              //{minAtk}default value : 4
                packet.WriteInt16((short)ch.MaxDamage);                                                              //{maxAtk}default value : 5
                packet.WriteInt16((short)ch.RangedAttackPower);                                                      //{minMAtk}default value : 1
                packet.WriteInt16((short)ch.RangedAttackPower);                                                      //{maxMAtk}default value : 1
                packet.WriteInt16(ch.ArcaneResist);                                                                  //{mDef}default value : 0
                packet.WriteInt16(ch.Defense);                                                                       //{minDef}default value : 17
                packet.WriteInt16(ch.Defense);                                                                       //{maxDef}default value : 28
                packet.WriteInt32(ch.BlockValue);                                                                    //{minBlock}default value : 0
                packet.WriteInt32(ch.BlockValue);                                                                    //{maxBlock}default value : 0
                packet.WriteInt16(15);                                                                               //value name : unk44 default value : 15Len : 2
                packet.WriteInt16(7);                                                                                //value name : unk45 default value : 7Len : 2
                packet.WriteInt16(4);                                                                                //value name : unk46 default value : 4Len : 2
                packet.WriteSkip(unk51);                                                                             //value name : unk51 default value : unk51Len : 28
                packet.WriteSkip(ch.SettingsFlags);                                                                  //{settingsBytes}default value : settingsBytes Len : 16
                packet.WriteInt32(ch.AvatarMask);                                                                    //{avatarMask}default value : 47 Len : 4
                for (int i = 11; i < 20; i += 1)
                {
                    var item = client.ActiveCharacter.Asda2Inventory.Equipment[i];
                    Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, false);

                    /*packet.WriteInt32(item == null ? 0 : item.ItemId);//{itemId}default value : 0
                     * packet.WriteByte(item == null ? 0 : 3);//{invNum}default value : 0
                     * packet.WriteInt32(item == null ? -1 : i);//{cellNum}default value : -1
                     * packet.WriteInt32(0);//value name : unk51 default value : 0
                     * packet.WriteInt16(0);//{weight}default value : 0
                     * packet.WriteSkip(Stab180);//value name : stab180 default value : stab180
                     * packet.WriteInt16(item == null ? -1 : 0);//{eqiped}default value : -1
                     * packet.WriteSkip(Stab198);//value name : stab198 default value : stab198
                     * packet.WriteInt16(item == null ? -1 : 0);//{equiped}default value : -1
                     * packet.WriteSkip(Stab202);//value name : stab202 default value : stab202
                     * packet.WriteByte(item == null ? 0 : 2);//{eq}default value : 0 if not, 2 if yes
                     * packet.WriteInt32(0);//value name : unk59 default value : 0
                     * packet.WriteInt16(0);//value name : _ default value : 0*/
                }
                client.Send(packet, addEnd: false);
            }
        }