Esempio n. 1
0
        public static void ChangeFromGuildAcademyToResponse(WorldClient client, Packet packet)
        {
            string GuildName;
              string RequestName;
              bool answer;
              if (!packet.TryReadString(out GuildName, 16) || !packet.TryReadString(out RequestName, 16)|| (!packet.TryReadBool(out answer) || !client.Character.IsInGuildAcademy))
                  return;
             if (answer)
            {
                GuildAcademyMember pMember = client.Character.GuildAcademy.Members.Find(m => m.Character.Character.Name == RequestName);
                if (pMember == null)
                    return;
                pMember.Character.IsInGuildAcademy = false;
                pMember.Academy.RemoveMember(pMember);
               pMember.Character.GuildAcademy.Guild.AddMember(pMember.Character, GuildRank.Member, Program.DatabaseManager.GetClient().GetConnection(), true, true);

                pMember.Character.Guild = pMember.Character.GuildAcademy.Guild;
                pMember.Character.IsInGuild = true;
             using (var pack = new Packet(SH38Type.SendJoinGuildFromAcademy))
             {
                 //this packet remove character from academy List and added to GuildList
                 pack.WriteString(RequestName, 16);
                 pack.WriteString(client.Character.Character.Name, 16);
                 pack.WriteByte(6);//rank
                 pack.WriteInt(0);//unk
                 pack.WriteUShort(0);//korp
                 pack.Fill(64, 0x00);//unk
                 pack.WriteByte(true ? (byte)0x95 : (byte)0x00);// (this.isOnline ? (byte)0x95 : (byte)0x00);
                 pack.Fill(3, 0x00);//unk
                 pack.WriteByte(pMember.Character.Character.Job);
                 pack.WriteByte(pMember.Character.Character.CharLevel);
                 pack.Fill(13, 0x00);//unk
                 client.Character.GuildAcademy.Guild.Broadcast(pack);
                 client.Character.GuildAcademy.Broadcast(pack);
                 }
             }
             using (var p2 = new Packet(SH4Type.CharacterGuildinfo))
             {
                 client.Character.Guild.WriteGuildInfo(packet);
                 client.SendPacket(p2);
             }
             using (var pack = new Packet(SH29Type.GuildMemberJoined))
             {
                 pack.WriteString(client.Character.Character.Name, 16);
                 client.Character.GuildAcademy.Guild.Broadcast(pack);
                 client.Character.GuildAcademy.Broadcast(pack);

             }
             using (var pack = new Packet(SH29Type.ChangeResponse))
             {
                 pack.WriteUShort(3137);//unk
                 pack.WriteByte(3);
                 pack.Fill(2, 0x00);//unk
                 client.SendPacket(pack);
             }
        }
Esempio n. 2
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);
            pPacket.WriteByte(0);//unk
        }
Esempio n. 3
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;
 }
Esempio n. 4
0
 public static void BackToWorldSelect(WorldClient client, Packet packet)
 {
     using (Packet pack = new Packet(SH3Type.BackToWorldListFromChar))
     {
         pack.WriteHexAsBytes("58 1E");//responsecode
         pack.Fill(32, 0);
         client.SendPacket(pack);
     }
 }
Esempio n. 5
0
 public static Packet Equip(ZoneCharacter character, Item equip)
 {
     //B2 00 - AB 38 - 07 - 0D 00 04
     Packet packet = new Packet(SH7Type.ShowEquip);
     packet.WriteUShort(character.MapObjectID);
     packet.WriteUShort(equip.ID);
     packet.WriteByte(equip.UpgradeStats.Upgrades);
     packet.Fill(3, 0xff);
     return packet;
 }
Esempio n. 6
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(wchar.GetEquipBySlot(ItemSlot.Armor));
     packet.WriteUShort(Settings.Instance.ShowEquips ? wchar.GetEquipBySlot(ItemSlot.Weapon2) : (ushort)0xffff);
     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.Fill(2, 0xff);              // UNK
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumeWeapon));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Wing));
     packet.Fill(2, 0xff);              // UNK
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Tail));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Pet));
 }
