Exemplo n.º 1
0
        public void LeaveGuild(GuildEntity guild, GuildMemberKey key)
        {
            int num = -1;

            try
            {
                HeroesGuildDBDataContext heroesGuildDBDataContext = new HeroesGuildDBDataContext();
                num = heroesGuildDBDataContext.GuildUserSecede(new int?(GuildAPI.ServerCode), new int?(guild.GuildSN), new int?(key.NexonSN), new long?((long)key.CharacterSN), key.CharacterName);
            }
            catch (Exception ex)
            {
                Log <HeroesGuildAPI> .Logger.Error("Error in LeaveGuild(GuildEntity guild, GuildMemberKey key)", ex);
            }
            if (num == 0)
            {
                GuildLog.AddGuildLedger(new LogData((long)guild.GuildSN, key.CID, OperationType.HeroesCore_LeaveGuild, GuildLedgerEventType.Success, string.Format("GuildSn: {0}, GuildToString: {1}", guild.GuildSN, guild.ToString(), key.ToString())));
                return;
            }
            GuildLog.AddGuildLedger(new LogData((long)guild.GuildSN, key.CID, OperationType.HeroesCore_LeaveGuild, GuildLedgerEventType.DatabaseFail, string.Format("GuildSn: {0}, GuildToString: {1}", guild.GuildSN, guild.ToString(), key.ToString())));
        }
Exemplo n.º 2
0
        public bool ChangeRank(GuildEntity guild, GuildMemberRank operatorRank, GuildMember targetMember, GuildMemberRank toRank)
        {
            int num = -1;
            HeroesGuildDBDataContext heroesGuildDBDataContext = new HeroesGuildDBDataContext();

            if (toRank == GuildMemberRank.Unknown)
            {
                if (operatorRank.HasSecedePermission(targetMember.Rank, toRank))
                {
                    try
                    {
                        num = heroesGuildDBDataContext.GuildUserSecede(new int?(GuildAPI.ServerCode), new int?(guild.GuildSN), new int?(targetMember.Key.NexonSN), new long?((long)targetMember.Key.CharacterSN), targetMember.Key.CharacterName);
                    }
                    catch
                    {
                        Log <GuildAPI> .Logger.ErrorFormat("GuildUserSecede fail in ChangeRank : ServiceCode[{0}], GuildSN[{1}], MemberNexonSN[{2}]", GuildAPI.ServerCode, guild.GuildSN, targetMember.Key.NexonSN);
                    }
                    if (num == 0)
                    {
                        GuildLog.AddGuildLedger(new LogData((long)guild.GuildSN, targetMember.Key.CID, OperationType.GainGuildPoint, GuildLedgerEventType.UpdateGuildUserPoint, "0", "Secede"));
                        int num2 = -1;
                        try
                        {
                            using (HeroesDataContext heroesDataContext = new HeroesDataContext())
                            {
                                num2 = heroesDataContext.UpdateGuildCharacterInfo(new long?(targetMember.Key.CID), new long?(0L));
                            }
                        }
                        catch
                        {
                            Log <GuildAPI> .Logger.ErrorFormat("UpdateGuildCharacterInfo fail in ChangeRank : ServiceCode[{0}], GuildSN[{1}], MemberNexonSN[{2}], toRank[{3}]", new object[]
                            {
                                GuildAPI.ServerCode,
                                guild.GuildSN,
                                targetMember.Key.NexonSN,
                                toRank
                            });
                        }
                        if (num2 == 0)
                        {
                            GuildLog.AddGuildLedger(new LogData((long)guild.GuildSN, targetMember.Key.CID, OperationType.HeroesCore_LeaveGuild, GuildLedgerEventType.Success, string.Format("GuildSn: {0}, GuildToString: {1}", guild.GuildSN, guild.ToString(), targetMember.Key.ToString())));
                        }
                    }
                    else
                    {
                        GuildLog.AddGuildLedger(new LogData((long)guild.GuildSN, targetMember.Key.CID, OperationType.HeroesCore_LeaveGuild, GuildLedgerEventType.DatabaseFail, string.Format("GuildSn: {0}, GuildToString: {1}", guild.GuildSN, guild.ToString(), targetMember.Key.ToString())));
                    }
                }
            }
            else if (operatorRank.HasRankChangePermission(targetMember.Rank, toRank))
            {
                Log <GuildAPI> .Logger.InfoFormat("UserTypeModify: ServiceCode[{0}], GuildSN[{1}], MemberNexonSN[{2}]", GuildAPI.ServerCode, guild.GuildSN, targetMember.Key.NexonSN);

                try
                {
                    num = heroesGuildDBDataContext.GuildUserTypeModify(new int?(GuildAPI.ServerCode), new int?(guild.GuildSN), new int?(targetMember.Key.NexonSN), new int?(targetMember.Key.CharacterSN), targetMember.Key.CharacterName, new int?((int)toRank.ToGroupUserType()));
                }
                catch (Exception ex)
                {
                    Log <HeroesGuildAPI> .Logger.Error("Error in ChangeRank(GuildEntity guild, GuildMemberRank operatorRank, GuildMember targetMember, GuildMemberRank toRank)", ex);
                }
                if (num == 0)
                {
                    GuildLog.AddGuildLedger(new LogData((long)guild.GuildSN, targetMember.Key.CID, OperationType.HeroesCore_ChangeRank, GuildLedgerEventType.Success, string.Format("GuildSn: {0}, GuildToString: {1}", guild.GuildSN, guild.ToString(), targetMember.Key.ToString())));
                }
                else
                {
                    GuildLog.AddGuildLedger(new LogData((long)guild.GuildSN, targetMember.Key.CID, OperationType.HeroesCore_ChangeRank, GuildLedgerEventType.DatabaseFail, string.Format("GuildSn: {0}, GuildToString: {1}", guild.GuildSN, guild.ToString(), targetMember.Key.ToString())));
                }
            }
            return(num == 0);
        }