public static Packet ShowDrops(List<Drop> drops) { Packet packet = new Packet(SH7Type.ShowDrops); packet.WriteByte((byte)drops.Count); drops.ForEach(d => d.Write(packet)); return packet; }
public static void ChangeDropMode(WorldClient client, Packet packet) { byte dropState; if (packet.TryReadByte(out dropState)) { client.Character.Group.ChangeDropType(client.Character, dropState); } }
public static void SendPing(WorldClient client) { using (var packet = new Packet(SH2Type.Ping)) { client.SendPacket(packet); } }
public void WritePremiumInfo(Packet packet) { packet.WriteInt(this.UniqueID); packet.WriteInt(this.ShopID); packet.WriteInt(0);//unk packet.WriteInt(0);//unk }
public static void CharacterSelectHandler(WorldClient client, Packet packet) { byte slot; if (!packet.TryReadByte(out slot) || slot > 10 || !client.Characters.ContainsKey(slot)) { Log.WriteLine(LogLevel.Warn, "{0} selected an invalid character.", client.Username); return; } WorldCharacter character; if (client.Characters.TryGetValue(slot, out character)) { //generate transfer ZoneConnection zone = Program.GetZoneByMap(character.Character.PositionInfo.Map); if (zone != null) { client.Characters.Clear(); //we clear the other ones from memory client.Character = character; //only keep the one selecte //Database.Storage.Characters.AddChars(character.Character); zone.SendTransferClientFromZone(client.AccountID, client.Username, client.Character.Character.Name,client.Character.ID, client.RandomID, client.Admin, client.Host); ClientManager.Instance.AddClientByName(client); //so we can look them up fast using charname later. SendZoneServerIP(client, zone); } else { Log.WriteLine(LogLevel.Warn, "Character tried to join unloaded map: {0}", character.Character.PositionInfo.Map); SendConnectError(client, ConnectErrors.MapUnderMaintenance); } } }
public static void HandleSetStatPoint(ZoneClient client, Packet packet) { byte stat; if (!packet.TryReadByte(out stat)) { Log.WriteLine(LogLevel.Warn, "Couldn't read HandleSetStatPoint packet. {0}", client); return; } if (client.Character.Character.UsablePoints == 0) { Log.WriteLine(LogLevel.Warn, "User tried to set stat point while not having any left. {0}", client); } else { // LETS DO ET switch (stat) { case 0: client.Character.Str++; break; case 1: client.Character.Dex++; break; case 2: client.Character.End++; break; case 3: client.Character.Int++; break; case 4: client.Character.Spr++; break; default: { Log.WriteLine(LogLevel.Warn, "User tried to set stat point on unknown stat {0} {1}", stat, client); return; } } client.Character.Character.UsablePoints--; //Program.Entity.SaveChanges(); SendSetUsablePoint(client, stat); } }
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); } }
public static void GetAcademyGoldRewardList(WorldClient client, Packet packet) { using (var pack = new Packet(SH38Type.SendAcademyGoldRewardList)) { pack.WriteHexAsBytes("80 18");//responsecode pack.WriteByte(1);//stat count pack.WriteHexAsBytes("0A 0A CA 9A 3B 00 00 00 00");//unk pack.WriteByte(10);//levelbreich pack.WriteLong(1000); pack.WriteByte(15);//level bereich pack.WriteLong(1000); pack.WriteByte(26);//level bereich pack.WriteLong(1000); pack.WriteByte(31);//level bereich pack.WriteLong(1000); pack.WriteByte(36);//levelbereich pack.WriteLong(1000); pack.WriteByte(41);//level bereich pack.WriteLong(9000); pack.WriteByte(46);//level bereich pack.WriteLong(1000); pack.WriteByte(51);//level bereich pack.WriteLong(1000); pack.WriteByte(56);//level bereich pack.WriteLong(1000); client.SendPacket(pack); } }
public static void WriteRefinement(WorldCharacter wchar, Packet pPacket) { //TODO: pPacket.WriteByte(Convert.ToByte(this.Inventory.GetEquippedUpgradesByType(ItemType.Weapon) << 4 | this.Inventory.GetEquippedUpgradesByType(ItemType.Shield))); pPacket.WriteByte(0xff); //this must be the above, but currently not cached pPacket.WriteByte(0xff); // UNK pPacket.WriteByte(0xff); // UNK }
public static void WriteLook(WorldCharacter wchar, Packet packet) { packet.WriteByte(Convert.ToByte(0x01 | (wchar.Character.Job << 2) | (Convert.ToByte(wchar.Character.LookInfo.Male)) << 7)); packet.WriteByte(wchar.Character.LookInfo.Hair); packet.WriteByte(wchar.Character.LookInfo.HairColor); packet.WriteByte(wchar.Character.LookInfo.Face); }
public static void SelectObjectHandler(ZoneClient client, Packet packet) { ushort id; if (!packet.TryReadUShort(out id)) { Log.WriteLine(LogLevel.Warn, "Could not read entity select request."); return; } MapObject mo; // Try to see if there is a map object with this ID if (!client.Character.Map.Objects.TryGetValue(id, out mo)) { client.Character.CharacterInTarget = mo; return; // Nothing found. Just return lawl } mo.SelectedBy.Add(client.Character); if (mo is ZoneCharacter || mo is Mob) { client.Character.SelectedObject = mo; SendStatsUpdate(mo, client, false); } }
public static void SendPing(ZoneClient character) { using (var packet = new Packet(SH2Type.Ping)) { character.SendPacket(packet); } }
public static Packet Animation(ZoneCharacter character, byte id) { Packet packet = new Packet(SH8Type.Emote); packet.WriteUShort(character.MapObjectID); packet.WriteByte(id); return packet; }
public static void TradeAgree(ZoneClient pClient, Packet pPacket) { if (pClient.Character.Trade == null) return; pClient.Character.Trade.AcceptTrade(pClient.Character); }
public static void MasterRemove(WorldClient client, Packet packet) { string removename; if(!packet.TryReadString(out removename,16)) return; MasterManager.Instance.RemoveMasterMember(client.Character, removename); }
public static void ClientReadyHandler(ZoneClient client, Packet packet) { if (client.Admin > 0) { client.Character.DropMessage("AdminLevel = {0}; ClientLoad = {1};", client.Admin, ClientManager.Instance.ZoneLoad); } Handler4.SendUsablePoints(client); if (!client.Character.IsDead) { // Just logged on. client.Character.Map.FinalizeAdd(client.Character); } else { // Reviving, not readding for this one! MapInfo mi; if (DataProvider.Instance.MapsByID.TryGetValue(client.Character.MapID, out mi)) { client.Character.State = PlayerState.Normal; client.Character.Map.SendCharacterLeftMap(client.Character, false); client.Character.Position.X = mi.RegenX; client.Character.Position.Y = mi.RegenY; client.Character.Map.SendCharacterEnteredMap(client.Character); } client.Character.SetHP(client.Character.MaxHP / 4); } }
public static Packet CreateWorldMessage(WorldMessageTypes pType, string pMessage) { var packet = new Packet(SH25Type.WorldMessage); packet.WriteByte((byte)pType); packet.WriteStringLen(pMessage, true); return packet; }
public override void WriteInfo(Packet pPacket, bool WriteStats = true) { byte length; byte statCount; if (ItemInfo.Slot == ItemSlot.None) { length = GetInfoLength(ItemInfo.Class); statCount = 0; } else { length = GetEquipLength(this); statCount = GetInfoStatCount(this); } byte lenght = 9;//later pPacket.WriteByte(lenght); pPacket.WriteByte((byte)this.Slot);//itemslot pPacket.WriteByte(0x08);//unk if (WriteStats) { if (ItemInfo.Slot == ItemSlot.None) this.WriteStats(pPacket); else WriteEquipStats(pPacket); } }
public static void TradeReqest(ZoneClient pClient, Packet pPacket) { ushort MapObjectID; if (!pPacket.TryReadUShort(out MapObjectID)) return; TradeManager.Instance.AddTradeRequest(pClient, MapObjectID); }
public static void TradeLock(ZoneClient pClient, Packet pPacket) { if (pClient.Character.Trade != null) { pClient.Character.Trade.TradeLock(pClient.Character); } }
public static void SendCharacterChunkEnd(ZoneCharacter character) { using (var packet = new Packet(SH4Type.CharacterInfoEnd)) { packet.WriteUShort(0xFFFF); character.Client.SendPacket(packet); } }
public static void SendChatBlock(ZoneCharacter character, int seconds) { using (var packet = new Packet(SH2Type.Chatblock)) { packet.WriteInt(seconds); character.Client.SendPacket(packet); } }
public void BroadcastGuildName() { var packet = new Packet(SH29Type.GuildNameResult); packet.WriteInt(Academy.Guild.ID); packet.WriteString(Academy.Guild.Name, 16); Character.BroucastPacket(packet); }
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; }
public static void BackTo(ZoneClient client, Packet packet) { using(var iacket = new InterPacket(InterHeader.ClientDisconect)) { iacket.WriteString(client.Character.Character.Name, 16); InterServer.WorldConnector.Instance.SendPacket(iacket); } }
public static void TradeBreak(ZoneClient pClient, Packet pPacket) { if (pClient.Character.Trade == null) return; pClient.Character.Trade.TradeBreak(pClient.Character); pClient.Character.Trade = null; }
public static void SendDetailedCharacterInfo(ZoneCharacter character) { using (var packet = new Packet(SH6Type.DetailedCharacterInfo)) { character.WriteDetailedInfoExtra(packet); character.Client.SendPacket(packet); } }
public static void PartyDecline(WorldClient client, Packet packet) { string inviteChar; if (packet.TryReadString(out inviteChar, 0x10)) { GroupManager.Instance.DeclineInvite(client, inviteChar); } }
public static void SendError(ZoneClient client, ServerError error) { using (Packet pack = new Packet(SH3Type.Error)) { pack.WriteShort((byte)error); client.SendPacket(pack); } }
public void BroadcastGuildName() { var packet = new Packet(SH29Type.GuildNameResult); packet.WriteInt(Guild.ID); packet.WriteString(Guild.Name, 16); BroadcastManager.Instance.BroadcastInRange(Character, packet, false); }