/// <summary> /// Executes this command /// </summary> public override void Execute() { var newObject = (INonPlayerCharacter)Subject; var sb = new List <string>(); IContains spawnTo; //No target = spawn to room you're in if (Target != null) { spawnTo = (IContains)Target; } else { spawnTo = OriginLocation; } var entityObject = new Intelligence(newObject, spawnTo); //TODO: keywords is janky, location should have its own identifier name somehow for output purposes - DISPLAY short/long NAME sb.Add(string.Format("{0} spawned to {1}", entityObject.DataTemplate.Name, spawnTo.Keywords[0])); var messagingObject = new MessageCluster(sb, new string[] { "You are ALIVE" }, new string[] { "You have been given $S$" }, new string[] { "$S$ appears in the $T$." }, new string[] { }); messagingObject.ExecuteMessaging(Actor, entityObject, spawnTo, OriginLocation, null); }
/// <summary> /// Executes this command /// </summary> public override void Execute() { var sb = new List <string>(); var thing = (IEntity)Subject; var actor = (IContains)Actor; IContains place; string toRoomMessage = "$A$ gets $S$."; if (Target != null) { place = (IContains)Target; toRoomMessage = "$A$ gets $S$ from $T$."; sb.Add("You get $S$ from $T$."); } else { place = (IContains)OriginLocation; sb.Add("You get $S$."); } place.MoveFrom(thing); actor.MoveInto(thing); var messagingObject = new MessageCluster(sb, new string[] { }, new string[] { }, new string[] { toRoomMessage }, new string[] { }); messagingObject.ExecuteMessaging(Actor, thing, (IEntity)Target, OriginLocation, null); }
public override void Execute() { //NPCs dont need to use this if (!Actor.GetType().GetInterfaces().Contains(typeof(IPlayer))) { return; } var returnStrings = new List <string>(); var sb = new StringBuilder(); var commandsAssembly = Assembly.GetAssembly(typeof(CommandParameterAttribute)); var loadedCommands = commandsAssembly.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(ICommand))); loadedCommands = loadedCommands.Where(comm => comm.GetCustomAttributes <CommandPermissionAttribute>().Any(att => att.MinimumRank <= ((ICharacter)Actor.DataTemplate).GamePermissionsRank)); returnStrings.Add("Commands:"); foreach (var commandName in loadedCommands.Select(comm => comm.Name)) { sb.Append(commandName + ", "); } if (sb.Length > 0) { sb.Length -= 2; } returnStrings.Add(sb.ToString()); var messagingObject = new MessageCluster(returnStrings, new string[] { }, new string[] { }, new string[] { }, new string[] { }); messagingObject.ExecuteMessaging(Actor, null, null, null, null); }
/// <summary> /// Executes this command /// </summary> public override void Execute() { var sb = new List <string>(); sb.Add(String.Format("You say '{0}'", Subject)); //TODO: language outputs var messagingObject = new MessageCluster(sb, new string[] { }, new string[] { }, new string[] { String.Format("$A$ says '{0}'", Subject) }, new string[] { }); messagingObject.ExecuteMessaging(Actor, null, null, OriginLocation, null); }
/// <summary> /// Executes this command /// </summary> public override void Execute() { var moveTo = (ILocation)Subject; var sb = new List <string>(); sb.Add("You teleport."); var messagingObject = new MessageCluster(sb, new string[] { }, new string[] { }, new string[] { "$A$ disappears in a puff of smoke." }, new string[] { "$A$ appears out of nowhere." }); messagingObject.ExecuteMessaging(Actor, null, null, OriginLocation, null); moveTo.MoveInto <Player>((Player)Actor); }
/// <summary> /// Executes this command /// </summary> public override void Execute() { var sb = new List <string>(); var thing = (IEntity)Subject; var place = (IContains)Target; var actor = (IContains)Actor; actor.MoveFrom(thing); place.MoveInto(thing); sb.Add("You put $S$ in the $T$."); var messagingObject = new MessageCluster(sb, new string[] { }, new string[] { }, new string[] { "$A$ puts $S$ in the $T$." }, new string[] { }); messagingObject.ExecuteMessaging(Actor, thing, (IEntity)place, OriginLocation, null); }
/// <summary> /// Executes this command /// </summary> public override void Execute() { var sb = new List <string>(); var thing = (IEntity)Subject; var actor = (IContains)Actor; IContains place = (IContains)OriginLocation; actor.MoveFrom(thing); place.MoveInto(thing); sb.Add("You drop $S$."); var messagingObject = new MessageCluster(sb, new string[] { }, new string[] { }, new string[] { "$A$ drops $S$." }, new string[] { }); messagingObject.ExecuteMessaging(Actor, thing, null, OriginLocation, null); }
/// <summary> /// Executes this command /// </summary> public override void Execute() { var sb = new List <string>(); var chr = (IMobile)Actor; sb.Add("You look through your belongings."); foreach (var thing in chr.Inventory.EntitiesContained()) { sb.AddRange(thing.RenderToLook(chr)); } var messagingObject = new MessageCluster(sb, new string[] { }, new string[] { }, new string[] { "$A$ sifts through $G$ belongings." }, new string[] { }); messagingObject.ExecuteMessaging(Actor, null, null, OriginLocation, null); }
/// <summary> /// Executes this command /// </summary> public override void Execute() { var sb = new List <string>(); var player = (Player)Actor; sb.Add("You save your life."); var messagingObject = new MessageCluster(sb, new string[] { }, new string[] { }, new string[] { }, new string[] { }); messagingObject.ExecuteMessaging(Actor, null, null, OriginLocation, null); var hotBack = new HotBackup(HostingEnvironment.MapPath("/HotBackup/")); //Save the player out hotBack.WriteOnePlayer(player); }
/// <summary> /// Executes this command /// </summary> public override void Execute() { var sb = new List <string>(); //Just do a look on the room if (Subject == null) { sb.AddRange(OriginLocation.RenderToLook(Actor)); } else { var lookTarget = (ILookable)Subject; sb.AddRange(lookTarget.RenderToLook(Actor)); } var messagingObject = new MessageCluster(sb, new string[] { "$A$ looks at you." }, new string[] { }, new string[] { "$A$ looks around the room." }, new string[] { }); messagingObject.ExecuteMessaging(Actor, (IEntity)Subject, null, OriginLocation, null); }
/// <summary> /// Executes this command /// </summary> public override void Execute() { var topic = (IHelpful)Subject; var sb = GetHelpHeader(topic); sb = sb.Concat(topic.RenderHelpBody()).ToList(); //If it's a command render the syntax help at the bottom if (topic.GetType().GetInterfaces().Contains(typeof(ICommand))) { var subject = (ICommand)topic; sb.Add(string.Empty); sb = sb.Concat(subject.RenderSyntaxHelp()).ToList(); } var messagingObject = new MessageCluster(sb, new string[] { }, new string[] { }, new string[] { }, new string[] { }); messagingObject.ExecuteMessaging(Actor, null, null, null, null); }
/// <summary> /// Executes this command /// </summary> public override void Execute() { var sb = new List <string>(); var thing = (IEntity)Subject; var place = (IContains)Target; var actor = (IContains)Actor; actor.MoveFrom(thing); place.MoveInto(thing); sb.Add("You put $S$ in the $T$."); var toActor = new Message(MessagingType.Visible, new Occurrence() { Strength = 1 }) { Override = sb }; var toOrigin = new Message(MessagingType.Visible, new Occurrence() { Strength = 30 }) { Override = new string[] { "$A$ puts $S$ in the $T$." } }; var messagingObject = new MessageCluster(toActor) { ToOrigin = new List <IMessage> { toOrigin } }; messagingObject.ExecuteMessaging(Actor, thing, place, OriginLocation.CurrentLocation, null); }