Beispiel #1
0
        public void Write(Packet pPacket)
        {
            pPacket.WriteUShort(ID);
            pPacket.WriteInt(60000); // Cooldown
            //pPacket.WriteShort(Upgrades);
            pPacket.WriteUShort(GetUpgrades(4, 3, 2, 1));

            pPacket.WriteInt(9000);         // Skill exp???
        }
Beispiel #2
0
 public void Write(Packet packet)
 {
     packet.WriteUShort(ID);
     packet.WriteUShort(Item.ItemID);
     packet.WriteInt(Position.X);
     packet.WriteInt(Position.Y);
     packet.WriteUShort((DroppedBy != null) ? DroppedBy.MapObjectID : (ushort)0xffff);
     packet.WriteByte(CanTake ? (byte)0x08 : (byte)0x00);
 }
Beispiel #3
0
 public static void SendChangeMap(ZoneCharacter character, ushort mapid, int x, int y)
 {
     using (var packet = new Packet(SH6Type.ChangeMap))
     {
         packet.WriteUShort(mapid);
         packet.WriteInt(x);
         packet.WriteInt(y);
         character.Client.SendPacket(packet);
     }
 }
Beispiel #4
0
        public static void SendChangeZone(ZoneCharacter character, ushort mapid, int x, int y, string IP, ushort port, ushort randomid)
        {
            using (var packet = new Packet(SH6Type.ChangeZone))
            {
                packet.WriteUShort(mapid);
                packet.WriteInt(x);
                packet.WriteInt(y);

                packet.WriteString(character.Client.Host == "127.0.0.1" ? "127.0.0.1" : IP, 16);
                packet.WriteUShort(port);
                packet.WriteUShort(randomid);
                character.Client.SendPacket(packet);
            }
        }
Beispiel #5
0
 public static void SendChatBlock(ZoneCharacter character, int seconds)
 {
     using (var packet = new Packet(SH2Type.Chatblock))
     {
         packet.WriteInt(seconds);
         character.Client.SendPacket(packet);
     }
 }
Beispiel #6
0
 public static void SendUnknown(WorldClient client)
 {
     using (var packet = new Packet(SH31Type.LoadUnkown))
     {
         packet.WriteInt(0xbd1); //lolwut?!  charid or sumtin'
         client.SendPacket(packet);
     }
 }
Beispiel #7
0
 public static void SendQuestion(ZoneCharacter character, Question question, ushort range)
 {
     using (var packet = new Packet(SH15Type.Question))
     {
         packet.WriteString(question.Text, 129);
         packet.WriteUShort(character.MapObjectID);     // Obj id
         packet.WriteInt(character.Position.X);
         packet.WriteInt(character.Position.Y);
         packet.WriteUShort(range);        // Distance how far your allowed to run when the question window is closed by Client
         packet.WriteByte((byte)question.Answers.Count);
         for (byte i = 0; i < question.Answers.Count; ++i)
         {
             packet.WriteByte(i);
             packet.WriteString(question.Answers[i], 32);
         }
         character.Client.SendPacket(packet);
     }
 }
Beispiel #8
0
 public static void SendGuildNameResult(WorldClient client, int pID, string pName)
 {
     using (var packet = new Packet(SH29Type.GuildNameResult))
     {
         packet.WriteInt(pID);
         packet.WriteString(pName, 16);
         client.SendPacket(packet);
     }
 }
Beispiel #9
0
        public static void WriteBasicCharInfo(WorldCharacter wchar, Packet packet)
        {
            packet.WriteInt(wchar.Character.ID);
            packet.WriteString(wchar.Character.Name, 20);
            packet.WriteByte(wchar.Character.CharLevel);
            packet.WriteByte(0);
            packet.WriteByte(wchar.Character.Slot);
            MapInfo mapinfo;
            if (!DataProvider.Instance.Maps.TryGetValue(wchar.Character.Map, out mapinfo))
            {
                Log.WriteLine(LogLevel.Warn, "{0} has an invalid MapID ({1})", wchar.Character.Name, wchar.Character.Map);
                wchar.Character.Map = 0;//we reset
                packet.WriteString("Rou", 13);
            }
            else
            {
                packet.WriteString(mapinfo.ShortName, 13);
            }

            packet.WriteByte(36); // Idk right now
            packet.WriteByte(193); // Idk right now
            packet.WriteByte(18); // Idk right now
            packet.WriteByte(11); // Idk right now

            WriteLook(wchar, packet);
            WriteEquipment(wchar, packet);
            WriteRefinement(wchar, packet);

            packet.WriteString(mapinfo == null ? "Rou" : mapinfo.ShortName, 12); //TODO: load from mapinfo.shn
            packet.WriteInt(0);				// X, doesn't matter
            packet.WriteInt(0);        		// Y, neither

            packet.WriteInt(0x63dd45ca);
            packet.WriteByte(0);
            packet.WriteInt(100);      		// Test later!
            packet.WriteByte(0);
            packet.WriteByte(2);
            packet.WriteByte(0);
            packet.WriteByte(0);
            packet.WriteByte(0);
            packet.WriteByte(0);
            wchar.Detach();
        }
