Beispiel #1
0
 public void WritePremiumInfo(Packet packet)
 {
     packet.WriteInt(this.UniqueID);
     packet.WriteInt(this.ShopID);
     packet.WriteInt(0);//unk
     packet.WriteInt(0);//unk
 }
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 SendClientTime(WorldClient client, DateTime time)
        {
            using (var packet = new Packet(SH2Type.UpdateClientTime))
            {
                //pPacket.WriteUInt((59 << 25) | (23 << 19) | (31 << 13) | (12 << 8) | (254));
            // *                    Minutes   | Hours      | Days       | Months    | Years
                packet.WriteInt(3);
                packet.WriteInt(time.Minute);//minutes
                packet.WriteInt(time.Hour);//hourses
                packet.WriteInt(time.Day);
                packet.WriteInt(time.Month-1);
                packet.WriteInt((time.Year - 1900));
                packet.WriteInt((int)time.DayOfWeek);//wekday?
                packet.WriteInt(105);
                packet.WriteInt(2);

                packet.WriteByte(1); //GMT 0-130 positive 130 -254 negative
              //  packet.WriteLong(2012);
               // packet.WriteInt(4);//unk
                //packet.WriteInt(1);//unk
                //packet.WriteInt(3);//unk
                //packet.WriteInt(46);
              //  packet.Fill(3, 0);//unk
               // packet.WriteByte(2);
                client.SendPacket(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(Settings.Instance.IP, 16);
         packet.WriteUShort(port);
         packet.WriteUShort(randomid);
         character.Client.SendPacket(packet);
     }
 }
Beispiel #6
0
 public static void SendChatBlock(ZoneCharacter character, int seconds)
 {
     using (var packet = new Packet(SH2Type.Chatblock))
     {
         packet.WriteInt(seconds);
         character.Client.SendPacket(packet);
     }
 }
Beispiel #7
0
        public void BroadcastGuildName()
        {
            var packet = new Packet(SH29Type.GuildNameResult);
            packet.WriteInt(Guild.ID);
            packet.WriteString(Guild.Name, 16);

            BroadcastManager.Instance.BroadcastInRange(Character, packet, false);
        }
Beispiel #8
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 #9
0
        public void BroadcastGuildName()
        {
            var packet = new Packet(SH29Type.GuildNameResult);
            packet.WriteInt(Academy.Guild.ID);
            packet.WriteString(Academy.Guild.Name, 16);

            Character.BroucastPacket(packet);
        }
Beispiel #10
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 #11
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 #12
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);
             }
        }
Beispiel #13
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
            }
        }
Beispiel #14
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);
        }
Beispiel #15
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 #16
0
        public static void MasterList(WorldClient client, Packet packet)
        {
            Dictionary<string, string> list = new Dictionary<string, string>
            {
                {"Char1", "hier ist Char1"},
                {"Char2", "hier ist Char2"}
            };
            using (var ppacket = new Packet(SH14Type.GroupList))
            {
                ppacket.WriteHexAsBytes("00 00 14 01 01 00 01 00 00 00");
                ppacket.WriteInt(list.Count);
                foreach (KeyValuePair<string, string> stat in list)
                {
                    // Note - teh f**k?
                    ppacket.WriteHexAsBytes("");
                    ppacket.WriteString("haha", 16);
                    ppacket.WriteString("1234567890123456789012345678901234567890123456", 46);
                    ppacket.WriteHexAsBytes("00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8C 8E CD 00 88 49 DF 4E B3 08 4C 00 78 26 43 00 01 00 00 00 5A 68 42 00 18 FE 64 02 40 55 DF 4E 08 27 4D 00 94 FF 64 02 24 00 00 00 BD 68 42 00 87 BE");
                }

                list.Clear();
                client.SendPacket(ppacket);
            }
        }
