예제 #1
0
 public NotifyRandomItem()
 {
     this.IsTelepathyEnable = true;
     this.IsUIEnable        = true;
     this.IsTownOnly        = FeatureMatrix.IsEnable("RandomItemBroadcastMode");
     this.AnnounceLevel     = FeatureMatrix.GetInteger("RandomItem_AnnounceLevel");
 }
예제 #2
0
 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;
 }
예제 #3
0
 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);
         }
     }
 }
예제 #4
0
            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;
            }
예제 #5
0
 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;
 }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
        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()
        {
            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;
        }
예제 #10
0
 public void Close()
 {
     if (!FeatureMatrix.IsEnable("GuildStorage"))
     {
         return;
     }
     this.ItemConn.Close();
 }
예제 #11
0
 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);
     }
 }
예제 #12
0
 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);
 }
예제 #13
0
 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;
        }
예제 #15
0
        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);
        }
예제 #16
0
 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);
 }
예제 #17
0
 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;
 }
예제 #18
0
 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);
 }
예제 #19
0
 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);
 }
예제 #20
0
 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);
 }
예제 #21
0
 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);
 }
예제 #22
0
 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);
 }
예제 #23
0
        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);
        }
예제 #24
0
 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);
 }
예제 #25
0
        public override IEnumerable <object> Run()
        {
            if (base.Operation.SearchKey == null || base.Operation.SearchKey.Length < 2 || base.Operation.SearchKey.Length > FeatureMatrix.GetInteger("GuildNamingRuleMaxBytes"))
            {
                Log <QueryGuildList> .Logger.InfoFormat("길드명 또는 길드 마스터 이름이 잘못되었습니다.{0}", base.Operation.SearchKey);

                base.Finished = true;
                yield return(new FailMessage("[QueryGuildListProcessor] GuildNamingRuleMaxBytes"));
            }
            else
            {
                int  total_page  = 1;
                bool queryResult = false;
                List <InGameGuildInfo> queryFuncResult = new List <InGameGuildInfo>();
                if (FeatureMatrix.IsEnable("GuildProcessorNotUseAsync"))
                {
                    queryResult = true;
                    int num;
                    ICollection <HeroesGuildInfo> list = GuildAPI.GetAPI().SearchGuild(base.Operation.QueryType, 0, base.Operation.Page, base.Operation.PageSize, base.Operation.SearchKey, out num);
                    total_page      = ((num == 0) ? 1 : ((num - 1) / (int)base.Operation.PageSize + 1));
                    queryFuncResult = list.ToGuildInfoList();
                }
                else
                {
                    AsyncFuncSync <List <InGameGuildInfo> > sync = new AsyncFuncSync <List <InGameGuildInfo> >(delegate
                    {
                        int num2;
                        ICollection <HeroesGuildInfo> list2 = GuildAPI.GetAPI().SearchGuild(this.Operation.QueryType, 0, this.Operation.Page, this.Operation.PageSize, this.Operation.SearchKey, out num2);
                        total_page = ((num2 == 0) ? 1 : ((num2 - 1) / (int)this.Operation.PageSize + 1));
                        return(list2.ToGuildInfoList());
                    });
                    yield return(sync);

                    queryResult     = sync.Result;
                    queryFuncResult = sync.FuncResult;
                }
                base.Finished = true;
                if (queryResult)
                {
                    yield return(queryFuncResult);

                    yield return(base.Operation.Page);

                    yield return(total_page);
                }
                else
                {
                    yield return(new FailMessage("[QueryGuildListProcessor] queryResult"));
                }
            }
            yield break;
        }
예제 #26
0
 protected override void OnServiceAdded(string category, int serviceID)
 {
     base.OnServiceAdded(category, serviceID);
     if (AdminClientService.isFirstMicroPlay && category == "MicroPlayServiceCore.MicroPlayService")
     {
         this.RequestResetAllShipList();
         AdminClientService.isFirstMicroPlay = false;
     }
     if (FeatureMatrix.IsEnable("FeatureMatrixSyncService"))
     {
         EventDataContext.AddFeatureMatrixUpdate(serviceID, category);
     }
 }
예제 #27
0
        internal void MakeRequest()
        {
            if (!FeatureMatrix.IsEnable("GRCService"))
            {
                if (!this.Entity.IsClosed)
                {
                    this.Entity.Close();
                }
                return;
            }
            if (this.Entity.IsClosed)
            {
                return;
            }
            if (this.FrontendConn == null)
            {
                this.Entity.Close();
                return;
            }
            if (this.State == GRCClient.GRCClientState.RespondWaiting)
            {
                Log <GRCService> .Logger.InfoFormat("GRCClient received no reply", new object[0]);

                using (GRCServiceErrorLogDataContext grcserviceErrorLogDataContext = new GRCServiceErrorLogDataContext())
                {
                    try
                    {
                        grcserviceErrorLogDataContext.AddGRCServiceError(new long?(this.Entity.ID), new int?(1), "NoReply");
                    }
                    catch (Exception ex)
                    {
                        Log <GRCService> .Logger.Error(string.Format("GRCService Error while making log : [CharacterID = {0}]", this.Entity.ID), ex);
                    }
                }
                this.Entity.Close();
                return;
            }
            this.Service.Content.MakeQuestionRandom(out this.LastQuestion, out this.LastAnswer);
            if (this.LastAnswer.Length > 0 || this.LastQuestion.Length > 0)
            {
                GameResourceRequestMessage serializeObject = new GameResourceRequestMessage(0, this.LastQuestion);
                this.FrontendConn.RequestOperation(SendPacket.Create <GameResourceRequestMessage>(serializeObject));
                this.State = GRCClient.GRCClientState.RespondWaiting;
            }
            else
            {
                this.State = GRCClient.GRCClientState.RequestSkipped;
            }
            Scheduler.Schedule(this.Service.Thread, Job.Create(new Action(this.MakeRequest)), this.Service.NextMilliseconds());
        }
