public static double GetStanding(this IStandingHandler standingHandler, long sourceEID, long targetEID) { double standing; standingHandler.TryGetStanding(sourceEID, targetEID, out standing); return(standing); }
public MissionAdministrator(MissionProcessor missionProcessor, MissionDataCache missionDataCache, IStandingHandler standingHandler, MissionInProgress.Factory missionInProgressFactory) { _missionProcessor = missionProcessor; _missionDataCache = missionDataCache; _standingHandler = standingHandler; _missionInProgressFactory = missionInProgressFactory; }
public static double GetStandingServerEntityToPlayerHierarchy(this IStandingHandler standingHandler, long serverEntityEid, Character character) { var playersCorporationEid = character.CorporationEid; var playersAllianceEid = character.AllianceEid; if (serverEntityEid == playersAllianceEid || serverEntityEid == playersCorporationEid) { //own corp or alliance return(10.0); } double standing; //was standing set for this alliance? if (standingHandler.TryGetStanding(serverEntityEid, playersAllianceEid, out standing)) { //if yes, then it overrides everything return(standing); } //was the standing set for the player's corp? if (standingHandler.TryGetStanding(serverEntityEid, playersCorporationEid, out standing)) { return(standing); } //was the standing set this player? if (standingHandler.TryGetStanding(serverEntityEid, character.Eid, out standing)) { return(standing); } return(0); }
public static void SendStandingToDefaultAlliances(this IStandingHandler standingHandler, Character character) { //refresh standings Message.Builder.SetCommand(Commands.GetStandingForDefaultAlliances) .WithData(standingHandler.GetStandingForDefaultAlliances(character)) .ToCharacter(character) .Send(); }
public static IDictionary <string, object> GetStandingForDefaultCorporations(this IStandingHandler standingHandler, Character character) { return(DefaultCorporationDataCache.GetAllDefaultCorporationEid().ToDictionary("s", corporationEID => { var standing = standingHandler.GetStanding(corporationEID, character.Eid); var entry = new Dictionary <string, object> { { k.eid, corporationEID }, { k.standing, standing } }; return entry; })); }
public static IDictionary <string, object> GetStandingForDefaultAlliances(this IStandingHandler standingHandler, Character character) { return(DefaultCorporationDataCache.GetMegaCorporationEids().ToDictionary("s", allianceEID => { var standing = standingHandler.GetStanding(allianceEID, character.Eid); var entry = new Dictionary <string, object>() { { k.eid, allianceEID }, { k.standing, standing }, }; return entry; })); }
public CorporationManager(IStandingHandler standingHandler, CorporationConfiguration corporationConfiguration, CorporateInvites corporateInvites) { _standingHandler = standingHandler; Settings = corporationConfiguration; Invites = corporateInvites; _timers.Add(new TimerAction(Invites.InviteCycle, TimeSpan.FromSeconds(3.03), true)); _timers.Add(new TimerAction(ScheduleCollectRend, TimeSpan.FromHours(1.07))); //not async _timers.Add(new TimerAction(FinishLeave, TimeSpan.FromSeconds(7.07), true)); _timers.Add(new TimerAction(ScheduleIntrusionIncome, TimeSpan.FromHours(5.013))); //not async }
public PBSTurret(IStandingHandler standingHandler, PBSObjectHelper <PBSTurret> .Factory pbsObjectHelperFactory) { _standingHandler = standingHandler; _pbsObjectHelper = pbsObjectHelperFactory(this); _standingController = new PBSStandingController <PBSTurret>(this) { AlwaysEnabled = true }; _blobHandler = new BlobHandler <PBSTurret>(this); _blobEmitter = new BlobEmitter(this); _reinforceHandler = new PBSReinforceHandler <PBSTurret>(this); _coreUseHandler = new CoreUseHandler <PBSTurret>(this, new EnergyStateFactory(this)); }
public CorporationSetMembersNeutral(IStandingHandler standingHandler) { _standingHandler = standingHandler; }
public ReloadStandingForCharacter(IStandingHandler standingHandler) { _standingHandler = standingHandler; }
public GetStandingForDefaultAlliances(IStandingHandler standingHandler) { _standingHandler = standingHandler; }
public SetStanding(IStandingHandler standingHandler) { _standingHandler = standingHandler; }
public GetStandingForDefaultCorporations(IStandingHandler standingHandler) { _standingHandler = standingHandler; }
public MissionProcessor(MissionDataCache missionDataCache, MissionAdministrator.Factory missionAdministratorFactory, IStandingHandler standingHandler) { MissionAdministrator = missionAdministratorFactory(this); _missionDataCache = missionDataCache; _standingHandler = standingHandler; }
public StandingHistory(IStandingHandler standingHandler) { _standingHandler = standingHandler; }
public SparkUnlock(SparkHelper sparkHelper, IStandingHandler standingHandler) { _sparkHelper = sparkHelper; _standingHandler = standingHandler; }
public CorporationGetReputation(IStandingHandler standingHandler) { _standingHandler = standingHandler; }
public CorporationMyStandings(IStandingHandler standingHandler) { _standingHandler = standingHandler; }
public StandingList(IStandingHandler standingHandler) { _standingHandler = standingHandler; }
public static Task CollectHangarRentAsync(IStandingHandler standingHandler) { return(Task.Run(() => CollectHangarRent(standingHandler))); }
private static void CollectHangarRent(IStandingHandler standingHandler) { var storage = EntityDefault.GetByName(DefinitionNames.PUBLIC_CORPORATE_HANGARS_STORAGE); var hangarEids = Db.Query().CommandText("select eid from entities where parent in (SELECT eid FROM dbo.getLiveDockingbaseChildren() WHERE definition=@hangarDef) order by parent") .SetParameter("@hangarDef", storage.Definition) .Execute() .Select(h => (CorporateHangar)GetOrThrow(h.GetValue <long>(0))) .ToArray(); Logger.Info("--- hangars collected for rent check: " + hangarEids.Count()); using (var scope = Db.CreateTransaction()) { try { foreach (var hangar in hangarEids) { var hangarStorage = hangar.GetHangarStorage(); switch (hangarStorage.GetParentDockingBase()) { case Outpost outpost: { var siteInfo = outpost.GetIntrusionSiteInfo(); if (siteInfo?.Owner != null) { //it has an owner if (hangar.Owner != siteInfo.Owner) { //the owner is not the hangar's owner var dockingStandingLimit = siteInfo.DockingStandingLimit; if (dockingStandingLimit != null) { //the outpost has standing limit set var standingTowardsOwner = standingHandler.GetStanding((long)siteInfo.Owner, hangar.Owner); if (standingTowardsOwner < dockingStandingLimit) { //the hangar is inaccessible Logger.Info("hangar is inaccessible for corp. " + hangar.Owner + " hangaried:" + hangar.Eid + " standing:" + standingTowardsOwner + " dockingStandingLimit:" + dockingStandingLimit); continue; } } } } break; } case PBSDockingBase pbsDockingBase: { if (pbsDockingBase.StandingEnabled) { var standingTowardsOwner = standingHandler.GetStanding(pbsDockingBase.Owner, hangar.Owner); if (standingTowardsOwner < pbsDockingBase.StandingLimit) { Logger.Info("hangar is inaccessible for corp. " + hangar.Owner + " hangaried:" + hangar.Eid + " standing:" + standingTowardsOwner + " dockingStandingLimit:" + pbsDockingBase.StandingLimit); continue; } } break; } } var rentInfo = hangarStorage.GetCorporationHangarRentInfo(); // rent expired? if (hangar.IsLeaseExpired) { continue; } if (DateTime.Now > hangar.LeaseEnd) { var corporation = hangar.GetCorporation(); Logger.Info("--- hangar rent process started for hangarEID:" + hangar.Eid + " hangarName:" + hangar.Name + " corporaration:" + corporation.Eid + " corpname:" + corporation.Description.name); var wallet = new CorporationWallet(corporation); if (wallet.Balance < rentInfo.price) { Logger.Info("--- corporation is broken. corporationEID:" + corporation.Eid + " hangar closed. EID:" + hangar.Eid); //corporation broken hangar.IsLeaseExpired = true; //block the hangar's content //alert accountants var info = new Dictionary <string, object> { { k.containerEID, hangar.Eid } }; Message.Builder.SetCommand(Commands.CorporationHangarRentExpired) .WithData(info) .ToCorporation(corporation, CorporationRole.Accountant) .Send(); } else { wallet.Balance -= rentInfo.price; var b = TransactionLogEvent.Builder() .SetCorporation(corporation) .SetTransactionType(TransactionType.hangarRentAuto) .SetCreditBalance(wallet.Balance) .SetCreditChange(-rentInfo.price); corporation.LogTransaction(b); hangarStorage.GetParentDockingBase().AddCentralBank(TransactionType.hangarRentAuto, rentInfo.price); hangar.LeaseStart = DateTime.Now; hangar.LeaseEnd = DateTime.Now + rentInfo.period; hangar.IsLeaseExpired = false; Logger.Info("--- hangar price paid. hangarEID: " + hangar.Eid + " lease ended:" + hangar.LeaseEnd + " lease extened:" + hangar.LeaseEnd); } hangar.Save(); } else { Logger.Info("--- hangar still paid. eid:" + hangar.Eid + " lease end:" + hangar.LeaseEnd); } } scope.Complete(); } catch (Exception ex) { Logger.Exception(ex); } } }
public ForceFactionStandings(IStandingHandler standingHandler) { _standingHandler = standingHandler; }
public static void Init(MissionDataCache missionDataCache, IStandingHandler standingHandler) { _missionDataCache = missionDataCache; _standingHandler = standingHandler; }
public ForceStanding(IStandingHandler standingHandler) { _standingHandler = standingHandler; }
public Gate(IStandingHandler standingHandler) { _standingHandler = standingHandler; _openState = DynamicProperties.GetProperty(k.state, () => 1); _standingLimit = DynamicProperties.GetProperty(k.standing, () => 0.0); }
/// <summary> /// Matches level with standing /// Used in config mission start /// </summary> /// <param name="character"></param> /// <param name="standingHandler"></param> /// <returns></returns> public bool MatchStandingToLevel(Character character, IStandingHandler standingHandler) { var standing = standingHandler.GetStanding(issuerAllianceEid, character.Eid); return(standing >= MissionLevel); }
public ItemShop(IStandingHandler standingHandler, CharacterWalletFactory characterWalletFactory) { _standingHandler = standingHandler; _characterWalletFactory = characterWalletFactory; }
public bool IsConfigMissionAvailable(Mission mission, IStandingHandler standingHandler, bool ignoreTriggerCheck = false) { //not listable if (!mission.listable) { return(false); } if (mission.LocationId != _location.id) { //not at the requested location return(false); } if (!ignoreTriggerCheck) { //the mission is member of a chain mission if (mission.isTriggered) { return(false); } } if (mission.MissionLevel > 0) { if (!mission.MatchStandingToLevel(_character, standingHandler)) { //standing VS megacorp return(false); } } if (!mission.CheckPeriodicMissions(_periodicMissionTimes)) { //mission was done within the period return(false); } if (!mission.CheckRequiredStandingsToOtherAlliances(_character)) { //standing check failed return(false); } //a finished unique mission can't be listed any more if (mission.isUnique) { if (_finishedMissionIds.Contains(mission.id)) { return(false); } } //required mission check if (mission.RequiredMissions.Any(missionId => !_finishedMissionIds.Contains(missionId))) { return(false); } if (IsCollectorAvailable()) { //currently this mission if (_collector.IsMissionCurrentlyRunning(mission.id)) { return(false); } //if the current mission is not triggered BUT starter of a chain of missions if (!mission.isTriggered) { //get all members of the chain var storyLineMissionMembers = _missionDataCache.GetCompleteMissionLine(mission.id); //check if any of the chain members are running if (storyLineMissionMembers.Count > 0) { if (_collector.AnyMissionFromTheListRunning(storyLineMissionMembers)) { return(false); } } } } if (mission.RequiredExtensions.Any()) { foreach (var requiredExtension in mission.RequiredExtensions) { if (!_character.CheckLearnedExtension(requiredExtension)) { return(false); } } } if (!CheckTutorialMissions(mission)) { return(false); } return(true); }