Beispiel #1
0
        public void WritePacket(Packet pPacket)
        {
            pPacket.WriteUShort(ItemID);
            if (this.Type != HouseType.Resting)
            {
                pPacket.Fill(10, 0xFF); // Unknown

                pPacket.WriteString(this.Name, 30);
            }
            else
            {
                pPacket.WriteHexAsBytes("BE 02 FA 01 F8 01");
                pPacket.Fill(34, 0xFF); // No idea!?
            }
            pPacket.WriteByte(0xFF);
        }
Beispiel #2
0
 public static Packet BeginDisplayRest(ZoneCharacter character)
 {
     Packet packet = new Packet(SH8Type.BeginDisplayRest);
     packet.WriteUShort(character.MapObjectID);
     packet.WriteUShort(character.House.ItemID);
     packet.Fill(10, 0xff);
     return packet;
 }
Beispiel #3
0
 public static Packet Equip(ZoneCharacter character, Equip equip)
 {
     //B2 00 - AB 38 - 07 - 0D 00 04
     Packet packet = new Packet(SH7Type.ShowEquip);
     packet.WriteUShort(character.MapObjectID);
     packet.WriteUShort(equip.ItemID);
     packet.WriteByte(equip.Upgrades);
     packet.Fill(3, 0xff);
     return packet;
 }
Beispiel #4
0
 public static void WriteEquipment(WorldCharacter wchar, Packet packet)
 {
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Helm));
     packet.WriteUShort(Settings.Instance.ShowEquips ? wchar.GetEquipBySlot(ItemSlot.Weapon) : (ushort)0xffff);
     packet.WriteUShort(Settings.Instance.ShowEquips ? wchar.GetEquipBySlot(ItemSlot.Weapon2) : (ushort)0xffff);
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Armor));
     packet.Fill(2, 0xff);
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Pants));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Boots));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumeBoots));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumePants));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumeArmor));
     packet.Fill(6, 0xff);              // UNK
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Glasses));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumeHelm));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Wing));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumeWeapon));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Tail));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Pet));
     packet.Fill(2, 0xff);              // UNK
 }
Beispiel #5
0
        //this is used by the smaller writer (e.g. additem, unequip, equip)
        public void WriteSmallInfo(Packet packet)
        {
            packet.WriteUShort(this.ItemID);
            switch (SlotType)
            {
                case ItemSlot.Helm:
                case ItemSlot.Armor:
                case ItemSlot.Pants:
                case ItemSlot.Boots:
                case ItemSlot.Weapon2:
                case ItemSlot.Weapon:
                    packet.WriteByte(Upgrades);
                    packet.Fill(6, 0);
                    packet.WriteUShort(ushort.MaxValue); //unk
                    packet.WriteUInt(GetExpiringTime());
                    packet.WriteUShort(ushort.MaxValue);
                    break;

                default:
                    packet.WriteUInt(GetExpiringTime());
                    packet.WriteInt(0); //unk
                    break;
            }
        }
