protected override bool Process(Player player, RealmTime time, string args) { if (player.Guild != "") try { string saytext = string.Join(" ", args); if ((from w in player.Manager.Worlds let world = w.Value where w.Key != 0 from i in world.Players.Where(i => i.Value.Guild == player.Guild) select world).Any()) { if (saytext.Equals(" ") || saytext == "") { player.SendHelp("Usage: /g <text>"); return false; } player.Manager.Chat.SayGuild(player, saytext.ToSafeText()); return true; } } catch (Exception e) { player.SendError(e.ToString()); player.SendInfo("Cannot guild chat!"); return false; } else player.SendInfo("You need to be in a guild to use guild chat!"); return false; }
protected override bool Process(Player player, RealmTime time, string args) { if (player.HasConditionEffect(ConditionEffects.Paused)) { player.ApplyConditionEffect(new ConditionEffect() { Effect = ConditionEffectIndex.Paused, DurationMS = 0 }); player.SendInfo("Game resumed."); return true; } else { if (player.Owner.EnemiesCollision.HitTest(player.X, player.Y, 8).OfType<Enemy>().Any()) { player.SendError("Not safe to pause."); return false; } else { player.ApplyConditionEffect(new ConditionEffect() { Effect = ConditionEffectIndex.Paused, DurationMS = -1 }); player.SendInfo("Game paused."); return true; } } }
public Party(Player leader) { ID = Party.nextID++; if (Party.nextID == int.MaxValue) Party.nextID = 0; Leader = leader; Members = new List<Player>(); Invitations = new List<int>(); World = Leader.Owner; Parties.Add(ID, this); AccountStorage.Add(Leader.AccountId, ID); Leader.SendInfo("Created new party!"); Leader.SendInfo("Type \"/party help\" for party commands."); }
protected override bool Process(Player player, RealmTime time, string args) { StringBuilder sb = new StringBuilder("Players online: "); var copy = player.Owner.Players.Values.ToArray(); if (copy.Length == 0) player.SendInfo("Nobody else is online"); else { for (int i = 0; i < copy.Length; i++) { if (i != 0) sb.Append(", "); sb.Append(copy[i].Name); } player.SendInfo(sb.ToString()); } return true; }
private static void HandleGuildPortal(Player player, GuildHallPortal portal) { if (portal.ObjectType == 0x072f) { var proto = player.Manager.Resources.Worlds["GuildHall"]; var world = player.Manager.GetWorld(proto.id); player.Reconnect(world); return; } player.SendInfo("Portal not implemented."); }
public void Execute(Player player, string[] args) { if (player.Guild != "") { try { string saytext = string.Join(" ", args); foreach (var w in RealmManager.Worlds) { World world = w.Value; if (w.Key != 0) // 0 is limbo?? { foreach (var i in world.Players) { if (i.Value.Guild == player.Guild) { i.Value.Client.SendPacket(new TextPacket() //echo to self { BubbleTime = 10, ObjectId = player.Id, Stars = player.Stars, Name = player.ResolveGuildChatName(), Recipient = "*Guild*", Text = " " + saytext }); } } } } } catch { player.SendInfo("Cannot guild chat!"); } } else player.SendInfo("You need to be in a guild to use guild chat!"); }
protected override bool Process(Player player, RealmTime time, string args) { StringBuilder sb = new StringBuilder("Users online: \r\n"); foreach (var i in player.Manager.Clients.Values) { if (i.Stage == ProtocalStage.Disconnected) continue; sb.AppendFormat("{0}#{1}@{2}\r\n", i.Account.Name, i.Player.Owner.Name, i.Socket.RemoteEndPoint.ToString()); } player.SendInfo(sb.ToString()); return true; }
public bool Execute(Player player, RealmTime time, string args) { if (!HasPermission(player)) { player.SendInfo("You are not an admin"); return false; } try { return Process(player, time, args); } catch (Exception ex) { Log.Error("Error when executing the command.", ex); player.SendError("Error when executing the command."); return false; } }
protected override bool Process(Player player, RealmTime time, string args) { foreach (Client i in player.Manager.Clients.Values) i.Save(); player.SendInfo("Saved all Clients!"); return true; }
public void Execute(Player player, string[] args) { if (player.GuildRank >= 20) { foreach (var i in RealmManager.Worlds) { if (i.Key != 0) { foreach (var e in i.Value.Players) { if (e.Value.Client.Account.Name.ToLower() == args[0].ToLower()) { if (e.Value.Client.Account.Guild.Name == "") { e.Value.Client.SendPacket(new InvitedToGuildPacket() { Name = player.Client.Account.Name, Guild = player.Client.Account.Guild.Name }); } else { player.Client.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "*Error*", Text = e.Value.Client.Account.Name + " is already in a guild!" }); } } } } } } else { { player.SendInfo("Members and initiates cannot invite!"); } } }
protected override bool Process(Player player, RealmTime time, string args) { try { player.Team = Convert.ToInt32(args); player.SendInfo("Updated to team #" + Convert.ToInt32(args)); return true; } catch { return false; } }
protected override bool Process(Player player, RealmTime time, string args) { player.SendInfo(player.Owner.Name); return true; }
protected override bool Process(Player player, RealmTime time, string args) { if (!player.NameChosen) { player.SendError("Choose a name!"); return false; } int index = args.IndexOf(' '); if (index == -1) { player.SendError("Usage: /tell <player name> <text>"); return false; } string playername = args.Substring(0, index); string msg = args.Substring(index + 1); if (player.Name.ToLower() == playername.ToLower()) { player.SendInfo("Quit telling yourself!"); return false; } foreach (var i in player.Manager.Clients.Values) { if (i.Account.NameChosen && i.Account.Name.EqualsIgnoreCase(playername)) { player.Client.SendPacket(new TextPacket() //echo to self { BubbleTime = 10, Stars = player.Stars, Name = player.Name, Recipient = i.Account.Name, Text = msg }); i.SendPacket(new TextPacket() //echo to /tell player { BubbleTime = 10, Stars = player.Stars, Name = player.Name, Recipient = i.Account.Name, Text = msg }); return true; } } player.SendError(string.Format("{0} not found.", playername)); return false; }
protected override bool Process(Player player, RealmTime time, string args) { StringBuilder sb = new StringBuilder("Available commands: "); var cmds = player.Manager.Commands.Commands.Values .Where(x => x.HasPermission(player)) .ToArray(); for (int i = 0; i < cmds.Length; i++) { if (i != 0) sb.Append(", "); sb.Append(cmds[i].CommandName); } player.SendInfo(sb.ToString()); return true; }
protected override bool Process(Player player, RealmTime time, string args) { if (args.Length == 0) { player.SendHelp("Usage: /killPlayer <playername>"); return false; } foreach (var i in player.Manager.Clients.Values) { if (i.Account.Name.EqualsIgnoreCase(args)) { i.Player.HP = 0; i.Player.Death("Moderator"); player.SendInfo("Player killed!"); return true; } } player.SendError(string.Format("Player '{0}' could not be found!", args)); return false; }
protected override bool Process(Player player, RealmTime time, string args) { ConditionEffectIndex effect; if (!Enum.TryParse(args, true, out effect)) { player.SendError("Invalid effect!"); return false; } if ((player.ConditionEffects & (ConditionEffects)(1 << (int)effect)) != 0) { //remove player.ApplyConditionEffect(new ConditionEffect { Effect = effect, DurationMS = 0 }); player.SendInfo("Sucessfully removed effect : " + args); } else { //add player.ApplyConditionEffect(new ConditionEffect { Effect = effect, DurationMS = -1 }); player.SendInfo("Sucessfully added effect : " + args); } return true; }
protected override bool Process(Player player, RealmTime time, string args) { if (player.Quest == null) { player.SendError("Player does not have a quest!"); return false; } player.SendInfo("Quest location: (" + player.Quest.X + ", " + player.Quest.Y + ")"); return true; }
protected override bool Process(Player player, RealmTime time, string args) { int count = 0; foreach (var i in player.Owner.Enemies) { var desc = i.Value.ObjectDesc; if (desc != null && desc.ObjectId != null && desc.ObjectId.ContainsIgnoreCase(args)) { i.Value.Death(time); count++; } } player.SendInfo(string.Format("{0} enemy killed!", count)); return true; }
public void OnPlayerEntered(Player player) { player.SendInfo("Welcome to Realm of the Mad God"); player.SendEnemy("Oryx the Mad God", "You are food for my minions!"); player.SendInfo("Use [WASDQE] to move; click to shoot!"); player.SendInfo("Type \"/help\" for more help"); }
protected override bool Process(Player player, RealmTime time, string args) { var name = args; if (name == "") return false; player.Manager.Data.AddPendingAction(db => { var cmd = db.CreateQuery(); cmd.CommandText = "UPDATE accounts SET muted=1 WHERE name=@name LIMIT 1"; cmd.Parameters.AddWithValue("@name", name); if (cmd.ExecuteNonQuery() <= 0) return; player.SendInfo("User was successfully muted"); foreach (var i in player.Owner.Players) { var x = db.GetAccount(i.Value.AccountId); var usr = i.Value; usr.Client.Account.Muted = x.Muted; usr.UpdateCount++; } }); return true; }
protected override bool Process(Player player, RealmTime time, string args) { if (!player.isNotVisible) { player.isNotVisible = true; player.Owner.PlayersCollision.Remove(player); if (player.Pet != null) player.Owner.LeaveWorld(player.Pet); player.SendInfo("You're now hidden from all players!"); return true; } player.isNotVisible = false; player.SendInfo("You're now visible to all players!"); return true; }
protected override bool Process(Player player, RealmTime time, string args) { player.Manager.Data.AddPendingAction(db => { foreach (var i in player.Owner.Players) { Account x = db.GetAccount(i.Value.AccountId); Player usr = i.Value; usr.Name = x.Name; usr.Client.Account.Rank = x.Rank; usr.UpdateCount++; } }); player.SendInfo("Users Updated."); return true; }
protected override bool Process(Player player, RealmTime time, string args) { var name = args; if (name == "") return false; player.Manager.Data.AddPendingAction(db => { var cmd = db.CreateQuery(); cmd.CommandText = "UPDATE accounts SET banned=0 WHERE name=@name LIMIT 1"; cmd.Parameters.AddWithValue("@name", name); if (cmd.ExecuteNonQuery() <= 0) return; player.SendInfo("User was successfully unbanned"); foreach (var i in player.Manager.Clients.Values.Where(i => i.Account.Name.EqualsIgnoreCase(name))) { i.Disconnect(); } }); return true; }
protected override bool Process(Player player, RealmTime time, string args) { foreach (var i in player.Manager.Clients.Values) { if (i.Account.Name.EqualsIgnoreCase(args)) { i.Disconnect(); player.SendInfo("Player disconnected!"); return true; } } player.SendError(string.Format("Player '{0}' could not be found!", args)); return false; }
protected override bool Process(Player player, RealmTime time, string args) { var index = args.IndexOf(' '); int num; var name = args; string extras = ""; if (name.Split('%').Length > 1) { extras = name.Split('%')[1].Trim(); name = name.Split('%')[0].Trim(); } if (args.IndexOf(' ') > 0 && int.TryParse(args.Substring(0, args.IndexOf(' ')), out num)) //multi name = args.Substring(index + 1); else num = 1; ushort objType; if (!player.Manager.GameData.IdToObjectType.TryGetValue(name, out objType) || !player.Manager.GameData.ObjectDescs.ContainsKey(objType)) { player.SendError("Unknown entity!"); return false; } for (var i = 0; i < num; i++) { var entity = Entity.Resolve(player.Manager, objType); entity.Move(player.X, player.Y); foreach (string item in extras.Split(';')) { string[] kv = item.Split(':'); switch (kv[0]) { case "name": entity.Name = kv[1]; break; case "size": entity.Size = Utils.FromString(kv[1]); break; case "eff": entity.ConditionEffects = (ConditionEffects)Utils.FromString(kv[1]); break; case "conn": (entity as ConnectedObject).Connection = ConnectionInfo.Infos[(uint)Utils.FromString(kv[1])]; break; case "mtype": (entity as Merchants).Custom = true; (entity as Merchants).MType = Utils.FromString(kv[1]); break; case "mcount": (entity as Merchants).MRemaining = Utils.FromString(kv[1]); break; case "mtime": (entity as Merchants).MTime = Utils.FromString(kv[1]); break; case "mcost": (entity as SellableObject).Price = Utils.FromString(kv[1]); break; case "mcur": (entity as SellableObject).Currency = (CurrencyType)Utils.FromString(kv[1]); break; case "stars": (entity as SellableObject).RankReq = Utils.FromString(kv[1]); break; //case "nstar": // entity.Stats[StatsType.NameChangerStar] = Utils.FromString(kv[1]); break; } } player.Owner.EnterWorld(entity); } if (num > 1) if (!args.ToLower().EndsWith("s")) player.SendInfo("Sucessfully spawned " + num + " : " + CultureInfo.CurrentCulture.TextInfo.ToTitleCase( args.Substring(index + 1).ToLower() + "s")); else player.SendInfo("Sucessfully spawned " + num + " : " + CultureInfo.CurrentCulture.TextInfo.ToTitleCase( args.Substring(index + 1).ToLower() + "'")); else player.SendInfo("Sucessfully spawned " + num + " : " + CultureInfo.CurrentCulture.TextInfo.ToTitleCase(args.ToLower())); return true; }
protected override bool Process(Player player, RealmTime time, string args) { if (args.Length == 0) { player.SendHelp("Usage: /gimme <Itemname>"); return false; } ushort objType; if (!player.Manager.GameData.IdToObjectType.TryGetValue(args, out objType)) { player.SendError("Unknown item type!"); return false; } for (int i = 0; i < player.Inventory.Length; i++) if (player.Inventory[i] == null) { player.Inventory[i] = player.Manager.GameData.Items[objType]; player.UpdateCount++; player.SaveToCharacter(); player.SendInfo("Success!"); return true; } player.SendError("Not enough space in inventory!"); return false; }
protected override bool Process(Player player, RealmTime time, string args) { int index = args.IndexOf(' '); int num; string stat = args; if (args.IndexOf(' ') > 0 && int.TryParse(args.Substring(index), out num)) stat = args.Substring(0, args.IndexOf(' ')); else num = 1; switch (stat) { case "hp": player.Stats[0] = num; player.UpdateCount++; break; case "mp": player.Stats[1] = num; player.UpdateCount++; break; case "att": player.Stats[2] = num; player.UpdateCount++; break; case "def": player.Stats[3] = num; player.UpdateCount++; break; case "spd": player.Stats[4] = num; player.UpdateCount++; break; case "vit": player.Stats[5] = num; player.UpdateCount++; break; case "wis": player.Stats[6] = num; player.UpdateCount++; break; case "dex": player.Stats[7] = num; player.UpdateCount++; break; case "all": player.Stats[2] = num; player.Stats[3] = num; player.Stats[4] = num; player.Stats[5] = num; player.Stats[6] = num; player.Stats[7] = num; player.UpdateCount++; break; default: player.SendHelp("Usage: /stats <stat name> <amount>"); break; } player.SendInfo("Successfully updated " + stat); return true; }
protected override bool Process(Player player, RealmTime time, string args) { var index = Convert.ToInt32(args); player.SendInfo("Stranged"); var data = new ItemData { NamePrefix = "Strange", NameColor = 0xFF5A28, Strange = true }; if (player.Inventory.Data[index] == null) player.Inventory.Data[index] = data; else { player.Inventory.Data[index].NamePrefix = data.NamePrefix; player.Inventory.Data[index].NameColor = data.NameColor; player.Inventory.Data[index].Strange = data.Strange; } player.UpdateCount++; return true; }
protected override bool Process(Player player, RealmTime time, string args) { if (player.Name.EqualsIgnoreCase(args)) { player.SendInfo("You are already at yourself, and always will be!"); return false; } foreach (var i in player.Owner.Players) { if (i.Value.Name.EqualsIgnoreCase(args)) { player.Teleport(time, i.Value.Id); return true; } } player.SendInfo(string.Format("Unable to find player: {0}", args)); return false; }
protected override bool Process(Player player, RealmTime time, string args) { if (args.Length == 0) { player.SendHelp("Usage: /summon <playername>"); return false; } foreach (var i in player.Owner.Players) { if (i.Value.Name.EqualsIgnoreCase(args)) { i.Value.Teleport(time, player.Id); player.SendInfo("Player summoned!"); return true; } } player.SendError(string.Format("Player '{0}' could not be found!", args)); return false; }
protected override bool Process(Player player, RealmTime time, string args) { if (player.GuildRank < 20) return false; foreach (var e in from i in player.Manager.Worlds where i.Key != 0 from e in i.Value.Players select e) if (String.Equals(e.Value.Client.Account.Name, args, StringComparison.CurrentCultureIgnoreCase)) if (e.Value.Client.Account.Guild.Name == "") { player.SendInfo(e.Value.Client.Account.Name + " has been invited to your guild!"); e.Value.Client.SendPacket(new InvitedToGuildPacket { Name = player.Client.Account.Name, Guild = player.Client.Account.Guild.Name }); return true; } else { player.SendError(e.Value.Client.Account.Name + " is already in a guild!"); return false; } else player.SendInfo("Members and initiates cannot invite!"); return false; }