public override async void Process(Level level) { try { Alliance a = await ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); StreamEntry stream = a.GetChatMessages().Find(c => c.GetId() == MessageID); Level _Sender = await ResourcesManager.GetPlayer(stream.GetSenderId()); int upcomingspace = stream.m_vDonatedTroop + Troop.GetHousingSpace(); if (upcomingspace <= stream.m_vMaxTroop) { DonateAllianceUnitCommand _Donate = new DonateAllianceUnitCommand(); _Donate.SetMessageID(MessageID); _Donate.Tick(level); _Donate.SetUnit(Troop); DonatedAllianceUnitCommand _Donated = new DonatedAllianceUnitCommand(); _Donated.Tick(_Sender); _Donated.SetDonator(level.GetPlayerAvatar().GetAvatarName()); _Donated.SetUnitID(Troop.GetGlobalID()); _Donated.SetUnitLevel(level.GetPlayerAvatar().GetUnitUpgradeLevel(Troop)); AvailableServerCommandMessage availableServerCommandMessage = new AvailableServerCommandMessage(level.GetClient()); availableServerCommandMessage.SetCommandId(4); availableServerCommandMessage.SetCommand(_Donate); AvailableServerCommandMessage ravailableServerCommandMessage = new AvailableServerCommandMessage(_Sender.GetClient()); ravailableServerCommandMessage.SetCommandId(5); ravailableServerCommandMessage.SetCommand(_Donated); StreamEntry _Stream = a.GetChatMessages().Find(c => c.GetId() == MessageID); Level _PreviousPlayer = await ResourcesManager.GetPlayer(_Stream.GetSenderId()); ClientAvatar _PreviousPlayerAvatar = _PreviousPlayer.GetPlayerAvatar(); _Stream.AddDonatedTroop(level.GetPlayerAvatar().GetId(), Troop.GetGlobalID(), 1, level.GetPlayerAvatar().GetUnitUpgradeLevel(Troop)); int _Capicity = Troop.GetHousingSpace(); _Stream.AddUsedCapicity(_Capicity); _PreviousPlayerAvatar.SetAllianceCastleUsedCapacity(_PreviousPlayerAvatar.GetAllianceCastleUsedCapacity() + _Capicity); _PreviousPlayerAvatar.AddAllianceTroop(level.GetPlayerAvatar().GetId(), Troop.GetGlobalID(), 1, level.GetPlayerAvatar().GetUnitUpgradeLevel(Troop)); //PacketProcessor.Send(availableServerCommandMessage); if (ResourcesManager.IsPlayerOnline(_Sender)) { PacketProcessor.Send(ravailableServerCommandMessage); } foreach (AllianceMemberEntry op in a.GetAllianceMembers()) { Level player = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (player.GetClient() != null) { AllianceStreamEntryMessage c = new AllianceStreamEntryMessage(player.GetClient()); c.SetStreamEntry(_Stream); PacketProcessor.Send(c); } } } } catch (Exception) { } }