예제 #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);
        }
예제 #2
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);
        }
예제 #3
0
        public GroupIDCheckResult CheckGroupID(string guildID)
        {
            if (guildID == null || guildID.Length == 0)
            {
                return(GroupIDCheckResult.IDNotSupplied);
            }
            if (GuildContents.HasForbiddenWords(guildID))
            {
                return(GroupIDCheckResult.InvalidCharacter);
            }
            GroupIDCheckResult result = GroupIDCheckResult.Succeed;

            try
            {
                Log <GuildAPI> .Logger.InfoFormat("CheckGroupID: ServerCode[{0}], GuildName[{1}]", GuildAPI.ServerCode, guildID);

                HeroesGuildDBDataContext heroesGuildDBDataContext = new HeroesGuildDBDataContext();
                if (heroesGuildDBDataContext.GuildCheckGroupID(new int?(GuildAPI.ServerCode), guildID) == 0)
                {
                    return(GroupIDCheckResult.Succeed);
                }
                return(GroupIDCheckResult.DuplicatedID);
            }
            catch (ArgumentException ex)
            {
                if (ex.Message == "Exists Guid ID.")
                {
                    result = GroupIDCheckResult.DuplicatedID;
                }
                else
                {
                    if (ex.Message != "Guild ID has special character")
                    {
                        Log <GuildAPI> .Logger.ErrorFormat("Unknown CheckGroupID exception message: {0}", ex.Message);
                    }
                    result = GroupIDCheckResult.InvalidCharacter;
                }
            }
            catch (Exception ex2)
            {
                Log <GuildService> .Logger.Error("CheckGroupID failed [" + guildID + "]", ex2);

                result = GroupIDCheckResult.InvalidCharacter;
            }
            return(result);
        }
예제 #4
0
        public bool SetDailyGPLimit()
        {
            string argString = base.Operation.GetArgString(0, "");
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary.Add("GuildLevel_DailyGPLimit", argString);
            FeatureMatrix.OverrideFeature(dictionary);
            GuildContents.LoadGuildDailyGPLimit();
            GuildService guildService = base.Entity.Service;

            if (guildService != null)
            {
                UpdateFeatureMatrix op = new UpdateFeatureMatrix(dictionary);
                foreach (IEntity entity in guildService.Entities)
                {
                    GuildEntity guildEntity = entity.Tag as GuildEntity;
                    foreach (OnlineGuildMember onlineGuildMember in guildEntity.OnlineMembers.Values)
                    {
                        onlineGuildMember.FrontendConn.RequestOperation(op);
                    }
                }
            }
            return(true);
        }