private static void ParseCreatureSpeak(InputMessage input) { //input.getU32(); input.getString(); byte type = input.getByte(); switch (type) { case 1: case 2: case 3: case 0x10: case 0x11: input.getLocation(); break; case 5: case 0xA: case 0xE: case 0xC: input.getU16(); break; case 6: input.getU16(); break; default: break; } input.getString(); }
private static void ParseTextWindow(InputMessage input) { input.getU32(); input.getU16(); input.getU16(); input.getString(); }
private static void ParsePlayerStats(InputMessage input) { input.getU16(); input.getU16(); input.getU16(); input.getU32(); input.getByte(); input.getByte(); input.getU16(); input.getU16(); input.getByte(); input.getByte(); }
private static void ParseUpdateTile(InputMessage input) { Location location = input.getLocation(); var thingId = input.PeekU16(); if (thingId == 0xFF01) { input.getU16(); } else { parseTileDescription(input, location); input.getU16(); } }
private static Item GetItem(InputMessage message, ushort itemid) { //Console.WriteLine("ID: " + itemid); if (itemid == ushort.MaxValue) { itemid = message.getU16(); } ItemType type = Instance.items.Get(itemid); if (type == null) { throw new Exception("[GetItem] (" + itemid + ") Can't find the item type."); //dat } byte Count = 0; byte Subtype = 0; if (type.IsStackable) { Count = message.getByte(); } else if (type.IsSplash || type.IsFluidContainer) { Subtype = message.getByte(); } return(new Item(type, Count, Subtype)); }
private static void ParseChannelsDialog(InputMessage input) { byte channelsSize = input.getByte(); for (int index = 0; index < channelsSize; index++) { input.getU16(); input.getString(); } }
private static void ParseContainer(InputMessage input) { input.getByte(); input.getU16(); input.getString(); input.getByte(); input.getByte(); byte containerSize = input.getByte(); for (int index = 0; index < containerSize; index++) { GetThing(input); } }
private static void parseFloorDescription(InputMessage message, List <Tile> tiles, int x, int y, int z, int width, int height, int offset, ref int skipTiles) { for (int nx = 0; nx < width; nx++) { for (int ny = 0; ny < height; ny++) { if (skipTiles == 0) { var tileOpt = message.PeekU16(); // Decide if we have to skip tiles // or if it is a real tile if (tileOpt == 0xFF11) { message.getU16(); // skip 0xFF11 return; } //Console.WriteLine(tileOpt.ToString("X")); if (tileOpt >= 0xFF00) { skipTiles = (short)(message.getU16() & 0xFF); } else { //real tile so read tile tiles.Add(parseTileDescription(message, new Location(x + nx + offset, y + ny + offset, z))); //tiles.Add(); skipTiles = (short)(message.getU16() & 0xFF); } } else { skipTiles--; } } } }
private static Thing GetThing(InputMessage message) { //get thing type var thingId = message.getU16(); if (thingId == 0x0061 || thingId == 0x0062) { //Console.WriteLine("Creature baby."); //creatures Creature creature = null; if (thingId == 0x0062) { uint creatureId = message.getU32(); creature = new Creature(creatureId); if (creature == null) { throw new Exception("[GetThing] (0x0062) Can't find the creature."); } byte creatureHealth = message.getByte(); //Console.WriteLine("Creature with id: " + creatureId + " Life: " + creatureHealth); } else if (thingId == 0x0061) //creature is not known { uint creatureId = message.getU32(); //Console.WriteLine("Removing creature: " + creatureId); uint creatureIdNew = message.getU32(); creature = new Creature(creatureIdNew); creature.Name = message.getString(); creature.Health = message.getByte(); } var direction = (Direction)message.getByte(); creature.LookDirection = direction; creature.TurnDirection = direction; creature.Outfit = message.getOutfit(); creature.LightLevel = message.getByte(); creature.LightColor = message.getByte(); creature.Speed = message.getU16(); creature.Skull = message.getByte(); creature.Shield = message.getByte(); return(creature); } else if (thingId == 0x0063) { uint creatureId = message.getU32(); Creature creature = new Creature(creatureId); if (creature == null) { throw new Exception("[GetThing] (0x0063) Can't find the creature in the battle list."); } creature.TurnDirection = (Direction)message.getByte(); return(creature); } else { return(GetItem(message, thingId)); } }
private static void ParseChangeSpeed(InputMessage input) { input.getU32(); input.getU16(); }
private static void ParseChannel(InputMessage input) { input.getU16(); input.getString(); }
private static void ParseClosePrivate(InputMessage input) { input.getU16(); }
private static void ParseRuleViolationsChannel(InputMessage input) { ushort size = input.getU16(); }