public override void Evaluate(Solution solution) { var s = (IntergenSolution)solution; var doubleVal = new double[Model.Setting.NumberOfFeatures]; var interacVal = new double[Model.Setting.NumberOfInteractions]; var values = new XReal(solution); for (var i = 0; i < Model.Setting.NumberOfFeatures; i++) { doubleVal[i] = values.GetValue(i); } for (var i = 0; i < Model.Setting.NumberOfInteractions; i++) { interacVal[i] = values.GetValue(i + Model.Setting.NumberOfFeatures); } //the distribution from the NSGA2 var nsgaFv = new Distribution(doubleVal); var interacDist = new Distribution(interacVal); var variantValuesWithoutInteraction = FeatureMatrix.Dot(doubleVal); var interacVals = InteractionMatrix.Dot(interacVal); var variantResults = variantValuesWithoutInteraction.Add(interacVals); var variantResult = new Distribution(variantResults); var fc = new FitnessCalculator(Model, s.FoundAtEval); var fitnessValues = fc.Calculate(null, null, null, null, interacDist, InteractionTarget); solution.Objective[0] = fitnessValues.InteracVal; FitnessTracker.AddInterac(s.FoundAtEval, fitnessValues.InteracVal); }
public ItemDropInfo(bool lucky, string itemClassString, bool isStoryDrop, string ename) { this.lucky = lucky; if (itemClassString.Contains("/")) { char[] separator = new char[] { '/' }; string[] array = itemClassString.Split(separator); if (array.Length == 2) { this.itemClass = array[0]; this.count = int.Parse(array[1]); } else if (array.Length == 3) { this.itemClass = array[0]; this.count = new Random().Next(int.Parse(array[1]), int.Parse(array[2])); } } else { this.itemClass = itemClassString; this.count = 1; } if (!FeatureMatrix.IsEnable("MultipleItemDrop")) { this.count = 1; } this.isStoryDrop = isStoryDrop; this.entityName = ename; this.isDropped = false; }
public void UnregisterPlayer(DSPlayer player) { if (player.WaitingParty != null) { DSWaitingParty waitingParty = player.WaitingParty; waitingParty.RemovePlayer(player); if (waitingParty.Members.Count == 0) { this.WaitingParties.Remove(waitingParty.Node); if (FeatureMatrix.IsEnable("DSDynamicLoad") && this.WaitingParties.Count == 0) { DSService.Instance.DSEntityMakerSystem.Dequeue(this.ID, this.DSType); } } this.Process(this.WaitingParties.First); return; } if (player.Ship != null) { DSShip ship = player.Ship; ship.RemovePlayer(player); if (ship.HasEmptySlot) { this.Process(this.WaitingParties.First); } } }
public NotifyRandomItem() { this.IsTelepathyEnable = true; this.IsUIEnable = true; this.IsTownOnly = FeatureMatrix.IsEnable("RandomItemBroadcastMode"); this.AnnounceLevel = FeatureMatrix.GetInteger("RandomItem_AnnounceLevel"); }
public override IEnumerable <object> Run() { GuildStorageManager storage = base.Entity.Storage; if (!base.Entity.Storage.Valid || !FeatureMatrix.IsEnable("GuildStorage") || base.Entity.Storage.Processing) { base.Finished = true; yield return(new FailMessage("[HandleGuildStorageSessionProcessor] Entity.Storage.Processing") { Reason = FailMessage.ReasonCode.LogicalFail }); } else { OnlineGuildMember member = base.Entity.GetOnlineMember(base.Operation.RequestingCID); if (member != null) { member.IsGuildStorageListening = base.Operation.IsStarting; if (member.IsGuildStorageListening) { member.SendGuildStorageInfoMessage(); member.SendGuildStorageLogsMessage(true); member.SendGuildStorageLogsMessage(false); } } base.Finished = true; yield return(new OkMessage()); } yield break; }
internal void MakeTcProtectRequest() { if (this.Handle.IsClosed) { this.Entity.Close(); return; } if (this.FrontendConn == null) { this.Entity.Close(); return; } if (FeatureMatrix.IsEnable("TcProtect")) { TcProtectRequestMessage serializeObject = new TcProtectRequestMessage(this.Service.TcProtectMd5, this.Service.TcProtectEncoded); this.FrontendConn.RequestOperation(SendPacket.Create <TcProtectRequestMessage>(serializeObject)); if (!FeatureMatrix.IsEnable("RepeatTcProtectCheckOff")) { Log <HackShieldService> .Logger.Warn("Current FeatureMatrix Info [RepeatTcprotectCheckOff Off]"); Scheduler.Schedule(this.Service.Thread, Job.Create(new Action(this.MakeTcProtectRequest)), this.Service.NextMilliseconds()); return; } Log <HackShieldService> .Logger.Warn("Current FeatureMatrix Info [RepeatTcprotectCheckOff On]"); } }
public override IEnumerable <object> Run() { FeatureMatrix.OverrideFeature(base.Operation.Features); FeatureMatrix.OnUpdated(this.Service, base.Operation); base.Finished = true; yield break; }
public bool IsAddLimited(OnlineGuildMember member, string itemclass, int slotNo, int amount, int targetTab) { if (member.GuildMember.Rank > GuildMemberRank.Member) { member.SendOperationFailedDialog("GuildStorageFail_RankLimited"); return(true); } if (itemclass == "gold") { int num = FeatureMatrix.GetInteger("GuildStorageGoldHoldingLimit"); if (num == 0) { num = int.MaxValue; } if (this.GoldHolding > num - amount) { member.SendOperationFailedDialog("GuildStorageFail_GoldAddLimit"); return(true); } return(false); } else { int num2 = (int)(this.AccessLimitTag >> targetTab * this.GuildStorageSettingFlagBitsPerTab & (long)this.GuildStorageSettingMask); if (num2 != 0 && member.GuildMember.Rank > (GuildMemberRank)num2) { member.SendOperationFailedDialog("GuildStorageFail_RankLimited"); return(true); } return(false); } }
public AsyncResultSync BeginLogin(string nexonID, string characterID, IPAddress loginAddress, IPAddress remoteAddress, bool canTry, bool isTrial, MachineID machineID, int gameRoomClient, object state) { if (!this.Valid) { return(null); } AsyncResultSync asyncResultSync = new AsyncResultSync(base.Thread); if (FeatureMatrix.IsEnable("zhCN")) { this.connection.BeginChineseLogin(nexonID, characterID, remoteAddress, canTry, new AsyncCallback(asyncResultSync.AsyncCallback), state); } else { if (!FeatureMatrix.IsEnable("jaJP")) { return(null); } this.connection.BeginLogin(nexonID, characterID, loginAddress, remoteAddress, canTry, isTrial, machineID, (gameRoomClient == 0) ? null : new int[] { gameRoomClient }, new AsyncCallback(asyncResultSync.AsyncCallback), state); } return(asyncResultSync); }
private CafeAuthService() { if (FeatureMatrix.IsEnable("jaJP")) { this.connection = new Connection(GameSN.HeroesJPN); } else if (FeatureMatrix.IsEnable("zhCN")) { this.connection = new Connection(GameSN.HeroesCHN); } else { this.connection = new Connection(GameSN.Heroes); } this.journalID = 0L; this.connection.ConnectionSucceeded += this.connection_ConnectionSucceeded; this.connection.ConnectionFail += this.connection_ConnectionFail; this.connection.Disconnected += this.connection_Disconnected; this.connection.ExceptionOccur += this.connection_ExceptionOccur; this.connection.MessageReceived += this.connection_MessageReceived; this.connection.InitializeSent += this.connection_InitializeSent; this.connection.InitializeResponsed += this.connection_InitializeResponsed; this.connection.TerminateRequested += this.connection_TerminateRequested; this.connection.SynchronizeRequested += this.connection_SynchronizeRequested; this.connection.LoginRecoveryRequested += this.connection_LoginRecoveryRequested; this.connection.RetryLoginRequested += this.connection_RetryLoginRequested; }
public bool AddQueue() { DSWaitingSystem dswaitingSystem = this.service.DSWaitingSystem; if (dswaitingSystem != null) { string argString = base.Operation.GetArgString(0, ""); if (argString == "reset") { string @string = FeatureMatrix.GetString("DSQuestSetting"); using (IEnumerator <string> enumerator = (from q in @string.Split(new char[] { ',' }) where q != "" select q).GetEnumerator()) { while (enumerator.MoveNext()) { string text = enumerator.Current; dswaitingSystem.AddWaitingQueue(text.Trim(), -1, true); } return(true); } } int argInt = base.Operation.GetArgInt(1, -1); dswaitingSystem.AddWaitingQueue(argString, argInt, true); } else { DSService.RequestDSBossOperation(base.Operation); } return(true); }
public static GroupNameCheckResult _CheckGroupName(string name) { Regex regex = new Regex(FeatureMatrix.GetString("GuildNamingRule"), RegexOptions.Compiled); Regex regex2 = new Regex("^[a-zA-Z0-9_]*$", RegexOptions.Compiled); bool flag = regex2.IsMatch(name); if ((flag && name.Length > FeatureMatrix.GetInteger("GuildNamingRuleMaxBytes")) || (!flag && name.Length > FeatureMatrix.GetInteger("GuildNamingRuleMaxBytes") / 2)) { return(GroupNameCheckResult.NotMatchedNamingRuleMaxBytes); } if (!regex.IsMatch(name)) { return(GroupNameCheckResult.NotMatchedNamingRule); } int integer = FeatureMatrix.GetInteger("NamingRuleRepeatingCharCheckCount"); if (integer > 0) { string text = string.Empty; foreach (char c in name) { if (!string.IsNullOrEmpty(text) && text[text.Length - 1] != c) { text = string.Empty; } text += c; if (text.Length > integer) { return(GroupNameCheckResult.RepeatedCharacters); } } } return(GroupNameCheckResult.Succeed); }
public void JoinWebChatMember(HeroesGuildChatRelay server, ChatJoinEventArg arg) { if (!FeatureMatrix.IsEnable("UseHeroesGuildChatServer")) { arg.Callback(null, arg.AsyncResult); } Log <GuildService> .Logger.InfoFormat("JoinWebChatMember is called. [ {0}, {1}, {2} ]", arg.GuildKey, arg.CID, arg.Sender); IEntity entityByID = base.GetEntityByID(arg.GuildKey); if (entityByID != null && entityByID.Tag is GuildEntity) { Log <GuildService> .Logger.InfoFormat("JoinWebChatMember is called. [ {0}, {1}, {2}, found ]", arg.GuildKey, arg.CID, arg.Sender); GuildEntity entity = entityByID.Tag as GuildEntity; if (this.DoJoinWebChatMember(entity, server, arg)) { arg.Callback(this.GetGameMembers(arg.GuildKey), arg.AsyncResult); return; } Log <GuildService> .Logger.WarnFormat("JoinWebChatMember(). DoJoinWebChatMember is failed [ {0}, {1}, {2} ]", arg.GuildKey, arg.CID, arg.Sender); } else { Log <GuildService> .Logger.InfoFormat("JoinWebChatMember(). cannot find guild entity [ {0}, {1}, {2} ]", arg.GuildKey, arg.CID, arg.Sender); } arg.Callback(null, arg.AsyncResult); }
public override IEnumerable <object> Run() { yield return(null); base.Operation.stateCounts = new Dictionary <int, Dictionary <string, int> >(); int count = (int)base.Feedback; for (int i = 0; i < count; i++) { yield return(null); int regionCode = (int)base.Feedback; yield return(null); base.Operation.stateCounts.Add(regionCode, base.Feedback as Dictionary <string, int>); } if (FeatureMatrix.IsEnable("Channeling_UserCount")) { yield return(null); base.Operation.stateChannelCounts = new Dictionary <byte, Dictionary <string, int> >(); int channelCount = (int)base.Feedback; for (int j = 0; j < channelCount; j++) { yield return(null); byte channelCode = (byte)base.Feedback; yield return(null); base.Operation.stateChannelCounts.Add(channelCode, base.Feedback as Dictionary <string, int>); } } yield break; }
public void Close() { if (!FeatureMatrix.IsEnable("GuildStorage")) { return; } this.ItemConn.Close(); }
private static void UpdateRankBasis(IEntityProxy connection, long gID, string rankID, long score, string guildName) { if (FeatureMatrix.IsEnable("CharacterRank") && connection != null) { UpdateRankBasis op = new UpdateRankBasis(gID, rankID, score, guildName); connection.RequestOperation(op); } }
public bool IsRecommendedGuild(int guildSN) { if (FeatureMatrix.IsEnable("NewbieGuildRecommend")) { GetInGameGuildInfo getInGameGuildInfo = this.GetInGameGuildInfo(new int?(FeatureMatrix.GameCode), new int?(ServiceCoreSettings.ServerCode), new int?(guildSN)).FirstOrDefault <GetInGameGuildInfo>(); return(getInGameGuildInfo != null && getInGameGuildInfo.NewbieRecommend); } return(false); }
private GuildAPI() { if (FeatureMatrix.IsEnable("GuildHeroesCore_v1")) { this.guildCore = new HeroesGuildAPI(); return; } this.guildCore = new PlatformGuildAPI(); }
public override IEnumerable <object> Run() { GuildStorageManager storage = base.Entity.Storage; OnlineGuildMember member = base.Entity.GetOnlineMember(base.Operation.RequestingCID); if (!base.Entity.Storage.Valid || !FeatureMatrix.IsEnable("GuildStorage")) { member.SendOperationFailedDialog("GuildStorageFail_Processing"); storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Invalid); base.Finished = true; yield return(new FailMessage("[UpdateGuildStorageSettingsProcessor] GuildStorage") { Reason = FailMessage.ReasonCode.LogicalFail }); } else if (base.Entity.Storage.Processing) { member.SendOperationFailedDialog("GuildStorageFail_Processing"); storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Processing); base.Finished = true; yield return(new FailMessage("[UpdateGuildStorageSettingsProcessor] Entity.Storage.Processing") { Reason = FailMessage.ReasonCode.LogicalFail }); } else if (!base.Entity.Storage.IsEnabled) { member.SendOperationFailedDialog("GuildStorageFail_Stopped"); storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Invalid); base.Finished = true; yield return(new FailMessage("[UpdateGuildStorageSettingsProcessor] Entity.Storage.IsEnabled") { Reason = FailMessage.ReasonCode.LogicalFail }); } else { if (member != null) { if (member.GuildMember.Rank == GuildMemberRank.Master) { storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.UpdateSetting, GuildStorageEventCode.ChangeSetting, base.Operation.AccessLimtiTag.ToString(), base.Operation.GoldLimit); base.Entity.Storage.UpdateSetting(base.Operation.GoldLimit, base.Operation.AccessLimtiTag); base.Entity.Storage.BroadCastInventoryInfo(); } else { member.SendOperationFailedDialog("GuildStorageFail_RankLimited"); } } storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.UpdateSetting, GuildStorageEventCode.Done); base.Finished = true; yield return(new OkMessage()); } yield break; }
public bool Step(ref LinkedListNode <DSWaitingParty> from) { if (this.WaitingParties.Count == 0 || from == null) { return(false); } bool flag = true; foreach (DSShip dsship in this.Ships) { if (dsship.HasEmptySlot) { flag = false; break; } } if (flag) { DSInfo waitingDS = this.Parent.DSStorage.GetWaitingDS(this.DSType); if (waitingDS == null) { if (FeatureMatrix.IsEnable("DSDynamicLoad")) { DSService.Instance.DSEntityMakerSystem.Enqueue(this.ID, this.DSType); } return(false); } DSShip dsship2 = new DSShip(this, waitingDS); dsship2.Node = this.Ships.AddLast(dsship2); } do { DSWaitingParty value = from.Value; from = from.Next; foreach (DSShip dsship3 in this.Ships) { if (dsship3.HasEmptySlot && dsship3.TryEnterShip(value)) { value.Clear(); this.WaitingParties.Remove(value); return(true); } } }while (from != null); DSInfo waitingDS2 = this.Parent.DSStorage.GetWaitingDS(this.DSType); if (waitingDS2 == null) { return(false); } DSShip dsship4 = new DSShip(this, waitingDS2); dsship4.Node = this.Ships.AddLast(dsship4); from = this.WaitingParties.First; return(true); }
public static UnifiedNetwork.Entity.Service StartService(string ip, string portstr) { DSService.Instance = new DSService(); ServiceInvoker.StartService(ip, portstr, DSService.Instance); if (FeatureMatrix.IsEnable("ServiceReporter")) { DSService.StartReporting(DSService.Instance); } return(DSService.Instance); }
public DSEntityMakerSystem(DSService parent) { this.NormalRaidResorcePoint = FeatureMatrix.GetInteger("DSNormalRaidResorcePoint"); this.GaiantRaidResorcePoint = FeatureMatrix.GetInteger("DSGiantRaidResorcePoint"); this.PvpResorcePoint = FeatureMatrix.GetInteger("DSPvpResorcePoint"); this.DSServiceInfoDic = new Dictionary <int, DSServiceInfo>(); this.DSEntityMakerList = new LinkedList <DSEntityMakerQueue>(); this.Parent = parent; this.startID = 0; DSServiceInfo.SetDSResorcePoint(this.NormalRaidResorcePoint, this.GaiantRaidResorcePoint, this.PvpResorcePoint); }
private CafeAuthJPNVersionService() { if (FeatureMatrix.IsEnable("jaJP")) { this.connection.SetGameSN(GameSN.HeroesJPN); } this.connection.ConnectionFail += this.connection_ConnectionFail; this.connection.Disconnected += this.connection_Disconnected; this.connection.ExceptionOccur += this.connection_ExceptionOccur; this.connection.MessageReceived += this.connection_MessageReceived; }
public bool UpdateNewbieRecommend(int guildSN, bool recommend) { if (FeatureMatrix.IsEnable("NewbieGuildRecommend")) { int num = this.UpdateGuildInfo(new int?(FeatureMatrix.GameCode), new int?(GuildAPI.ServerCode), new int?(guildSN), null, new bool?(recommend), null, null, null, new int?(FeatureMatrix.GetInteger("InGameGuild_MaxMember")), null); if (num == 1) { return(true); } } return(false); }
private static void StartReporting(GuildService serv) { if (!FeatureMatrix.IsEnable("ServiceReporter")) { return; } int num = ServiceReporterSettings.Get("GuildService.Interval", 60); ServiceReporter.Instance.Initialize("GuildService"); ServiceReporter.Instance.AddGathering("Stat", new ServiceReporter.GatheringDelegate <int>(serv.OnGatheringStat)); ServiceReporter.Instance.Start(num * 1000); }
public bool UpdateInGameGuildDailyGainGP(int guildSN, GPGainType gainType, int point) { if (FeatureMatrix.IsEnable("GuildLevel")) { int num = this.UpdateInGameGuildDailyGainGP(new int?(FeatureMatrix.GameCode), new int?(GuildAPI.ServerCode), new int?(guildSN), new byte?((byte)gainType), new int?(point)); if (num == 1) { return(true); } } return(false); }
public bool ResetInGameGuildDailyGainGP(int guildSN) { if (FeatureMatrix.IsEnable("GuildLevel")) { int num = this.ResetInGameGuildDailyGainGP(new int?(FeatureMatrix.GameCode), new int?(GuildAPI.ServerCode), new int?(guildSN)); if (num == 1) { return(true); } } return(false); }
public long GetGuildCharacterPoint(long cid) { if (FeatureMatrix.IsEnable("GuildLevel")) { GetInGameGuildCharacterInfo getInGameGuildCharacterInfo = this.GetInGameGuildCharacterInfo(new long?(cid)).FirstOrDefault <GetInGameGuildCharacterInfo>(); if (getInGameGuildCharacterInfo != null) { return(getInGameGuildCharacterInfo.Point); } } return(0L); }
public bool UpdateMaxMemberLimit(int guildSN, int maxMemberLimit) { if (FeatureMatrix.IsEnable("InGameGuild") && FeatureMatrix.GetInteger("InGameGuild_MaxMemberLimit") >= maxMemberLimit) { int num = this.UpdateGuildInfo(new int?(FeatureMatrix.GameCode), new int?(GuildAPI.ServerCode), new int?(guildSN), new int?(maxMemberLimit), null, null, null, null, new int?(FeatureMatrix.GetInteger("InGameGuild_MaxMember")), null); if (num == 1) { return(true); } } return(false); }
public DateTime GetGuildLastDailyGPReset(int guildSN) { if (FeatureMatrix.IsEnable("GuildLevel")) { GetInGameGuildLastDailyGPReset getInGameGuildLastDailyGPReset = this.GetInGameGuildLastDailyGPReset(new int?(FeatureMatrix.GameCode), new int?(GuildAPI.ServerCode), new int?(guildSN)).FirstOrDefault <GetInGameGuildLastDailyGPReset>(); if (getInGameGuildLastDailyGPReset != null) { return(getInGameGuildLastDailyGPReset.LastDailyGPReset); } } return(DateTime.Now); }