public static void CreateCharHandler(WorldClient client, Packet packet) { string name; byte slot, jobGender, hair, color, style; if (!packet.TryReadByte(out slot) || !packet.TryReadString(out name, 20) || !packet.TryReadByte(out jobGender) || !packet.TryReadByte(out hair) || !packet.TryReadByte(out color) || !packet.TryReadByte(out style)) { Log.WriteLine(LogLevel.Warn, "Error reading create char for {0}", client.Username); return; } if (DatabaseChecks.IsCharNameUsed(name)) { SendCharCreationError(client, CreateCharError.NameTaken); return; } else if (DataProvider.Instance.IsBadName(name)) { SendCharCreationError(client, CreateCharError.NameInUse); return; } byte isMaleByte = (byte)((jobGender >> 7) & 0x01); byte classIDByte = (byte)((jobGender >> 2) & 0x1F); Job job = (Job)classIDByte; switch (job) { case Job.Archer: case Job.Cleric: case Job.Fighter: case Job.Mage: case Job.Trickster: //create character here try { WorldCharacter wchar = client.CreateCharacter(name, slot, hair, color, style, job, Convert.ToBoolean(isMaleByte)); SendCharOKResponse(client, wchar); } catch (Exception ex) { Log.WriteLine(LogLevel.Exception, "Error creating character for {0}: {1}", client.Username, ex.InnerException.ToString()); SendCharCreationError(client, CreateCharError.FailedToCreate); return; } break; default: SendCharCreationError(client, CreateCharError.WrongClass); Log.WriteLine(LogLevel.Warn, "Invalid job ID at char creation from {0}", client.Username); break; } }
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 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 TradeRemovitem(ZoneClient pClient, Packet pPacket) { byte pSlot; if (!pPacket.TryReadByte(out pSlot)) return; if (pClient.Character.Trade == null) return; pClient.Character.Trade.RemoveItemToHandel(pClient.Character, pSlot); }
public static void MasterRequestCoper(ZoneClient client, Packet pPacket) { byte unk; if (!pPacket.TryReadByte(out unk)) return; using (var packet = new Packet(SH37Type.SendRecivveCopper)) { packet.WriteUShort(7264);//unk packet.WriteLong(client.Character.Character.ReviveCoper); client.SendPacket(packet); } }
public static void PartyChat(WorldClient client, Packet packet) { if (client.Character.Group == null) return; byte msgLen; string msg = string.Empty; if (!packet.TryReadByte(out msgLen) || !packet.TryReadString(out msg, msgLen)) return; client.Character.Group.Chat(client, msg); }
public static void ChangeCharNameHandler(WorldClient client, Packet packet) { byte Character_slot; string charname; if (!packet.TryReadByte(out Character_slot) || !packet.TryReadString(out charname, 16)) return; using (var pack = new Packet(SH5Type.SendCharacterChangeNewName)) { pack.WriteByte(Character_slot); pack.WriteString(charname,16); pack.WriteUShort(208);//Responsecode? } //Todo ChangeinDatabase }
public static void Wisper(WorldClient client, Packet packet) { string toname; byte messagelenght; if (packet.TryReadString(out toname, 16) && packet.TryReadByte(out messagelenght)) { string message; if (!packet.TryReadString(out message, messagelenght)) { return; } WorldClient toChar = ClientManager.Instance.GetClientByCharname(toname); if (toChar != null) { using (var frompacket = new Packet(SH8Type.WisperFrom)) { frompacket.WriteString(client.Character.Character.Name, 16); if (!toChar.Character.BlocketUser.Contains(client.Character.Character.Name)) { frompacket.WriteByte(0); } else { frompacket.WriteByte(12);//blocket notdisplay message } frompacket.WriteByte(messagelenght); frompacket.WriteString(message, messagelenght); toChar.SendPacket(frompacket); } using (var pack = new Packet(SH8Type.WisperTo)) { pack.WriteString(toname, 16); pack.WriteByte(messagelenght); pack.WriteString(message, messagelenght); client.SendPacket(pack); } } else { //target not found using (var pp = new Packet(SH8Type.WisperTargetNotfound)) { pp.WriteUShort(3945);//unk pp.WriteString(toname, 16); client.SendPacket(pp); } } } }
public static void QuestionHandler(ZoneClient client, Packet packet) { byte answer; if (!packet.TryReadByte(out answer)) { Log.WriteLine(LogLevel.Warn, "Received invalid question response."); return; } ZoneCharacter character = client.Character; if (character.Question == null) return; else if (character.Question.Answers.Count <= answer) return; character.Question.Function(character, answer); character.Question = null; }
public static void ClientEquippedItem(ZoneClient pClient, Packet pPacket) { byte fromSlot; if (!pPacket.TryReadByte(out fromSlot)) { Log.WriteLine(LogLevel.Warn, "Could not read equip slot."); return; } Item fromItem; if (!pClient.Character.Inventory.InventoryItems.TryGetValue(fromSlot, out fromItem)) { Log.WriteLine(LogLevel.Warn, "Equipping empty inventory slot."); return; } if (fromItem == null) { Log.WriteLine(LogLevel.Warn, "Client tries to equip an ITEM, not EQUIP!"); return; } byte toSlot = (byte)fromItem.Slot; Item toEquip = pClient.Character.Inventory.EquippedItems.Find(e => e.ItemInfo.Slot == fromItem.ItemInfo.Slot); // TODO: Check, does user equip item to correct slot. Right now client only does it. ZoneClient client = pClient; if (fromItem.ItemInfo.Level > pClient.Character.Level) { FailedEquip(client.Character, 645); // 85 02 } else { if (toEquip == null) { pClient.Character.EquipItem(fromItem); } else { pClient.Character.SwapEquips(toEquip, fromItem); } } }
public static void MasterRequestResponse(WorldClient client, Packet packet) { string requester = string.Empty; string target = string.Empty; byte response; if (!packet.TryReadString(out requester, 16)) return; if (!packet.TryReadString(out target, 16)) return; if (!packet.TryReadByte(out response)) return; if (response == 0) { MasterManager.Instance.RemoveMasterRequest(client); } else if(response == 1) { MasterManager.Instance.MasterRequestAccept(requester, target); } }
public static void ShoutHandler(ZoneClient client, Packet packet) { ZoneCharacter character = client.Character; byte len; string message; if (!packet.TryReadByte(out len) || !packet.TryReadString(out message, len)) { Log.WriteLine(LogLevel.Warn, "Could not read shout from {0}.", character.Name); return; } int shoutcheck = character.ShoutCheck(); if (shoutcheck > 0) { Handler2.SendChatBlock(character, shoutcheck); } else { ChatLog.Instance.LogChat(client.Character.Name, message, true); using (var broad = Shout(character.Name, message)) { character.Map.Broadcast(broad); } } }
public static void SellItem(ZoneClient client, Packet packet) { byte slot; int sellcount; ZoneCharacter character = client.Character; if (packet.TryReadByte(out slot) && packet.TryReadInt(out sellcount)) { Item item; character.Inventory.InventoryItems.TryGetValue(slot, out item); if (item != null) { long fullSellPrice = sellcount * item.ItemInfo.SellPrice; if (item.Ammount > 1) { item.Ammount -= (ushort)sellcount; byte Slot = (byte)item.Slot; Handler12.ModifyInventorySlot(character, 0x24, Slot, Slot, item); character.Inventory.Money += fullSellPrice; character.ChangeMoney(character.Inventory.Money); } else { character.Inventory.Money += fullSellPrice; character.ChangeMoney(character.Inventory.Money); character.Inventory.InventoryItems.Remove(slot); ResetInventorySlot(character, slot); } System.Console.WriteLine(item.ItemInfo.Type); } } }
public static void MoveItemHandler(ZoneClient pClient, Packet pPacket) { byte oldslot, oldstate, newslot, newstate; if (!pPacket.TryReadByte(out oldslot) || !pPacket.TryReadByte(out oldstate) || !pPacket.TryReadByte(out newslot) || !pPacket.TryReadByte(out newstate)) { Log.WriteLine(LogLevel.Warn, "Could not read item move."); return; } if (oldslot == newslot) { Log.WriteLine(LogLevel.Warn, "Client tried to dupe an item."); return; } Item source; if (!pClient.Character.Inventory.InventoryItems.TryGetValue(oldslot, out source) && newstate != 0x00 && oldstate != 0x00 || newstate == 0x00) { if (pClient.Character.Guild != null) { if(newstate == 0x00 && oldstate == 0x24) { source.Flags = Data.ItemFlags.GuildItem; } else if(newstate == 0x24 && oldstate == 0x00) { source.Flags = Data.ItemFlags.Normal; } else if (source == null || newstate != 0x24) { if (!pClient.Character.Guild.GuildStore.GuildStorageItems.TryGetValue(oldslot, out source)) { return; } } } if (source == null) { Log.WriteLine(LogLevel.Warn, "Client tried to move empty slot."); return; } } if (newslot == 0xff || newstate == 0xff) { pClient.Character.Inventory.InventoryItems.Remove(oldslot); source.Delete(); //TODO: make a drop Handler12.ModifyInventorySlot(pClient.Character, oldslot, oldstate, (byte)source.Slot, null); } else if(newstate == 0x00 && oldstate == 0x24 && pClient.Character.Guild != null) { if (!pClient.Character.Guild.GuildStore.GetHasFreeGuildStoreSlot()) //todo GuildStorefuell return; pClient.Character.Inventory.RemoveInventory(source); pClient.Character.Guild.GuildStore.GuildStorageItems.Add(newslot, source); pClient.Character.Guild.GuildStore.SendAddGuildStore(Data.GuildStoreAddFlags.Item, pClient.Character.Character.Name, source.Ammount, 0, source.ItemInfo.ItemID); pClient.Character.Guild.GuildStore.SaveStoreItem(pClient.Character.Guild.ID, source.ItemInfo.ItemID, newslot); Handler12.ModifyInventorySlot(pClient.Character, oldstate, newstate, oldslot, null); Handler12.ModifyInventorySlot(pClient.Character, oldstate, newstate, oldslot, newslot, source); return; } else if(oldstate == 0x00 && newstate == 0x24 && pClient.Character.Guild != null) { if (!pClient.Character.Guild.GuildStore.GuildStorageItems.TryGetValue(oldslot, out source)) return; source.Slot = (sbyte)newslot; pClient.Character.Guild.GuildStore.GuildStorageItems.Remove(oldslot); pClient.Character.Inventory.AddToInventory(source); pClient.Character.Guild.GuildStore.SendRemoveFromGuildStore (Data.GuildStoreAddFlags.Item, pClient.Character.Character.Name, source.Ammount, 0, source.ItemInfo.ItemID); pClient.Character.Guild.GuildStore.RemoveStoreItem(pClient.Character.Guild.ID, source.ItemInfo.ItemID); Handler12.ModifyInventorySlot(pClient.Character, newstate,oldstate, newslot, oldslot, null); Handler12.ModifyInventorySlot(pClient.Character, newstate, newstate, newstate, newslot, source); return; } if (source.Flags == Data.ItemFlags.Normal) { Item destination; if (pClient.Character.Inventory.InventoryItems.TryGetValue(newslot, out destination)) { //item swap pClient.Character.Inventory.InventoryItems.Remove(oldslot); pClient.Character.Inventory.InventoryItems.Remove(newslot); source.Slot = (sbyte)newslot; destination.Slot = (sbyte)oldslot; pClient.Character.Inventory.InventoryItems.Add(newslot, source); pClient.Character.Inventory.InventoryItems.Add(oldslot, destination); source.Save(); destination.Save(); Handler12.ModifyInventorySlot(pClient.Character, newslot, 0x24, oldslot, destination); Handler12.ModifyInventorySlot(pClient.Character, oldslot, 0x24, newslot, source); } else { //item moved to empty slot pClient.Character.Inventory.InventoryItems.Remove(oldslot); pClient.Character.Inventory.InventoryItems.Add(newslot, source); source.Slot = (sbyte)newslot; source.Save(); Handler12.ModifyInventorySlot(pClient.Character, newslot, 0x24, oldslot, null); Handler12.ModifyInventorySlot(pClient.Character, oldslot, 0x24, newslot, source); } } else if (source.Flags == Data.ItemFlags.GuildItem) { Item destination; if (pClient.Character.Guild.GuildStore.GuildStorageItems.TryGetValue(newslot, out destination)) { //item swap pClient.Character.Guild.GuildStore.GuildStorageItems.Remove(oldslot); pClient.Character.Guild.GuildStore.GuildStorageItems.Remove(newslot); source.Slot = (sbyte)newslot; destination.Slot = (sbyte)oldslot; pClient.Character.Guild.GuildStore.GuildStorageItems.Add(newslot, source); pClient.Character.Guild.GuildStore.GuildStorageItems.Add(oldslot, destination); Handler12.ModifyInventorySlot(pClient.Character, oldstate, newstate, newslot, oldslot, destination); Handler12.ModifyInventorySlot(pClient.Character, oldstate, oldstate, newstate, newslot, source); } else { //item moved to empty slot pClient.Character.Guild.GuildStore.GuildStorageItems.Remove(oldslot); pClient.Character.Guild.GuildStore.GuildStorageItems.Add(newslot, source); source.Slot = (sbyte)newslot; Handler12.ModifyInventorySlot(pClient.Character, oldstate, newstate, newslot, oldslot,null); Handler12.ModifyInventorySlot(pClient.Character, newstate, oldstate, newstate, newslot, source); } } }
public static void GetPremiumItemList(ZoneClient pClient, Packet pPacket) { byte PageID; if (!pPacket.TryReadByte(out PageID)) return; pClient.Character.WritePremiumList(PageID); }
public static void GetByList(ZoneClient client, Packet packet) { ZoneCharacter character = client.Character; byte handlerflags; packet.TryReadByte(out handlerflags); if (handlerflags == (ushort)NpcFlags.Vendor && character.CharacterInTarget != null) { Npc npc = character.CharacterInTarget as Npc; switch (npc.Point.RoleArg0) { case "Weapon": SendItemShopWeapon(npc, packet, character); break; case "Item": SendItemShopItems(npc, packet, character); break; case "Guild": SendItemShopItems(npc, packet, character); break; case "WeaponTitle": SendItemShopItems(npc, packet, character); break; case "Skill": SendItemShopSkill(npc, packet, character); break; case "SoulStone": SendItemShopStones(npc, packet, character); break; default: Log.WriteLine(LogLevel.Error, "Unhandelt Npc VendorType : {0}", npc.Point.RoleArg0); break; } } }
public static void NormalChatHandler(ZoneClient client, Packet packet) { byte len; string text; if (!packet.TryReadByte(out len) || !packet.TryReadString(out text, len)) { Log.WriteLine(LogLevel.Warn, "Could not parse normal chat from {0}.", client.Character.Name); return; } if (client.Admin > 0 && (text.StartsWith("&") || text.StartsWith("/"))) { CommandLog.Instance.LogCommand(client.Character.Name, text); CommandStatus status = CommandHandler.Instance.ExecuteCommand(client.Character, text.Split(' ')); switch (status) { case CommandStatus.Error: client.Character.DropMessage("Error executing command."); break; case CommandStatus.GMLevelTooLow: client.Character.DropMessage("You do not have the privileges for this command."); break; case CommandStatus.NotFound: client.Character.DropMessage("Command not found."); break; } } else { int chatblock = client.Character.ChatCheck(); if (chatblock == -1) { ChatLog.Instance.LogChat(client.Character.Name, text, false); SendNormalChat(client.Character, text, client.Admin > 0 ? (byte)0x03 : (byte)0x2a); } else { Handler2.SendChatBlock(client.Character, chatblock); } } }
public static void On_GameClient_AcademyChat(WorldClient Client, Packet Packet) { byte len; string msg; if (!Packet.TryReadByte(out len) || !Packet.TryReadString(out msg, len)) { return; } if (Client.Character.IsInGuildAcademy || Client.Character.IsInGuild) { if (Client.Character.IsInGuildAcademy && Client.Character.GuildAcademyMember.IsChatBlocked) { using (var packet = new Packet(SH38Type.AcademyChatBlocked)) { packet.WriteUShort(6140); Client.SendPacket(packet); } return; } using (var packet = new Packet(SH38Type.AcademyChat)) { 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); Client.Character.GuildAcademy.Broadcast(packet); } } }
public static void UseHandler(ZoneClient client, Packet packet) { byte slot; if (!packet.TryReadByte(out slot)) { Log.WriteLine(LogLevel.Warn, "Error reading used item slot."); return; } client.Character.UseItem(slot); }
public static void GuildExtraRequest(ZoneClient client, Packet packet) { if (client.Character.Guild == null && client.Character.GuildAcademy == null) return; byte response; ushort ResponseCode; if (!packet.TryReadByte(out response)) return; switch (response) { case 0: if (client.Character.Guild == null) { //todo Response for is not in Guild end academymember return; } ResponseCode = 6104; break; case 1: break; case 2: break; } if (!client.Character.IsInaAcademy) { using (var pack = new Packet(SH38Type.GuildItemList)) { pack.WriteUShort(6104);//Responsecode // pack.WriteLong(client.Character.Guild.GuildMoney);//guildmoney pack.WriteByte((byte)client.Character.Guild.GuildStore.GuildStorageItems.Count);//ItemCount foreach (var pItem in client.Character.Guild.GuildStore.GuildStorageItems.Values) { if (pItem.ItemInfo.Slot == ItemSlot.None) { pItem.WriteInfo(pack); pack.WriteByte((byte)pItem.Ammount);//amount } else { pItem.WriteInfo(pack); } } client.SendPacket(pack); } } else { using (var pack = new Packet(SH38Type.GuildItemList)) { pack.WriteUShort(6104);//Responsecode // pack.WriteLong(client.Character.Guild.GuildMoney);//guildmoney pack.WriteByte((byte)client.Character.GuildAcademy.Guild.GuildStore.GuildStorageItems.Count);//ItemCount foreach (var pItem in client.Character.GuildAcademy.Guild.GuildStore.GuildStorageItems.Values) { if (pItem.ItemInfo.Slot == ItemSlot.None) { pItem.WriteInfo(pack); pack.WriteByte((byte)pItem.Ammount);//amount } else { pItem.WriteInfo(pack); } } client.SendPacket(pack); } } }
public static void EmoteHandler(ZoneClient client, Packet packet) { ZoneCharacter character = client.Character; byte action; if (!packet.TryReadByte(out action)) { Log.WriteLine(LogLevel.Warn, "{0} did empty emote.", character.Name); return; } if (action > 74) { character.CheatTracker.AddCheat(CheatTypes.Emote, 500); return; } using (var broad = Animation(character, action)) { character.Broadcast(broad, true); } }
public static void WorldSelectHandler(LoginClient pClient, Packet pPacket) { if (!pClient.IsAuthenticated || pClient.IsTransferring) { Log.WriteLine(LogLevel.Warn, "Invalid world select request."); SendFailedLogin(pClient, ServerError.Exception); return; } byte id; if (!pPacket.TryReadByte(out id)) { Log.WriteLine(LogLevel.Warn, "Invalid world select."); return; } WorldConnection world; if (WorldManager.Instance.Worlds.TryGetValue(id, out world)) { switch (world.Status) { case WorldStatus.Maintenance: Log.WriteLine(LogLevel.Warn, "{0} tried to join world in maintentance.", pClient.Username); SendFailedLogin(pClient, ServerError.ServerMaintenance); return; case WorldStatus.Offline: Log.WriteLine(LogLevel.Warn, "{0} tried to join offline world.", pClient.Username); SendFailedLogin(pClient, ServerError.ServerMaintenance); return; default: Log.WriteLine(LogLevel.Debug, "{0} joins world {1}", pClient.Username, world.Name); break; } string hash = System.Guid.NewGuid().ToString().Replace("-", ""); world.SendTransferClientFromWorld(pClient.AccountID, pClient.Username, pClient.Admin, pClient.Host, hash); Log.WriteLine(LogLevel.Debug, "Transferring login client {0}.", pClient.Username); pClient.IsTransferring = true; SendWorldServerIP(pClient, world, hash); } else { Log.WriteLine(LogLevel.Warn, "{0} selected invalid world.", pClient.Username); return; } }
public static void DeleteCharacterHandler(WorldClient client, Packet packet) { byte slot; if (!packet.TryReadByte(out slot) || slot > 10 || !client.Characters.ContainsKey(slot)) { Log.WriteLine(LogLevel.Warn, "{0} tried to delete character out of range.", client.Username); return; } WorldCharacter todelete = client.Characters[slot]; if (todelete.Delete()) { client.Characters.Remove(slot); SendCharDeleteOKResponse(client, slot); } else { Handler3.SendError(client, ServerError.DatabaseError); } }
public static void ClientUnequippedItem(ZoneClient pClient, Packet pPacket) { byte sourceSlot, destinationSlot; if (!pPacket.TryReadByte(out sourceSlot) || !pPacket.TryReadByte(out destinationSlot)) { Log.WriteLine(LogLevel.Warn, "Could not read unequip values."); return; } Item sourceEquip = pClient.Character.Inventory.EquippedItems.Find(e => (byte)e.ItemInfo.Slot == sourceSlot); //Item destinationItem = pClient.Character.Inventory.EquippedItems.Find(i => i.Slot == destinationSlot);// Item was searched from wrong place Item destinationItem; pClient.Character.Inventory.InventoryItems.TryGetValue(destinationSlot, out destinationItem); // check if something there if (destinationItem != null && (destinationItem.ItemInfo.Slot == ItemSlot.None)) { Log.WriteLine(LogLevel.Warn, "Equipping an item, not possible."); // Failed to unequip message here, no need to log it return; } // TODO: If source and destination types are different return. // Except rings and costumes (But that can be done later). /* if( sourceEquip.Type != destinationItem.Type ) { Log.WriteLine(LogLevel.Warn, "SourceType != DestinationType, just debugging message, not important"); // Failed to unequip message here, no need to log it return; } */ if (destinationItem != null) { Item destinationEquip = (Item)destinationItem; pClient.Character.SwapEquips(sourceEquip, destinationEquip); } else { if (sourceEquip == null) { Handler12.UpdateEquipSlot(pClient.Character, destinationSlot, 0x24, 0, null); return; } pClient.Character.UnequipItem(sourceEquip, destinationSlot); } }
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); } } }
public static void UseTeleporter(ZoneClient client, Packet packet) { byte anwser; if (packet.TryReadByte(out anwser)) { using (Packet Packet = new Packet(SH6Type.TelePorter)) { Packet.WriteShort(6593);//code for normal teleport client.SendPacket(Packet); } switch (anwser) { case 0: client.Character.ChangeMap(0, 4199, 4769);//Roumen break; case 1: client.Character.ChangeMap(9, 11802, 10466);//Eldrine break; case 2: client.Character.ChangeMap(75, 9069, 9312);//EldGbl02 break; case 3: client.Character.ChangeMap(5,13658,7812);//RouVal01 break; default: Log.WriteLine(LogLevel.Warn,"Unkown Teleport Answer {1}",anwser); break; } } }
public static void DropItemHandler(ZoneClient client, Packet packet) { byte slot; if (!packet.TryReadByte(out slot)) { Log.WriteLine(LogLevel.Warn, "Invalid drop request."); return; } client.Character.DropItemRequest(slot); }
public static void On_GameClient_UpdateGuildMemberRank(WorldClient Client, Packet Packet) { string targetName; byte newRankByte; if (!Packet.TryReadString(out targetName, 16) || !Packet.TryReadByte(out newRankByte)) { return; } var newRank = (GuildRank)newRankByte; GuildMember member; GuildMember target; if (Client.Character.Guild != null && Client.Character.Guild.GetMember(Client.Character.Character.Name, out member) && Client.Character.Guild.GetMember(targetName, out target)) { switch (member.Rank) { case GuildRank.Master: if (newRank == GuildRank.Master) { Client.Character.Guild.UpdateMemberRank(member, GuildRank.Member); } Client.Character.Guild.UpdateMemberRank(target, newRank); using (var packet = new Packet(SH29Type.UpdateGuildMemberRankResponse)) { packet.WriteString(targetName, 16); packet.WriteByte(newRankByte); packet.WriteUShort(3137); // ok response Client.SendPacket(packet); } break; case GuildRank.Admin: case GuildRank.Advice: case GuildRank.Commander: case GuildRank.Default: case GuildRank.Guard: case GuildRank.Member: return; } } }
public static void EnhancementHandler(ZoneClient client, Packet packet) { byte weapslot, stoneslot; if (!packet.TryReadByte(out weapslot) || !packet.TryReadByte(out stoneslot)) { Log.WriteLine(LogLevel.Warn, "Invalid item enhance request."); return; } client.Character.UpgradeItem(weapslot, stoneslot); }