private static void ParseUpdateTileItem(InputMessage input) { Location location = input.getLocation(); var stack = input.getByte(); var thing = GetThing(input); if (!location.IsCreature) { //get tile Tile tile = Instance.Map.GetTile(location); if (tile == null) { //Console.WriteLine("Update tile item location not exists"); return; } var oldThing = tile.GetThing(stack); if (oldThing == null) { //Console.WriteLine("Update tile item stack location not exists"); return; // the client will send update tile. } tile.ReplaceThing(stack, thing); Instance.Map.SetTile(tile); } }
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 ParseRemoveTileItem(InputMessage input) { Location location = input.getLocation(); var stack = input.getByte(); if (location.IsCreature) //TODO: Veirificar o porque disso. { return; } Tile tile = Instance.Map.GetTile(location); if (tile == null) { //Console.WriteLine("Remove tile item location not exists"); return; } var thing = tile.GetThing(stack); if (thing == null) // The client will send update tile. //Console.WriteLine("Remove tile item stack location not exists"); { return; } tile.RemoveThing(stack); }
private static void ParseAddTileItem(InputMessage input) { Location location = input.getLocation(); Thing thing = GetThing(input); Tile tile = Instance.Map.GetTile(location); if (tile == null) { //Console.WriteLine("Add tile item location not exists"); return; } tile.AddThing(thing); Instance.Map.SetTile(tile); }
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(); } }
public static void ParseMapDescription(Recording recording, InputMessage input) { Location playerLocation = input.getLocation(); if (recording.Location == null) { recording.Location = playerLocation; } Player.location = playerLocation; var tiles = new List <Tile>(); GetMapDescription(input, tiles, Player.location.X - 8, Player.location.Y - 6, Player.location.Z, 18, 14); Instance.Map.OnMapUpdated(tiles); }
private static void ParseMagicEffect(InputMessage input) { input.getLocation(); input.getByte(); }
private static void ParseMoveCreature(InputMessage input) { Location oldLocation = input.getLocation(); var oldStack = input.getByte(); Location newLocation = input.getLocation(); if (oldLocation.IsCreature) { var creatureId = oldLocation.GetCretureId(oldStack); Creature creature = new Creature(creatureId); if (creature == null) { return; } var tile = Instance.Map.GetTile(newLocation); if (tile == null) { return; } tile.AddThing(creature); Instance.Map.SetTile(tile); } else { Tile tile = Instance.Map.GetTile(oldLocation); if (tile == null) { return; } Thing thing = tile.GetThing(oldStack); Creature creature = thing as Creature; if (creature == null) { return; //The client will send update tile. } tile.RemoveThing(oldStack); Instance.Map.SetTile(tile); tile = Instance.Map.GetTile(newLocation); if (tile == null) { return; } tile.AddThing(creature); Instance.Map.SetTile(tile); //update creature direction if (oldLocation.X > newLocation.X) { creature.LookDirection = Direction.DIRECTION_WEST; creature.TurnDirection = Direction.DIRECTION_WEST; } else if (oldLocation.X < newLocation.X) { creature.LookDirection = Direction.DIRECTION_EAST; creature.TurnDirection = Direction.DIRECTION_EAST; } else if (oldLocation.Y > newLocation.Y) { creature.LookDirection = Direction.DIRECTION_NORTH; creature.TurnDirection = Direction.DIRECTION_NORTH; } else if (oldLocation.Y < newLocation.Y) { creature.LookDirection = Direction.DIRECTION_SOUTH; creature.TurnDirection = Direction.DIRECTION_SOUTH; } } }
private static void ParseAnimatedText(InputMessage input) { input.getLocation(); input.getByte(); input.getString(); }
private static void ParseDistanceShoot(InputMessage input) { input.getLocation(); input.getLocation(); input.getByte(); }