Esempio n. 1
0
        public GroupNameCheckResult CheckGroupName(string guildName)
        {
            GroupNameCheckResult groupNameCheckResult = GuildAPI._CheckGroupName(guildName);

            if (groupNameCheckResult == GroupNameCheckResult.Succeed)
            {
                if (GuildContents.HasForbiddenWords(guildName))
                {
                    return(GroupNameCheckResult.NotMatchedNamingRule);
                }
                try
                {
                    HeroesGuildDBDataContext heroesGuildDBDataContext = new HeroesGuildDBDataContext();
                    Log <GuildAPI> .Logger.InfoFormat("CheckGroupName: ServerCode[{0}], GuildName[{1}]", GuildAPI.ServerCode, guildName);

                    if (heroesGuildDBDataContext.GuildCheckGroupName(new int?(GuildAPI.ServerCode), guildName) == 0)
                    {
                        return(GroupNameCheckResult.Succeed);
                    }
                    return(GroupNameCheckResult.DuplicatedName);
                }
                catch (Exception ex)
                {
                    Log <GuildService> .Logger.Error("잘못된 길드명입니다", ex);

                    groupNameCheckResult = GroupNameCheckResult.DuplicatedName;
                }
                return(groupNameCheckResult);
            }
            return(groupNameCheckResult);
        }
        public override IEnumerable <object> Run()
        {
            this.Finished = true;
            string guildName = this.Operation.GuildName;
            string guildID   = this.Operation.GuildID;
            string guildLog  = string.Format("GuildSN={0}, GuildID={1}, GuildName={2}", (object)this.Operation.GuildSN, (object)guildID, (object)guildName);

            if (guildName != null)
            {
                GroupNameCheckResult namingResult = GuildAPI.GetAPI().CheckGroupName(this.Operation.GuildName);
                if (namingResult != GroupNameCheckResult.Succeed)
                {
                    GuildLog.AddGuildLedger(new LogData((long)this.Operation.GuildSN, this.Operation.MemberKey.CID, OperationType.HeroesCore_GuildIDAndNameModify, GuildLedgerEventType.ChangeIDAndName_InvalidName, guildLog));
                    yield return((object)ChangeGuildIDAndName.ResultCodeEnum.Fail_InvalidGuildName);

                    yield break;
                }
            }
            if (guildID != null)
            {
                GroupIDCheckResult checkResult = GuildAPI.GetAPI().CheckGroupID(guildID);
                if (checkResult != GroupIDCheckResult.Succeed)
                {
                    GuildLog.AddGuildLedger(new LogData((long)this.Operation.GuildSN, this.Operation.MemberKey.CID, OperationType.HeroesCore_GuildIDAndNameModify, GuildLedgerEventType.ChangeIDAndName_InvalidID, guildLog));
                    yield return((object)ChangeGuildIDAndName.ResultCodeEnum.Fail_InvalidGuildID);

                    yield break;
                }
            }
            using (HeroesDataContext heroesDataContext = new HeroesDataContext())
            {
                if (heroesDataContext.GuildInfoUpdate(new int?(this.Operation.GuildSN), guildID, guildName) != 0)
                {
                    GuildLog.AddGuildLedger(new LogData((long)this.Operation.GuildSN, this.Operation.MemberKey.CID, OperationType.HeroesCore_GuildIDAndNameModify, GuildLedgerEventType.ChangeIDAndName_UpdateFailed, guildLog));
                    yield return((object)ChangeGuildIDAndName.ResultCodeEnum.Fail_GuildInfoUpdateFailed);

                    yield break;
                }
                else
                {
                    GuildLog.AddGuildLedger(new LogData((long)this.Operation.GuildSN, this.Operation.MemberKey.CID, OperationType.HeroesCore_GuildIDAndNameModify, GuildLedgerEventType.ChangeIDAndName_Success, guildLog));
                }
            }
            if (this.Entity != null)
            {
                this.Entity.ReportGuildInfoChanged();
                this.Entity.Sync();
            }
            yield return((object)ChangeGuildIDAndName.ResultCodeEnum.Success);
        }
Esempio n. 3
0
        public GroupNameCheckResult CheckGroupName(string guildName)
        {
            GroupNameCheckResult groupNameCheckResult = GuildAPI._CheckGroupName(guildName);

            if (groupNameCheckResult == GroupNameCheckResult.Succeed)
            {
                try
                {
                    Log <GuildAPI> .Logger.InfoFormat("CheckGroupName: ServerCode[{0}], GuildName[{1}]", GuildAPI.ServerCode, guildName);

                    HeroesGuild.CheckGroupName(GuildAPI.ServerCode, guildName);
                    return(GroupNameCheckResult.Succeed);
                }
                catch (Exception ex)
                {
                    Log <GuildService> .Logger.Error("잘못된 길드명입니다", ex);

                    groupNameCheckResult = GroupNameCheckResult.DuplicatedName;
                }
                return(groupNameCheckResult);
            }
            return(groupNameCheckResult);
        }