Esempio n. 7
0
        public static void WriteBasicCharInfo(WorldCharacter wchar, Packet packet)
        {
            packet.WriteInt(wchar.Character.ID); //charid
            packet.FillPadding(wchar.Character.Name, 0x10);
            packet.WriteInt(0);//unk
            packet.WriteShort((short)wchar.Character.CharLevel); //level
            packet.WriteByte(wchar.Character.Slot);
            MapInfo mapinfo;
            if (!DataProvider.Instance.Maps.TryGetValue(wchar.Character.PositionInfo.Map, out mapinfo))
            {
                Log.WriteLine(LogLevel.Warn, "{0} has an invalid MapID ({1})", wchar.Character.Name, wchar.Character.PositionInfo.Map);
                wchar.Character.PositionInfo.Map = 0;
                packet.FillPadding(mapinfo.ShortName, 0x0D); //townname
            }
            else
            {
                packet.FillPadding(mapinfo.ShortName, 0x0D); //townname
            }

            //packet.WriteByte(0); // UNK
            packet.WriteInt(0); // Random seed
            WriteLook(wchar,packet);
            WriteEquipment(wchar,packet);
            WriteRefinement(wchar,packet);
            packet.WriteByte(0);

            packet.WriteByte(0xF0);
            packet.WriteByte(0xFF);//unk
            packet.WriteByte(0xFF);

            packet.FillPadding(mapinfo.ShortName, 0x0c);
            packet.WriteInt(0); //pos
            packet.WriteInt(0); //pos
            packet.WriteUShort(0xdb78);
            packet.WriteUShort(4910);//unk
            packet.WriteUShort(25600);
            packet.Fill(4, 0);
        }
Esempio n. 8
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);
     pPacket.WriteLong(this.Inventory.Money);
     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);//  -.
     pPacket.WriteByte(this.End);//   |
     pPacket.WriteByte(this.Dex);//   |  Boni
     pPacket.WriteByte(this.Int);//   |
     pPacket.WriteByte(this.Spr);//  -'
     pPacket.WriteShort(0);               // UNK
     pPacket.WriteUInt(0);               // Killpoints (TODO)
     pPacket.Fill(7, 0);                 // UNK
 }
Esempio n. 9
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);
            //(IsMale ? 1 : 0)
            int mount = (this.Mount != null) ? (int) this.Mount.Handle : (int)0xffff;
            packet.WriteUShort((ushort)mount);  // 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(55, 0);                // Buff Bits? Something like that
            if (this.Character.GuildID > 1)
            {
                packet.WriteInt(this.Guild.ID);
            }
            else if (this.Character.AcademyID > 0)
            {
                packet.WriteInt(this.Character.AcademyID);
            }
            else
            {
                packet.WriteInt(0);
            }
            packet.WriteByte(0x02);            // UNK (0x02)

            packet.WriteBool(this.IsInaAcademy);            // In Guild Academy (0 - No, 1 - Yes)
            packet.WriteBool(true);            // Pet AutoPickup   (0 - Off, 1 - On)
            packet.WriteByte(this.Level);
        }
Esempio n. 10
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(55, 0);
 }
Esempio n. 11
0
 public void WriteInfo(Packet Packet)
 {
     Packet.WriteInt(Guild.ID);
     Packet.WriteByte(1);//unk
     Packet.WriteString(Guild.Master.Character.Character.Name, 16);
     Packet.WriteUShort((ushort)Members.Count);//membercount
     Packet.WriteUShort(MaxMembers);//maxmembercount
     Packet.WriteInt(Guild.ID);//academyid
     Packet.WriteInt((int)Guild.CreateTime.DayOfWeek);//weeks //Todo Calculate Weeks
     Packet.WriteInt((int)GuildBuffKeepTime.TotalSeconds);  //time in sek (buff?)
     Packet.Fill(128, 1);//GuildAcademyBUff
     Packet.WriteString(Message, 512);
 }