Beispiel #6
0
        public void WriteEquipStats(Packet packet)
        {
            byte StatCount = 0;
            if (Str > 0) StatCount++;
            if (End > 0) StatCount++;
            if (Dex > 0) StatCount++;
            if (Spr > 0) StatCount++;
            if (Int > 0) StatCount++;

            packet.WriteUShort(ItemID);
            switch (this.SlotType)
            {
                case ItemSlot.Helm:
                case ItemSlot.Armor:
                case ItemSlot.Pants:
                case ItemSlot.Boots:
                // case ItemSlot.Bow: // Shield = same
                case ItemSlot.Weapon2:
                case ItemSlot.Weapon:
                    packet.WriteByte(this.Upgrades);   // Refinement
                    packet.WriteByte(0);
                    packet.WriteShort(0); // Or int?
                    packet.WriteShort(0);
                    if (this.SlotType == ItemSlot.Weapon || (this.SlotType == ItemSlot.Weapon2 && Info.TwoHand))
                    {
                        packet.WriteByte(0);
                        // Licence data
                        packet.WriteUShort(0xFFFF);    // Nr.1 - Mob ID
                        packet.WriteUInt(0);           // Nr.1 - Kill count
                        packet.WriteUShort(0xFFFF);    // Nr.2 - Mob ID
                        packet.WriteUInt(0);           // Nr.2 - Kill count
                        packet.WriteUShort(0xFFFF);    // Nr.3 - Mob ID
                        packet.WriteUInt(0);           // Nr.3 - Kill count
                        packet.WriteUShort(0xFFFF);        // UNK
                        packet.WriteString("", 16);    // First licence adder name
                    }
                    packet.WriteByte(0);
                    packet.WriteUInt(GetExpiringTime());               // Expiring time (1992027391 -  never expires)
                    //packet.WriteShort(0);
                    break;
                case ItemSlot.Pet:
                    packet.WriteByte(this.Upgrades);   // Pet Refinement Lol
                    packet.Fill(2, 0);                     // UNK
                    packet.WriteUInt(GetExpiringTime());               // Expiring time (1992027391 -  never expires)
                    packet.WriteUInt(0);               // Time? (1992027391 -  never expires)
                    break;
                case ItemSlot.Earings:
                case ItemSlot.Necklace:
                case ItemSlot.Ring:
                    packet.WriteUInt(GetExpiringTime());               // Expiring time (1992027391 -  never expires)
                    packet.WriteUInt(0);               // Time? (1992027391 -  never expires)
                    packet.WriteByte(this.Upgrades);   // Refinement
                    // Stats added while refining
                    packet.WriteUShort(0);             // it may be byte + byte too (some kind of counter when item downgrades)
                    packet.WriteUShort(0);             // STR
                    packet.WriteUShort(0);             // END
                    packet.WriteUShort(0);             // DEX
                    packet.WriteUShort(0);             // INT
                    packet.WriteUShort(0);             // SPR
                    break;
                case ItemSlot.CostumeWeapon:
                case ItemSlot.CostumeShield:
                    packet.WriteUInt(25000);           // Skin Durability
                    break;
                default:
                    packet.WriteUInt(GetExpiringTime());      // Expiring time (1992027391 -  never expires)
                    packet.WriteUInt(0);                        // Time? (1992027391 -  never expires)
                    break;
            }

            // Random stats data (Not those what were added in refinement)
            switch (this.SlotType)
            {                       // Stat count (StatCount << 1 | Visible(0 or 1 are stats shown or not))
                case ItemSlot.Earings:
                    packet.WriteByte((byte)(StatCount << 1 | 1));
                    break;
                case ItemSlot.Necklace:
                case ItemSlot.Ring:
                    packet.WriteByte((byte)(StatCount << 1 | 1));
                    break;
                case ItemSlot.Helm:
                case ItemSlot.Armor:
                case ItemSlot.Pants:
                case ItemSlot.Boots:
                case ItemSlot.Weapon2:
                case ItemSlot.Weapon:
                    packet.WriteByte((byte)(StatCount << 1 | 1));
                    break;
                case ItemSlot.Pet:          // Yes!! Its possible to give stats to pet also (It overrides default one(s)).
                    packet.WriteByte((byte)(StatCount << 1 | 1));
                    break;
            }
            // foreach stat
            //pPacket.WriteByte(type);              // Stat type ( 0 = STR, 1 = END, 2 = DEX, 3 = INT, 4 = SPR )
            //pPacket.WriteUShort(amount);          // Amount
            // end foreach
            if (Str > 0) { packet.WriteByte(0); packet.WriteUShort(Str); }
            if (End > 0) { packet.WriteByte(1); packet.WriteUShort(End); }
            if (Dex > 0) { packet.WriteByte(2); packet.WriteUShort(Dex); }
            if (Spr > 0) { packet.WriteByte(3); packet.WriteUShort(Spr); }
            if (Int > 0) { packet.WriteByte(4); packet.WriteUShort(Int); }
        }
Beispiel #7
0
 private static void InvalidClientVersion(LoginClient pClient)
 {
     using (Packet pack = new Packet(SH3Type.IncorrectVersion))
     {
         pack.Fill(10, 0);
         pClient.SendPacket(pack);
     }
 }