Beispiel #10
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 #11
0
 public static void SendActiveSkillList(ZoneCharacter character)
 {
     using (var packet = new Packet(SH4Type.CharacterActiveSkillList))
     {
         var list = character.SkillsActive.Values;
         packet.WriteByte(0);
         packet.WriteInt(character.ID);
         packet.WriteUShort((ushort)list.Count); // Skill count (max 300)
         foreach (var skill in list)
         {
             skill.Write(packet);
         }
         character.Client.SendPacket(packet);
     }
 }
Beispiel #12
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);
        }
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 static void SendTitleList(ZoneCharacter character)
        {
            using (var packet = new Packet(SH4Type.CharacterTitles))
            {
                packet.WriteInt(0); //current title ID
                packet.WriteShort(0); //title count
                //here comes shit loop (see old Solar)

                character.Client.SendPacket(packet);
            }
        }
Beispiel #15
0
 public static void SendRevive(ZoneClient client, ushort mapid, int x, int y)
 {
     using (var packet = new Packet(SH4Type.Revive))
     {
         packet.WriteUShort(mapid);
         packet.WriteInt(x);
         packet.WriteInt(y);
         client.SendPacket(packet);
     }
 }
Beispiel #16
0
 public static void SendTeleportCharacter(ZoneCharacter character, int x, int y)
 {
     using (var packet = new Packet(SH8Type.Teleport))
     {
         packet.WriteInt(x);
         packet.WriteInt(y);
         character.Client.SendPacket(packet);
     }
 }
Beispiel #17
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 #18
0
 public static void ObtainedItem(ZoneCharacter character, DroppedItem item, ObtainedItemStatus status)
 {
     using (var packet = new Packet(SH12Type.ObtainedItem))
     {
         packet.WriteUShort(item.ItemID);
         packet.WriteInt(item.Amount);
         packet.WriteUShort((ushort)status);
         packet.WriteUShort(0xffff);
         character.Client.SendPacket(packet);
     }
 }
Beispiel #19
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 #20
0
 public static Packet MoveObject(MapObject obj, int oldx, int oldy, bool walk, ushort speed = 115)
 {
     Packet packet = new Packet(walk ? SH8Type.Walk : SH8Type.Move);
     packet.WriteUShort(obj.MapObjectID);
     packet.WriteInt(oldx);
     packet.WriteInt(oldy);
     packet.WriteInt(obj.Position.X);
     packet.WriteInt(obj.Position.Y);
     packet.WriteUShort(speed);
     return packet;
 }
Beispiel #21
0
 public static Packet StopObject(MapObject obj)
 {
     Packet packet = new Packet(SH8Type.StopTele);
     packet.WriteUShort(obj.MapObjectID);
     packet.WriteInt(obj.Position.X);
     packet.WriteInt(obj.Position.Y);
     return packet;
 }
Beispiel #22
0
 public static void SendQuestListBusy(ZoneCharacter character)
 {
     using (var packet = new Packet(SH4Type.CharacterQuestsBusy))
     {
         packet.WriteInt(character.ID);
         packet.WriteByte(1); //enabled list
         packet.WriteByte(0); //count (analyzed in separate TXT)
         //TODO: load quest list from database
         character.Client.SendPacket(packet);
     }
 }
Beispiel #23
0
 public static void SendQuestListDone(ZoneCharacter character)
 {
     using (var packet = new Packet(SH4Type.CharacterQuestsDone))
     {
         packet.WriteInt(character.ID);
         packet.WriteShort(0); //quest count
         character.Client.SendPacket(packet);
     }
 }
Beispiel #24
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 #25
0
 public static void SendPositionBlock(ZoneCharacter character, int x, int y)
 {
     using (var packet = new Packet(SH8Type.BlockWalk))
     {
         packet.WriteInt(x);
         packet.WriteInt(y);
         character.Client.SendPacket(packet);
     }
 }