Esempio n. 12
0
        private static void On_CharacterManager_CharacterLogin(WorldCharacter Character)
        {
            if (Character.IsInGuild)
            {
                var guild = Character.Guild;

                //send guild info to client
                using (var packet = new Packet(SH4Type.CharacterGuildinfo))
                {
                    guild.WriteGuildInfo(packet);

                    Character.Client.SendPacket(packet);
                }

                //send member list to client
                guild.SendMemberList(Character.Client);

                GuildMember member;
                if (guild.GetMember(Character.Character.Name, out member))
                {
                    //send guild member logged in to other guild members
                    using (var packet = new Packet(SH29Type.GuildMemberLoggedIn))
                    {
                        packet.WriteString(Character.Character.Name, 16);

                        Character.Guild.Broadcast(packet, member);
                    }
                }

                //send packet to zone that guild member logged in
                using (var packet = new InterPacket(InterHeader.ZONE_GuildMemberLogin))
                {
                    packet.WriteInt(guild.ID);
                    packet.WriteInt(Character.ID);

                    ZoneManager.Instance.Broadcast(packet);
                }
            }
            else
            {
                using (var packet = new Packet(SH4Type.CharacterGuildinfo))
                {
                    packet.WriteInt(0);

                    Character.Client.SendPacket(packet);
                }
            }

            //academy
            var academy = Character.GuildAcademy;
            if (academy != null)
            {
                if (Character.IsInGuildAcademy)
                {
                    using (var packet = new Packet(SH4Type.CharacterGuildacademyinfo))
                    {
                        academy.WriteInfo(packet);

                        Character.Client.SendPacket(packet);
                    }

                    academy.SendMemberList(Character.Client);
                }
                else
                {
                    using (var packet = new Packet(SH4Type.CharacterGuildacademyinfo))
                    {
                        packet.Fill(5, 0);

                        Character.Client.SendPacket(packet);
                    }
                }
            }
            else
            {
                using (var packet = new Packet(SH4Type.CharacterGuildacademyinfo))
                {
                    packet.Fill(5, 0);

                    Character.Client.SendPacket(packet);
                }
            }
        }
