Beispiel #1
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 #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 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 #4
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 #5
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 #6
0
        public static void SendAttackAnimation(MapObject from, ushort objectID, ushort attackspeed, byte stance)
        {
            using (var packet = new Packet(SH9Type.AttackAnimation))
            {
                packet.WriteUShort(from.MapObjectID);
                packet.WriteUShort(objectID);
                packet.WriteByte(stance);

                packet.WriteUShort(attackspeed);

                packet.WriteByte(4);
                packet.WriteByte(100);
                from.MapSector.Broadcast(packet);
            }
        }
Beispiel #7
0
 public static Packet Animation(ZoneCharacter character, byte id)
 {
     Packet packet = new Packet(SH8Type.Emote);
     packet.WriteUShort(character.MapObjectID);
     packet.WriteByte(id);
     return packet;
 }
Beispiel #8
0
 public static void SendConnectError(WorldClient client, ConnectErrors error)
 {
     using (var packet = new Packet(SH4Type.ConnectError))
     {
         packet.WriteUShort((ushort)error);
         client.SendPacket(packet);
     }
 }
Beispiel #9
0
 public static void SendCharacterChunkEnd(ZoneCharacter character)
 {
     using (var packet = new Packet(SH4Type.CharacterInfoEnd))
     {
         packet.WriteUShort(0xFFFF);
         character.Client.SendPacket(packet);
     }
 }
Beispiel #10
0
 public static void FailedUnequip(ZoneCharacter character)
 {
     using (var packet = new Packet(SH12Type.FailedUnequip))
     {
         packet.WriteUShort(706);
         character.Client.SendPacket(packet);
     }
 }
Beispiel #11
0
 public static void FailedEquip(ZoneCharacter character, ushort val = 0)
 {
     using (var packet = new Packet(SH12Type.FailedEquip))
     {
         packet.WriteUShort(val);
         character.Client.SendPacket(packet);
     }
 }
Beispiel #12
0
 public static void SendSkillLearnt(ZoneCharacter character, ushort skillid)
 {
     using (var packet = new Packet(SH18Type.LearnSkill))
     {
         packet.WriteUShort(skillid);
         packet.WriteByte(0); //unk
         character.Client.SendPacket(packet);
     }
 }
Beispiel #13
0
 public static void SendZoneServerIP(WorldClient client, ZoneConnection info)
 {
     using (var packet = new Packet(SH4Type.ServerIP))
     {
         packet.WriteString(client.Host == "127.0.0.1" ? "127.0.0.1" : info.IP, 16);
         packet.WriteUShort(info.Port);
         client.SendPacket(packet);
     }
 }
Beispiel #14
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 #15
0
 public static void SendServerTime(WorldClient client)
 {
     using (var packet = new Packet(SH2Type.ServerTime))
     {
         packet.WriteByte(Convert.ToByte(DateTime.Now.Hour));
         packet.WriteUShort(Convert.ToUInt16(DateTime.Now.Minute));
         client.SendPacket(packet);
     }
 }
Beispiel #16
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 #17
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 #18
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 #19
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 #20
0
 private static void SendCharCreationError(WorldClient client, CreateCharError error)
 {
     using (Packet packet = new Packet(SH5Type.CharCreationError))
     {
         packet.WriteUShort((ushort)error);
         client.SendPacket(packet);
     }
 }
Beispiel #21
0
        public static void SendAttackDamage(MapObject from, ushort objectID, ushort damage, bool crit, uint hpleft, ushort counter)
        {
            using (var packet = new Packet(SH9Type.AttackDamage))
            {
                packet.WriteUShort(from.MapObjectID);
                packet.WriteUShort(objectID);
                packet.WriteBool(crit);
                packet.WriteUShort(damage);
                packet.WriteUInt(hpleft);
                packet.WriteUShort(counter);
                packet.WriteByte(4);
                packet.WriteByte(100);

                from.MapSector.Broadcast(packet);
            }
        }
Beispiel #22
0
 public static void SendUpdateSP(ZoneCharacter character)
 {
     using (var p = new Packet(SH9Type.HealSP))
     {
         p.WriteUInt(character.SP);
         p.WriteUShort(character.UpdateCounter);
         character.Client.SendPacket(p);
     }
 }
Beispiel #23
0
 public static void SendStatsUpdate(MapObject pObject, ZoneClient to, bool selectedby)
 {
     using (var packet = new Packet(SH9Type.StatUpdate))
     {
         packet.WriteBool(selectedby);
         packet.WriteUShort(pObject.MapObjectID);
         if (pObject is ZoneCharacter)
         {
             ((ZoneCharacter)pObject).WriteUpdateStats(packet);
         }
         else
         {
             ((Mob)pObject).WriteUpdateStats(packet);
         }
         to.SendPacket(packet);
     }
 }
