public ClientState(PacketStream InStream) { this.InStream = InStream; FileStream datFile = new FileStream("./Tibia.dat", FileMode.Open); FileStream sprFile = new FileStream("./Tibia.spr", FileMode.Open); GameData = new TibiaGameData(datFile, sprFile); Protocol = new TibiaGameProtocol(GameData); Viewport = new ClientViewport(GameData, Protocol); }
public ClientViewport(TibiaGameData GameData, TibiaGameProtocol Protocol) { this.GameData = GameData; this.Protocol = Protocol; DefaultChannel = new ClientChannel(0, "Default"); this.Channels[0] = DefaultChannel; for (int i = 0; i < 12; ++i) { Inventory.Add(null); } Protocol.PlayerLogin.Add(OnPlayerLogin); Protocol.UpdateSkills.Add(OnUpdateSkills); Protocol.UpdateStats.Add(OnUpdateStats); Protocol.PlayerIcons.Add(OnPlayerIcons); Protocol.MapDescription.Add(OnMapDescription); Protocol.MoveNorth.Add(OnMapDescription); Protocol.MoveWest.Add(OnMapDescription); Protocol.MoveSouth.Add(OnMapDescription); Protocol.MoveEast.Add(OnMapDescription); Protocol.FloorUp.Add(OnMapDescription); Protocol.FloorDown.Add(OnMapDescription); Protocol.AddThing.Add(OnAddThing); Protocol.RemoveThing.Add(OnRemoveThing); Protocol.RefreshTile.Add(OnRefreshTile); Protocol.TransformThing.Add(OnTransformThing); Protocol.CreatureMove.Add(OnCreatureMove); Protocol.CreatureTurn.Add(OnCreatureTurn); Protocol.CreatureSpeed.Add(OnCreatureSpeed); Protocol.CreatureShield.Add(OnCreatureShield); Protocol.CreatureSkull.Add(OnCreatureSkull); Protocol.CreatureHealth.Add(OnCreatureHealth); Protocol.CreatureTurn.Add(OnCreatureLight); Protocol.CreatureSpeak.Add(OnCreatureSpeak); Protocol.OpenChannel.Add(OnOpenChannel); Protocol.OpenPrivateChat.Add(OnOpenPrivateChat); Protocol.TextMessage.Add(OnTextMessage); Protocol.VIPState.Add(OnVIPState); Protocol.VIPLogin.Add(OnVIPLogin); Protocol.VIPLogout.Add(OnVIPLogout); Protocol.UpdateInventory.Add(OnUpdateInventory); Protocol.ClearInventory.Add(OnClearInventory); Protocol.OpenContainer.Add(OnOpenContainer); Protocol.CloseContainer.Add(OnCloseContainer); Protocol.ContainerAddItem.Add(OnContainerAddItem); Protocol.ContainerRemoveItem.Add(OnContainerRemoveItem); Protocol.ContainerTransformItem.Add(OnContainerTransformItem); }