Esempio n. 4
0
        public override IEnumerable <object> Run()
        {
            Log <OpenGuildProcessor> .Logger.Warn("Starting OpenGuild...");

            Func <int> func = delegate
            {
                GroupIDCheckResult groupIDCheckResult = GuildAPI.GetAPI().CheckGroupID(base.Operation.GuildNameID);
                if (groupIDCheckResult != GroupIDCheckResult.Succeed)
                {
                    int result;
                    switch (groupIDCheckResult)
                    {
                    case GroupIDCheckResult.IDNotSupplied:
                        result = -8;
                        break;

                    case GroupIDCheckResult.DuplicatedID:
                        result = -9;
                        break;

                    case GroupIDCheckResult.InvalidCharacter:
                        result = -1;
                        break;

                    default:
                        Log <OpenGuildProcessor> .Logger.ErrorFormat("CheckGroupID result is {0}, but it's not processed by OpenGuildProcessor.Run().", groupIDCheckResult.ToString());

                        result = -7;
                        break;
                    }
                    return(result);
                }
                GroupNameCheckResult groupNameCheckResult = GuildAPI.GetAPI().CheckGroupName(base.Operation.GuildName);
                if (groupNameCheckResult != GroupNameCheckResult.Succeed)
                {
                    int result2;
                    switch (groupNameCheckResult)
                    {
                    case GroupNameCheckResult.NotMatchedNamingRule:
                        result2 = -2;
                        break;

                    case GroupNameCheckResult.NotMatchedNamingRuleMaxBytes:
                        result2 = -5;
                        break;

                    case GroupNameCheckResult.RepeatedCharacters:
                        result2 = -6;
                        break;

                    case GroupNameCheckResult.DuplicatedName:
                        result2 = -4;
                        break;

                    default:
                        result2 = -7;
                        break;
                    }
                    return(result2);
                }
                return(GuildAPI.GetAPI().OpenGuild(base.Operation.GuildMemberKey, base.Operation.GuildName, base.Operation.GuildNameID, base.Operation.GuildIntro));
            };
            bool openResult     = false;
            int  openFuncResult = -99;

            if (FeatureMatrix.IsEnable("GuildProcessorNotUseAsync"))
            {
                openResult     = true;
                openFuncResult = func();
            }
            else
            {
                AsyncFuncSync <int> sync = new AsyncFuncSync <int>(func);
                yield return(sync);

                openResult     = sync.Result;
                openFuncResult = sync.FuncResult;
            }
            Log <OpenGuildProcessor> .Logger.Warn("OpenGuild Finished");

            base.Finished = true;
            if (openResult)
            {
                Log <OpenGuildProcessor> .Logger.WarnFormat("OpenGuild Result : {0}", openResult);

                if (openFuncResult > 0)
                {
                    using (HeroesDataContext heroesDataContext = new HeroesDataContext())
                    {
                        heroesDataContext.UpdateGuildCharacterInfo(new long?(base.Operation.GuildMemberKey.CID), new long?(0L));
                        GuildLog.AddGuildLedger(new LogData((long)openFuncResult, base.Operation.GuildMemberKey.CID, OperationType.GainGuildPoint, GuildLedgerEventType.UpdateGuildUserPoint, "0", "OpenGuild"));
                    }
                    yield return((long)openFuncResult);
                }
                else if (openFuncResult == -1)
                {
                    yield return("GuildID");
                }
                else if (openFuncResult == -2)
                {
                    yield return("GuildNamingRule");
                }
                else if (openFuncResult == -3)
                {
                    yield return("GuildInvalidName");
                }
                else if (openFuncResult == -4)
                {
                    yield return("GuildDuplicatedName");
                }
                else if (openFuncResult == -5)
                {
                    yield return("GuildNamingRuleMaxBytes");
                }
                else if (openFuncResult == -6)
                {
                    yield return("GuildRepeatedCharacters");
                }
                else if (openFuncResult == -7)
                {
                    yield return("GuildEtc");
                }
                else if (openFuncResult == -8)
                {
                    yield return("GuildEmptyID");
                }
                else if (openFuncResult == -9)
                {
                    yield return("GuildDuplicatedID");
                }
                else
                {
                    yield return(new FailMessage("[OpenGuildProcessor] openFuncResult"));
                }
            }
            else
            {
                yield return(new FailMessage("[OpenGuildProcessor] openResult"));
            }
            yield break;
        }