Beispiel #17
0
        public static void On_GameClient_GuildChat(WorldClient Client, Packet pPacket)
        {
            byte len;
            string msg;
            if (Client.Character == null
                || !pPacket.TryReadByte(out len)
                || !pPacket.TryReadString(out msg, len))
            {
                return;
            }

            len = (byte)(len + 2);

            if (Client.Character.Guild != null)
            {
                using (var packet = new Packet(SH29Type.GuildChat))
                {
                    packet.WriteInt(Client.Character.Guild.ID);
                    packet.WriteString(Client.Character.Character.Name, 16);

                    packet.WriteByte(len);
                    packet.WriteString(msg, len);

                    Client.Character.Guild.Broadcast(packet);
                }
            }
        }
Beispiel #18
0
        public static void On_GameClient_CreateGuild(WorldClient Client, Packet Packet)
        {
            string name, password;
            bool allowGuildWar;
            if (!Packet.TryReadString(out name, 16)
                || !Packet.TryReadString(out password, 8)
                || !Packet.ReadSkip(4) // unk ?
                || !Packet.TryReadBool(out allowGuildWar))
            {
                return;
            }

            GuildCreateResponse response;

            if (Client.Character.Character.CharLevel < 20)
            {
                response = GuildCreateResponse.LevelTooLow;
            }
            else if (Client.Character.Character.Money < Guild.Price)
            {
                response = GuildCreateResponse.MoneyTooLow;
            }
            else
            {
                //encrypt guild pw
               var pwData = Encoding.UTF8.GetBytes(password);
            //                InterCrypto.Encrypt(ref pwData, 0, pwData.Length);

                Guild guild;

                //try to create guild
                lock (ThreadLocker)
                {
                    int result;
                    int guildID;
                    var createTime = Program.CurrentTime;

                    using (var con = Program.DatabaseManager.GetClient().GetConnection())
                    {
                        //insert guild in db
                        using (var cmd = con.CreateCommand())
                        {
                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.CommandText = "Guild_Create";

                            cmd.Parameters.Add(new MySqlParameter("@pName", name));
                            cmd.Parameters.Add(new MySqlParameter("@pPassword", pwData));
                            cmd.Parameters.Add(new MySqlParameter("@pAllowGuildWar", allowGuildWar));
                            cmd.Parameters.Add(new MySqlParameter("@pCreaterID", Client.Character.ID));
                            cmd.Parameters.Add(new MySqlParameter("@pCreateTime", createTime));

                            var idParam = cmd.Parameters.Add(new MySqlParameter("@pID", SqlDbType.Int)
                                {
                                    Direction = ParameterDirection.Output
                                });
                            result = Convert.ToInt32(cmd.ExecuteScalar());
                            guildID = (int)idParam.Value;
                        }

                        switch (result)
                        {
                            case -1:
                                //guild name already exists (ToDo: get response code)

                                SendGuildCreateResponse(Client, name, password, allowGuildWar, GuildCreateResponse.AlredyExist);
                                return;

                            case -2: //database error @ insert guild (ToDo: get response code)
                                SendGuildCreateResponse(Client, name, password, allowGuildWar, GuildCreateResponse.Failed);
                                return;
                            case -3: //database error @ insert guild academy (ToDo: get response code)
                                SendGuildCreateResponse(Client, name, password, allowGuildWar, GuildCreateResponse.Failed);
                                return;

                            case 0:

                                //create guild
                                guild = new Guild(con, guildID, name, pwData, allowGuildWar, Client.Character, createTime);
                            //insert guild master (character will get updated)
                                guild.AddMember(Client.Character, GuildRank.Master, con, false, false);
                                //add to loaded guilds
                                LoadedGuilds.Add(guild);

                                break;

                            default:
                                return;
                        }
                    }
                }

                Client.Character.
                //revoke money
               Client.Character.ChangeMoney(Client.Character.Character.Money - Guild.Price);

                //let character broadcast guild name packet
                using (var packet = new Packet(SH29Type.GuildNameResult))
                {
                    packet.WriteInt(guild.ID);
                    packet.WriteString(guild.Name, 16);

                    BroadcastManager.Instance.BroadcastInRange(Client.Character, packet, true);
                }

                //let zone know that a guild has been loaded
                using (var packet = new InterPacket(InterHeader.ZONE_GuildCreated))
                {
                    packet.WriteInt(guild.ID);
                    packet.WriteInt(Client.Character.ID);

                    ZoneManager.Instance.Broadcast(packet);
                }

                //set response to success
                response = GuildCreateResponse.Success;
            }

            SendGuildCreateResponse(Client, name, password, allowGuildWar, response);
        }
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 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
 }