Beispiel #24
0
 public static void SendSkillStartSelf(ZoneCharacter user, ushort skillid, ushort victim, ushort animid)
 {
     // 9 78 | [04 06] [8A 27] [E5 3F]
     using (var packet = new Packet(SH9Type.SkillUsePrepareSelf))
     {
         packet.WriteUShort(skillid);
         packet.WriteUShort(victim);
         packet.WriteUShort(animid);
         user.Client.SendPacket(packet);
     }
 }
Beispiel #25
0
 public static void SendSkillStartOthers(MapObject user, ushort skillid, ushort victim, ushort animid)
 {
     // 9 79 | [9A 26] [06 06] [8A 27] [97 2D]
     using (var packet = new Packet(SH9Type.SkillUsePrepareOthers))
     {
         packet.WriteUShort(user.MapObjectID);
         packet.WriteUShort(skillid);
         packet.WriteUShort(victim);
         packet.WriteUShort(animid);
         user.MapSector.Broadcast(packet, user.MapObjectID);
     }
 }
Beispiel #26
0
 public static void SendSkillPosition(MapObject user, ushort animid, ushort skillid, uint x, uint y)
 {
     // 9 81 | [32 29] [B8 10] [56 0A 00 00] [3A 27 00 00] [75 70]
     using (var packet = new Packet(SH9Type.SkillAnimationPosition))
     {
         packet.WriteUShort(user.MapObjectID);
         packet.WriteUShort(skillid);
         packet.WriteUInt(x);
         packet.WriteUInt(y);
         packet.WriteUShort(animid);
         user.MapSector.Broadcast(packet);
     }
 }
Beispiel #27
0
 public static void SendSkillNoVictim(MapObject user, ushort animid)
 {
     // 9 82 | [75 70] [32 29] [00]
     using (var packet = new Packet(SH9Type.SkillAnimationTarget))
     {
         packet.WriteUShort(animid);
         packet.WriteUShort(user.MapObjectID);
         packet.WriteBool(false);
         user.MapSector.Broadcast(packet);
     }
 }
Beispiel #28
0
 public static void SendSkillAnimationForPlayer(MapObject user, ushort skillid, ushort animid)
 {
     // 9 87 | [E5 3F] [8A 27] [04 06]
     // 9 87 | [97 2D] [9A 26] [06 06]
     using (var packet = new Packet(SH9Type.SkillAnimation))
     {
         packet.WriteUShort(animid);
         packet.WriteUShort(user.MapObjectID);
         packet.WriteUShort(skillid);
         user.MapSector.Broadcast(packet);
     }
 }
Beispiel #29
0
 public static void SendSkill(MapObject user, ushort animid, List<SkillVictim> victims)
 {
     using (var packet = new Packet(SH9Type.SkillAnimationTarget))
     {
         packet.WriteUShort(animid);
         packet.WriteUShort(user.MapObjectID);
         packet.WriteByte((byte)(victims.Count > 255 ? 255 : victims.Count));
         for (byte i = 0; i < victims.Count && i != 255; i++)
         {
             var victim = victims[i];
             packet.WriteUShort(victim.MapObjectID);
             packet.WriteByte(victim.Stance1);
             packet.WriteByte(victim.Stance2);
             packet.WriteUInt(victim.Damage);
             packet.WriteUInt(victim.HPLeft);
             packet.WriteUShort(victim.HPCounter);
         }
         user.MapSector.Broadcast(packet);
     }
 }
Beispiel #30
0
 public static void SendSkill(MapObject user, ushort animid, ushort victimid, uint damage, uint newhp, ushort counter, byte special1 = 0x10, byte special2 = 0x00)
 {
     // 9 82 | [E5 3F] [8A 27] [01] [8A 27] [10 00] [09 00 00 00] [5E 00 00 00] [A7 4C]
     // 9 82 | [9A 35] [8A 27] [01] [C2 05] [10 00] [0A 00 00 00] [1D 01 00 00] [73 37]
     // 9 82 | [43 3C] [42 15] [01] [AC 4C] [01 01] [7A 02 00 00] [00 00 00 00] [35 09]
     // 9 82 | [0E 39] [42 15] [01] [00 4A] [21 01] [1C 03 00 00] [00 00 00 00] [8C 0E]
     using (var packet = new Packet(SH9Type.SkillAnimationTarget))
     {
         packet.WriteUShort(animid);
         packet.WriteUShort(user.MapObjectID);
         packet.WriteBool(true);
         packet.WriteUShort(victimid);
         packet.WriteByte(special1);
         packet.WriteByte(special2);
         packet.WriteUInt(damage);
         packet.WriteUInt(newhp);
         packet.WriteUShort(counter);
         user.MapSector.Broadcast(packet);
     }
 }