public static bool EndEvent(string name, string scriptend, string msgend, AdminClientServicePeer peer) { EventDataContext.StartProcessing(); Event @event = EventDataContext.GetEvent(name); if (@event == null) { if (peer != null) { peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.ERROR, string.Format("Event is Not Registered ! - \"{0}\"", name)))); } return(false); } if (scriptend != null) { @event.EndScript = scriptend; } if (msgend != null) { @event.EndMessage = msgend; } EventDataContext.EndEvent(name); EventDataContext.RemoveEvent(name); if (peer != null) { string msg = EventDataContext.SendEventListAndDetail(name, "Event is Ended !", false); peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.SUCCESS, msg))); } return(true); }
private bool ProcessDsCommand(string cmd, string args, AdminClientServicePeer peer) { AdminCommand op = new AdminCommand(cmd, args); base.RequestOperation("DSService.DSService", op); return(true); }
private bool ProcessGuildCommand(string cmd, string args, AdminClientServicePeer peer) { foreach (int num in this.GuildServiceIDs()) { AdminCommand op = new AdminCommand(cmd, args); base.RequestOperation("GuildService.GuildService", op); } return(true); }
public void ProcessConsoleCommand(string cmd, string args, AdminClientServicePeer peer) { if (this._ProcessConsoleCommand(cmd, args, peer, -1)) { peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.SUCCESS, string.Format("Console Command Executed ! - \"{0} {1}\"", cmd, args)))); return; } if (peer != null) { peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.ERROR, string.Format("Console Command Failed ! - \"{0} {1}\"", cmd, args)))); } }
public static bool ShowEvent(string name, AdminClientServicePeer peer) { if (peer != null) { Event @event = EventDataContext.GetEvent(name); if (@event != null) { peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.SUCCESS, string.Format("\r\n========== Event Detail ==========\r\nStatus [{0}]\r\n{1}\r\n========== Event Detail ==========", EventDataContext.IsRunning(name) ? "Running" : "Pending", @event.ToStringX())))); return(true); } } return(false); }
public static bool ListEvent(AdminClientServicePeer peer) { if (peer != null) { string text = ""; foreach (Event @event in EventDataContext.Instance.Event) { text += string.Format("{0} [{1}]\r\n", @event.Name, EventDataContext.IsRunning(@event.Name) ? "Running" : "Pending"); } peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.SUCCESS, string.Format("\r\n========== Event List ==========\r\n{0}========== Event List ==========", text)))); return(true); } return(false); }
public void SetFreeTokenMode(bool on, AdminClientServicePeer peer) { int[] array = this.MicroPlayServiceIDs(); FreeToken[] array2 = new FreeToken[array.Length]; for (int i = 0; i < array.Length; i++) { array2[i] = new FreeToken(); array2[i].On = on; base.RequestOperation(array[i], array2[i]); } if (peer != null) { peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.SUCCESS, string.Format("Set FreeToken Mode [{0}]", on)))); } }
public static bool RegisterEvent(string name, string template, string feature, string scriptstart, string scriptend, DateTime?startTime, DateTime?endTime, TimeSpan?periodBegin, TimeSpan?periodEnd, string msgstart, string msgnotify, string msgend, int msginterval, int startCont, string username, AdminClientServicePeer peer) { EventDataContext.StartProcessing(); EventTemplate eventTemplate = null; bool flag = false; if (EventDataContext.IsRunning(name)) { if (peer != null) { string msg = EventDataContext.SendEventListAndDetail(name, "Event is Already Running !", true); peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.ERROR, msg))); } return(false); } if (template != null) { eventTemplate = AdminContents.GetTemplate(template); if (eventTemplate == null) { if (peer != null) { peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.ERROR, string.Format("Cannot Find Event Template ! - \"{0}\"", template)))); } return(false); } } Event @event = EventDataContext.GetEvent(name); if (@event == null) { @event = new Event(); @event.Name = name; flag = true; } if (eventTemplate != null) { @event.Feature = eventTemplate.Feature; @event.StartScript = eventTemplate.StartScript; @event.EndScript = eventTemplate.EndScript; } if (feature != null) { @event.Feature = feature; } if (scriptstart != null) { @event.StartScript = scriptstart; } if (scriptend != null) { @event.EndScript = scriptend; } if (startTime != null) { if (startTime < DateTime.Now) { if (peer != null) { peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.ERROR, string.Format("Reservation Time Error - \"{0}\"", startTime)))); } return(false); } @event.StartTime = startTime; } if (endTime != null) { if (endTime < DateTime.Now) { if (peer != null) { peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.ERROR, string.Format("Reservation Time Error - \"{0}\"", endTime)))); } return(false); } @event.EndTime = endTime; } if (periodBegin != null) { @event.PeriodBegin = periodBegin; } if (periodEnd != null) { @event.PeriodEnd = periodEnd; } if (msgstart != null) { @event.StartMessage = msgstart; } if (msgnotify != null) { @event.NotifyMessage = msgnotify; } if (msgend != null) { @event.EndMessage = msgend; } @event.NotifyInterval = new int?(msginterval); @event.StartCount = new int?(startCont); @event.UserName = username; if (flag) { if (feature != null) { string text = EventDataContext.IsExistFeature(feature); if (text != null) { if (peer != null) { peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.ERROR, string.Format("That feature is already exist ! - \"{0}\"", text)))); } return(false); } } if (!EventDataContext.AddEvent(@event)) { if (peer != null) { peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.ERROR, string.Format("Event Register Failed ! - \"{0}\"", name)))); } return(false); } } else if (!EventDataContext.ModifyEvent(@event)) { if (peer != null) { peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.ERROR, string.Format("Event Update Failed ! - \"{0}\"", name)))); } return(false); } if (@event.StartTime == null && !(@event.StartCount > 0)) { EventDataContext.StartEvent(name, @event); if (peer != null) { string msg2 = EventDataContext.SendEventListAndDetail(name, "Event is Started !", true); peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.SUCCESS, msg2))); } } else if (peer != null) { string msg3 = EventDataContext.SendEventListAndDetail(name, "Event is Reserved !", true); peer.Transmit(SerializeWriter.ToBinary <AdminReportNotifyMessage>(new AdminReportNotifyMessage(NotifyCode.SUCCESS, msg3))); } return(true); }
private bool ProcessEventCommand(string args, AdminClientServicePeer peer, int targetServiceID) { if (args == "goal") { this.ProcessMicroPlayCommand("monster_kill", "", targetServiceID); this.ProcessMicroPlayCommand("autofish_item", "capsule_ap100", targetServiceID); return(true); } CmdTokenizer cmdTokenizer = new CmdTokenizer(args); string next = cmdTokenizer.GetNext(); string next2 = cmdTokenizer.GetNext(); string template = null; string msgstart = null; string msgnotify = null; string msgend = null; string feature = null; string scriptstart = null; string scriptend = null; int msginterval = 1800; int num = 0; string username = "******"; DateTime? startTime = null; DateTime? endTime = null; TimeSpan? periodBegin = null; TimeSpan? periodEnd = null; string text; while (cmdTokenizer.GetNext(out text)) { if (text == "template") { template = cmdTokenizer.GetNext(); } else if (text == "feature") { feature = cmdTokenizer.GetNext(); } else if (text == "scriptstart") { scriptstart = cmdTokenizer.GetNext(); } else { if (!(text == "scriptend")) { if (text == "starttime") { if (num > 0) { Log <AdminClientService> .Logger.Error("starttime은 startcount와 함께 사용될 수 없습니다."); return(false); } try { string next3 = cmdTokenizer.GetNext(); if (next3.Length > 0) { startTime = new DateTime?(DateTime.Parse(next3)); } continue; } catch (Exception ex) { Log <AdminClientService> .Logger.Error("starttime 파싱 도중 에러가 발생했습니다", ex); return(false); } } if (text == "endtime") { try { string next4 = cmdTokenizer.GetNext(); if (next4.Length > 0) { endTime = new DateTime?(DateTime.Parse(next4)); } continue; } catch (Exception ex2) { Log <AdminClientService> .Logger.Error("endtime 파싱 도중 에러가 발생했습니다", ex2); return(false); } } if (text == "periodbegin") { try { string next5 = cmdTokenizer.GetNext(); if (next5.Length > 0) { periodBegin = new TimeSpan?(TimeSpan.Parse(next5)); } continue; } catch (Exception ex3) { Log <AdminClientService> .Logger.Error("periodbegin 파싱 도중 에러가 발생했습니다", ex3); return(false); } } if (text == "periodend") { try { string next6 = cmdTokenizer.GetNext(); if (next6.Length > 0) { periodEnd = new TimeSpan?(TimeSpan.Parse(next6)); } continue; } catch (Exception ex4) { Log <AdminClientService> .Logger.Error("periodend 파싱 도중 에러가 발생했습니다", ex4); return(false); } } if (text == "msgstart") { msgstart = cmdTokenizer.GetNext(); continue; } if (text == "msgnotify") { msgnotify = cmdTokenizer.GetNext(); continue; } if (text == "msgend") { msgend = cmdTokenizer.GetNext(); continue; } if (text == "msginterval") { try { string next7 = cmdTokenizer.GetNext(); if (next7.Length > 0) { msginterval = int.Parse(next7); } continue; } catch (Exception ex5) { Log <AdminClientService> .Logger.Error("msginterval 파싱 도중 에러가 발생했습니다", ex5); return(false); } } if (text == "startcount") { if (startTime != null) { Log <AdminClientService> .Logger.Error("startcount는 starttime과 함께 사용될 수 없습니다."); return(false); } try { string next8 = cmdTokenizer.GetNext(); if (next8.Length > 0) { num = int.Parse(next8); } continue; } catch (Exception ex6) { Log <AdminClientService> .Logger.Error("startcount 파싱 도중 에러가 발생했습니다", ex6); return(false); } } if (text == "username") { username = cmdTokenizer.GetNext(); continue; } Log <AdminClientService> .Logger.ErrorFormat("알수 없는 옵션입니다. [{0}]", text); return(false); } scriptend = cmdTokenizer.GetNext(); } } if (next == "reg") { if (next2.Length > 0) { return(EventDataContext.RegisterEvent(next2, template, feature, scriptstart, scriptend, startTime, endTime, periodBegin, periodEnd, msgstart, msgnotify, msgend, msginterval, num, username, peer)); } } else if (next == "end") { if (next2.Length > 0) { return(EventDataContext.EndEvent(next2, scriptend, msgend, peer)); } } else { if (next == "list") { return(EventDataContext.ListEvent(peer)); } if (next == "show") { if (next2.Length > 0) { return(EventDataContext.ShowEvent(next2, peer)); } } else if (next == "resume") { EventDataContext.StartProcessing(); } } return(false); }
private bool _ProcessConsoleCommand(string cmd, string args, AdminClientServicePeer peer, int targetServiceID) { if (cmd == "event") { return(this.ProcessEventCommand(args, peer, targetServiceID)); } if (cmd == "freetoken") { if (args == "on") { this.SetFreeTokenMode(true, peer); return(true); } if (args == "off") { this.SetFreeTokenMode(false, peer); return(true); } } else { if (cmd.Contains("monster_") || cmd.Contains("droptable") || cmd.Contains("autofish") || cmd.Contains("sector_") || cmd.Contains("antisectorskip_")) { return(this.ProcessMicroPlayCommand(cmd, args, targetServiceID)); } if (cmd.Length >= 6 && cmd.Substring(0, 6) == "quest_") { return(this.ProcessQuestCommand(cmd, args, targetServiceID)); } if (cmd.Contains("manufacture_")) { return(this.ProcessItemCommand(cmd, args, targetServiceID)); } if (cmd.Contains("ds_")) { return(this.ProcessDsCommand(cmd, args, peer)); } if (cmd.Contains("store_fake_ingame_guild_info")) { return(this.ProcessGuildCommand(cmd, args, peer)); } if (cmd.Contains("guildwebchat_activate")) { return(this.ProcessGuildCommand(cmd, args, peer)); } if (cmd.Contains("goalevent_")) { bool flag = this.ProcessQuestCommand(cmd, args, targetServiceID); bool flag2 = this.ProcessMicroPlayCommand(cmd, args, targetServiceID); return(flag && flag2); } if (cmd.ToLower().StartsWith("query_service_id")) { HashSet <int> hashSet = new HashSet <int>(); hashSet.UnionWith(this.MicroPlayServiceIDs()); hashSet.UnionWith(this.PlayerServiceIDs()); hashSet.UnionWith(this.GuildServiceIDs()); foreach (int serviceID in hashSet) { AdminCommand op = new AdminCommand(cmd, args); base.RequestOperation(serviceID, op); } return(true); } if (cmd.ToLower().StartsWith("clr_profiler")) { string[] source = args.Split(new char[] { ' ' }); if (source.Count <string>() == 2) { int num = 0; bool flag3 = int.TryParse(source.ElementAt(0), out num); if (flag3 && num > 0) { AdminCommand op2 = new AdminCommand(cmd, source.ElementAt(1).ToLower()); base.RequestOperation(num, op2); return(true); } Log <AdminClientService> .Logger.Error("clr_profiler cannot find serviceID"); } else { Log <AdminClientService> .Logger.Error("clr_profiler needs two argments. clr_profiler <serviceId> <operation>"); } return(false); } if (cmd.ToLower().StartsWith("frauddetector_")) { string[] source2 = args.Split(new char[] { ' ' }); AdminCommand op3 = new AdminCommand(cmd, (args.Length > 0) ? source2.ElementAt(1).ToLower() : ""); HashSet <int> hashSet2 = new HashSet <int>(); hashSet2.UnionWith(this.FrontendServiceIDs()); foreach (int serviceID2 in hashSet2) { base.RequestOperation(serviceID2, op3); } return(true); } } return(false); }