Esempio n. 13
0
        public static void On_GameClient_GetGuildList(WorldClient Client, Packet Packet)
        {
            if (Client.Character == null)
            {
                return;
            }

            var now = Program.CurrentTime;
            if (now.Subtract(Client.Character.LastGuildListRefresh).TotalSeconds >= 60)
            {
                Client.Character.LastGuildListRefresh = now;

                const int GuildsPerPacket = 100;
                lock (ThreadLocker)
                {
                    using (var con = Program.DatabaseManager.GetClient().GetConnection())
                    {
                        //get guild count
                        int guildCount;
                        using (var cmd = con.CreateCommand())
                        {
                            cmd.CommandText = "SELECT COUNT(*) FROM Guilds";

                            guildCount = Convert.ToInt32(cmd.ExecuteScalar());
                        }

                        using (var cmd = con.CreateCommand())
                        {
                            cmd.CommandText = "SELECT ID FROM Guilds";

                            Packet listPacket = null;
                            var count = 0;
                            var globalCount = 0;

                            using (var reader = cmd.ExecuteReader())
                            {
                                while (reader.Read())
                                {
                                    if (listPacket == null)
                                    {
                                        listPacket = new Packet(SH29Type.SendGuildList);
                                        listPacket.WriteUShort(3137);
                                        listPacket.WriteByte(1);
                                        listPacket.WriteUShort((ushort)guildCount);
                                        listPacket.WriteUShort((ushort)Math.Min(GuildsPerPacket, guildCount - globalCount));
                                    }

                                    Guild guild;
                                    if (GuildManager.GetGuildByID(reader.GetInt32(0), out guild))
                                    {
                                        //write packet
                                        listPacket.WriteInt(guild.ID);
                                        listPacket.WriteString(guild.Name, 16);
                                        listPacket.WriteString(guild.Master.Character.Character.Name, 16);
                                        listPacket.WriteBool(guild.AllowGuildWar);
                                        listPacket.WriteByte(1);     // unk
                                        listPacket.WriteUShort((ushort)guild.Members.Count);
                                        listPacket.WriteUShort(100); // unk
                                    }
                                    else
                                    {
                                        Packet.Fill(42, 0); // guild get error
                                    }

                                    globalCount++;
                                    count++;
                                    if (count >= Math.Min(GuildsPerPacket, guildCount - globalCount))
                                    {
                                        //send packet
                                        Client.SendPacket(listPacket);

                                        listPacket.Dispose();
                                        listPacket = null;

                                        //reset
                                        count = 0;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 14
0
        public static void On_GameClient_GetAcademyList(WorldClient Client, Packet pPacket)
        {
            if (Client.Character == null)
            {
                return;
            }

            const int GuildsPerPacket = 54;
            lock (GuildManager.ThreadLocker)
            {
                using (var con = Program.DatabaseManager.GetClient().GetConnection())
                {
                    //get guild count
                    int guildCount;
                    using (var cmd = con.CreateCommand())
                    {
                        cmd.CommandText = "SELECT COUNT(*) FROM Guilds";

                        guildCount = Convert.ToInt32(cmd.ExecuteScalar());
                    }

                    using (var cmd = con.CreateCommand())
                    {
                        cmd.CommandText = "SELECT ID FROM Guilds";

                        Packet listPacket = null;
                        var count = 0;
                        var globalCount = 0;

                        using (var reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                if (listPacket == null)
                                {
                                    listPacket = new Packet(SH38Type.SendAcademyList);
                                    listPacket.WriteUShort(6312);
                                    listPacket.WriteByte(1);
                                    listPacket.WriteUShort((ushort)guildCount);
                                    listPacket.WriteUShort(0);
                                    listPacket.WriteUShort((ushort)Math.Min(GuildsPerPacket, guildCount - globalCount));
                                    listPacket.WriteUShort(0);
                                }

                                Guild guild;
                                if (GuildManager.GetGuildByID(reader.GetInt32("ID"), out guild))
                                {
                                    //write packet
                                    listPacket.WriteString(guild.Name, 16);
                                    listPacket.WriteString(guild.Master.Character.Character.Name, 16);
                                    listPacket.WriteUShort((ushort)guild.Members.Count);
                                    listPacket.WriteUShort((ushort)guild.Academy.Members.Count);
                                    listPacket.WriteUShort(guild.Academy.Points); // Graduates
                                }
                                else
                                {
                                    pPacket.Fill(38, 0); // guild get error
                                }

                                globalCount++;
                                count++;
                                if (count >= Math.Min(GuildsPerPacket, guildCount - globalCount))
                                {
                                    //send packet
                                    Client.SendPacket(listPacket);

                                    listPacket.Dispose();
                                    listPacket = null;

                                    //reset
                                    count = 0;
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 15
0
 public void WriteInfo(Packet packet)
 {
     packet.WriteString(Character.Character.Name, 16);
     packet.Fill(65, 0x00);//unk
     packet.WriteBool(Character.IsIngame);
     packet.Fill(3, 0x00);//unk
     packet.WriteByte(Character.Character.Job);//job
     packet.WriteByte(Character.Character.CharLevel);//level
     packet.WriteByte(0);// unk
     packet.WriteString(DataProvider.GetMapname(Character.Character.PositionInfo.Map), 12);//mapName
     packet.WriteByte((byte)RegisterDate.Month);//month
     packet.WriteByte(184);//year fortmat unkown
     packet.WriteByte((byte)RegisterDate.Day);//day
     packet.WriteByte(0);//unk
     packet.WriteByte(0);  //unk
 }
Esempio n. 16
0
 public static Packet InventoryMessage(ushort pMessage, ushort pID = ushort.MaxValue, ushort pCount = (ushort) 1)
 {
     /*  0x0341 	Item Obtained
         0x0342 	Failed to obtain
         0x0346 	Inventory Full  */
     Packet pack = new Packet();
     pack.WriteUShort(0x300a);
     pack.WriteUShort(pID);
     pack.WriteInt(pCount);
     pack.WriteUShort(pMessage);
     pack.Fill(2, 0xff);
     return pack;
 }
Esempio n. 17
0
        public void WriteGuildInfo(Packet Packet)
        {
            Packet.WriteInt(ID);
            Packet.WriteInt(ID); // academy id?
            Packet.WriteString(Name, 16);

            Packet.Fill(24, 0x00); //unk
            Packet.WriteUShort(38);
            Packet.WriteInt(100);
            Packet.Fill(233, 0x00);//unk
            Packet.WriteUShort(11779);
            Packet.WriteShort(20082);
            Packet.WriteInt(31);
            Packet.WriteInt(55);
            Packet.WriteInt(18);//unk
            Packet.WriteInt(15);
            Packet.WriteInt(8);//unk
            Packet.WriteInt(111);//unk
            Packet.WriteInt(4);
            Packet.Fill(136, 0);//buff or string
            Packet.WriteUShort(1824);
            Packet.WriteUShort(20152);
            Packet.WriteInt(16);
            Packet.WriteInt(28);
            Packet.WriteInt(MessageCreateTime.Minute);//createDetails Guild Minutes Date
            Packet.WriteInt(MessageCreateTime.Hour); //create Details Guild Hours Date
            Packet.WriteInt(MessageCreateTime.Day);//create details Guild Day Date
            Packet.WriteInt(MessageCreateTime.Month);//create details Month
            Packet.WriteInt(MessageCreateTime.Year - 1900);//creae details year 1900- 2012
            Packet.WriteInt(10);//unk
            Packet.WriteUShort(2);
            Packet.Fill(6, 0);//unk
            if(MessageCreater.Character.Name == null)
            {
            Packet.WriteString("", 16);
            }
            else
            {
                Packet.WriteString(MessageCreater.Character.Name, 16);
            }
            Packet.WriteString(Message, 512);//details message
        }
Esempio n. 18
0
        public void Write(Packet packet)
        {
            packet.WriteUShort(this.MapObjectID);
            packet.WriteByte(2); //always 2 (type i bet shown / transparent?) -> test it
            packet.WriteUShort(this.ID);
            packet.WriteInt(this.Position.X);
            packet.WriteInt(this.Position.Y);
            packet.WriteByte(this.Rotation);
            if (Gate != null)
            {
                packet.WriteByte(1);
                packet.WriteString(Gate.MapClient, 12);
                packet.Fill(43, 0);

            }
            else
            {
                packet.Fill(56, 0); //find out later
            }
        }
Esempio n. 19
0
 public void WritePacket(Packet pPacket)
 {
     pPacket.WriteBool(IsOnline);	// Logged In
     pPacket.WriteByte(this.Month);	// Last connect Month << 4 (TODO)
     pPacket.WriteByte(this.Day);	// Last connect Day (TODO)
     pPacket.WriteByte(0);	// Unknown (TODO)
     pPacket.WriteString(this.Name, 16);
     pPacket.WriteByte(this.Job);
     pPacket.WriteByte(this.Level);
     pPacket.WriteByte(0);	// In Party (TODO)
     pPacket.WriteByte(0);	// Unkown (TODO)
     pPacket.WriteString(this.Map, 12);
     pPacket.Fill(32, 0);
 }
Esempio n. 20
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);
            }
        }
Esempio n. 21
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));
 }
Esempio n. 22
0
 private static void InvalidClientVersion(LoginClient pClient)
 {
     using (Packet pack = new Packet(SH3Type.IncorrectVersion)) {
     pack.Fill(10, 0);
     pClient.SendPacket(pack);
     }
 }
Esempio n. 23
0
        public static void On_GameClient_UpdateGuildMessage(WorldClient Client, Packet Packet)
        {
            ushort length;
            string message;
            if (Client.Character.Guild == null
                || !Packet.TryReadUShort(out length)
                || !Packet.TryReadString(out message, length))
            {
                return;
            }

            //response packets
            using (var packet = new Packet(SH29Type.UnkMessageChange))
            {
                packet.WriteHexAsBytes("68 1B 00 92 AD F8 4F 2E 00 00 00 2B 00 00 00 17 00 00 00 07 00 00 00 06 00 00 00 70 00 00 00 06 00 00 00 BC 00 00 00 01 00 00 00 00 00");

                Client.SendPacket(packet);
            }
            using (var packet = new Packet(SH29Type.ClearGuildDetailsMessage))
            {
                packet.WriteUShort(3137);
                packet.WriteLong(0);

                Client.SendPacket(packet);
            }
            using (var packet = new Packet(SH29Type.UpdateGuildMessageResponse))
            {
                packet.WriteUShort(3137);
                Client.SendPacket(packet);
            }

            //update guild
            lock (Client.Character.Guild.ThreadLocker)
            {
                Client.Character.Guild.Message = message;
                Client.Character.Guild.MessageCreater = Client.Character;
                Client.Character.Guild.MessageCreateTime = Program.CurrentTime;

                Client.Character.Guild.Save();

                //broadcast packet to all guild members
                using (var packet = new Packet(SH29Type.SendUpdateGuildDetails))
                {
                    packet.Fill(4, 0x00);
                    packet.WriteInt(Client.Character.Guild.MessageCreateTime.Second);
                    packet.WriteInt(Client.Character.Guild.MessageCreateTime.Minute);
                    packet.WriteInt(Client.Character.Guild.MessageCreateTime.Hour);
                    packet.WriteInt(Client.Character.Guild.MessageCreateTime.Day);
                    packet.WriteInt(Client.Character.Guild.MessageCreateTime.Month - 1);
                    packet.WriteInt(Client.Character.Guild.MessageCreateTime.Year - 1900);
                    packet.WriteInt(0);
                    packet.WriteLong(0);
                    packet.WriteString(Client.Character.Character.Name, 16);
                    packet.WriteUShort(length);
                    packet.WriteString(message, length);

                    Client.Character.Guild.Broadcast(packet);
                }

                //send packet to zone that guild message changed
                using (var packet = new InterPacket(InterHeader.ZONE_GuildMessageUpdate))
                {
                    packet.WriteInt(Client.Character.Guild.ID);
                    packet.WriteInt(Client.Character.ID);
                    packet.WriteDateTime(Client.Character.Guild.MessageCreateTime);

                    packet.WriteUShort(length);
                    packet.WriteString(message, length);
                    ZoneManager.Instance.Broadcast(packet);
                }
            }
        }
Esempio n. 24
0
        private static void SendWorldServerIP(LoginClient pClient, WorldConnection wc, string hash)
        {
            using (var pack = new Packet(SH3Type.WorldServerIP)) {
            pack.WriteByte((byte)wc.Status);

            pack.WriteString(wc.IP, 16);
            Log.WriteLine(LogLevel.Warn, "{0} - IP", wc.IP);
            pack.WriteUShort(wc.Port);
            pack.WriteString(hash, 32);
            pack.Fill(32, 0);
            pClient.SendPacket(pack);
            }
        }
Esempio n. 25
0
 private void Testg(ZoneCharacter character, params string[] param)
 {
     //05 58 00 04 0A 7A 0F 00 90 2B
     using (var pack = new Packet(SH38Type.AcademyMemberJoined))
     {
         pack.WriteString("invider", 16);
         pack.WriteString("Create", 16);
         pack.WriteByte(6);//rank
         pack.WriteInt(0);//unk
         pack.WriteUShort(9000);//korp
         pack.Fill(64, 0x00);//unk
         pack.WriteByte(95);// (this.isOnline ? (byte)0x95 : (byte)0x00);
         pack.Fill(3, 0x00);//unk
         pack.WriteByte(21);
         pack.WriteByte(255);
         pack.Fill(13, 0x00);//unk
         character.Client.SendPacket(pack);
     }
 }
Esempio n. 26
0
        public void WriteInfo(Packet Packet)
        {
            Packet.WriteString(Character.Character.Name, 16);
            Packet.WriteByte((byte)Rank);
            Packet.WriteInt(0); //unk ?

            Packet.WriteUShort(Corp);
            Packet.WriteByte(0);
            Packet.WriteUShort(0xFFFF); //unk
            Packet.WriteUShort(0xFFFF); //unk
            Packet.WriteByte(0);
            Packet.WriteInt(32);
            Packet.WriteInt(32);
            Packet.Fill(50, 0x00); // unk
            Packet.WriteByte((byte)(Character.IsOnline ? 0xB9 : 0x00));
            Packet.Fill(3, 0x00); // unk
            Packet.WriteByte(Character.Character.Job);
            Packet.WriteByte(Character.Character.CharLevel);
            Packet.WriteByte(0);
            Packet.WriteString(Data.DataProvider.GetMapname(Character.Character.PositionInfo.Map), 12);
        }