public int GetDonationLimit(int allianceLevel) { if (allianceLevel > 0) { LogicAllianceLevelData allianceLevelData = LogicDataTables.GetAllianceLevel(allianceLevel); if (allianceLevelData != null) { return(allianceLevelData.GetTroopDonationLimit()); } } return(LogicDataTables.GetGlobals().GetMaxTroopDonationCount()); }
public static int GetMaxUnitDonationCount(int allianceLevel, int unitType) { if (unitType == 1) { return(LogicDataTables.GetGlobals().GetMaxSpellDonationCount()); } if (allianceLevel > 0) { LogicAllianceLevelData allianceLevelData = LogicDataTables.GetAllianceLevel(allianceLevel); if (allianceLevelData != null) { return(allianceLevelData.GetTroopDonationLimit()); } } return(LogicDataTables.GetGlobals().GetMaxTroopDonationCount()); }
public override int GetMax(int idx) { int multiplierPercent = 100; if (this.m_parent.GetLevel().GetHomeOwnerAvatar() != null) { if (this.m_parent.GetLevel().GetHomeOwnerAvatar().IsClientAvatar()) { int allianceExpLevel = ((LogicClientAvatar)this.m_parent.GetLevel().GetHomeOwnerAvatar()).GetAllianceLevel(); if (allianceExpLevel > 0) { multiplierPercent = LogicDataTables.GetAllianceLevel(allianceExpLevel).GetWarLootCapacityPercent(); } } } return(multiplierPercent * this.m_maxResourceCount[idx] / 100); }
private static void OnAllianceUnitDonateResponseMessageReceived(AllianceUnitDonateResponseMessage message) { if (AllianceManager.TryGet(message.AccountId, out Alliance alliance)) { StreamEntry streamEntry = StreamManager.GetAllianceStream(message.StreamId); if (streamEntry != null) { DonateStreamEntry donateStreamEntry = (DonateStreamEntry)streamEntry; if (message.Success) { LogicAllianceLevelData allianceLevel = LogicDataTables.GetAllianceLevel(alliance.Header.GetAllianceLevel()); LogicAllianceUnitReceivedCommand logicAllianceUnitReceivedCommand = new LogicAllianceUnitReceivedCommand(); logicAllianceUnitReceivedCommand.SetData(message.MemberName, message.Data, LogicMath.Clamp(message.UpgradeLevel + allianceLevel.GetTroopDonationUpgrade(), 0, message.Data.GetUpgradeLevelCount() - 1)); ServerMessageManager.SendMessage(new GameAllowServerCommandMessage { AccountId = donateStreamEntry.GetSenderAvatarId(), ServerCommand = logicAllianceUnitReceivedCommand }, 9); } else { donateStreamEntry.RemoveDonation(message.MemberId, message.Data, message.UpgradeLevel); alliance.UpdateStreamEntry(donateStreamEntry); } donateStreamEntry.SetDonationPendingRequestCount(donateStreamEntry.GetDonationPendingRequestCount() - 1); if (donateStreamEntry.IsCastleFull() && donateStreamEntry.GetDonationPendingRequestCount() <= 0) { alliance.RemoveStreamEntry(donateStreamEntry.GetId()); AllianceManager.Save(alliance); } else { StreamManager.Save(donateStreamEntry); } } } }