public void OnHistory(List <KettleHistoryEntry> history) { Console.WriteLine("AI OnHistory called."); if (history[0] is KettleHistoryCreateGame) { KettleHistoryCreateGame kcreate = (KettleHistoryCreateGame)history[0]; KettlePlayer player = kcreate.Players.Where(p => p.AccountId == StartClient.JoinGame.AccountId).First(); PlayerId = player.Entity.EntityId - 1; } }
public void OnHistory(List <KettleHistoryEntry> history) { KettleHistoryCreateGame createGame = history.Where(p => p is KettleHistoryCreateGame).Select(p => p as KettleHistoryCreateGame).FirstOrDefault(); if (createGame != null) { KettlePlayer player = createGame.Players.Where(p => p.AccountId == StartClient.JoinGame.AccountId).First(); PlayerId = player.Entity.EntityId - 1; // TODO create the Game object here, etc } Console.WriteLine("AI OnHistory called."); }
public static KettleHistoryCreateGame CreateGameTest() { var k = new KettleHistoryCreateGame { Game = new KettleEntity { EntityId = 1, Tags = new Dictionary <int, int> { [(int)GameTag.ENTITY_ID] = 1, [(int)GameTag.ZONE] = (int)Zone.PLAY, [(int)GameTag.CARDTYPE] = (int)CardType.GAME, } }, Players = new List <KettlePlayer>(), }; k.Players.Add(new KettlePlayer { Entity = new KettleEntity() { EntityId = 2, Tags = new Dictionary <int, int> { [(int)GameTag.ENTITY_ID] = 2, [(int)GameTag.PLAYER_ID] = 1, [(int)GameTag.HERO_ENTITY] = 4, [(int)GameTag.MAXHANDSIZE] = 10, [(int)GameTag.STARTHANDSIZE] = 4, [(int)GameTag.TEAM_ID] = 1, [(int)GameTag.ZONE] = (int)Zone.PLAY, [(int)GameTag.CONTROLLER] = 1, [(int)GameTag.MAXRESOURCES] = 10, [(int)GameTag.CARDTYPE] = (int)CardType.PLAYER, } }, PlayerId = 1, CardBack = 0 }); k.Players.Add(new KettlePlayer { Entity = new KettleEntity() { EntityId = 3, Tags = new Dictionary <int, int> { [(int)GameTag.ENTITY_ID] = 3, [(int)GameTag.PLAYER_ID] = 2, [(int)GameTag.HERO_ENTITY] = 6, [(int)GameTag.MAXHANDSIZE] = 10, [(int)GameTag.STARTHANDSIZE] = 4, [(int)GameTag.TEAM_ID] = 2, [(int)GameTag.ZONE] = (int)Zone.PLAY, [(int)GameTag.CONTROLLER] = 2, [(int)GameTag.MAXRESOURCES] = 10, [(int)GameTag.CARDTYPE] = (int)CardType.PLAYER, } }, PlayerId = 1, CardBack = 0 }); return(k); }