public static AskForCardUsageResponse Parse(int id, ISkill skill, List <Card> cards, List <Player> players, int wrtPlayerId) { AskForCardUsageResponse response = new AskForCardUsageResponse(); response.Id = id; response.SkillItem = SkillItem.Parse(skill); if (cards == null) { response.CardItems = null; } else { response.CardItems = new List <CardItem>(); foreach (var card in cards) { response.CardItems.Add(CardItem.Parse(card, wrtPlayerId)); } } if (players == null) { response.PlayerItems = null; } else { response.PlayerItems = new List <PlayerItem>(); foreach (var player in players) { response.PlayerItems.Add(PlayerItem.Parse(player)); } } return(response); }
public void MoveHandCard(int from, int to) { networkService.Send(new HandCardMovementNotification() { From = from, To = to, PlayerItem = PlayerItem.Parse(SelfId) }); }
public static DeckPlaceItem Parse(DeckPlace dp) { DeckPlaceItem dpi = new DeckPlaceItem(); dpi.PlayerItem = PlayerItem.Parse(dp.Player); dpi.DeckName = dp.DeckType.AbbriviatedName; return(dpi); }
public void SendMultipleCardUsageResponded(Player player) { for (int i = 0; i < server.MaxClients; i++) { server.SendPacket(i, new MultiCardUsageResponded() { PlayerItem = PlayerItem.Parse(player) }); } }
public static SkillItem Parse(ISkill skill) { if (skill == null) { return(null); } SkillItem result; if (skill is CheatSkill) { CheatSkillItem csi = new CheatSkillItem(); CheatSkill cs = skill as CheatSkill; result = csi; csi.CardId = cs.CardId; csi.CheatType = (int)cs.CheatType; csi.SkillName = cs.SkillName; } else if (skill is IAdditionalTypedSkill) { var atsi = new AdditionalTypedSkillItem(); var ats = skill as IAdditionalTypedSkill; result = atsi; atsi.AdditionalTypeId = GameEngine.Serialize(ats.AdditionalType); } else { result = new SkillItem(); } result.PlayerItem = PlayerItem.Parse(skill.Owner); if (skill.Owner != null) { result.SkillId = (byte)skill.Owner.ActionableSkills.IndexOf(skill); } return(result); }