예제 #28
0
 public override void Initialize(JobProcessor thread)
 {
     ConnectionStringLoader.LoadFromServiceCore(Settings.Default);
     base.Initialize(thread, MessageID.TypeConverters);
     base.RegisterMessage(OperationMessages.TypeConverters);
     base.RegisterProcessor(typeof(Respond), (Operation op) => new RespondProcessor(this, op as Respond));
     if (FeatureMatrix.IsEnable("TcProtect"))
     {
         this.InitializeFsw();
         Scheduler.Schedule(base.Thread, Job.Create(new Action(this.UpdateTcProtect)), 0);
         base.RegisterProcessor(typeof(TcProtectRespond), (Operation op) => new TcProtectRespondProcessor(this, op as TcProtectRespond));
         base.RegisterProcessor(typeof(TcProtectCheck), (Operation op) => new TcProtectCheckProcessor(this, op as TcProtectCheck));
     }
 }
예제 #29
0
        public override IEnumerable <object> Run()
        {
            bool leaveResult = false;
            HeroesGuildMemberInfo leaveFuncResult = null;

            if (FeatureMatrix.IsEnable("GuildProcessorNotUseAsync"))
            {
                leaveResult = true;
                GuildAPI.GetAPI().LeaveGuild(base.Entity, base.Operation.Key);
                leaveFuncResult = GuildAPI.GetAPI().GetMemberInfo(base.Entity, base.Operation.Key);
            }
            else
            {
                AsyncFuncSync <HeroesGuildMemberInfo> sync = new AsyncFuncSync <HeroesGuildMemberInfo>(delegate
                {
                    GuildAPI.GetAPI().LeaveGuild(base.Entity, base.Operation.Key);
                    return(GuildAPI.GetAPI().GetMemberInfo(base.Entity, base.Operation.Key));
                });
                yield return(sync);

                leaveResult     = sync.Result;
                leaveFuncResult = sync.FuncResult;
            }
            base.Finished = true;
            if (leaveResult)
            {
                if (leaveFuncResult != null)
                {
                    base.Entity.UpdateGroupMemberInfo(base.Operation.Key, leaveFuncResult);
                    base.Entity.Sync();
                    yield return(new FailMessage("[LeaveGuildProcessor] leaveFuncResult"));
                }
                else
                {
                    using (HeroesDataContext heroesDataContext = new HeroesDataContext())
                    {
                        heroesDataContext.UpdateGuildCharacterInfo(new long?(base.Operation.Key.CID), new long?(0L));
                        GuildLog.AddGuildLedger(new LogData((long)base.Entity.GuildSN, base.Operation.Key.CID, OperationType.GainGuildPoint, GuildLedgerEventType.UpdateGuildUserPoint, "0", "LeaveGuild"));
                    }
                    base.Entity.UpdateGroupMemberInfo(base.Operation.Key, leaveFuncResult);
                    base.Entity.Sync();
                    yield return(new OkMessage());
                }
            }
            else
            {
                yield return(new FailMessage("[LeaveGuildProcessor] leaveResult"));
            }
            yield break;
        }
예제 #30
0
        public static InGameGuildInfo ToGuildInfo(this HeroesGuildInfo groupInfo)
        {
            InGameGuildInfo result = null;

            try
            {
                HeroesDataContext heroesDataContext = new HeroesDataContext();
                int maxMemberLimit = heroesDataContext.GetMaxMemberLimit(groupInfo.GuildSN);
                if (FeatureMatrix.IsEnable("NewbieGuildRecommend"))
                {
                    GetInGameGuildInfo guildInfo   = heroesDataContext.GetGuildInfo(groupInfo.GuildSN);
                    int      guildLevel            = 1;
                    long     guildPoint            = 0L;
                    DateTime guildLastDailyGPReset = heroesDataContext.GetGuildLastDailyGPReset(groupInfo.GuildSN);
                    Dictionary <byte, int> dailyGainGP;
                    if (FeatureMatrix.IsEnable("GuildLevel"))
                    {
                        guildLevel = guildInfo.Level;
                        guildPoint = guildInfo.Exp;
                        DateTime prevDailyGPResetTime = GuildContents.GetPrevDailyGPResetTime();
                        if (guildLastDailyGPReset >= prevDailyGPResetTime)
                        {
                            dailyGainGP = heroesDataContext.GetGuildDailyGainGP(groupInfo.GuildSN);
                        }
                        else
                        {
                            dailyGainGP = new Dictionary <byte, int>();
                            heroesDataContext.ResetInGameGuildDailyGainGP(groupInfo.GuildSN);
                        }
                    }
                    else
                    {
                        dailyGainGP = new Dictionary <byte, int>();
                    }
                    result = new InGameGuildInfo(groupInfo.GuildSN, groupInfo.GuildName, guildLevel, groupInfo.RealUserCount, groupInfo.NameInGroup_Master, maxMemberLimit, guildInfo.NewbieRecommend, guildPoint, guildInfo.Notice, dailyGainGP);
                }
                else
                {
                    result = new InGameGuildInfo(groupInfo.GuildSN, groupInfo.GuildName, 1, groupInfo.RealUserCount, groupInfo.NameInGroup_Master, maxMemberLimit);
                }
            }
            catch (Exception ex)
            {
                Log <GuildAPI> .Logger.ErrorFormat("Exception occured in GuildAPI_Extension::ToGuildInfo( GroupInfo ) : {0}", ex.ToString());

                return(null);
            }
            return(result);
        }