public void Load() { foreach (Datum datum in new Datums("trocks").Populate("CharacterID = {0}", TrockParent.ID)) { byte index = (byte)datum["Index"]; int map = (int)datum["Map"]; if (index >= 5) { VIPTrocks.Add(map); } else { RegularTrocks.Add(map); } } }
public void UpdateTrockHandler(Packet inPacket) { ItemConstants.TrockMapAction action = (ItemConstants.TrockMapAction)inPacket.ReadByte(); ItemConstants.TrockType type = (ItemConstants.TrockType)inPacket.ReadByte(); switch (action) { case ItemConstants.TrockMapAction.RemoveMapTrock: { int mapID = inPacket.ReadInt(); switch (type) { case ItemConstants.TrockType.Regular: if (!RegularTrocks.Contains(mapID)) { return; } VIPTrocks.Remove(mapID); break; case ItemConstants.TrockType.VIP: if (!VIPTrocks.Contains(mapID)) { return; } VIPTrocks.Remove(mapID); break; default: throw new ArgumentOutOfRangeException(); } } break; case ItemConstants.TrockMapAction.AddMapTrock: { int mapID = TrockParent.Map.MapleID; if (TrockParent.Map.FieldLimit != (int)MapConstants.FieldLimit.CannotUseVIPTrock) { switch (type) { case ItemConstants.TrockType.Regular: if (RegularTrocks.Contains(mapID)) { return; } RegularTrocks.Add(mapID); break; case ItemConstants.TrockType.VIP: if (VIPTrocks.Contains(mapID)) { return; } VIPTrocks.Add(mapID); break; default: throw new ArgumentOutOfRangeException(); } } else { Character.Notify(TrockParent, "[TrockHandler] This map cannot be added to teleport rock!"); } } break; default: throw new ArgumentOutOfRangeException(); } TrockParent.Client.Send(CharacterTrocksPackets.TrockInventoryUpdate(action, type)); }