public static void SetSenderInfo(StreamEntry entry, LogicClientAvatar avatar) { entry.SetSenderAvatarId(avatar.GetId()); entry.SetSenderHomeId(avatar.GetCurrentHomeId()); entry.SetSenderName(avatar.GetName()); entry.SetSenderLevel(avatar.GetExpLevel()); entry.SetSenderLeagueType(avatar.GetLeagueType()); entry.SetSenderRole(avatar.GetAllianceRole()); }
public override int Execute(LogicLevel level) { LogicClientAvatar playerAvatar = level.GetPlayerAvatar(); if (playerAvatar != null) { if (this.m_allianceCreate) { LogicGlobals globals = LogicDataTables.GetGlobals(); LogicResourceData resource = globals.GetAllianceCreateResourceData(); int removeCount = LogicMath.Min(globals.GetAllianceCreateCost(), playerAvatar.GetResourceCount(resource)); playerAvatar.CommodityCountChangeHelper(0, resource, -removeCount); } playerAvatar.SetAllianceId(this.m_allianceId.Clone()); playerAvatar.SetAllianceName(this.m_allianceName); playerAvatar.SetAllianceBadgeId(this.m_allianceBadgeId); playerAvatar.SetAllianceLevel(this.m_allianceExpLevel); playerAvatar.SetAllianceRole(this.m_allianceCreate ? LogicAvatarAllianceRole.LEADER : LogicAvatarAllianceRole.MEMBER); playerAvatar.GetChangeListener().AllianceJoined(playerAvatar.GetAllianceId(), this.m_allianceName, this.m_allianceBadgeId, this.m_allianceExpLevel, playerAvatar.GetAllianceRole()); LogicGameListener gameListener = level.GetGameListener(); if (gameListener != null) { if (this.m_allianceCreate) { gameListener.AllianceCreated(); } else { gameListener.AllianceJoined(); } } return(0); } return(-1); }
/// <summary> /// Sets the data. /// </summary> public void SetData(LogicClientAvatar avatar) { this._avatarId = avatar.GetId(); this._homeId = avatar.GetCurrentHomeId(); this._avatarName = avatar.GetName(); this._facebookId = avatar.GetFacebookId(); this._expLevel = avatar.GetExpLevel(); this._leagueType = avatar.GetLeagueType(); this._nameChangeState = avatar.GetNameChangeState(); this._nameSetByUser = avatar.GetNameSetByUser(); if (avatar.IsInAlliance()) { this._allianceId = avatar.GetAllianceId(); this._allianceName = avatar.GetAllianceName(); this._allianceExpLevel = avatar.GetAllianceExpLevel(); this._allianceRole = avatar.GetAllianceRole(); this._badgeId = avatar.GetAllianceBadge(); } }