Beispiel #8
0
 public void Write(Packet packet)
 {
     packet.WriteUShort(this.MapObjectID);
     packet.WriteByte(2); //always 2 (type i bet shown / transparent?)
     packet.WriteUShort(ID);
     packet.WriteInt(this.Position.X);
     packet.WriteInt(this.Position.Y);
     packet.WriteByte(this.Rotation); //TODO: rotation for NPC (from txt official files?)
     if (Gate != null)
     {
         packet.WriteByte(1);
         packet.WriteString(Gate.MapClient, 12);
         packet.Fill(41, 0);
     }
     else
     {
         packet.Fill(54, 0); //find out later
     }
 }
Beispiel #9
0
 public void Write(Packet packet)
 {
     packet.WriteUShort(this.MapObjectID);
     packet.WriteByte(2);
     packet.WriteUShort(ID);
     packet.WriteInt(this.Position.X);
     packet.WriteInt(this.Position.Y);
     packet.WriteByte(this.Rotation);
     packet.Fill(54, 0);
 }
Beispiel #10
0
        public static void WriteRefinement(WorldCharacter wchar, Packet pPacket)
        {
            //TODO: pPacket.WriteByte(Convert.ToByte(this.Inventory.GetEquippedUpgradesByType(ItemType.Weapon) << 4 | this.Inventory.GetEquippedUpgradesByType(ItemType.Shield)));
            // pPacket.WriteByte(0x00); //this must be the above, but currently not cached
            // pPacket.WriteByte(0xf0);    		// UNK
            // pPacket.WriteByte(0xff);    		// UNK

            pPacket.Fill(2, 0x00);      		// UNK
            pPacket.WriteByte(0xF0);         // UNK
            pPacket.Fill(4, 0xFF);         // UNK
        }
Beispiel #11
0
 public void WriteEquipment(Packet packet)
 {
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.Helm));
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.Weapon));
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.Armor));
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.Weapon2));
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.Pants));
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.Boots));
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.CostumeBoots));
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.CostumePants));
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.CostumeArmor));
     packet.Fill(6, 0xff);              // UNK
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.Glasses));
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.CostumeHelm));
     packet.Fill(2, 0xff);              // UNK
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.CostumeWeapon));
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.Wing));
     packet.Fill(2, 0xff);              // UNK
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.Tail));
     packet.WriteUShort(GetEquippedBySlot(ItemSlot.Pet));
 }
Beispiel #12
0
        public void WriteDetailedInfoExtra(Packet packet, bool levelUP = false)
        {
            if (!levelUP)
            {
                packet.WriteUShort(this.MapObjectID);
            }

            packet.WriteLong(this.Exp);
            packet.WriteULong(DataProvider.Instance.GetMaxExpForLevel(this.Level));

            packet.WriteInt(BaseStats.Strength);
            packet.WriteInt(BaseStats.Strength + GetExtraStr());
            packet.WriteInt(BaseStats.Endurance);
            packet.WriteInt(BaseStats.Endurance + GetExtraEnd());
            packet.WriteInt(BaseStats.Dexterity);
            packet.WriteInt(BaseStats.Dexterity + GetExtraDex());
            packet.WriteInt(BaseStats.Intelligence);
            packet.WriteInt(BaseStats.Intelligence + GetExtraInt());
            packet.WriteInt(0); // Wizdom. It isn't set in the server so it can contain shit from old buffers... :D
            packet.WriteInt(0); // I once had a name here :P
            packet.WriteInt(BaseStats.Spirit);
            packet.WriteInt(BaseStats.Spirit + GetExtraSpr());

            packet.WriteInt(GetWeaponDamage()); //base damage
            packet.WriteInt(GetWeaponDamage(true)); //increased damage (e.g. buffs)
            packet.WriteInt(GetMagicDamage()); //magic dmg
            packet.WriteInt(GetMagicDamage(true)); //inc magic dmg

            packet.WriteInt(GetWeaponDefense()); //todo equip stats loading (weapondef)
            packet.WriteInt(GetWeaponDefense(true)); //weapondef inc

            packet.WriteInt(GetAim()); //TODO: basestats aim + dex?
            packet.WriteInt(GetAim(true)); //aim inc (calcuate later based on dex)

            packet.WriteInt(GetEvasion()); //evasion
            packet.WriteInt(GetEvasion(true)); //evasion inc

            packet.WriteInt(GetWeaponDamage()); //damage block again
            packet.WriteInt(GetWeaponDamage(true));

            packet.WriteInt(GetMagicDamage()); //magic damage
            packet.WriteInt(GetMagicDamage(true));

            packet.WriteInt(GetMagicDefense()); //magic def
            packet.WriteInt(GetMagicDefense(true)); //magic def inc

            packet.WriteInt(1);
            packet.WriteInt(20);
            packet.WriteInt(2);
            packet.WriteInt(40);

            packet.WriteUInt(BaseStats.MaxHP); //max HP
            packet.WriteUInt(BaseStats.MaxSP); //max SP

            packet.WriteInt(0);                   // UNK
            packet.WriteInt(BaseStats.MAXSoulHP);   // Max HP Stones
            packet.WriteInt(BaseStats.MAXSoulSP);   // Max SP Stones
            packet.Fill(64, 0);
            if (!levelUP)
            {
                packet.WriteInt(this.Position.X);
                packet.WriteInt(this.Position.Y);
            }
        }