Beispiel #21
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);
        }
Beispiel #22
0
        public Packet UpdateStatsPacket(Packet packet)
        {
            StatsByte[] pUpdate = this.statsToUpdate;

            int lange = pUpdate.Length;
            packet.WriteByte((byte)lange);
            for (int i = 0; i < pUpdate.Length; ++i)
            {
                packet.WriteByte((byte)pUpdate[i]);
                // THIS BUGS.
                packet.WriteInt(this.GetStatValue(pUpdate[i]));
            }
            return packet;
        }
Beispiel #23
0
        public void Move(int oldx, int oldy, int newx, int newy, bool walk, bool stop)
        {
            Teleport(newx, newy);

            if (stop)
            {
                using (var packet = Handler8.StopObject(this))
                {
                    Broadcast(packet);
                }
            }
            else
            {
                ushort speed = 0;
                if (walk) speed = 60;
                else if(Mount != null) speed = this.Mount.speed;
                else speed = 115;
                foreach (var member in this.Party)
                {
                    if (member.Value.Character.Name != this.Character.Name)
                    {
                        using (var ppacket = new Packet(14, 73))
                        {
                            ppacket.WriteByte(1);//unk
                            ppacket.WriteString(member.Key, 16);
                            ppacket.WriteInt(member.Value.Character.Character.PositionInfo.XPos);
                            ppacket.WriteInt(member.Value.Character.Character.PositionInfo.XPos);
                            member.Value.SendPacket(ppacket);
                        }
                    }
                }
                using (var packet = Handler8.MoveObject(this, oldx, oldy, walk, speed))
                {
                    Broadcast(packet);
                }

                if (this.Group != null)
                {
                    this.Group.CharacterMoved(this.GroupMember, oldx, oldy, newx, newy);
                }
            }
        }
Beispiel #24
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);
                }
            }
        }
Beispiel #25
0
        public static void On_GameClient_GuildNameRequest(WorldClient Client, Packet Packet)
        {
            int guildID;
            if (!Packet.TryReadInt(out guildID))
            {
                return;
            }

            Guild guild;
            if (GetGuildByID(guildID, out guild))
            {
                using (var packet = new Packet(SH29Type.GuildNameResult))
                {
                    packet.WriteInt(guildID);
                    packet.WriteString(guild.Name, 16);

                    Client.SendPacket(packet);
                }
            }
        }
Beispiel #26
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);
 }
Beispiel #27
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);
                }
            }
        }
Beispiel #28
0
 internal void CharacterMoved(GroupMember groupMember, int oldx, int oldy, int newx, int newy)
 {
     using (var packet = new Packet(SH14Type.UpdatePartyMemberLoc))
     {
         packet.WriteByte(1);	// 		unk
         packet.WriteString(groupMember.Name, 16);
         packet.WriteInt(newx);
         packet.WriteInt(newy);
         AnnouncePacket(packet);
     }
 }
Beispiel #29
0
        private static void SendGuildCreateResponse(WorldClient Client, string Name, string Password, bool AllowGuildWar, GuildCreateResponse Response)
        {
            using (var packet = new Packet(SH29Type.CreateGuildResponse))
            {

                packet.WriteUShort((ushort)Response);
                packet.WriteInt((Response == GuildCreateResponse.Success ? 32 : 0));

                packet.WriteString(Name, 16);
                packet.WriteString(Password, 8);
                packet.WriteBool(AllowGuildWar);
                Client.SendPacket(packet);
            }
        }
Beispiel #30
0
        private void UpdateMemberPosition(GroupMember member)
        {
            if (!member.IsOnline)
                return;
            using (var packet = new Packet(SH14Type.UpdatePartyMemberLoc))
            {
                packet.WriteString(member.Name, 0x10);
                packet.WriteInt(member.Character.Position.X);
                packet.WriteInt(member.Character.Position.Y);

                AnnouncePacketToUpdatable(packet);
            }
        }