Example #1
0
		public static int GetDailyGPLimit(GPGainType gainType)
		{
			if (!GPGainTypeUtil.IsValidGPGainTypeValue(gainType, true))
			{
				return 0;
			}
			int result = 0;
			if (!GuildContents.GuildDailyGPLimit.TryGetValue(gainType, out result))
			{
				result = -1;
			}
			return result;
		}
        public bool GiveGP()
        {
            int  argInt  = base.Operation.GetArgInt(0, 0);
            int  argInt2 = base.Operation.GetArgInt(1, 255);
            bool flag    = base.Operation.GetArgInt(2, 0) != 0;

            if (!GPGainTypeUtil.IsValidGPGainTypeValue(argInt2, true))
            {
                Log <_CheatCommandProcessor> .Logger.ErrorFormat("Invalid gainType value is retrieved from DB: GPGainType: {0}, GuildSN: {1}", argInt2, base.Entity.GuildSN);

                return(false);
            }
            if (!flag)
            {
                int num = base.Entity.GiveGP(argInt, (GPGainType)argInt2, 0L);
                if (num != 0)
                {
                    using (HeroesDataContext heroesDataContext = new HeroesDataContext())
                    {
                        heroesDataContext.UpdateGuildInfo(new int?(FeatureMatrix.GameCode), new int?(GuildAPI.ServerCode), new int?(base.Entity.GuildSN), null, null, new int?(base.Entity.GuildInfo.GuildLevel), new long?(base.Entity.GuildInfo.GuildPoint), null, new int?(FeatureMatrix.GetInteger("InGameGuild_MaxMember")), null);
                    }
                    base.Entity.ReportGuildInfoChanged();
                    base.Entity.Sync();
                }
                return(true);
            }
            long num2 = 0L;

            foreach (KeyValuePair <string, OnlineGuildMember> keyValuePair in base.Entity.OnlineMembers)
            {
                if (keyValuePair.Value.FID == base.Connection.RemoteID)
                {
                    num2 = keyValuePair.Value.CID;
                    break;
                }
            }
            if (num2 == 0L)
            {
                Log <_CheatCommandProcessor> .Logger.WarnFormat("Could not find _CheatCommand requester by FID. FID: {0}", base.Connection.RemoteID);

                return(false);
            }
            GiveGuildGP giveGuildGP = new GiveGuildGP();

            giveGuildGP.GainType = (GPGainType)argInt2;
            giveGuildGP.GiveDict.Add(num2, argInt);
            this.service.RequestOperation(base.Entity.Entity, new Location(base.Entity.GuildID, "GuildService.GuildService"), giveGuildGP);
            return(true);
        }
Example #3
0
        public Dictionary <byte, int> GetGuildDailyGainGP(int guildSN)
        {
            ISingleResult <GetInGameGuildDailyGainGP> inGameGuildDailyGainGP = this.GetInGameGuildDailyGainGP(new int?(FeatureMatrix.GameCode), new int?(GuildAPI.ServerCode), new int?(guildSN));
            Dictionary <byte, int> dictionary = new Dictionary <byte, int>();

            foreach (GetInGameGuildDailyGainGP getInGameGuildDailyGainGP in inGameGuildDailyGainGP)
            {
                if (!GPGainTypeUtil.IsValidGPGainTypeValue((int)getInGameGuildDailyGainGP.GPGainType, false))
                {
                    Log <GuildAPI> .Logger.ErrorFormat("Invalid GPGainType value is retrieved from DB: GPGainType: {0}, GuildSN: {1}", getInGameGuildDailyGainGP.GPGainType, guildSN);
                }
                else
                {
                    dictionary.Add(getInGameGuildDailyGainGP.GPGainType, getInGameGuildDailyGainGP.Point);
                }
            }
            return(dictionary);
        }