public HeroesGuildMemberInfo GetMemberInfo(GuildEntity guild, GuildMemberKey key) { HeroesGuildMemberInfo result; try { Log <GuildAPI> .Logger.InfoFormat("GroupMemberGetInfo: ServerCode[{0}], GuildSN[{1}], MemberNexonSN[{2}]", GuildAPI.ServerCode, guild.GuildSN, key.NexonSN); GroupMemberInfo groupMemberInfo = HeroesGuild.GroupMemberGetInfo(GuildAPI.ServerCode, guild.GuildSN, key.CharacterSN, key.CharacterName); HeroesGuildUserType value = this.ConvertToHeroesGuildUserType(groupMemberInfo.emGroupUserType); if (value.ToGuildMemberRank().IsInvalid()) { result = null; } else { result = new HeroesGuildMemberInfo(groupMemberInfo); } } catch (GroupException ex) { if (ex.ErrorCode != 15) { Log <GuildService> .Logger.Error("GroupMemberGetInfo Error", ex); } result = null; } catch (Exception ex2) { Log <GuildService> .Logger.Error("GroupMemberGetInfo Error", ex2); result = null; } return(result); }
public int OpenGuild(GuildMemberKey key, string guildName, string guildID, string guildIntro) { int num = 0; Log <HeroesGuildAPI> .Logger.InfoFormat("Create: GuildMemberKey[{0}], guildName[{1}], guildID[{2}], guildIntro[{3}]", new object[] { key, guildName, guildID, guildIntro }); try { Log <HeroesGuildAPI> .Logger.Warn("Sending OpenGuild"); HeroesGuildDBDataContext heroesGuildDBDataContext = new HeroesGuildDBDataContext(); num = heroesGuildDBDataContext.GuildCreate(new int?(GuildAPI.ServerCode), new int?(key.NexonSN), new long?((long)key.CharacterSN), key.CharacterName, guildName, guildID, guildIntro); Log <HeroesGuildAPI> .Logger.Warn("Done OpenGuild"); } catch (Exception ex) { Log <HeroesGuildAPI> .Logger.Error("Error in Create", ex); } if (num >= 0) { GuildLog.AddGuildLedger(new LogData((long)num, key.CID, OperationType.HeroesCore_OpenGuild, GuildLedgerEventType.Success, string.Format("GuildName: {0}, GuildID: {1}", guildName, guildID))); } else { GuildLog.AddGuildLedger(new LogData((long)num, key.CID, OperationType.HeroesCore_OpenGuild, GuildLedgerEventType.DatabaseFail, string.Format("GuildName: {0}, GuildID: {1}", guildName, guildID))); } return(num); }
public bool CloseGuild(GuildEntity guild, GuildMemberKey key) { if (guild == null || key == null) { Log <HeroesGuildAPI> .Logger.ErrorFormat("parameter is null in CloseGuild()", new object[0]); return(false); } int num = -1; try { Log <HeroesGuildAPI> .Logger.InfoFormat("Remove: GuildMemberKey[{0}]", key); HeroesGuildDBDataContext heroesGuildDBDataContext = new HeroesGuildDBDataContext(); num = heroesGuildDBDataContext.GuildRemove(new int?(GuildAPI.ServerCode), new int?(key.NexonSN), new int?(guild.GuildSN)); } catch (Exception ex) { Log <HeroesGuildAPI> .Logger.Error("Remove(CloseGuild) Error: ", ex); } if (num == 0) { GuildLog.AddGuildLedger(new LogData((long)guild.GuildSN, key.CID, OperationType.HeroesCore_CloseGuild, GuildLedgerEventType.Success, string.Format("GuildSn: {0}, GuildToString: {1}", guild.GuildSN, guild.ToString()))); } else { GuildLog.AddGuildLedger(new LogData((long)guild.GuildSN, key.CID, OperationType.HeroesCore_CloseGuild, GuildLedgerEventType.DatabaseFail, string.Format("GuildSn: {0}, GuildToString: {1}", guild.GuildSN, guild.ToString()))); } return(num == 0); }
public OnlineGuildMember(GuildEntity parent, GuildMemberKey key, long fid) { this.Parent = parent; this.Key = key; this.FID = fid; this.FrontendConn = GuildService.Instance.Connect(this.Parent.Entity, new Location { ID = fid, Category = "FrontendServiceCore.FrontendService" }); this.PlayerConn = GuildService.Instance.Connect(this.Parent.Entity, new Location { ID = key.CID, Category = "PlayerService.PlayerService" }); this.PlayerConn.Closed += delegate(object _, EventArgs <IEntityProxy> __) { Log <OnlineGuildMember> .Logger.WarnFormat("[{0}] Charater Logout Detected", this.Key.CharacterName); GuildService.Instance.LeaveChatRoom(this); this.Disconnect(); this.Parent.Disconnect(this.Key); this.Parent.Sync(); }; this.CashShopConn = GuildService.Instance.Connect(this.Parent.Entity, new Location { ID = (long)key.NexonSN, Category = "CashShopService.CashShopService" }); this.Observables = new ObservableCollection(); this.BriefGuildInfoObservable = this.Observables.AddObservable(this.Key.CID, "BriefGuildInfo"); }
public void UserNameModify(GuildMemberKey key, string newName) { if (key == null || string.IsNullOrEmpty(newName)) { return; } HeroesGuild.UserNameModify(GuildAPI.ServerCode, key.NexonSN, key.CharacterSN, newName); }
public void KickFromChatRoom(GuildEntity entity, GuildMemberKey key) { if (this.ChatRelay != null) { GuildChatWebMember guildChatWebMember = this.ChatRelay[key.CID]; if (guildChatWebMember != null) { Log <GuildService> .Logger.InfoFormat("KickFromChatRoom is called. [ {0} {1} {2} ]", guildChatWebMember.GuildID, guildChatWebMember.CID, guildChatWebMember.Sender); this.ChatRelay.KickMember(guildChatWebMember.GuildID, guildChatWebMember.CID); this.LeaveChatRoom(guildChatWebMember); } } }
public bool JoinChatRoomFromGame(GuildEntity entity, GuildMemberKey key) { Log <GuildService> .Logger.InfoFormat("JoinChatRoomFromGame is called", new object[0]); if (entity != null) { OnlineGuildMember onlineMember = entity.GetOnlineMember(key.CID); if (onlineMember != null) { Log <GuildService> .Logger.InfoFormat("JoinChatRoomFromGame onlineGuildMember is not null", new object[0]); GuildChatRoom chatRoom = entity.ChatRoom; return(chatRoom.JoinGameMember(onlineMember)); } Log <GuildService> .Logger.WarnFormat("JoinChatRoomFromGame onlineGuildMember is null", new object[0]); } return(false); }
public HeroesGuildMemberInfo GetMemberInfo(GuildEntity guild, GuildMemberKey key) { try { HeroesGuildDBDataContext heroesGuildDBDataContext = new HeroesGuildDBDataContext(); List <GuildGroupMemberGetInfoResult> source = heroesGuildDBDataContext.GuildGroupMemberGetInfo(new int?(GuildAPI.ServerCode), new int?(guild.GuildSN), new int?(key.CharacterSN), key.CharacterName).ToList <GuildGroupMemberGetInfoResult>(); GuildGroupMemberGetInfoResult guildGroupMemberGetInfoResult = source.FirstOrDefault <GuildGroupMemberGetInfoResult>(); if (source.Count <GuildGroupMemberGetInfoResult>() == 1 && guildGroupMemberGetInfoResult != null) { return(new HeroesGuildMemberInfo(guildGroupMemberGetInfoResult.CharacterName, (long)guildGroupMemberGetInfoResult.CharacterSN, (HeroesGuildUserType)guildGroupMemberGetInfoResult.emGroupUserType, guildGroupMemberGetInfoResult.GuildSN, guildGroupMemberGetInfoResult.Intro, guildGroupMemberGetInfoResult.NameInGroup, guildGroupMemberGetInfoResult.NexonSN)); } } catch (Exception ex) { Log <HeroesGuildAPI> .Logger.Error("Error in GetMemberInfo(GuildEntity guild, GuildMemberKey key)", ex); } return(null); }
public List <HeroesUserGuildInfo> GetGuildInfo(GuildMemberKey key) { Log <GuildAPI> .Logger.InfoFormat("UserGroupGetList: ServerCode[{0}], MemberNexonSN[{1}], MaxValue[{2}]", GuildAPI.ServerCode, key.NexonSN, byte.MaxValue); int num; int num2; Collection <UserGroupInfo> collection = HeroesGuild.UserGroupGetList(GuildAPI.ServerCode, key.NexonSN, 1, byte.MaxValue, out num, out num2); List <HeroesUserGuildInfo> list = new List <HeroesUserGuildInfo>(); foreach (UserGroupInfo userGroupInfo in collection) { if (userGroupInfo.CharacterName == key.CharacterName && userGroupInfo.CharacterSN == key.CharacterSN) { list.Add(new HeroesUserGuildInfo(userGroupInfo)); } } return(list); }
public int OpenGuild(GuildMemberKey key, string guildName, string guildID, string guildIntro) { int result = 0; Log <GuildAPI> .Logger.InfoFormat("Create: GuildMemberKey[{0}], guildName[{1}], guildID[{2}], guildIntro[{3}]", new object[] { key, guildName, guildID, guildIntro }); try { Log <PlatformGuildAPI> .Logger.Warn("Sending OpenGuild"); result = HeroesGuild.Create(GuildAPI.ServerCode, key.NexonSN, (long)key.CharacterSN, key.CharacterName, guildName, guildID, guildIntro); Log <PlatformGuildAPI> .Logger.Warn("Done OpenGuild"); } catch (GroupException ex) { if (ex.ErrorCode == 24) { result = -3; } else if (ex.ErrorCode == 1 || ex.ErrorCode == 9000) { result = -4; } else if (ex.ErrorCode == -1) { result = -1; } else { Log <PlatformGuildAPI> .Logger.ErrorFormat("GroupException : {0}", ex.ErrorCode); Log <PlatformGuildAPI> .Logger.Error("exception : ", ex); result = -3; } } return(result); }
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()))); }
public bool ChangeMaster(GuildEntity guild, GuildMember newMaster, GuildMember oldMaster) { GuildMemberKey key = newMaster.Key; HeroesGuildUserType value = GuildMemberRank.Operator.ToGroupUserType(); int num = -1; try { HeroesGuildDBDataContext heroesGuildDBDataContext = new HeroesGuildDBDataContext(); num = heroesGuildDBDataContext.GuildGroupChangeMaster(new int?(GuildAPI.ServerCode), new int?(guild.GuildSN), new int?(key.NexonSN), new long?((long)key.CharacterSN), key.CharacterName, new int?((int)value)); } catch (Exception ex) { Log <HeroesGuildAPI> .Logger.Error("Error in ChangeMaster", ex); } if (num == 0) { GuildLog.AddGuildLedger(new LogData((long)guild.GuildSN, newMaster.Key.CID, OperationType.HeroesCore_ChangeMaster, GuildLedgerEventType.Success, guild.GuildInfo.MasterName, newMaster.Key.CharacterName)); return(true); } GuildLog.AddGuildLedger(new LogData((long)guild.GuildSN, newMaster.Key.CID, OperationType.HeroesCore_ChangeMaster, GuildLedgerEventType.DatabaseFail, guild.GuildInfo.MasterName, newMaster.Key.CharacterName)); return(false); }
public void UserNameModify(GuildMemberKey key, string newName) { int num = -1; try { HeroesGuildDBDataContext heroesGuildDBDataContext = new HeroesGuildDBDataContext(); num = heroesGuildDBDataContext.GuildUserNameModify(new int?(GuildAPI.ServerCode), new int?(key.NexonSN), new long?((long)key.CharacterSN), newName); } catch (Exception ex) { Log <HeroesGuildAPI> .Logger.Error("Error in UserNameModify(GuildMemberKey key, string newName)", ex); } if (num == 0) { GuildLog.AddGuildLedger(new LogData(0L, key.CID, OperationType.HeroesCore_UserNameModify, GuildLedgerEventType.Success, string.Format("Prev: {0}", key.ToString()), string.Format("New: {0}", newName))); } else { Log <HeroesGuildAPI> .Logger.ErrorFormat("ErrorCode return in UserNameModify(GuildMemberKey key, string newName): {0}", num); GuildLog.AddGuildLedger(new LogData(0L, key.CID, OperationType.HeroesCore_UserNameModify, GuildLedgerEventType.DatabaseFail, string.Format("Prev: {0}", key.ToString()), string.Format("New: {0}", newName))); } }
public List <HeroesUserGuildInfo> GetGuildInfo(GuildMemberKey key) { int?num = new int?(0); int?num2 = new int?(0); List <HeroesUserGuildInfo> list = new List <HeroesUserGuildInfo>(); try { HeroesGuildDBDataContext heroesGuildDBDataContext = new HeroesGuildDBDataContext(); ISingleResult <GuildUserGroupGetListResult> source = heroesGuildDBDataContext.GuildUserGroupGetList(new int?(GuildAPI.ServerCode), new int?(key.NexonSN), new int?(1), new byte?(byte.MaxValue), ref num, ref num2); foreach (GuildUserGroupGetListResult guildUserGroupGetListResult in source.ToList <GuildUserGroupGetListResult>()) { if (guildUserGroupGetListResult.CharacterName == key.CharacterName && guildUserGroupGetListResult.CharacterSN == key.CharacterSN) { list.Add(new HeroesUserGuildInfo(guildUserGroupGetListResult.CharacterName, guildUserGroupGetListResult.CharacterSN, guildUserGroupGetListResult.dateCreate, (HeroesGuildUserType)guildUserGroupGetListResult.GroupUserType, guildUserGroupGetListResult.GuildID, guildUserGroupGetListResult.GuildName, guildUserGroupGetListResult.GuildSN, guildUserGroupGetListResult.Intro, guildUserGroupGetListResult.NameInGroup, guildUserGroupGetListResult.NameInGroup_Master, guildUserGroupGetListResult.NexonSN_Master, guildUserGroupGetListResult.RealUserCount)); } } } catch (Exception ex) { Log <HeroesGuildAPI> .Logger.Error("Error in GetGuildInfo(GuildMemberKey key)", ex); } return(list); }
public bool ChangeMaster(GuildEntity guild, GuildMember newMaster, GuildMember oldMaster) { if (!FeatureMatrix.IsEnable("EnableChangeGuildMaster")) { return(false); } GuildMemberKey key = newMaster.Key; Log <GuildAPI> .Logger.InfoFormat("ChangeMaster: Guild[{0}], newMasterKey[{1}], oldMasterKey[{2}]", guild.ToString(), key.ToString(), oldMaster.Key.ToString()); Log <GuildAPI> .Logger.InfoFormat("ChangeMaster: serverCode[{0}] guildSn[{1}] NexonSN[{2}] C_SN[{3}] Name[{4}] Rank[{5}]", new object[] { GuildAPI.ServerCode, guild.GuildSN, key.NexonSN, key.CharacterSN, key.CharacterName, GuildMemberRank.Operator.ToGroupUserType() }); HeroesGuildUserType type = GuildMemberRank.Operator.ToGroupUserType(); return(HeroesGuild.GroupChangeMaster(GuildAPI.ServerCode, guild.GuildSN, key.NexonSN, (long)key.CharacterSN, key.CharacterName, this.ConvertToGroupUserType(type))); }
public bool CloseGuild(GuildEntity guild, GuildMemberKey key) { Log <GuildAPI> .Logger.InfoFormat("Remove: GuildMemberKey[{0}]", key); try { HeroesGuild.Remove(GuildAPI.ServerCode, key.NexonSN, guild.GuildSN); } catch (GroupException ex) { if (ex.ErrorCode != 6) { Log <GuildService> .Logger.Error("Remove(CloseGuild) Error: ", ex); } return(false); } catch (Exception ex2) { Log <GuildService> .Logger.Error("Remove(CloseGuild) Error: ", ex2); return(false); } return(true); }
public GuildOperationResult(bool result, GuildMemberKey key, HeroesGuildMemberInfo info) { this.Result = result; this.Key = key; this.HeroesGuildMemberInfo = info; }
public void LeaveGuild(GuildEntity guild, GuildMemberKey key) { Log <GuildAPI> .Logger.InfoFormat("UserSecede: GuildMemberKey[{0}]", key); HeroesGuild.UserSecede(GuildAPI.ServerCode, guild.GuildSN, key.NexonSN, key.CharacterSN, key.CharacterName); }
public void Join(GuildEntity guild, GuildMemberKey key) { Log <GuildAPI> .Logger.InfoFormat("UserJoin: GuildMemberKey[{0}]", key); HeroesGuild.UserJoin(GuildAPI.ServerCode, guild.GuildSN, key.NexonSN, (long)key.CharacterSN, key.CharacterName, string.Empty); }