public static SquadMsg CreateAcceptJoinRequestMessage(string requesterId, string biSource, SquadController.ActionCallback callback, object cookie) { SquadMsg squadMsg = SquadMsgUtils.CreateMemberIdMessage(requesterId, SquadAction.AcceptApplicationToJoin, callback, cookie); squadMsg.BISource = biSource; return(squadMsg); }
public static SquadMsg CreatePromoteMemberMessage(string memberId, SquadController.ActionCallback callback, object cookie) { SquadMsg squadMsg = SquadMsgUtils.CreateMemberIdMessage(memberId, SquadAction.PromoteMember, callback, cookie); squadMsg.MemberData.MemberRole = SquadRole.Officer; return(squadMsg); }
public static SquadMsg CreateJoinSquadMessage(string squadId, string biSource, SquadController.ActionCallback callback, object cookie) { SquadMsg squadMsg = SquadMsgUtils.CreateSquadMessage(squadId, SquadAction.Join, callback, cookie); squadMsg.BISource = biSource; return(squadMsg); }
public static SquadMsg CreateApplyToJoinSquadMessage(string squadId, string message, SquadController.ActionCallback callback, object cookie) { SqmRequestData sqmRequestData = new SqmRequestData(); sqmRequestData.Text = message; SquadMsg squadMsg = SquadMsgUtils.CreateSquadMessage(squadId, SquadAction.ApplyToJoin, callback, cookie); squadMsg.RequestData = sqmRequestData; return(squadMsg); }
private static SquadMsg CreateSquadMessage(string squadId, SquadAction action, SquadController.ActionCallback callback, object cookie) { SqmSquadData sqmSquadData = new SqmSquadData(); sqmSquadData.Id = squadId; SquadMsg squadMsg = SquadMsgUtils.CreateActionMessage(action, callback, cookie); squadMsg.SquadData = sqmSquadData; return(squadMsg); }
public static SquadMsg CreateShareReplayMessage(string message, BattleEntry entry) { SqmReplayData sqmReplayData = new SqmReplayData(); sqmReplayData.BattleId = entry.RecordID; sqmReplayData.Text = message; SquadMsg squadMsg = SquadMsgUtils.CreateActionMessage(SquadAction.ShareReplay, null, null); squadMsg.ReplayData = sqmReplayData; return(squadMsg); }
public static SquadMsg CreateSendReplayMessage(string battleId, string message) { SqmReplayData sqmReplayData = new SqmReplayData(); sqmReplayData.BattleId = battleId; sqmReplayData.Text = message; SquadMsg squadMsg = SquadMsgUtils.CreateActionMessage(SquadAction.ShareReplay, null, null); squadMsg.ReplayData = sqmReplayData; return(squadMsg); }
public static SquadMsg CreateRequestTroopsMessage(bool payToSkip, int resendCrystalCost, string message) { SqmRequestData sqmRequestData = new SqmRequestData(); sqmRequestData.PayToSkip = payToSkip; sqmRequestData.ResendCrystalCost = resendCrystalCost; sqmRequestData.Text = message; SquadMsg squadMsg = SquadMsgUtils.CreateActionMessage(SquadAction.RequestTroops, null, null); squadMsg.RequestData = sqmRequestData; return(squadMsg); }
public static SquadMsg CreateSendInviteMessage(string recipientId, string fbFriendId, string fbAccessToken, SquadController.ActionCallback callback, object cookie) { SqmFriendInviteData sqmFriendInviteData = new SqmFriendInviteData(); sqmFriendInviteData.PlayerId = recipientId; sqmFriendInviteData.FacebookFriendId = fbFriendId; sqmFriendInviteData.FacebookAccessToken = fbAccessToken; SquadMsg squadMsg = SquadMsgUtils.CreateActionMessage(SquadAction.SendInviteToJoin, callback, cookie); squadMsg.FriendInviteData = sqmFriendInviteData; return(squadMsg); }
public static SquadMsg CreateDonateMessage(string recipientId, Dictionary <string, int> donations, int donationCount, string requestId, SquadController.ActionCallback callback, object cookie) { CurrentPlayer currentPlayer = Service.CurrentPlayer; SquadMsg squadMsg = SquadMsgUtils.CreateMemberIdMessage(currentPlayer.PlayerId, SquadAction.DonateTroops, callback, cookie); SqmDonationData sqmDonationData = new SqmDonationData(); squadMsg.DonationData = sqmDonationData; sqmDonationData.RecipientId = recipientId; sqmDonationData.Donations = donations; sqmDonationData.DonationCount = donationCount; sqmDonationData.RequestId = requestId; return(squadMsg); }
private static SquadMsg CreateSquadMessage(string name, string description, string symbolName, int scoreReq, bool openEnrollment, SquadAction action, SquadController.ActionCallback callback, object cookie) { SqmSquadData sqmSquadData = new SqmSquadData(); sqmSquadData.Name = name; sqmSquadData.Desc = description; sqmSquadData.Icon = symbolName; sqmSquadData.MinTrophies = scoreReq; sqmSquadData.Open = openEnrollment; SquadMsg squadMsg = SquadMsgUtils.CreateActionMessage(action, callback, cookie); squadMsg.SquadData = sqmSquadData; return(squadMsg); }
public static SquadMsg CreateStartMatchmakingMessage(List <string> memberIds, bool allowSameFaction) { SqmWarParticipantData sqmWarParticipantData = new SqmWarParticipantData(); int i = 0; int count = memberIds.Count; while (i < count) { sqmWarParticipantData.Participants.Add(memberIds[i]); i++; } sqmWarParticipantData.AllowSameFactionMatchMaking = allowSameFaction; SquadMsg squadMsg = SquadMsgUtils.CreateActionMessage(SquadAction.StartWarMatchmaking, null, null); squadMsg.WarParticipantData = sqmWarParticipantData; return(squadMsg); }
public static SquadMsg CreateEditSquadMessage(string description, string symbolName, int scoreReq, bool openEnrollment, SquadController.ActionCallback callback, object cookie) { return(SquadMsgUtils.CreateSquadMessage(null, description, symbolName, scoreReq, openEnrollment, SquadAction.Edit, callback, cookie)); }
public static SquadMsg CreateRejectSquadInviteMessage(string squadId, SquadController.ActionCallback callback, object cookie) { return(SquadMsgUtils.CreateSquadMessage(squadId, SquadAction.RejectInviteToJoin, callback, cookie)); }
public static SquadMsg CreateLeaveSquadMessage(SquadController.ActionCallback callback, object cookie) { return(SquadMsgUtils.CreateActionMessage(SquadAction.Leave, callback, cookie)); }
public static SquadMsg CreateRemoveMemberMessage(string memberId, SquadController.ActionCallback callback, object cookie) { return(SquadMsgUtils.CreateMemberIdMessage(memberId, SquadAction.RemoveMember, callback, cookie)); }
public static SquadMsg GenerateMessageFromServerMessageObject(object messageObj) { Dictionary <string, object> dictionary = messageObj as Dictionary <string, object>; if (dictionary == null) { return(null); } SquadMsg squadMsg = new SquadMsg(); if (dictionary.ContainsKey("notification")) { squadMsg = SquadMsgUtils.GenerateMessageFromNotifObject(dictionary["notification"]); if (dictionary.ContainsKey("guildId")) { if (squadMsg.SquadData == null) { squadMsg.SquadData = new SqmSquadData(); } squadMsg.SquadData.Id = Convert.ToString(dictionary["guildId"]); if (dictionary.ContainsKey("guildName")) { squadMsg.SquadData.Name = WWW.UnEscapeURL(Convert.ToString(dictionary["guildName"])); } } return(squadMsg); } if (dictionary.ContainsKey("serverTime")) { squadMsg.TimeSent = Convert.ToUInt32(dictionary["serverTime"]); } if (dictionary.ContainsKey("event")) { string name = Convert.ToString(dictionary["event"]); squadMsg.Type = StringUtils.ParseEnum <SquadMsgType>(name); } if (dictionary.ContainsKey("guildId")) { SqmSquadData sqmSquadData = new SqmSquadData(); squadMsg.SquadData = sqmSquadData; sqmSquadData.Id = Convert.ToString(dictionary["guildId"]); if (dictionary.ContainsKey("guildName")) { sqmSquadData.Name = WWW.UnEscapeURL(Convert.ToString(dictionary["guildName"])); } } if (dictionary.ContainsKey("senderId")) { SqmFriendInviteData sqmFriendInviteData = new SqmFriendInviteData(); squadMsg.FriendInviteData = sqmFriendInviteData; sqmFriendInviteData.SenderId = Convert.ToString(dictionary["senderId"]); if (dictionary.ContainsKey("senderName")) { sqmFriendInviteData.SenderName = Convert.ToString(dictionary["senderName"]); } } if (dictionary.ContainsKey("recipientId")) { if (squadMsg.FriendInviteData == null) { squadMsg.FriendInviteData = new SqmFriendInviteData(); } squadMsg.FriendInviteData.PlayerId = Convert.ToString(dictionary["recipientId"]); } if (dictionary.ContainsKey("warId")) { SqmWarEventData sqmWarEventData = new SqmWarEventData(); squadMsg.WarEventData = sqmWarEventData; sqmWarEventData.WarId = Convert.ToString(dictionary["warId"]); if (dictionary.ContainsKey("empireName")) { sqmWarEventData.EmpireSquadName = Convert.ToString(dictionary["empireName"]); } if (dictionary.ContainsKey("empireScore")) { sqmWarEventData.EmpireScore = Convert.ToInt32(dictionary["empireScore"]); } if (dictionary.ContainsKey("rebelName")) { sqmWarEventData.RebelSquadName = Convert.ToString(dictionary["rebelName"]); } if (dictionary.ContainsKey("rebelScore")) { sqmWarEventData.RebelScore = Convert.ToInt32(dictionary["rebelScore"]); } if (dictionary.ContainsKey("buffBaseUid")) { sqmWarEventData.BuffBaseUid = Convert.ToString(dictionary["buffBaseUid"]); } if (dictionary.ContainsKey("empireCrateTier")) { sqmWarEventData.EmpireCrateId = Convert.ToString(dictionary["empireCrateTier"]); } else if (dictionary.ContainsKey("empireCrateId")) { sqmWarEventData.EmpireCrateId = Convert.ToString(dictionary["empireCrateId"]); } if (dictionary.ContainsKey("rebelCrateTier")) { sqmWarEventData.RebelCrateId = Convert.ToString(dictionary["rebelCrateTier"]); } else if (dictionary.ContainsKey("rebelCrateId")) { sqmWarEventData.RebelCrateId = Convert.ToString(dictionary["rebelCrateId"]); } } if (dictionary.ContainsKey("level") || dictionary.ContainsKey("totalRepInvested")) { SquadMsgUtils.AddSquadLevelToSquadMessageData(dictionary, squadMsg); } if (dictionary.ContainsKey("perkId")) { SquadMsgUtils.AddPerkUnlockUpgrdeDataToSquadMessageData(dictionary, squadMsg); } return(squadMsg); }
public static SquadMsg CreateRejectJoinRequestMessage(string requesterId, SquadController.ActionCallback callback, object cookie) { return(SquadMsgUtils.CreateMemberIdMessage(requesterId, SquadAction.RejectApplicationToJoin, callback, cookie)); }
public static SquadMsg CreateCancelMatchmakingMessage() { return(SquadMsgUtils.CreateActionMessage(SquadAction.CancelWarMatchmaking, null, null)); }
public static SquadMsg GenerateMessageFromNotifObject(object notif) { Dictionary <string, object> dictionary = notif as Dictionary <string, object>; if (dictionary == null) { return(null); } SquadMsg squadMsg = new SquadMsg(); if (dictionary.ContainsKey("id")) { squadMsg.NotifId = Convert.ToString(dictionary["id"]); } if (dictionary.ContainsKey("date")) { squadMsg.TimeSent = Convert.ToUInt32(dictionary["date"]); } if (dictionary.ContainsKey("type")) { string name = Convert.ToString(dictionary["type"]); squadMsg.Type = StringUtils.ParseEnum <SquadMsgType>(name); } if (dictionary.ContainsKey("playerId")) { SqmOwnerData sqmOwnerData = new SqmOwnerData(); squadMsg.OwnerData = sqmOwnerData; sqmOwnerData.PlayerId = Convert.ToString(dictionary["playerId"]); if (dictionary.ContainsKey("name")) { sqmOwnerData.PlayerName = Convert.ToString(dictionary["name"]); } } if (dictionary.ContainsKey("message")) { SqmChatData sqmChatData = new SqmChatData(); squadMsg.ChatData = sqmChatData; sqmChatData.Message = WWW.UnEscapeURL(Convert.ToString(dictionary["message"])); } if (dictionary.ContainsKey("data")) { Dictionary <string, object> dictionary2 = dictionary["data"] as Dictionary <string, object>; if (dictionary2 != null) { if (dictionary2.ContainsKey("senderName")) { SqmFriendInviteData sqmFriendInviteData = new SqmFriendInviteData(); squadMsg.FriendInviteData = sqmFriendInviteData; sqmFriendInviteData.SenderName = Convert.ToString(dictionary2["senderName"]); } if (dictionary2.ContainsKey("toRank")) { SqmMemberData sqmMemberData = new SqmMemberData(); squadMsg.MemberData = sqmMemberData; string name2 = Convert.ToString(dictionary2["toRank"]); sqmMemberData.MemberRole = StringUtils.ParseEnum <SquadRole>(name2); } if (dictionary2.ContainsKey("acceptor")) { SqmApplyData sqmApplyData = new SqmApplyData(); squadMsg.ApplyData = sqmApplyData; sqmApplyData.AcceptorId = Convert.ToString(dictionary2["acceptor"]); } if (dictionary2.ContainsKey("rejector")) { SqmApplyData sqmApplyData2 = new SqmApplyData(); squadMsg.ApplyData = sqmApplyData2; sqmApplyData2.RejectorId = Convert.ToString(dictionary2["rejector"]); } if (dictionary2.ContainsKey("battleId")) { SqmReplayData sqmReplayData = new SqmReplayData(); squadMsg.ReplayData = sqmReplayData; sqmReplayData.BattleId = Convert.ToString(dictionary2["battleId"]); if (dictionary2.ContainsKey("battleVersion")) { sqmReplayData.BattleVersion = Convert.ToString(dictionary2["battleVersion"]); } if (dictionary2.ContainsKey("cmsVersion")) { sqmReplayData.CMSVersion = Convert.ToString(dictionary2["cmsVersion"]); } if (dictionary2.ContainsKey("type")) { string name3 = Convert.ToString(dictionary2["type"]); sqmReplayData.BattleType = StringUtils.ParseEnum <SquadBattleReplayType>(name3); } if (dictionary2.ContainsKey("battleScoreDelta")) { object obj = dictionary2["battleScoreDelta"]; if (obj != null) { sqmReplayData.MedalDelta = Convert.ToInt32(obj); } } if (dictionary2.ContainsKey("damagePercent")) { sqmReplayData.DamagePercent = Convert.ToInt32(dictionary2["damagePercent"]); } if (dictionary2.ContainsKey("stars")) { sqmReplayData.Stars = Convert.ToInt32(dictionary2["stars"]); } if (dictionary2.ContainsKey("opponentId")) { sqmReplayData.OpponentId = Convert.ToString(dictionary2["opponentId"]); } if (dictionary2.ContainsKey("opponentName")) { sqmReplayData.OpponentName = Convert.ToString(dictionary2["opponentName"]); } if (dictionary2.ContainsKey("opponentFaction")) { string name4 = Convert.ToString(dictionary2["opponentFaction"]); sqmReplayData.OpponentFaction = StringUtils.ParseEnum <FactionType>(name4); } if (dictionary2.ContainsKey("faction")) { string name5 = Convert.ToString(dictionary2["faction"]); sqmReplayData.SharerFaction = StringUtils.ParseEnum <FactionType>(name5); } } if (dictionary2.ContainsKey("totalCapacity")) { SqmRequestData sqmRequestData = new SqmRequestData(); squadMsg.RequestData = sqmRequestData; sqmRequestData.TotalCapacity = Convert.ToInt32(dictionary2["totalCapacity"]); if (dictionary2.ContainsKey("amount")) { sqmRequestData.StartingAvailableCapacity = Convert.ToInt32(dictionary2["amount"]); } if (dictionary2.ContainsKey("warId")) { sqmRequestData.WarId = Convert.ToString(dictionary2["warId"]); } if (dictionary2.ContainsKey("troopDonationLimit")) { sqmRequestData.TroopDonationLimit = Convert.ToInt32(dictionary2["troopDonationLimit"]); } else { Service.Logger.Error("Missing troop request data param: troopDonationLimitdefaulting to " + GameConstants.MAX_PER_USER_TROOP_DONATION); sqmRequestData.TroopDonationLimit = GameConstants.MAX_PER_USER_TROOP_DONATION; } } if (dictionary2.ContainsKey("troopsDonated")) { SqmDonationData sqmDonationData = new SqmDonationData(); squadMsg.DonationData = sqmDonationData; Dictionary <string, object> dictionary3 = dictionary2["troopsDonated"] as Dictionary <string, object>; if (dictionary3 != null) { sqmDonationData.Donations = new Dictionary <string, int>(); foreach (KeyValuePair <string, object> current in dictionary3) { string key = current.Key; int value = Convert.ToInt32(current.Value); sqmDonationData.Donations.Add(key, value); } } if (dictionary2.ContainsKey("requestId")) { sqmDonationData.RequestId = Convert.ToString(dictionary2["requestId"]); } if (dictionary2.ContainsKey("recipientId")) { sqmDonationData.RecipientId = Convert.ToString(dictionary2["recipientId"]); } if (dictionary2.ContainsKey("amount")) { sqmDonationData.DonationCount = Convert.ToInt32(dictionary2["amount"]); } } if (dictionary2.ContainsKey("warId")) { SqmWarEventData sqmWarEventData = new SqmWarEventData(); squadMsg.WarEventData = sqmWarEventData; sqmWarEventData.WarId = Convert.ToString(dictionary2["warId"]); if (dictionary2.ContainsKey("buffBaseUid")) { sqmWarEventData.BuffBaseUid = Convert.ToString(dictionary2["buffBaseUid"]); } if (dictionary2.ContainsKey("captured")) { sqmWarEventData.BuffBaseCaptured = Convert.ToBoolean(dictionary2["captured"]); } if (dictionary2.ContainsKey("opponentId")) { sqmWarEventData.OpponentId = Convert.ToString(dictionary2["opponentId"]); } if (dictionary2.ContainsKey("opponentName")) { sqmWarEventData.OpponentName = Convert.ToString(dictionary2["opponentName"]); } if (dictionary2.ContainsKey("stars")) { sqmWarEventData.StarsEarned = Convert.ToInt32(dictionary2["stars"]); } if (dictionary2.ContainsKey("victoryPoints")) { sqmWarEventData.VictoryPointsTaken = Convert.ToInt32(dictionary2["victoryPoints"]); } if (dictionary2.ContainsKey("attackExpirationDate")) { sqmWarEventData.AttackExpirationTime = Convert.ToUInt32(dictionary2["attackExpirationDate"]); } } if (dictionary2.ContainsKey("level") || dictionary2.ContainsKey("totalRepInvested")) { SquadMsgUtils.AddSquadLevelToSquadMessageData(dictionary2, squadMsg); } if (dictionary2.ContainsKey("perkId")) { SquadMsgUtils.AddPerkUnlockUpgrdeDataToSquadMessageData(dictionary2, squadMsg); } } } return(squadMsg); }