Beispiel #13
0
 public void WriteDetailedInfo(Packet pPacket)
 {
     pPacket.WriteInt(ID);
     pPacket.WriteString(this.Name, 16);
     pPacket.WriteByte(this.Slot);
     pPacket.WriteByte(this.Level);
     pPacket.WriteLong(this.Exp);
     pPacket.WriteInt(12345678);                // UNK
     pPacket.WriteShort(this.StonesHP);
     pPacket.WriteShort(this.StonesSP);
     pPacket.WriteUInt(this.HP);
     pPacket.WriteUInt(this.SP);
     pPacket.WriteInt(this.Fame);                // Fame
     pPacket.WriteLong(this.Money); //TODO: inventory class
     pPacket.WriteString(this.Map.MapInfo.ShortName, 12);
     pPacket.WriteInt(this.Position.X);
     pPacket.WriteInt(this.Position.Y);
     pPacket.WriteByte(this.Rotation);
     pPacket.WriteByte(this.Str);   // Str bonus
     pPacket.WriteByte(this.End);   // End bonus
     pPacket.WriteByte(this.Dex);   // Dex bonus
     pPacket.WriteByte(this.Int);   // Int bonus
     pPacket.WriteByte(this.Spr);   // Spr bonus
     pPacket.WriteShort(0);               // UNK
     pPacket.WriteUInt(0);               // Killpoints
     pPacket.Fill(7, 0);                 // UNK
 }
Beispiel #14
0
        public void WriteCharacterDisplay(Packet packet)
        {
            packet.WriteUShort(MapObjectID);
            packet.WriteString(Name, 16);
            packet.WriteInt(Position.X);
            packet.WriteInt(Position.Y);
            packet.WriteByte(Rotation);                // Rotation
            packet.WriteByte((byte)State);          // Player State (1,2 - Player, 3 - Dead, 4 - Resting, 5 - Vendor, 6 - On Mount)
            packet.WriteByte((byte)Job);
            if (State != PlayerState.Resting && State != PlayerState.Vendor && this.House == null)
            {
                WriteLook(packet);
                WriteEquipment(packet);
            }
            else
            {
                this.House.WritePacket(packet);
            }
            WriteRefinement(packet);

            packet.WriteUShort(0xffff);  // Mount Handle
            packet.WriteUShort(0xffff);
            packet.WriteByte(0xff);          // Emote (0xff = nothing)
            packet.WriteUShort(0xffff);
            packet.WriteShort(0);
            packet.WriteUShort(0);             // Mob ID (title = 10)

            packet.Fill(53, 0);                // Buff Bits? Something like that
            packet.WriteInt(character.GuildID.HasValue ? character.GuildID.Value : 0);      // Guild ID
            packet.WriteByte(0x02);            // UNK (0x02)
            packet.WriteBool(false);            // In Guild Academy (0 - No, 1 - Yes)
            packet.WriteBool(true);            // Pet AutoPickup   (0 - Off, 1 - On)
            packet.WriteByte(this.Level);
        }