protected virtual bool DoIload(string rawParameters, params CommandParameter[] parameters) { if (parameters.Length == 0 || !parameters[0].IsNumber) { Send("Syntax: iload <id>"); return(true); } ItemBlueprintBase itemBlueprint = DependencyContainer.Instance.GetInstance <IWorld>().GetItemBlueprint(parameters[0].AsNumber); if (itemBlueprint == null) { Send("No item with that id."); return(true); } IContainer container = itemBlueprint.WearLocation == WearLocations.None ? Impersonating.Room as IContainer : Impersonating as IContainer; IItem item = DependencyContainer.Instance.GetInstance <IWorld>().AddItem(Guid.NewGuid(), itemBlueprint, container); if (item == null) { Send("Item cannot be created."); DependencyContainer.Instance.GetInstance <IServer>().Wiznet($"DoIload: item with id {parameters[0].AsNumber} cannot be created", WiznetFlags.Bugs, AdminLevels.Implementor); return(true); } DependencyContainer.Instance.GetInstance <IServer>().Wiznet($"{DisplayName} loads {item.DebugName}.", WiznetFlags.Load); Impersonating.Act(ActOptions.ToAll, "{0:N} {0:h} created {1}!", Impersonating, item); Send("Ok."); return(true); }
protected virtual bool DoCload(string rawParameters, params CommandParameter[] parameters) { if (parameters.Length == 0 || !parameters[0].IsNumber) { Send("Syntax: cload <id>"); return(true); } CharacterBlueprint characterBlueprint = DependencyContainer.Instance.GetInstance <IWorld>().GetCharacterBlueprint(parameters[0].AsNumber); if (characterBlueprint == null) { Send("No character with that id."); return(true); } ICharacter character = DependencyContainer.Instance.GetInstance <IWorld>().AddCharacter(Guid.NewGuid(), characterBlueprint, Impersonating.Room); if (character == null) { Send("Character cannot be created."); DependencyContainer.Instance.GetInstance <IServer>().Wiznet($"DoCload: character with id {parameters[0].AsNumber} cannot be created", WiznetFlags.Bugs, AdminLevels.Implementor); return(true); } DependencyContainer.Instance.GetInstance <IServer>().Wiznet($"{DisplayName} loads {character.DebugName}.", WiznetFlags.Load); Impersonating.Act(ActOptions.ToAll, "{0:N} {0:h} created {1:n}!", Impersonating, character); Send("Ok."); return(true); }
protected virtual bool DoGoto(string rawParameters, params CommandParameter[] parameters) { if (parameters.Length == 0) { Send("Goto where?"); return(true); } // IRoom where = FindHelpers.FindLocation(Impersonating, parameters[0]); if (where == null) { Send("No such location."); return(true); } if (Impersonating.Fighting != null) { Impersonating.StopFighting(true); } Impersonating.Act(Impersonating.Room.People.Where(x => x != Impersonating && x.CanSee(Impersonating)), "{0} leaves in a swirling mist.", Impersonating); // Don't display 'Someone leaves ...' if Impersonating is not visible Impersonating.ChangeRoom(where); Impersonating.Act(Impersonating.Room.People.Where(x => x != Impersonating && x.CanSee(Impersonating)), "{0} appears in a swirling mist.", Impersonating); Impersonating.AutoLook(); return(true); }
protected virtual bool DoPurge(string rawParameters, params CommandParameter[] parameters) { if (parameters.Length == 0) { Send("Purge what?"); return(true); } IItem item = FindHelpers.FindItemHere(Impersonating, parameters[0]); if (item == null) { Send(StringHelpers.ItemNotFound); return(true); } DependencyContainer.Instance.GetInstance <IServer>().Wiznet($"{DisplayName} purges {item.DebugName}.", WiznetFlags.Punish); Impersonating.Act(ActOptions.ToAll, "{0:N} purge{0:v} {1}!", Impersonating, item); DependencyContainer.Instance.GetInstance <IWorld>().RemoveItem(item); return(true); }
protected virtual bool DoQuit(string rawParameters, params CommandParameter[] parameters) { if (Impersonating != null) { if (Impersonating.Fighting != null) { Send("No way! You are fighting."); return(true); } if (Impersonating.Position == Positions.Stunned) { Send("You can't leave while stunned."); return(true); } } Send("Alas, all good things must come to an end."); Impersonating?.Act(ActOptions.ToRoom, "{0:N} has left the game.", Impersonating); DependencyContainer.Instance.GetInstance <IServer>().Wiznet($"{DisplayName} rejoins the real world.", WiznetFlags.Logins); Save(); DependencyContainer.Instance.GetInstance <IServer>().Quit(this); return(true); }