public static void StatClass(CharData ch, string[] str) { if( ch == null ) return; int circle; int level; CharData realChar = ch.GetChar(); int num = (int)realChar.CharacterClass.ClassNumber; /* * Set default arguments. */ CharClass cclass = realChar.CharacterClass; if (str.Length != 0 && !String.IsNullOrEmpty(str[0])) { // If it's not a number try it as a class name. if (Int32.TryParse(str[0], out num)) { cclass = CharClass.ClassList[num]; } else { /* * Look for class to turn on. */ for (int iClass = 0; iClass < CharClass.ClassList.Length; iClass++) { if (CharClass.ClassList[iClass].Name.StartsWith(str[0], StringComparison.CurrentCultureIgnoreCase)) { num = iClass; cclass = CharClass.ClassList[iClass]; break; } } } } if (cclass == null) { ch.SendText("No such class.\r\n"); return; } string text = String.Format("Class: {0} ({1}) Class Number: &n&+W{2}&n\r\n", cclass.Name, cclass.WholistName, num); string buf1 = text; text = String.Format("File: {0} Prime Attribute: {1}\r\n", cclass.Filename, StringConversion.AffectApplyString(cclass.PrimeAttribute)); buf1 += text; text = String.Format("Save Modifiers: {0} {1} {2} {3} {4}", cclass.SaveModifiers[0], cclass.SaveModifiers[1], cclass.SaveModifiers[2], cclass.SaveModifiers[3], cclass.SaveModifiers[4] ); text = String.Format("Thac0Lvl0: {0} Thac0Lvl40: {1} Experience Modifier: {2}\r\n", MUDString.PadInt(cclass.HitrollLevel0, 5), cclass.HitrollLevel40, cclass.ExperienceModifier); buf1 += text; text = String.Format("Hp Min/Hp Max: {0}/{1} Mana: {2} Weapon: {3} Mount: {4}\r\n", cclass.MinHpGain, cclass.MaxHpGain, cclass.GainsMana ? "yes" : "no", cclass.FirstWeapon, cclass.CanSummonMountNumber); buf1 += text; buf1 += "\r\nSkills available for this class.\r\n"; buf1 += "Lv Abilities\r\n"; for (level = 0; level < Limits.LEVEL_AVATAR; level++) { foreach (KeyValuePair<String, Skill> kvp in Skill.SkillList) { if (kvp.Value.ClassAvailability[num] != level) continue; text = String.Format("&+c{0}:&n {1}\r\n", MUDString.PadInt(level, 2), kvp.Value.Name); buf1 += text; } } buf1 += "\r\nSpells available for this class.\r\n"; buf1 += "Circle Spells\r\n"; for (circle = 0; circle < Limits.MAX_CIRCLE; circle++) { foreach (KeyValuePair<String, Spell> kvp in Spell.SpellList) { if (kvp.Value.SpellCircle[num] != circle) continue; text = String.Format("&+c{0}:&n {1}\r\n", MUDString.PadInt(circle, 2), kvp.Key); buf1 += text; } } realChar.SendText(buf1); return; }
/// <summary> /// Immortal command to ban a site from the game. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Ban(CharData ch, string[] str) { if( ch == null ) return; BanData ban; if (ch.IsNPC()) { return; } CharData realChar = ch.GetChar(); if (!realChar.Authorized("ban")) { return; } if (str.Length == 0) { string text = "Banned sites:\r\n"; foreach (BanData it in Database.BanList) { ban = it; text += ban.Name; text += "\r\n"; } ch.SendText(text); return; } foreach (BanData it in Database.BanList) { ban = it; if (!MUDString.StringsNotEqual(str[0], ban.Name)) { ch.SendText("That site is already banned!\r\n"); return; } } ban = new BanData(); ban.Name = str[0]; Database.BanList.Add(ban); ch.SendText("Done.\r\n"); Event.UpdateBans(); return; }
public static void GroupStat(CharData ch, string[] str) { if( ch == null ) return; CharData victim; CharData groupChar; CharData leader; string text; string arg = String.Empty; string buf1; CharData realChar = ch.GetChar(); if (arg.Length > 0) { victim = realChar.GetCharRoom(arg); if (!victim) { victim = realChar.GetCharWorld(arg); } if (!victim) { realChar.SendText("You can't find that person anywhere.\r\n"); return; } if (!victim.GroupLeader) { realChar.SendText("They aren't in a group.\r\n"); return; } leader = victim.GroupLeader; buf1 = String.Format("&+G{0}'s group:&n\r\n", leader.Name); for (groupChar = leader; groupChar; groupChar = groupChar.NextInGroup) { text = String.Format(" &+G{0}&n\r\n", groupChar.Name); buf1 += text; } realChar.SendText(buf1); return; } buf1 = String.Empty; foreach (CharData it in Database.CharList) { victim = it; if (victim != victim.GroupLeader) { continue; } leader = victim.GroupLeader; text = String.Format("&+G{0}'s group:&n\r\n", leader.Name); buf1 += text; for (groupChar = leader; groupChar; groupChar = groupChar.NextInGroup) { text = String.Format(" &+G{0}&n\r\n", groupChar.Name); buf1 += text; } } realChar.SendText(buf1); return; }
/// <summary> /// Finds a mob or list of mobiles in the area or in the world. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void FindMobile(CharData ch, string[] str) { if( ch == null ) return; MobTemplate mobTemplate; int indexNumber; int bottom; int top; bool fRace = false; bool fTeacher = false; bool fClass = false; int race = 0; ModernMUD.CharClass.Names charclass = 0; ch.GetChar(); if (str.Length < 2 || (MUDString.StringsNotEqual(str[0], "world") && MUDString.StringsNotEqual(str[0], "area") && MUDString.StringsNotEqual(str[0], "race") && MUDString.StringsNotEqual(str[0], "teacher"))) { ch.SendText("Syntax: find m world <mobile>|all\r\n"); ch.SendText("or: find m area <mobile>|all\r\n"); ch.SendText(" find m race <racename> <class>\r\n"); ch.SendText(" find m teacher race|class|all <race|class>\r\n"); return; } if (String.IsNullOrEmpty(str[1])) { ch.SendText("Find what mob?\r\n"); return; } bool all = !MUDString.StringsNotEqual(str[1], "all"); bool found = false; Area area = ch.InRoom.Area; bool world = !MUDString.StringsNotEqual(str[0], "world"); if (!MUDString.StringsNotEqual(str[0], "race")) { int value; fRace = true; world = true; bool result = Int32.TryParse(str[1], out value); if (result != false) { race = Race.RaceLookup(str[1]); } if (race == -1) { ch.SendText("Lookup mobs of what race?\r\n"); return; } if (!MUDString.StringsNotEqual(str[1], "class") && str.Length > 2) { fClass = true; charclass = CharClass.ClassLookup(str[2]); } } if (world) { bottom = 0; top = Database.HighestMobIndexNumber; } else { bottom = area.LowMobIndexNumber; top = area.HighMobIndexNumber + 1; } /* * Yeah, so iterating over all index numbers takes one loop for each index. */ for (indexNumber = bottom; indexNumber < top; indexNumber++) { mobTemplate = Database.GetMobTemplate(indexNumber); if (!mobTemplate) continue; if (!world && area != mobTemplate.Area) continue; if (all || MUDString.NameContainedIn(str[1], mobTemplate.PlayerName)) { if (all || MUDString.NameContainedIn(str[1], mobTemplate.PlayerName) || (fRace && mobTemplate.Race == race) || (fClass && mobTemplate.CharacterClass.ClassNumber == charclass)) { if (fTeacher && !mobTemplate.HasActBit(MobTemplate.ACT_TEACHER)) continue; found = true; string buf = String.Format("[{0}] {1}&n\r\n", MUDString.PadInt(mobTemplate.IndexNumber, 5), mobTemplate.ShortDescription.ToUpper()); ch.SendText(buf); } } } if (!found) { ch.SendText("Nothing like that in &+rhell&n, &+gea&+brth&n, or &+Yhea&+Wven&n.\r\n"); return; } return; }
/// <summary> /// Immortal command to force someone to do something. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Force(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); if (!realChar.Authorized("force")) return; if (str.Length < 2) { ch.SendText("Force whom to do what?\r\n"); return; } /* * Look for command in command table. */ int trust = ch.GetTrust(); foreach (CommandType cmd in CommandType.CommandTable) { if ( !MUDString.IsPrefixOf(str[0], cmd.Name) && (cmd.MinLevel > trust)) { ch.SendText("You can't even do that yourself!\r\n"); return; } } string action = String.Join(" ", str, 1, (str.Length - 1)); if (!MUDString.StringsNotEqual(str[0], "all")) { foreach (CharData worldChar in Database.CharList) { if (!worldChar.IsNPC() && worldChar.GetTrust() < ch.GetTrust()) { SocketConnection.Act("$n forces you to '$t'.", ch, action, worldChar, SocketConnection.MessageTarget.victim); CommandType.Interpret(worldChar, action); } } } else { CharData victim; if (!(victim = ch.GetCharWorld(str[0]))) { ch.SendText("They aren't here.\r\n"); return; } if (victim == ch) { ch.SendText("Aye aye, right away!\r\n"); return; } if (victim.GetTrust() >= ch.GetTrust()) { ch.SendText("Do it yourself!\r\n"); return; } SocketConnection.Act("$n forces you to '$t'.", ch, action, victim, SocketConnection.MessageTarget.victim); CommandType.Interpret(victim, action); } ch.SendText("Done.\r\n"); return; }
/// <summary> /// Disconnect a character from the game. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Disconnect(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); SocketConnection socket; if (!realChar.Authorized("disconnect")) { return; } if (str.Length == 0) { ch.SendText("Disconnect whom?\r\n"); return; } CharData victim = ch.GetCharWorld(str[0]); if (!victim) { ch.SendText("They aren't here.\r\n"); return; } if (!victim.Socket) { SocketConnection.Act("$N doesn't have a socket.", ch, null, victim, SocketConnection.MessageTarget.character); return; } foreach (SocketConnection it in Database.SocketList) { socket = it; if (socket == victim.Socket) { socket.CloseSocket(); ch.SendText("Done.\r\n"); return; } } Log.Error("Disconnect: Socket not found.", 0); ch.SendText("Socket not found!\r\n"); return; }
/// <summary> /// Immortal command to echo content to the whole MUD. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Echo(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); if (!realChar.Authorized("echo")) { return; } if (str.Length == 0 || String.IsNullOrEmpty(str[0])) { ch.SendText("Echo what?\r\n"); return; } string colorCode = String.Empty; if (!ch.IsNPC() && ((PC)ch).ImmortalData != null) colorCode = ((PC)ch).ImmortalData.ImmortalColor; string content = colorCode + String.Join(" ", str) + "&n\r\n"; SocketConnection.SendToAllChar(content); return; }
/// <summary> /// Deletes/destroys a character and removes them from the game. Reserved for use /// on real grade-A jerks. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Terminate(CharData ch, string[] str) { if( ch == null ) return; CharData victim; SocketConnection socket; CharData realChar = ch.GetChar(); if (!realChar.Authorized("terminate")) { return; } if (str.Length == 0 ) { ch.SendText("Terminate whom?\r\n"); return; } if (!(victim = realChar.GetCharWorld(str[0]))) { ch.SendText("They aren't here.\r\n"); return; } if (!victim.Socket) { SocketConnection.Act("$N&n doesn't have a descriptor.", ch, null, victim, SocketConnection.MessageTarget.character); } if (realChar == victim) { ch.SendText("You may not terminate yourself, use RETIRE.\r\n"); return; } if (realChar.Level <= victim.Level && realChar != victim) { ch.SendText("You may not terminate your peer nor your superior.\r\n"); return; } foreach (SocketConnection it in Database.SocketList) { socket = it; if (socket == victim.Socket) { /* By saving first i assure i am not removing a non existing file * i know it's stupid and probably useless but... */ victim.SendText("&+RYour soul has been revoked by the gods!&n\r\n"); SocketConnection.Act("&+R$n&+R grabs ahold of $N&+R's soul and tears it to shreds.&n\r\n" + "&+R$n&+R then proceeds to jump all over the little pieces while cackling fiendishly.&n", realChar, null, victim, SocketConnection.MessageTarget.room); Log.Trace("Terminate: Saving"); CharData.SavePlayer(victim); Log.Trace("Terminate: Backing Up"); CharData.BackupPlayer(victim); Log.Trace("Terminate: Deleting"); CharData.DeletePlayer(victim); Log.Trace("Terminate: Extracting"); CharData.ExtractChar(victim, true); Log.Trace("Terminate: Closing Socket"); socket.CloseSocket(); realChar.SendText("&+RVic&+rtim des&+Rtro&+ryed&+R!&n\r\n"); return; } } ch.SendText("Termination target not found!\r\n"); return; }
public static void AppearanceMessage(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); if (!realChar.Authorized("appearmsg") || ch.IsImmortal() ) return; if (str.Length == 0) { ch.SendText("What do you want your appear message to say?\r\n"); } if (!ch.IsNPC()) { if (ch.StringTooLong(str[0])) { return; } ((PC)ch).ImmortalData.AppearMessage = str[0]; ch.SendText("Done.\r\n"); } return; }
/// <summary> /// Lets an immortal take control of (possess) a mob. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Switch(CharData ch, string[] str) { if( ch == null ) return; CharData victim; CharData realChar = ch.GetChar(); if (!realChar.Authorized("switch")) { return; } if (str.Length == 0) { ch.SendText("Switch into whom?\r\n"); return; } if (ch.Socket == null) { return; } if (ch.Socket.Original) { ch.SendText("You are already switched.\r\n"); return; } if (!(victim = ch.GetCharWorld(str[0]))) { ch.SendText("They aren't here.\r\n"); return; } if (victim == ch) { ch.SendText("Done.\r\n"); return; } /* * Pointed out by Da Pub (What Mud) */ if (!victim.IsNPC()) { ch.SendText("You cannot switch into a player!\r\n"); return; } if (victim.Socket) { ch.SendText("Character in use.\r\n"); return; } ((PC)ch).IsSwitched = true; ch.Socket.Character = victim; ch.Socket.Original = ch; victim.Socket = ch.Socket; ch.Socket = null; victim.SendText("Done.\r\n"); string buf = String.Format("{0} switched into {1}", realChar.Name, victim.ShortDescription); ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_SWITCHES, realChar.GetTrust(), buf); return; }
public static void Terminat(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); if (!realChar.Authorized("terminate")) { return; } ch.SendText("If you want to TERMINATE someone, spell it out.\r\n"); return; }
/// <summary> /// Shows statistics for a given spell or group of spells. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void StatSpell(CharData ch, string[] str) { if( ch == null ) return; string arg = String.Join(" ", str); ch.GetChar(); if (str.Length == 0) { ch.SendText("Stat what spell?\r\nYou can use 'stat spell all', 'stat spell <type>', types being 'ignore', 'offensive', 'object', or 'defensive'.\r\n"); return; } if (!MUDString.StringsNotEqual(arg, "all") || !MUDString.StringsNotEqual(arg, "offensive") || !MUDString.StringsNotEqual(arg, "none")) { TargetType type = TargetType.none; bool specificType = false; if ("offensive".StartsWith(arg, StringComparison.CurrentCultureIgnoreCase)) { specificType = true; type = TargetType.singleCharacterOffensive; } else if ("ignore".StartsWith(arg, StringComparison.CurrentCultureIgnoreCase)) { specificType = true; type = TargetType.none; } else if ("defensive".StartsWith(arg, StringComparison.CurrentCultureIgnoreCase)) { specificType = true; type = TargetType.singleCharacterDefensive; } else if ("object".StartsWith(arg, StringComparison.CurrentCultureIgnoreCase)) { specificType = true; type = TargetType.objectInInventory; } foreach (Spell spll in Spell.SpellList.Values) { if (String.IsNullOrEmpty(spll.Name)) continue; if (specificType && type != spll.ValidTargets) continue; ch.SendText(String.Format("Spell: '{0}'. ", spll.Name)); if (specificType) { ch.SendText(String.Format("Lag: {0}. Castable in battle: {1}. School: {2}.\r\n", spll.CastingTime, spll.CanCastInCombat ? "Yes." : "No. ", StringConversion.SpellSchoolString(spll.School))); } else { ch.SendText("\r\n"); } } } else { try { Spell sn = Spell.SpellList[arg]; ch.SendText(sn.ToString()); } catch (KeyNotFoundException) { ch.SendText("No such spell.\r\n"); return; } } return; }
/// <summary> /// Immortal command to display info about a reace. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void StatRace(CharData ch, string[] str) { int num; CharData realChar = ch.GetChar(); if (str.Length == 0) { num = (int)realChar.CharacterClass.ClassNumber; } else if (MUDString.IsNumber(str[0])) { Int32.TryParse(str[0], out num); } else { num = Race.RaceLookup(str[0]); } if (num < 0 || num >= Race.RaceList.Length) { ch.SendText("Invalid race number!\r\n"); return; } string buf1 = String.Format("&+WRacial stats for race {0}&n\r\n\r\n", num); string text = String.Format("Name: {0} ANSI Name: {1}\r\n", Race.RaceList[num].Name, Race.RaceList[num].ColorName); buf1 += text; text = String.Format("Key: {0} Size: {1}\r\n", Race.RaceList[num].Key, Race.RaceList[num].DefaultSize); buf1 += text; text = String.Format("Height: {0} inches. Weight: {1} pounds. Base Alignment: {2} ({3})\r\n", Race.RaceList[num].Height, Race.RaceList[num].Weight, Race.RaceList[num].BaseAlignment, StringConversion.AlignmentString(Race.RaceList[num].BaseAlignment)); buf1 += text; text = String.Format("&+WStat modifiers: (Max. stats):&n\r\n"); buf1 += text; text = String.Format("Str: {0} Int: {1} Wis: {2} Dex: {3} Con: {4}\r\nAgi: {5} Cha: {6} Pow: {7} Luk: {8}\r\n", Race.RaceList[num].StrModifier, Race.RaceList[num].IntModifier, Race.RaceList[num].WisModifier, Race.RaceList[num].DexModifier, Race.RaceList[num].ConModifier, Race.RaceList[num].AgiModifier, Race.RaceList[num].ChaModifier, Race.RaceList[num].PowModifier, Race.RaceList[num].LukModifier); buf1 += text; text = String.Format("HP Gain (unused): {0} Mana Gain: {1} Move Gain (unused): {2}\r\n", Race.RaceList[num].HpGain, Race.RaceList[num].ManaGain, Race.RaceList[num].MoveGain); buf1 += text; text = String.Format("Thirst Mod (unused): {0} Hunger Mod (unused): {1}\r\nDamage Message: {2} Walk Message: {3}\r\n", Race.RaceList[num].ThirstModifier, Race.RaceList[num].HungerModifier, Race.RaceList[num].DamageMessage, Race.RaceList[num].WalkMessage); buf1 += text; text = String.Format("Hatred: {0}.\r\nParts: {1}.\r\nResist: {2}. Immune: {3}.\r\nSusceptible: {4}. Vulnerable: {5}.\r\n", Race.RaceList[num].Hate, Race.RaceList[num].BodyParts, Race.RaceList[num].Resistant, Race.RaceList[num].Immune, Race.RaceList[num].Susceptible, Race.RaceList[num].Vulnerable); buf1 += text; text = String.Format("Racewar Side: {0} Language: {1} Base Age: {2} Max Age: {3}\r\n", Race.RaceList[num].WarSide, Race.RaceList[num].PrimaryLanguage, Race.RaceList[num].BaseAge, Race.RaceList[num].MaxAge); buf1 += text; realChar.SendText(buf1); return; }
/// <summary> /// Immortal command to get the stats of an object. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void StatObject(CharData ch, string[] str) { if( ch == null ) return; Object obj = null; int value; string buf1 = String.Empty; ch.GetChar(); if (str.Length == 0) { ch.SendText("Ostat what?\r\n"); return; } Int32.TryParse(str[0], out value); // Non numeric, search for object as a string. if (value == 0 && !(obj = Object.GetObjectInWorld(ch, str[0]))) { ch.SendText("Nothing like '" + str[0] + "' in this universe.\r\n"); return; } // Nothing found or numeric supplied, look for index number. if (!obj) { ObjTemplate objTemplate; if (!(objTemplate = Database.GetObjTemplate(value))) { ch.SendText("Invalid object index number.\r\n"); return; } if (!(obj = Object.GetFirstObjectOfTemplateType(objTemplate))) { ch.SendText("None of those in game.\r\n"); return; } } string text = String.Format("Name: {0}.\r\n", obj.Name); buf1 += text; text = String.Format("IndexNumber: {0}. Type: {1} - {2}.\r\n", obj.ObjIndexData.IndexNumber, obj.ItemType, StringConversion.ItemTypeString(obj)); buf1 += text; text = String.Format("Short description: {0}&n.\r\nLong description: {1}&n\r\n", obj.ShortDescription, obj.FullDescription); buf1 += text; text = String.Format("Wear bits: {0}. Extra bits: {1} ({2} {3}).\r\n", obj.WearFlags[0], Object.ItemString(obj), obj.ExtraFlags[0], obj.ExtraFlags[1]); buf1 += text; buf1 += String.Format("Number: {0}/{1}. Weight: {2}/{3}. Size: {4}. Volume: {5}.\r\n", 1, Object.GetObjectQuantity(obj), obj.Weight, obj.GetWeight(), obj.Size, obj.Volume); text = String.Format("Material Type: {0}. ({1}). Craftsmanship: {2}. Scarcity: {3}.\n", obj.Material, Material.Table[(int)obj.Material].ShortDescription, obj.Craftsmanship, obj.ObjIndexData.Scarcity); buf1 += text; text = String.Format("Cost: {0}. Timer: {1}. Level: {2}. Number Loaded: {3}.\r\n", obj.Cost, obj.Timer, obj.Level, obj.ObjIndexData.QuantityLoaded); buf1 += text; /* Added wear_location in text, not int format. */ text = String.Format( "In room: {0}. In object: {1}. Carried by: {2}. WearLoc: {3}.\r\n", obj.InRoom ? obj.InRoom.IndexNumber : 0, obj.InObject ? obj.InObject.ShortDescription : "(none)", obj.CarriedBy ? obj.CarriedBy.Name : "(none)", obj.WearLocation); // Had to change this - V buf1 += text; /* Added all eight values. */ text = String.Format("Values: {0} {1} {2} {3} {4} {5} {6} {7}.\r\n", obj.Values[0], obj.Values[1], obj.Values[2], obj.Values[3], obj.Values[4], obj.Values[5], obj.Values[6], obj.Values[7]); buf1 += text; if (obj.ExtraDescription.Count > 0 || obj.ObjIndexData.ExtraDescriptions.Count > 0) { buf1 += "Extra description keywords: "; bool first = true; foreach (ExtendedDescription ed in obj.ExtraDescription) { if (!first) { buf1 += " "; } buf1 += ed.Keyword; first = false; } first = true; foreach (ExtendedDescription ed in obj.ObjIndexData.ExtraDescriptions) { if (!first) { buf1 += " "; } buf1 += ed.Keyword; first = false; } buf1 += ".\r\n"; } foreach (Affect aff in obj.Affected) { foreach (AffectApplyType apply in aff.Modifiers) { text = String.Format("Affects {0} by {1}.\r\n", StringConversion.AffectApplyString(apply.Location), apply.Amount); buf1 += text; } } foreach (Affect aff in obj.ObjIndexData.Affected) { foreach (AffectApplyType apply in aff.Modifiers) { text = String.Format("Template Affects {0} by {1}.\r\n", StringConversion.AffectApplyString(apply.Location), apply.Amount); buf1 += text; } } /* Added display of object's condition. */ /* This will need to be modified from int to a char string, once a table exists for it. */ text = String.Format("Object is in {0} condition.\r\n", obj.Condition); buf1 += text; if (obj.UseFlags != null) { text = String.Format("Object UseFlags: {0} {1} ({2})\r\n", obj.UseFlags[0], obj.UseFlags[1], Object.UseFlagString(obj)); } else { text = String.Format("Object has no UseFlags.\r\n"); } buf1 += text; if (obj.SpecFun != null) { text = String.Format("Special function: {0}.\r\n", StringConversion.ObjectSpecialString(obj.SpecFun)); buf1 += text; } //if( obj.pIndexData.objprogs ) //{ // buf = String.Format( "Object has an objprog.\r\n" ); // buf1 += buf; //} /* Added display of affected_by array. */ text = String.Format("Affected by: {0}.\r\n", BitvectorFlagType.AffectString(obj.AffectedBy, false)); buf1 += text; ch.SendText(buf1); return; }
/// <summary> /// Deny a player access to the game. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Deny(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); if (!realChar.Authorized("deny")) { return; } if (str.Length == 0) { ch.SendText("Deny whom?\r\n"); return; } CharData victim = ch.GetCharWorld(str[0]); if (victim == null) { ch.SendText("They aren't here.\r\n"); return; } if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } if (victim.GetTrust() >= ch.GetTrust()) { ch.SendText("You failed.\r\n"); return; } victim.SetActionBit(PC.PLAYER_DENY); victim.SendText("You are denied access!\r\n"); ch.SendText("Done.\r\n"); if (victim.Level <= 1) { CommandType.Interpret(victim, "quit"); } return; }
/// <summary> /// Immortal command to change a player's level. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Advance(CharData ch, string[] str) { if( ch == null ) return; CharData victim; string text; int level = 0; int iLevel = 0; CharData realChar = ch.GetChar(); if (!realChar.Authorized("advance")) { return; } if (str.Length < 2 || String.IsNullOrEmpty(str[0]) || String.IsNullOrEmpty(str[1]) || !MUDString.IsNumber(str[1])) { ch.SendText("Syntax: advance <char> <level>.\r\n"); return; } if (!(victim = ch.GetCharRoom(str[0]))) { ch.SendText("That player is not here.\r\n"); return; } if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } Int32.TryParse(str[1], out level); if (level < 1 || level > Limits.MAX_LEVEL) { ch.SendText(String.Format("Advance within range 1 to {0}.\r\n", Limits.MAX_LEVEL)); return; } if (level > ch.GetTrust()) { ch.SendText("Limited to your trust level.\r\n"); return; } /* * Lower level: * Reset to level 1. * Then raise again. * Currently, an imp can lower another imp. */ if (level <= victim.Level) { ch.SendText("Lowering a player's level!\r\n"); victim.SendText("**** OOOOHHHHHHHHHH NNNNOOOO ****\r\n"); victim.Level = 1; // Max_hit should only be accessed for PERMENANT changes. victim.MaxHitpoints = 20; if (ch.CharacterClass.GainsMana) { victim.MaxMana = 50; // Mana bonuses for newbies. victim.MaxMana += (victim.GetCurrInt() / 10); victim.MaxMana += (victim.GetCurrWis() / 14); victim.MaxMana += (victim.GetCurrPow() / 7); } else { victim.MaxMana = 0; } victim.MaxMoves = 150; // removed resetting of skills. victim.Hitpoints = victim.GetMaxHit(); victim.CurrentMana = victim.MaxMana; victim.CurrentMoves = victim.MaxMoves; text = String.Format("{0} has been demoted to level {1} by {2}", victim.Name, level, ch.Name); ImmortalChat.SendImmortalChat(victim, ImmortalChat.IMMTALK_LEVELS, realChar.GetTrust(), text); } else { ch.SendText("Raising a player's level!\r\n"); victim.SendText("**** OOOOHHHHHHHHHH YYYYEEEESSS ****\r\n"); text = String.Format("{0} has been advanced to level {1} by {2}", victim.Name, level, ch.Name); ImmortalChat.SendImmortalChat(victim, ImmortalChat.IMMTALK_LEVELS, realChar.GetTrust(), text); } // Do not advance skills -- rerolling someone will auto-master // their skills with no effort from the player... so we advance // them with skills set to false -- Xangis for (iLevel = victim.Level; iLevel < level; iLevel++) { victim.AdvanceLevel(victim); } victim.ExperiencePoints = 1; victim.TrustLevel = 0; return; }
public static void DisappearMessage(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); if (!realChar.Authorized("disappearmsg") || !ch.IsImmortal()) { return; } if (str.Length == 0) { ch.SendText("You need to provide a message.\r\n"); return; } if (!ch.IsNPC()) { if (ch.StringTooLong(str[0])) { return; } ((PC)ch).ImmortalData.DisappearMessage = str[0]; ch.SendText("Done.\r\n"); } return; }
/// <summary> /// Teleports a character from one place to another. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Transfer(CharData ch, string[] str) { if( ch == null ) return; SocketConnection socket; Room location; CharData realChar = ch.GetChar(); if (!realChar.Authorized("transfer")) { return; } if (str.Length < 1 || String.IsNullOrEmpty(str[0])) { ch.SendText("Transfer whom (and where)?\r\n"); return; } if (!MUDString.StringsNotEqual(str[0], "all")) { // Transfer them one by one. foreach (SocketConnection it in Database.SocketList) { socket = it; if (socket.ConnectionStatus == SocketConnection.ConnectionState.playing && socket.Character != ch && socket.Character.InRoom && CharData.CanSee(ch, socket.Character)) { str[0] = socket.Character.Name; Transfer(ch, str); } } return; } if (str.Length < 2 || String.IsNullOrEmpty(str[1])) { location = ch.InRoom; } else { location = Room.FindLocation(ch, str[1]); if (!location) { ch.SendText("No such location.\r\n"); return; } if (location.IsPrivate()) { ch.SendText("That room is private right now.\r\n"); return; } } CharData victim = ch.GetCharWorld(str[0]); if (!victim) { ch.SendText("They aren't here.\r\n"); return; } if (!victim.InRoom) { ch.SendText("They are in limbo.\r\n"); return; } if (victim.Fighting) { Combat.StopFighting(victim, true); } SocketConnection.Act("$n disappears in a mushroom cloud.", victim, null, null, SocketConnection.MessageTarget.room); victim.RemoveFromRoom(); victim.AddToRoom(location); SocketConnection.Act("$n arrives from a puff of smoke.", victim, null, null, SocketConnection.MessageTarget.room); if (ch != victim) { SocketConnection.Act("$n has transferred you.", ch, null, victim, SocketConnection.MessageTarget.victim); } CommandType.Interpret(victim, "look auto"); ch.SendText("Done.\r\n"); }
/// <summary> /// Perform a command at another location. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void At(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); if (!realChar.Authorized("at")) { return; } if (str.Length < 2) { ch.SendText("At where what?\r\n"); return; } Room location = Room.FindLocation(ch, str[0]); if (!location) { ch.SendText("No such location.\r\n"); return; } if (location.IsPrivate()) { ch.SendText("That room is private right now.\r\n"); return; } Room original = ch.InRoom; ch.RemoveFromRoom(); ch.AddToRoom(location); string text = String.Join(" ", str, 1, (str.Length - 1)); CommandType.Interpret(ch, text); /* * See if 'ch' still exists before continuing! * Handles 'at XXXX quit' case. */ foreach (CharData worldChar in Database.CharList) { if (worldChar == ch) { ch.RemoveFromRoom(); ch.AddToRoom(original); break; } } return; }
public static void Trust(CharData ch, string[] str) { if( ch == null ) return; CharData victim; string arg1 = String.Empty; string arg2 = String.Empty; int level; CharData realChar = ch.GetChar(); if (!realChar.Authorized("trust")) { return; } if (String.IsNullOrEmpty(arg1) || String.IsNullOrEmpty(arg2) || !MUDString.IsNumber(arg2)) { ch.SendText("Syntax: trust <char> <level>.\r\n"); return; } if (!(victim = ch.GetCharRoom(arg1))) { ch.SendText("That player is not here.\r\n"); return; } Int32.TryParse(arg2, out level); if (level < 1 || level > Limits.MAX_LEVEL) { ch.SendText(String.Format("Trust within range 1 to {0}.\r\n", Limits.MAX_LEVEL)); return; } if (level > ch.GetTrust()) { ch.SendText("Limited to your trust.\r\n"); return; } string text = String.Format("{0} has been trusted at level {1} by {2}", victim.Name, level, ch.Name); ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_LEVELS, realChar.GetTrust(), text); victim.TrustLevel = level; return; }
public static void Find(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); if (!realChar.Authorized("lookup")) { return; } if (str.Length == 0) { ch.SendText("Try finding up a MOBILE, OBJECT, or ROOM.\r\n"); return; } if (str.Length < 2) { ch.SendText("Yes, but which one do you want to find?\r\n"); return; } String tmpStr = String.Join(" ", str, 1, str.Length - 1); String[] newArg = tmpStr.Split(' '); if (!MUDString.IsPrefixOf(str[0], "mobile")) FindMobile(ch, newArg ); else if (!MUDString.IsPrefixOf(str[0], "object")) FindObject(ch,newArg ); else if (!MUDString.IsPrefixOf(str[0], "room")) FindRoom(ch, newArg ); else ch.SendText("Try looking up a MOBILE, OBJECT, or ROOM.\r\n"); return; }
/// <summary> /// Lists all users in the game. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Users(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); SocketConnection socket; string text = String.Empty; string arg = String.Empty; if (!realChar.Authorized("users")) { return; } int count = 0; if (arg.Length > 0) { CharData victim = realChar.GetCharWorld(arg); if (!victim) { realChar.SendText("They don't seem to be online.\r\n"); return; } foreach (SocketConnection it in Database.SocketList) { socket = it; if (socket.Character != victim) continue; text = String.Format("[{0} {1}] {2}@{3}\r\n", MUDString.PadStr(socket.ToString(), 3), socket.ConnectionStatus.ToString(), socket.Original ? socket.Original.Name : socket.Character ? socket.Character.Name : "(none)", socket.Host); ch.SendText(text); } return; } foreach (SocketConnection it in Database.SocketList) { socket = it; if (socket.Character && CharData.CanSee(ch, socket.Character)) { ++count; text = String.Format("[{0}] {1}@{2}\r\n", socket.ConnectionStatus.ToString(), socket.Original ? socket.Original.Name : socket.Character ? socket.Character.Name : "(none)", socket.Host); } } string buf2 = String.Format("{0} user{1}\r\n", count, count == 1 ? String.Empty : "s"); text += buf2; ch.SendText(text); return; }
/// <summary> /// Immortal command to look up an object template. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void FindObject(CharData ch, string[] str) { if( ch == null ) return; ObjTemplate objTemplate; string text; int indexNumber, bottom, top; ObjTemplate.ObjectType type = 0; Bitvector bvect = new Bitvector(); int total = 0; Affect.Apply stat = Affect.Apply.none; ch.GetChar(); if (str.Length < 2) { ch.SendText("Syntax: find o world <object>\r\n"); ch.SendText("or: find o area <object>\r\n"); ch.SendText("or: find o bitvector <bitvector name>\r\n"); ch.SendText("or: find o type <type number>\r\n"); ch.SendText("or: find o stat <stat name> (optional: area)\r\n"); return; } if (MUDString.StringsNotEqual(str[0], "world") && MUDString.StringsNotEqual(str[0], "area") && MUDString.StringsNotEqual(str[0], "bitvector") && MUDString.StringsNotEqual(str[0], "type") && MUDString.StringsNotEqual(str[0], "stat")) { } if (String.IsNullOrEmpty(str[1])) { ch.SendText("Find what object?\r\n"); return; } bool all = !MUDString.StringsNotEqual(str[1], "all"); bool found = false; Area area = ch.InRoom.Area; bool bit = !MUDString.StringsNotEqual(str[0], "bit"); bool fType = !MUDString.StringsNotEqual(str[0], "type"); bool fArea = !MUDString.StringsNotEqual(str[0], "area"); bool fArea2 = (str.Length > 2 && !MUDString.StringsNotEqual(str[2], "area")); if (fArea2) { fArea = true; } bool fStat = !MUDString.StringsNotEqual(str[0], "stat"); if (fStat) { if (!MUDString.StringsNotEqual(str[1], "maxstr")) stat = Affect.Apply.max_strength; else if (!MUDString.StringsNotEqual(str[1], "maxint")) stat = Affect.Apply.max_intelligence; else if (!MUDString.StringsNotEqual(str[1], "maxwis")) stat = Affect.Apply.max_wisdom; else if (!MUDString.StringsNotEqual(str[1], "maxdex")) stat = Affect.Apply.max_dexterity; else if (!MUDString.StringsNotEqual(str[1], "maxagi")) stat = Affect.Apply.max_agility; else if (!MUDString.StringsNotEqual(str[1], "maxcon")) stat = Affect.Apply.max_constitution; else if (!MUDString.StringsNotEqual(str[1], "maxcha")) stat = Affect.Apply.max_charisma; else if (!MUDString.StringsNotEqual(str[1], "maxpow")) stat = Affect.Apply.max_power; else if (!MUDString.StringsNotEqual(str[1], "maxluck")) stat = Affect.Apply.max_luck; else if (!MUDString.StringsNotEqual(str[1], "racestr")) stat = Affect.Apply.race_strength; else if (!MUDString.StringsNotEqual(str[1], "raceint")) stat = Affect.Apply.race_intelligence; else if (!MUDString.StringsNotEqual(str[1], "racewis")) stat = Affect.Apply.race_wisdom; else if (!MUDString.StringsNotEqual(str[1], "racedex")) stat = Affect.Apply.race_dexterity; else if (!MUDString.StringsNotEqual(str[1], "raceagi")) stat = Affect.Apply.race_agility; else if (!MUDString.StringsNotEqual(str[1], "racecon")) stat = Affect.Apply.race_constitution; else if (!MUDString.StringsNotEqual(str[1], "racecha")) stat = Affect.Apply.race_charisma; else if (!MUDString.StringsNotEqual(str[1], "racepow")) stat = Affect.Apply.race_power; else if (!MUDString.StringsNotEqual(str[1], "raceluck")) stat = Affect.Apply.race_luck; else if (!MUDString.StringsNotEqual(str[1], "str")) stat = Affect.Apply.strength; else if (!MUDString.StringsNotEqual(str[1], "int")) stat = Affect.Apply.intelligence; else if (!MUDString.StringsNotEqual(str[1], "wis")) stat = Affect.Apply.wisdom; else if (!MUDString.StringsNotEqual(str[1], "dex")) stat = Affect.Apply.dexterity; else if (!MUDString.StringsNotEqual(str[1], "agi")) stat = Affect.Apply.agility; else if (!MUDString.StringsNotEqual(str[1], "con")) stat = Affect.Apply.constitution; else if (!MUDString.StringsNotEqual(str[1], "cha")) stat = Affect.Apply.charisma; else if (!MUDString.StringsNotEqual(str[1], "pow")) stat = Affect.Apply.power; else if (!MUDString.StringsNotEqual(str[1], "luck")) stat = Affect.Apply.luck; else if (!MUDString.StringsNotEqual(str[1], "svpara")) stat = Affect.Apply.save_paralysis; else if (!MUDString.StringsNotEqual(str[1], "svpoi")) stat = Affect.Apply.save_poison; else if (!MUDString.StringsNotEqual(str[1], "svdis")) stat = Affect.Apply.save_petrification; else if (!MUDString.StringsNotEqual(str[1], "svbreath")) stat = Affect.Apply.save_breath; else if (!MUDString.StringsNotEqual(str[1], "svspell")) stat = Affect.Apply.save_spell; else if (!MUDString.StringsNotEqual(str[1], "mana")) stat = Affect.Apply.mana; else if (!MUDString.StringsNotEqual(str[1], "hitpoints")) stat = Affect.Apply.hitpoints; else if (!MUDString.StringsNotEqual(str[1], "move")) stat = Affect.Apply.move; else if (!MUDString.StringsNotEqual(str[1], "hitroll")) stat = Affect.Apply.hitroll; else if (!MUDString.StringsNotEqual(str[1], "damroll")) stat = Affect.Apply.damroll; else { ch.SendText("Valid stats for a stat lookup are: str, int, wis, dex, agi, con, cha, pow, luck,\r\n" + " maxstr, maxint, maxwis, maxdex, maxagi, maxcon, maxcha, maxpow, maxluck, svpara,\r\n" + " svpoi, svdis, svbreath, svspell, mana, hitpoints, move, hitroll, damroll, bit.\r\n"); return; } } if (bit) { int count; for (count = 0; BitvectorFlagType.ItemFlags[count].BitvectorData; ++count) { if (!MUDString.StringsNotEqual(str[1], BitvectorFlagType.ItemFlags[count].Name)) { bvect = BitvectorFlagType.ItemFlags[count].BitvectorData; break; } } if (bvect == null) { ch.SendText("No such item flag.\r\n"); return; } } if (fType) { try { type = (ObjTemplate.ObjectType)Enum.Parse(typeof(ObjTemplate.ObjectType), str[2], false); text = String.Format("Looking for object type {0}:\r\n", type); ch.SendText(text); } catch (Exception) { ch.SendText("Invalid object type."); return; } } if (fArea) { bottom = area.LowObjIndexNumber; top = area.HighObjIndexNumber + 1; } else { bottom = 0; top = Database.HighestObjIndexNumber; } for (indexNumber = bottom; indexNumber < top; indexNumber++) { if (total > 5000) { ch.SendText("Greater than 5000 items found. List truncated.\r\n"); break; } if (!(objTemplate = Database.GetObjTemplate(indexNumber))) { continue; } if (fArea && area != objTemplate.Area) { continue; } if (bit) { if (Macros.IsSet(objTemplate.ExtraFlags[bvect.Group], bvect.Vector)) { found = true; text = String.Format("[{0}]:{1} of {2}: {3} &n({4}&+yc&n)\r\n", MUDString.PadInt(objTemplate.IndexNumber, 5), MUDString.PadInt(objTemplate.QuantityLoaded, 5), MUDString.PadInt(objTemplate.MaxNumber, 5), objTemplate.ShortDescription.ToUpper(), objTemplate.Cost); ch.SendText(text); total++; } } else if (fType) { if (objTemplate.ItemType == type) { found = true; text = String.Format("[{0}]:{1} of {2}: {3} &n({4}&+yc&n)\r\n", MUDString.PadInt(objTemplate.IndexNumber, 5), MUDString.PadInt(objTemplate.QuantityLoaded, 5), MUDString.PadInt(objTemplate.MaxNumber, 5), objTemplate.ShortDescription.ToUpper(), objTemplate.Cost); ch.SendText(text); total++; } } else if (fStat) { foreach (Affect affect in objTemplate.Affected) { foreach (AffectApplyType apply in affect.Modifiers) { if (apply.Location == stat) { found = true; text = String.Format("[{0}] {1}&n (modifier {2})\r\n", MUDString.PadInt(objTemplate.IndexNumber, 5), objTemplate.ShortDescription.ToUpper(), apply.Amount); ch.SendText(text); total++; break; } } } } else { if (all || MUDString.NameContainedIn(str[1], objTemplate.Name)) { found = true; text = String.Format("[{0}]:{1} of {2}: {3} &n({4}&+yc&n)\r\n", MUDString.PadInt(objTemplate.IndexNumber, 5), MUDString.PadInt(objTemplate.QuantityLoaded, 5), MUDString.PadInt(objTemplate.MaxNumber, 5), objTemplate.ShortDescription.ToUpper(), objTemplate.Cost); ch.SendText(text); total++; } } } if (!found) { ch.SendText("Nothing like that in this universe.\r\n"); return; } return; }
/// <summary> /// Immortal command to find a player or object. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Where(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); if (!realChar.Authorized("where")) return; if (str.Length == 0) { ch.SendText("Try where-ing a MOBILE, CHAR, or OBJECT, or WHERE ALL for all players.\r\n"); return; } if (str.Length < 2) { ch.SendText("Yes, but which one are you looking for?\r\n"); return; } if (!MUDString.IsPrefixOf(str[0], "mobile")) MobWhere(ch, new[] { str[1] } ); else if (!MUDString.StringsNotEqual(str[0], "char")) WherePlayer(ch, new[] { str[1] }); else if (!MUDString.IsPrefixOf(str[0], "object")) ObjectWhere(ch, new[] { str[1] }); else if (!MUDString.IsPrefixOf(str[0], "all")) CommandType.Interpret(ch, "pwhere all"); else ch.SendText("Try where-ing a MOBILE, CHAR, or OBJECT, or WHERE ALL for all players.\r\n"); return; }
/// <summary> /// Immortal command to paralyze a player. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Freeze(CharData ch, string[] str) { if( ch == null ) return; CharData victim; CharData realChar = ch.GetChar(); if (!realChar.Authorized("freeze")) { return; } if (str.Length == 0) { ch.SendText("Freeze whom?\r\n"); return; } if (!(victim = ch.GetCharWorld(str[0]))) { ch.SendText("They aren't here.\r\n"); return; } if (ch == victim && ch.HasActionBit(PC.PLAYER_FREEZE)) { ch.RemoveActionBit(PC.PLAYER_FREEZE); } if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } if (victim.GetTrust() >= ch.GetTrust()) { ch.SendText("You failed.\r\n"); return; } if (victim.HasActionBit(PC.PLAYER_FREEZE)) { victim.RemoveActionBit(PC.PLAYER_FREEZE); ch.SendText("FREEZE bit removed.\r\n"); victim.SendText("You can play again.\r\n"); } else { victim.SetActionBit(PC.PLAYER_FREEZE); ch.SendText("FREEZE bit set.\r\n"); victim.SendText("You can't do anything!\r\n"); } CharData.SavePlayer(victim); return; }
public static void Wizify(CharData ch, string[] str) { if( ch == null ) return; CharData victim; string arg1 = String.Empty; CharData realChar = ch.GetChar(); if (!realChar.Authorized("wizify")) return; if (String.IsNullOrEmpty(arg1)) { ch.SendText("Syntax: wizify <_name>\r\n"); return; } if (!(victim = ch.GetCharWorld(arg1))) { ch.SendText("They aren't here.\r\n"); return; } if (victim.IsNPC()) { ch.SendText("Not on mobs.\r\n"); return; } if (!victim.HasActionBit(PC.PLAYER_WIZBIT)) { victim.SetActionBit(PC.PLAYER_WIZBIT); SocketConnection.Act("$N wizified.", ch, null, victim, SocketConnection.MessageTarget.character); SocketConnection.Act("$n has wizified you!", ch, null, victim, SocketConnection.MessageTarget.victim); } else { victim.RemoveActionBit(PC.PLAYER_WIZBIT); SocketConnection.Act("$N dewizzed.", ch, null, victim, SocketConnection.MessageTarget.character); SocketConnection.Act("$n has dewizzed you!", ch, null, victim, SocketConnection.MessageTarget.victim); } CommandType.Interpret(ch, "save"); return; }
/// <summary> /// Teleport to another location. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Goto(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); if (!realChar.Authorized("goto") || !ch.IsImmortal()) { return; } if (str.Length == 0) { ch.SendText("Goto where?\r\n"); return; } Room location = Room.FindLocation(ch, str[0]); if (!location) { ch.SendText("No such location.\r\n"); return; } if (location.IsPrivate()) { ch.SendText("That room is private right now.\r\n"); return; } if (ch.Fighting) { Combat.StopFighting(ch, true); } if (!ch.HasActionBit(PC.PLAYER_WIZINVIS)) { if (!ch.IsNPC() && ((PC)ch).ImmortalData.DisappearMessage.Length > 0) { SocketConnection.Act("$T", ch, null, ((PC)ch).ImmortalData.DisappearMessage, SocketConnection.MessageTarget.room); } else { SocketConnection.Act("$n disappears in a puff of smoke.", ch, null, null, SocketConnection.MessageTarget.room); } } ch.RemoveFromRoom(); ch.AddToRoom(location); if (!ch.HasActionBit(PC.PLAYER_WIZINVIS)) { if (!ch.IsNPC() && ((PC)ch).ImmortalData.AppearMessage.Length > 0) { SocketConnection.Act("$T", ch, null, ((PC)ch).ImmortalData.AppearMessage, SocketConnection.MessageTarget.room); } else { SocketConnection.Act("$n appears in a swirling mist", ch, null, null, SocketConnection.MessageTarget.room); } } CommandType.Interpret(ch, "look auto"); return; }
/// <summary> /// Command to lock the game so it can be entered by immortals only. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Wizlock(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); if (!realChar.Authorized("wizlock")) { return; } Database.SystemData.GameIsWizlocked = !Database.SystemData.GameIsWizlocked; if (Database.SystemData.GameIsWizlocked) { ch.SendText("Game wizlocked.\r\n"); } else { ch.SendText("Game un-wizlocked.\r\n"); } return; }
/// <summary> /// Say something on the guild chat channel. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void GuildChat(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); if (realChar.IsNPC() || !realChar.IsGuild()) { ch.SendText("You aren't a guildmember!\r\n"); return; } SocketConnection.SendToChannel(ch, String.Join(" ", str), TalkChannel.guild, "guild"); return; }
/// <summary> /// Shows area details and stats. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void StatArea(CharData ch, string[] str) { if( ch == null ) return; Room room; Object obj; Exit exit; int count; ch.GetChar(); Area area = ch.InRoom.Area; if (area == null) { Log.Error("Stat: char not in a valid area.", 0); ch.SendText("You are not in a valid area!"); return; } string text = String.Format("Name: '{0}'.\r\n", area.Name); ch.SendText(text); text = String.Format("Range: {0}-{1} Author: {2}.\r\n", MUDString.PadInt(area.MinRecommendedLevel, 2), MUDString.PadInt(area.MaxRecommendedLevel, 2), area.Author); ch.SendText(text); text = String.Format("File: {0}.\r\n", area.Filename); ch.SendText(text); if (area.GuildId > 0) { text = String.Format("Guild Id: {0}.\r\n", area.GuildId); ch.SendText(text); } text = String.Format("Age (sec):[{0}] Players: [{1}] Security: [{2}]\r\n", MUDString.PadInt(area.AgeInSeconds, 5), MUDString.PadInt(area.NumPlayers, 5), MUDString.PadInt(area.Security, 5)); ch.SendText(text); text = String.Format("Indexes: {0} - {1}\r\n", area.LowIndexNumber, area.HighIndexNumber); ch.SendText(text); text = String.Format("Rooms: {0} - {1} Objs: {2} - {3} Mobs: {4} - {5}\r\n", area.LowRoomIndexNumber, area.HighRoomIndexNumber, area.LowObjIndexNumber, area.HighObjIndexNumber, area.LowMobIndexNumber, area.HighMobIndexNumber); ch.SendText(text); text = String.Format("Recall: [{0}] '{1}'.&n\r\n", MUDString.PadInt(area.Recall, 5), Room.GetRoom(area.Recall) ? Room.GetRoom(area.Recall).Title : "none"); ch.SendText(text); text = String.Format("Flags: {0} ({1}) Reset Mode: {2}\r\n", BitvectorFlagType.AreaString(area), area.AreaFlags[0], area.AreaResetMode); ch.SendText(text); text = String.Format("Reset: {0}\r\n", area.ResetMessage); ch.SendText(text); text = String.Format("Reset lifespan: {0} minutes Time since Reset: {1} seconds.\r\n", area.MinutesBetweenResets, area.AgeInSeconds); ch.SendText(text); text = String.Format("Builders: {0}\r\n", area.Builders); ch.SendText(text); if (area.JusticeType != 0) ch.SendText("This area is controlled by justice.\r\n"); if (area.DefenderTemplateNumber != 0) text = String.Format("Defender IndexNumber: {0} Number Spawned During Invasion: {1}\r\n", area.DefenderTemplateNumber, area.DefendersPerSquad); ch.SendText(text); text = String.Format("Judge Room: {0} Jail Room: {1} Barracks: {2} Defenders Dispatched: {3}/{4} ({5} squads)\r\n", area.JudgeRoom, area.JailRoom, area.BarracksRoom, area.NumDefendersDispatched, (area.DefendersPerSquad * 5), area.DefenderSquads); ch.SendText(text); /* This code checks for exits from zone and bad exits. */ int lower = area.LowRoomIndexNumber; int upper = area.HighRoomIndexNumber; for (count = lower; count <= upper; ++count) { if ((room = Room.GetRoom(count))) { int door = 0; for (door = 0; door < Limits.MAX_DIRECTION; door++) { if ((exit = room.ExitData[door])) { int vn = exit.TargetRoom ? exit.TargetRoom.IndexNumber : -1; if (vn == -1) { // Bad exit text = String.Format("Exit {0} in room {1} leads to nothing.\r\n", door.ToString().ToUpper(), room.IndexNumber != 0 ? room.IndexNumber : -1); ch.SendText(text); } else { // Check to see outta zone if (vn < lower || vn > upper) { text = String.Format("Exit {0} in room {1} leads to zone {2}&n.\r\n", door.ToString().ToUpper(), room.IndexNumber, exit.TargetRoom.Area.Name); ch.SendText(text); } } } } } } /* Adding check through objects to check for portals. */ lower = area.LowObjIndexNumber; upper = area.HighObjIndexNumber; for (count = lower; count <= upper; ++count) { if ((obj = Object.GetFirstObjectOfTemplateType(Database.GetObjTemplate(count)))) { if (obj.ItemType == ObjTemplate.ObjectType.portal && (room = Room.GetRoom(obj.Values[0]))) { if (obj.Values[0] < area.LowRoomIndexNumber || obj.Values[0] > area.HighRoomIndexNumber) { /* Display portal destn. room etc. */ if (obj.InRoom == null) { if (obj.ObjIndexData) { Log.Error("Commandastat: Object {0} is portal w/out a room", obj.ObjIndexData.IndexNumber); continue; } Log.Error("Commandastat: Object is portal w/out a room", 0); continue; } if (room.Area == null) { Log.Error("Commandastat: Room {0} is not in any area!", room.IndexNumber); continue; } text = String.Format("Portal {0}&n in room {1}&n({2}) leads to zone {3}&n.\r\n", obj.Name, obj.InRoom.Title, obj.InRoom.IndexNumber, room.Area.Name); ch.SendText(text); } } } } return; }