/// <summary> /// Command for gods to respond to the players. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void PlayerTell(CharData ch, string[] str) { if( ch == null ) return; if (!ch.Authorized("ptell")) { ch.SendText("&+LYou cannot respond to &+Bpetitions&+L.&n\r\n"); return; } if (str.Length < 2) { ch.SendText("Tell what to who?\r\n"); } /* * Can tell to PC's anywhere, but NPC's only in same room. */ CharData victim = ch.GetCharWorld(str[0]); if (!victim) { ch.SendText("They aren't here.\r\n"); return; } if (!victim.Socket) { SocketConnection.Act("$N&n is &+Llinkdead&n.", ch, null, victim, SocketConnection.MessageTarget.character); return; } string text = String.Join(" ", str, 1, (str.Length - 1)); text = DrunkSpeech.MakeDrunk(text, ch); SocketConnection.Act("&n&+rYou tell $N&n&+r '&+R$t&n&+r'&n", ch, text, victim, SocketConnection.MessageTarget.character); int position = victim.CurrentPosition; victim.CurrentPosition = Position.standing; SocketConnection.Act("&n&+r$n&n&+r responds to your petition with '&+R$t&n&+r'&n", ch, text, victim, SocketConnection.MessageTarget.victim); string buf = String.Format("&+r{0} responds to {1}'s petition with '&+R{2}&n&+r'&n", ch.Name, victim.Name, text); ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_PETITION, Limits.LEVEL_AVATAR, buf); victim.CurrentPosition = position; victim.ReplyTo = ch; if (victim.HasActionBit(PC.PLAYER_AFK)) SocketConnection.Act("Just so you know, $E is &+RAFK&n.", ch, null, victim, SocketConnection.MessageTarget.character); else if (victim.HasActionBit(PC.PLAYER_BOTTING)) SocketConnection.Act("Just so you know, $E is a &+YBOT&n", ch, null, victim, SocketConnection.MessageTarget.character); return; }
public static void Finger(CharData ch, string[] str) { if( ch == null ) return; CharData victim; SocketConnection victDD; bool loggedIn; if (ch.IsNPC()) return; if (str.Length == 0) { ch.SendText("Finger whom?\r\n"); return; } /* Look for the character logged in. */ if ((victim = ch.GetCharWorld(str[0]))) { if (victim.IsNPC()) { ch.SendText("Don't finger mobs.\r\n"); return; } if (!victim.Socket) { ch.SendText("Character is linkdead.\r\n"); if (!CharData.LoadPlayer((victDD = new SocketConnection()), str[0])) { /* If not in save files, they don't exist. */ ch.SendText("This character does not exist.\r\n"); return; } loggedIn = false; } else { loggedIn = true; ch.SendText("This character is logged in.\r\n"); victDD = victim.Socket; } } /* If not, then load from save files. */ else { loggedIn = false; if (!(CharData.LoadPlayer((victDD = new SocketConnection()), str[0].ToUpper()))) { /* If not in save files, they don't exist. */ ch.SendText("This character does not exist.\r\n"); return; } else ch.SendText("This character is not logged in.\r\n"); victim = victDD.Original ? victDD.Original : victDD.Character; } /* Display general character info. */ string buf = String.Format("Name: {0}. Title: {1}&n.\r\n", victDD.Original ? victDD.Original.Name : victDD.Character ? victDD.Character.Name : "(none)", (!victim.IsNPC() && ((PC)victim).Title.Length != 0) ? ((PC)victim).Title : "(none)"); ch.SendText(buf); buf = String.Format("Guild: {0}&n. Level: {1}&n.\r\n", (!victim.IsNPC() && ((PC)victim).GuildMembership != null) ? ((PC)victim).GuildMembership.Name : "(none)", victim.Level); ch.SendText(buf); buf = String.Format("Class: {0}&n. Room: {1}&n. Race: {2}&n.\r\n", (victim.CharacterClass != null ? victim.CharacterClass.WholistName : "(Undefined)"), victim.InRoom ? victim.InRoom.IndexNumber : -1, (victim.GetRace() < Race.RaceList.Length && victim.GetRace() >= 0) ? Race.RaceList[victim.GetRace()].ColorName : "(Undefined)"); ch.SendText(buf); /* Messages specific to whether a player is logged in. */ if (loggedIn) { if (victim.InRoom) { buf = String.Format("In room: {0}&n ({1}).\r\n", victim.InRoom.Title.Length != 0 ? victim.InRoom.Title : "(none)", victim.InRoom.IndexNumber); ch.SendText(buf); } buf = String.Format("On since: {0}", victim.LogonTime); } else buf = String.Format("Created: {0} Birthdate: {1}", ((PC)victim).Created, ((PC)victim).Birthdate); ch.SendText(buf); if (loggedIn) { buf = String.Format("Last save: {0}", victim.SaveTime); ch.SendText(buf); } else { buf = String.Format("Last logged in: {0}", victim.SaveTime); ch.SendText(buf); } /* Close rented chars pfile (w/out saving!). */ if (!loggedIn) victDD = null; 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; }
/// <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> /// Shows a character's attribute screen. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Attributes(CharData ch, string[] str) { if( ch == null ) return; string buf1 = String.Empty; if (ch.IsNPC()) { ch.SendText("&nYour attributes are as would be expected for an NPC.\r\n"); return; } if (ch.IsImmortal() && str.Length != 0) { CharData worldChar = ch.GetCharWorld(str[0]); if (!worldChar) { ch.SendText("No such person.\r\n"); return; } if (worldChar.IsNPC()) { ch.SendText("NPCs don't have skills!\r\n"); return; } } string buf = String.Format( "&+WName: &+G{0}&n &+WLevel: {1}&n\r\n", MUDString.PadStr(ch.Name, 17), ch.Level); buf1 += buf; buf = String.Format( "&+WRace:&n {0} &+WClass:&n {1} &n&+WSex:&n {2}\r\n", MUDString.PadStr(Race.RaceList[ch.GetRace()].ColorName, 16), MUDString.PadStr(ch.CharacterClass.WholistName, 16), System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(ch.GetSexString())); buf1 += buf; // Break a player's size into strings when we get around to it // -- Xangis if (!ch.IsNPC()) { buf = String.Format( "&+WHeight:&n {0} inches &+WWeight:&n {1} pounds &+WSize:&n {2}\r\n", MUDString.PadInt(((PC)ch).Height, 3), MUDString.PadInt(((PC)ch).Weight, 5), Race.SizeString(ch.CurrentSize)); } else { buf = String.Format("&+WSize:&n {0}\r\n", ch.CurrentSize); } buf1 += buf; TimeSpan time = TimeSpan.FromTicks(ch.TimePlayed.Ticks) + (DateTime.Now - ch.LogonTime); int days = (int)time.TotalHours / 24; time = (time - TimeSpan.FromDays(days)); int hours = (int)time.TotalHours; time = (time - TimeSpan.FromHours(hours)); int minutes = (int)time.TotalMinutes; // Age is a hack until we get it coded - Xangis buf = String.Format( "\r\n&+BAge:&n {0} years. &+BPlaying Time:&n {1} days {2} hours {3} minutes.\r\n", MUDString.PadInt(ch.GetAge(), 3), days, hours, minutes); buf1 += buf; // Need to create a function to display character status strings buf = String.Format("&+BStatus:&n {0}", System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(Position.PositionString(ch.CurrentPosition))); if (!ch.IsNPC() && ch.IsAffected(Affect.AFFECT_BERZERK)) { buf += ", &+Rberzerk&n"; } if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEMORIZING)) { buf += ", Memorizing"; } if (ch.IsAffected(Affect.AFFECT_CASTING)) { buf += ", Casting"; } if (ch.IsAffected(Affect.AFFECT_SINGING)) { buf += ", Singing"; } if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEDITATING)) { buf += ", Meditating"; } if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_CAMPING)) { /* This is ugly and should be moved to its own function */ buf += ", Camping"; } buf += ".\r\n\r\n"; buf1 += buf; // We want players to see the same stats for levels 1-50. // Should create string converters so that we have no decimals displayed // below this point. buf = String.Format(" &+cSTR:&n {0} &+cArmor Class:&n {1}.\r\n", MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrStr()), 15), ch.GetAC()); buf1 += buf; buf = String.Format(" &+cAGI:&n {0} &+cHitroll:&n {1}\r\n", MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrAgi()), 15), StringConversion.BonusString(ch.GetHitroll(ObjTemplate.WearLocation.hand_one))); buf1 += buf; buf = String.Format(" &+cDEX:&n {0} &+cDamroll:&n {1}\r\n", MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrDex()), 15), StringConversion.BonusString(ch.GetDamroll(ObjTemplate.WearLocation.hand_one))); buf1 += buf; buf = String.Format(" &+cCON:&n {0} &+cAlignment:&n {1}\r\n", MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrCon()), 15), StringConversion.AlignmentString(ch)); buf1 += buf; buf = String.Format(" &n&+cINT:&n {0}\r\n", MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrInt()), 15)); buf1 += buf; buf = String.Format(" &+cWIS:&n {0} &+BSaving Throws&n\r\n", MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrWis()), 15)); buf1 += buf; buf = String.Format(" &+cPOW:&n {0} &+cParalysis:&n {1}\r\n", MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrPow()), 15), StringConversion.BonusString(-ch.SavingThrows[0])); buf1 += buf; buf = String.Format(" &+cCHA:&n {0} &+cRod:&n {1}\r\n", MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrCha()), 15), StringConversion.BonusString(-ch.SavingThrows[1])); buf1 += buf; buf = String.Format(" &+cLUK:&n {0} &+cPetrify:&n {1}\r\n", MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrLuck()), 15), StringConversion.BonusString(-ch.SavingThrows[2])); buf1 += buf; buf = String.Format(" &+cBreath:&n {0}\r\n", StringConversion.BonusString(-ch.SavingThrows[3])); buf1 += buf; buf = String.Format("&+BWimpy: &n{0} &+cSpell:&n {1}\r\n", MUDString.PadInt(ch.Wimpy, 4), StringConversion.BonusString(-ch.SavingThrows[4])); buf1 += buf; buf = String.Format("&+BLoad Carried: &n{0} pounds ({1})\r\n", MUDString.PadInt(ch.CarryWeight, 3), StringConversion.WeightString(ch)); buf1 += buf; ch.SendText(buf1); return; }
/// <summary> /// Tropy command. Shows kill data and whether certain mobs are "boring" and worth less experience. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Trophy(CharData ch, string[] str) { if( ch == null ) return; int count; CharData targetChar; if (str.Length == 0 || !ch.IsImmortal()) { targetChar = ch; } else { targetChar = ch.GetCharWorld(str[0]); if (!targetChar) { ch.SendText("No such person.\r\n"); return; } } if (targetChar.IsNPC()) { ch.SendText("Mobs don't have Trophy.\r\n"); return; } if (targetChar.Level < 5) { ch.SendText("You don't need to worry about trophy yet.\r\n"); return; } ch.SendText("&+BTrophy data:\r\n"); for (count = 0; count < Limits.MAX_LEVEL; ++count) { if (((PC)targetChar).TrophyData[count].MobIndexNumber == 0) continue; if (((PC)targetChar).TrophyData[count].NumberKilled == 0) continue; /* Added else for mobs which are removed from game. (Earlier, Trophy would crash the mud on no-longer existant mobs.) */ // TODO: Fix format of float value. string buf; if (Database.GetMobTemplate(((PC)targetChar).TrophyData[count].MobIndexNumber) != null) { buf = String.Format(" &n&+b(&+y{0:0000.00}&+b)&n {1}&n\r\n", ((float)((PC)targetChar).TrophyData[count].NumberKilled / (float)100), (Database.GetMobTemplate(((PC)targetChar).TrophyData[count].MobIndexNumber)).ShortDescription); } else if (((PC)targetChar).TrophyData[count].MobIndexNumber != 0) { buf = String.Format(" &n&+b(&+y{0:0000.00}&+b)&n ({1}) \r\n", ((float)((PC)targetChar).TrophyData[count].NumberKilled / (float)100), ((PC)targetChar).TrophyData[count].MobIndexNumber); } else { buf = String.Format(" &n&+b(&+y{0:0000.00}&+b)&n (null) \r\n", ((float)((PC)targetChar).TrophyData[count].NumberKilled / (float)100)); } ch.SendText(buf); } ch.SendText("\r\n"); 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> /// Change something on a mob or a player. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void SetMob(CharData ch, string[] str) { if( ch == null ) return; ch = ch.GetChar(); if (str.Length < 3) { ch.SendText("Syntax: set mob <victim> <field> <value>\r\n"); ch.SendText("or: set mob <victim> <string> <value>\r\n"); ch.SendText("\r\n"); ch.SendText("Field being one of:\r\n"); ch.SendText(" str int wis dex con agi cha pow luck size\r\n"); ch.SendText(" class hp mana move align wait height weight\r\n"); ch.SendText(" sex race level thirst hunger drunk full security\r\n"); ch.SendText(" copper silver gold platinum position exp faction\r\n"); ch.SendText(" resistant immune susceptible vulnerable\r\n"); ch.SendText("String being one of:\r\n"); ch.SendText(" name short long title spec guild rank\r\n"); return; } CharData victim; if (!(victim = ch.GetCharWorld(str[0]))) { ch.SendText("They aren't here.\r\n"); return; } /* * Snarf the value (which need not be numeric). */ int value; bool ok = Int32.TryParse(str[2], out value); if (!ok) { value = -1; } string text = String.Empty; /* * Set something. */ if ("strength".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < 1 || value > Limits.MAX_BASE_ATTRIBUTE) { text += "Strength range is 1 to " + Limits.MAX_BASE_ATTRIBUTE + ".\r\n"; ch.SendText(text); return; } victim.PermStrength = value; ch.SendText("Ok.\r\n"); return; } if ("intelligence".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < 1 || value > Limits.MAX_BASE_ATTRIBUTE) { text += "Intelligence range is 1 to " + Limits.MAX_BASE_ATTRIBUTE + ".\r\n"; ch.SendText(text); return; } victim.PermIntelligence = value; ch.SendText("Ok.\r\n"); return; } if ("wisdom".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < 1 || value > Limits.MAX_BASE_ATTRIBUTE) { text += "Wisdom range is 1 to " + Limits.MAX_BASE_ATTRIBUTE + ".\r\n"; ch.SendText(text); return; } victim.PermWisdom = value; ch.SendText("Ok.\r\n"); return; } if ("dexterity".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < 1 || value > Limits.MAX_BASE_ATTRIBUTE) { text += "Dexterity range is 1 to " + Limits.MAX_BASE_ATTRIBUTE + ".\r\n"; ch.SendText(text); return; } victim.PermDexterity = value; ch.SendText("Ok.\r\n"); return; } if ("constitution".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < 1 || value > Limits.MAX_BASE_ATTRIBUTE) { text += "Constitution range is 1 to " + Limits.MAX_BASE_ATTRIBUTE + ".\r\n"; ch.SendText(text); return; } victim.PermConstitution = value; ch.SendText("Ok.\r\n"); return; } if ("agility".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < 1 || value > Limits.MAX_BASE_ATTRIBUTE) { text += "Agility range is 1 to " + Limits.MAX_BASE_ATTRIBUTE + ".\r\n"; ch.SendText(text); return; } victim.PermAgility = value; ch.SendText("Ok.\r\n"); return; } if ("charisma".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < 1 || value > Limits.MAX_BASE_ATTRIBUTE) { text += "Charisma range is 1 to " + Limits.MAX_BASE_ATTRIBUTE + ".\r\n"; ch.SendText(text); return; } victim.PermCharisma = value; ch.SendText("Ok.\r\n"); return; } if ("power".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < 1 || value > Limits.MAX_BASE_ATTRIBUTE) { text += "Power range is 1 to " + Limits.MAX_BASE_ATTRIBUTE + ".\r\n"; ch.SendText(text); return; } victim.PermPower = value; ch.SendText("Ok.\r\n"); return; } if ("luck".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < 1 || value > Limits.MAX_BASE_ATTRIBUTE) { text += "Luck range is 1 to " + Limits.MAX_BASE_ATTRIBUTE + ".\r\n"; ch.SendText(text); return; } victim.PermLuck = value; ch.SendText("Ok.\r\n"); return; } /* size */ if ("size".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { Race.Size newsize; int val; Int32.TryParse(str[2], out val); if (val == 0) newsize = StringLookup.SizeLookup(str[2]); else newsize = (Race.Size)val; if (newsize < 0 || newsize > Race.Size.none) { text += "Size range is from 0 to " + Race.MAX_SIZE + ".\r\n"; ch.SendText(text); return; } victim.CurrentSize = newsize; ch.SendText("Ok.\r\n"); return; } if ("position".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < 0 || value > (int)Position.standing) { text += "Position range is from 0 to " + Position.standing + ".\r\n"; ch.SendText(text); return; } victim.CurrentPosition = value; ch.SendText("Ok.\r\n"); return; } if ("faction".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (victim.IsNPC()) { ch.SendText("Can't set faction values on an NPC.\r\n"); return; } ch.SendText("Setting faction values isn't done yet.\r\n"); return; //if( value < Limits.MIN_FACTION || value > Limits.MAX_FACTION ) //{ // ch.SendText( String.Format( "Valid faction values range from {0} to {1}.\r\n", // Limits.MIN_FACTION, Limits.MAX_FACTION )); // return; //} } if ("class".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { CharClass.Names cclass = CharClass.ClassLookup(str[2]); if (cclass < 0 || (int)cclass >= CharClass.ClassList.Length) { int cval; if (Int32.TryParse(str[2], out cval)) { cclass = (CharClass.Names)cval; } } if (cclass < 0 || (int)cclass >= CharClass.ClassList.Length) { string buf4 = String.Format("Class range is 0 to {0}.\n", CharClass.ClassList.Length - 1); ch.SendText(buf4); return; } value = (int)cclass; SocketConnection.Act("You set $N&n's class to $t.", ch, CharClass.ClassList[value].Name, victim, SocketConnection.MessageTarget.character); SocketConnection.Act("Your class is now $t.", ch, CharClass.ClassList[value].Name, victim, SocketConnection.MessageTarget.victim); victim.CharacterClass = CharClass.ClassList[value]; victim.CharClassNumber = value; ch.SendText("Ok.\r\n"); return; } if ("sex".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (victim.IsAffected( Affect.AFFECT_CHANGE_SEX)) { ch.SendText("This person is affect by change sex.\r\n"); ch.SendText("Try again later.\r\n"); return; } if (value < 0 || value > 2) { ch.SendText("Sex range is 0 to 2.\r\n"); return; } victim.Gender = (MobTemplate.Sex)value; ch.SendText("Ok.\r\n"); return; } if ("race".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { Object wield; Object wield2; if (victim.IsAffected( Affect.AFFECT_POLYMORPH)) { ch.SendText("This person is affected by polymorph other.\r\n"); ch.SendText("Try again later.\r\n"); return; } int race = Race.RaceLookup(str[1]); if (race < 0 || race >= Race.RaceList.Length) Int32.TryParse(str[2], out race); if (race < 0 || race >= Race.RaceList.Length) { ch.SendText("Invalid race.\r\n"); return; } victim.SetPermRace(race); if ((wield = Object.GetEquipmentOnCharacter(victim, ObjTemplate.WearLocation.hand_one)) && wield.ItemType == ObjTemplate.ObjectType.weapon && !victim.HasInnate(Race.RACE_WEAPON_WIELD)) { SocketConnection.Act("You drop $p&n.", victim, wield, null, SocketConnection.MessageTarget.character); SocketConnection.Act("$n&n drops $p&n.", victim, wield, null, SocketConnection.MessageTarget.room); wield.RemoveFromChar(); wield.AddToRoom(victim.InRoom); } if ((wield2 = Object.GetEquipmentOnCharacter(victim, ObjTemplate.WearLocation.hand_two)) && wield2.ItemType == ObjTemplate.ObjectType.weapon && !victim.HasInnate(Race.RACE_WEAPON_WIELD)) { SocketConnection.Act("You drop $p&n.", victim, wield2, null, SocketConnection.MessageTarget.character); SocketConnection.Act("$n&n drops $p&n.", victim, wield2, null, SocketConnection.MessageTarget.room); wield2.RemoveFromChar(); wield2.AddToRoom(victim.InRoom); } ch.SendText("Ok.\r\n"); return; } if ("level".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (!victim.IsNPC()) { ch.SendText("Not on PC's.\r\n"); return; } if (value < 0 || value > Limits.MAX_ADVANCE_LEVEL) { ch.SendText("Level range is 0 to 40.\r\n"); return; } victim.Level = value; ch.SendText("Ok.\r\n"); return; } if ("wait".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < 0 || value > 120) { ch.SendText("Wait range is 0 to 120.\r\n"); return; } victim.Wait = value; ch.SendText("Ok.\r\n"); return; } //if ( !MUDString.strcasecmp( arg2, "copper" ) ) //{ // victim.money.copper = value; // return; //} //if ( !MUDString.strcasecmp( arg2, "silver" ) ) //{ // victim.money.silver = value; // return; //} //if ( !MUDString.strcasecmp( arg2, "gold" ) ) //{ // victim.money.gold = value; // return; //} //if ( !MUDString.strcasecmp( arg2, "platinum" ) ) //{ // victim.money.platinum = value; // return; //} if ("hp".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase) || "hitpoints".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < -10 || value > 30000) { ch.SendText("HP range is -10 to 30,000 hit points.\r\n"); return; } if (victim.Fighting && value < 0) { ch.SendText("You cannot set a fighting person's hp below 0.\r\n"); return; } // Set their perm hitpoints so that their current max hitpoints will be reflected if (!ch.IsNPC()) { victim.MaxHitpoints = ((value * 100) / victim.GetCurrCon()) + 1; } else { victim.MaxHitpoints = value; } ch.SendText("Ok.\r\n"); return; } if ("mana".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < 0 || value > 30000) { ch.SendText("Mana range is 0 to 30,000 mana points.\r\n"); return; } victim.MaxMana = value; ch.SendText("Ok.\r\n"); return; } if ("moves".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < 0 || value > 30000) { ch.SendText("Move range is 0 to 30,000 move points.\r\n"); return; } victim.MaxMoves = value; ch.SendText("Ok.\r\n"); return; } if ("alignment".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (value < -1000 || value > 1000) { ch.SendText("Alignment range is -1000 to 1000.\r\n"); return; } victim.Alignment = value; ch.SendText("Ok.\r\n"); return; } if ("thirsty".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } if ((value < 0 || value > 100) && victim.GetTrust() < Limits.LEVEL_AVATAR) { ch.SendText("Thirst range is 0 to 100.\r\n"); return; } if (value < -1 || value > 100) { ch.SendText("Thirst range is -1 to 100.\r\n"); return; } ((PC)victim).Thirst = value; ch.SendText("Ok.\r\n"); return; } if ( "hunger".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase) || "hungry".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase) ) { if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } if ((value < 0 || value > 100) && victim.GetTrust() < Limits.LEVEL_AVATAR) { ch.SendText("Hunger range is 0 to 100.\r\n"); return; } if (value < -1 || value > 100) { ch.SendText("Hunger range is -1 to 100.\r\n"); return; } ((PC)victim).Hunger = value; ch.SendText("Ok.\r\n"); return; } if ("experience".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } if (value < 0 || value > 100) { ch.SendText("Experience range is 0 to 100 (in percent).\r\n"); return; } victim.ExperiencePoints = (value * ExperienceTable.Table[victim.Level].LevelExperience) / 100; ch.SendText("Ok.\r\n"); return; } if ("frags".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } if (value < -1000 || value > 1000) { ch.SendText("Frag range is -1000 to 1000.\r\n"); return; } ((PC)victim).Frags = value; ch.SendText("Ok.\r\n"); return; } if ("drunkenness".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } if (value < 0 || value > 100) { ch.SendText("Drunk range is 0 to 100.\r\n"); return; } ((PC)victim).Drunk = value; ch.SendText("Ok.\r\n"); return; } if ("weight".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } if (value < 1 || value > 1000) { ch.SendText("Weight range is 1 to 1000 pounds.\r\n"); return; } ((PC)victim).Weight = value; ch.SendText("Ok.\r\n"); return; } if ("height".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } if (value < 1 || value > 120) { ch.SendText("Height range is 1 to 120 inches.\r\n"); return; } ((PC)victim).Height = value; ch.SendText("Ok.\r\n"); return; } if ("full".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } if ((value < 0 || value > 100) && victim.GetTrust() < Limits.LEVEL_AVATAR) { ch.SendText("Full range is 0 to 100.\r\n"); return; } if (value < -1 || value > 100) { ch.SendText("Full range is -1 to 100.\r\n"); return; } ((PC)victim).Hunger = value; ch.SendText("Ok.\r\n"); return; } if ("name".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (!victim.IsNPC()) { ch.SendText("Not on PC's.\r\n"); return; } if (ch.StringTooLong(str[2])) return; victim.Name = str[2]; ch.SendText("Ok.\r\n"); return; } if (!MUDString.StringsNotEqual(str[1], "short")) { if (ch.StringTooLong(str[2])) return; victim.ShortDescription = str[2]; ch.SendText("Ok.\r\n"); return; } if (!MUDString.StringsNotEqual(str[1], "long")) { if (ch.StringTooLong(str[2])) return; victim.FullDescription = str[2] + "\r\n"; ch.SendText("Ok.\r\n"); return; } if (!MUDString.StringsNotEqual(str[1], "guild")) { Guild guild; Guild oldGuild; int count; bool found = false; if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } if ((guild = Guild.GetGuild(str[2])) == null) { ch.SendText("That guild doesn't exist.\r\n"); return; } // remember the number of the available slot in the count // variable so we can fill that slot at the end of this code for (count = 0; count < Limits.MAX_GUILD_MEMBERS; ++count) { if (guild.Members[count].Filled == false) { found = true; break; } } if (!found) { ch.SendText("That guild is full.\r\n"); return; } if (((PC)victim).GuildMembership != null) { oldGuild = ((PC)victim).GuildMembership; oldGuild.NumMembers--; int count2; for (count2 = 0; count2 < Limits.MAX_GUILD_MEMBERS; count2++) { if (oldGuild.Members[count2].Name.Length == 0 || !MUDString.StringsNotEqual(oldGuild.Members[count2].Name, victim.Name)) { oldGuild.Members[count2].Filled = false; } } oldGuild.Save(); } ((PC)victim).GuildMembership = guild; ((PC)victim).GuildMembership.Name = guild.Name; ((PC)victim).GuildMembership.NumMembers++; if (((PC)victim).GuildRank == 0) ((PC)victim).GuildRank = Guild.Rank.normal; guild.Members[count].Name = victim.Name; guild.Members[count].Rank = ((PC)victim).GuildRank; guild.Members[count].Fine = 0; guild.Members[count].JoinTime = Database.SystemData.CurrentTime; guild.Members[count].Filled = true; ch.SendText("Guild initiation successful. Be sure to set rank.\r\n"); guild.Save(); ch.SendText("Ok.\r\n"); return; } if ("resistant".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { victim.Resistant = (Race.DamageType)value; ch.SendText("Ok.\r\n"); return; } if ("immune".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { victim.Immune = (Race.DamageType)value; ch.SendText("Ok.\r\n"); return; } if ("susceptible".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { victim.Susceptible = (Race.DamageType)value; ch.SendText("Ok.\r\n"); return; } if ("vulnerable".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { victim.Vulnerable = (Race.DamageType)value; ch.SendText("Ok.\r\n"); return; } if ("title".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } SetTitle(victim, str[2]); ch.SendText("Ok.\r\n"); return; } if (!MUDString.StringsNotEqual(str[1], "spec")) { if (!victim.IsNPC()) { ch.SendText("Not on PC's.\r\n"); return; } List<MobSpecial> spec = MobSpecial.SpecMobLookup(str[2]); if (spec.Count < 1) { ch.SendText("No such spec fun.\r\n"); return; } victim.MobileTemplate.AddSpecFun(spec[0]); ch.SendText("Ok.\r\n"); return; } if (!MUDString.StringsNotEqual(str[1], "death")) { if (!victim.IsNPC()) { ch.SendText("Not on PC's.\r\n"); return; } if ((victim.MobileTemplate.DeathFun = MobSpecial.SpecMobLookup(str[2])) == null) { ch.SendText("No such death fun.\r\n"); return; } ch.SendText("Ok.\r\n"); return; } if (!MUDString.StringsNotEqual(str[1], "rank")) { if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } Guild.Rank rank; try { rank = (Guild.Rank)Enum.Parse(typeof(Guild.Rank), str[1], false); } catch (Exception) { ch.SendText("That's not a valid rank.\r\n"); return; } ((PC)victim).GuildRank = rank; ch.SendText("Ok.\r\n"); return; } if (!MUDString.StringsNotEqual(str[1], "points")) { if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } ((PC)victim).SkillPoints = value; ch.SendText("Ok.\r\n"); return; } if (!MUDString.StringsNotEqual(str[1], "tradition")) { if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } if (value < 0 || value >= TraditionData.Table.Length) { ch.SendText("Value out of range\r\n"); return; } ((PC)victim).Tradition = value; ch.SendText("Ok.\r\n"); return; } if (!MUDString.StringsNotEqual(str[1], "security")) { if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } if ((value > ((PC)ch).Security && ch.GetTrust() < Limits.LEVEL_OVERLORD) || value < 0) { if (((PC)ch).Security > 0) { text += "Valid security is 0-" + ((PC)ch).Security + ".\r\n"; ch.SendText(text); } else { ch.SendText("Valid security is 0 only.\r\n"); } return; } ((PC)victim).Security = value; ch.SendText("Ok.\r\n"); return; } /* * Generate usage message. */ CommandType.Interpret(ch, "set mob"); return; }
/// <summary> /// Set a skill to the specified value. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void SetSkill(CharData ch, string[] str) { if( ch == null ) return; if (str.Length < 3 || String.IsNullOrEmpty(str[0]) || String.IsNullOrEmpty(str[1]) || String.IsNullOrEmpty(str[2])) { ch.SendText("Syntax: set skill <victim> <skill> <value>\r\n"); ch.SendText("or: set skill <victim> all <value>\r\n"); ch.SendText("Skill being any skill.\r\n"); return; } CharData victim; if (!(victim = ch.GetCharWorld(str[0]))) { ch.SendText("They aren't here.\r\n"); return; } if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } if (ch.Level <= victim.Level && ch != victim) { ch.SendText("You may not set your peer nor your superior.\r\n"); return; } bool all = (str[1].Equals("all", StringComparison.CurrentCultureIgnoreCase)); Skill skl = null; if (!all && ((skl = Skill.SkillLookup(str[1])) == null)) { ch.SendText("No such skill.\r\n"); return; } if (!MUDString.IsNumber(str[2])) { ch.SendText("Value must be numeric.\r\n"); return; } int value = 0; Int32.TryParse(str[2], out value); if (value < 0 || value > Limits.MAX_SKILL_ADEPT) { ch.SendText("Value range is 0 to " + Limits.MAX_SKILL_ADEPT.ToString() + ".\r\n"); return; } if (all) { if (ch.GetTrust() < Limits.LEVEL_OVERLORD) { ch.SendText("Only immortals level " + Limits.LEVEL_OVERLORD.ToString() + " and up may set all skills.\r\n"); return; } foreach( SkillEntry entry in ch.CharacterClass.Skills ) { if( entry.Level < victim.GetTrust() ) { ((PC)victim).SkillAptitude[entry.Name] = value; } else { ((PC)victim).SkillAptitude[entry.Name] = 1; } } } else { ((PC)victim).SkillAptitude[skl.Name] = value; } ch.SendText("Ok.\r\n"); return; }
/// <summary> /// Immortal command to restore players to a fully rested state with full hits, moves, and mana. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Restore(CharData ch, string[] str) { if( ch == null ) return; CharData victim; string text; CharData realChar = ch.GetChar(); if (!realChar.Authorized("restore")) { return; } if (str.Length == 0 || !MUDString.StringsNotEqual(str[0], "room")) { foreach (CharData roomChar in ch.InRoom.People) { if (roomChar.IsNPC()) { continue; } ch.Restore(roomChar); } text = String.Format("{0} has restored room {1}.", realChar.Name, ch.InRoom.IndexNumber); ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_RESTORE, realChar.GetTrust(), text); ch.SendText("Room restored.\r\n"); return; } if (!MUDString.StringsNotEqual(str[0], "all")) { foreach (CharData it in Database.CharList) { victim = it; if (!victim.InRoom || victim.IsNPC()) { continue; } ch.Restore(victim); } text = String.Format("{0} has restored the whole mud.", ch.Name); ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_RESTORE, realChar.GetTrust(), text); ch.SendText("Aww...how sweet :)...Done.\r\n"); } else { if (!(victim = ch.GetCharWorld(str[0]))) { ch.SendText("They aren't here.\r\n"); return; } ch.Restore(victim); text = String.Format("{0} has restored {1}.", ch.Name, victim.Name); ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_RESTORE, realChar.GetTrust(), text); ch.SendText("Done.\r\n"); } return; }
public static void SetLanguage(CharData ch, string[] str) { if( ch == null ) return; string buf = String.Empty; int num; if (str.Length == 0) { ch.SendText("Syntax: set language <char> <language> <number>.\r\n"); return; } if (!(ch.GetCharWorld(buf))) ch.SendText("You don't see that person.\r\n"); Race.Language lang = StringLookup.LanguageLookup(ch, buf); if (lang == 0) { ch.SendText("Syntax: set language <char> &+r<language>&n <number>.\r\n"); return; } Int32.TryParse(buf, out num); if (num == 0) { ch.SendText("Syntax: set language <char> <language> &+r<number>&n\r\n"); return; } }
public static void ResetLanguages(CharData ch, string[] str) { if( ch == null ) return; CharData victim; if (str.Length == 0) { ch.SendText("Try supplying more information with your command.\r\n"); return; } if (!(victim = ch.GetCharWorld(str[0]))) { ch.SendText("You don't see that person.\r\n"); } else { if (victim.IsNPC()) { ch.SendText("Not on NPCS!\r\n"); return; } victim.InitializeLanguages(); string buf = String.Format("{0} has had their languages Reset.\r\n", victim.Name); ch.SendText(buf); } }
public static void Rename(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); CharData victim; if (!realChar.Authorized("rename")) { return; } if (str.Length == 0) { ch.SendText("Rename whom?\r\n"); return; } if (str.Length < 2) { ch.SendText("Rename them to what?\r\n"); return; } if (!(victim = ch.GetCharWorld(str[0]))) { ch.SendText("They aren't here.\r\n"); return; } if (realChar.Level <= victim.Level) { ch.SendText("You may not rename your peer nor your superior.\r\n"); return; } if (!SocketConnection.CheckPlayerName(str[1])) { ch.SendText("That name is not allowed here, please try again.\r\n"); return; } if (victim.IsNPC()) { ch.SendText("You can't rename NPCs, you fool!"); return; } Log.Trace("Rename: Saving"); CharData.SavePlayer(victim); Log.Trace("Rename: Backing Up"); CharData.BackupPlayer(victim); Log.Trace("Rename: Deleting"); CharData.DeletePlayer(victim); Log.Trace("Rename: Giving New Name to Player"); string oldname = victim.Name; victim.Name = str[1].ToUpper(); Log.Trace("Rename: Saving Renamed Player"); CharData.SavePlayer(victim); ch.SendText("Done.\r\n"); string text = String.Format("Your new _name is {0}.\r\n", victim.Name); victim.SendText(text); text = String.Format("{0} has just renamed {1} to {2}.", ch.Name, oldname, victim.Name); ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_SECURE, realChar.GetTrust(), text); Log.Trace(text); return; }
/// <summary> /// Immortal command to clear the room of junk (mobs and objects). /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Purge(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); if (!realChar.Authorized("purge")) { return; } if (str.Length == 0) { /* 'purge' */ for( int i = (ch.InRoom.People.Count - 1); i >= 0; i-- ) { if (ch.InRoom.People[i].IsNPC() && ch.InRoom.People[i] != ch) { CharData.ExtractChar(ch.InRoom.People[i], true); } } for( int i = (ch.InRoom.Contents.Count - 1); i >= 0; i-- ) { ch.InRoom.Contents[i].RemoveFromWorld(); } ch.SendText("Done.\r\n"); SocketConnection.Act("$n purges the room!", ch, null, null, SocketConnection.MessageTarget.room); return; } CharData victim = ch.GetCharWorld(str[0]); if (!victim) { ch.SendText("They aren't here.\r\n"); return; } if (!victim.IsNPC()) { ch.SendText("Not on PC's.\r\n"); return; } SocketConnection.Act("$n&n purges $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim); CharData.ExtractChar(victim, true); return; }
/// <summary> /// Player track command. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void TrackCommand(CharData ch, string[] str) { if( ch == null ) return; CharData victim; if (ch.IsAffected(Affect.AFFECT_TRACK)) { ch.SendText("You stop tracking.\r\n"); Combat.StopHunting(ch); ch.RemoveAffect(Affect.AFFECT_TRACK); return; } if (!ch.HasSkill("track")) { ch.SendText("You couldn't track an &+Lelephant&n in your own bedroom.\r\n"); return; } if (str.Length == 0) { ch.SendText("Whom are you trying to track?\r\n"); return; } if (ch.Riding) { ch.SendText("You can't sniff a trail mounted.\r\n"); return; } if (ch.FlightLevel != 0) { ch.SendText("You find tracks on the _ground_!\r\n"); return; } if (ch.InRoom.IsWater()) { ch.SendText("You can't track through water.\r\n"); return; } if (ch.CurrentPosition != Position.standing) { if (ch.CurrentPosition == Position.fighting) ch.SendText("You're too busy fighting .\r\n"); else ch.SendText("You must be standing to track!\r\n"); return; } /* only imps can hunt to different areas */ bool area = (ch.GetTrust() < Limits.LEVEL_OVERLORD); if (area) { victim = ch.GetCharInArea(str[0]); } else { victim = ch.GetCharWorld(str[0]); } if (!victim || (!victim.IsNPC() && (ch.IsRacewar(victim)) && !ch.IsImmortal())) { ch.SendText("You can't find a trail of anyone like that.\r\n"); return; } if (ch.InRoom == victim.InRoom) { SocketConnection.Act("You're already in $N&n's room!", ch, null, victim, SocketConnection.MessageTarget.character); return; } /* * Deduct some movement. */ if (ch.CurrentMoves > 2) { ch.CurrentMoves -= 3; } else { ch.SendText("You're too exhausted to hunt anyone!\r\n"); return; } SocketConnection.Act("$n carefully sniffs the air.", ch, null, null, SocketConnection.MessageTarget.room); ch.WaitState(Skill.SkillList["track"].Delay); Exit.Direction direction = Track.FindPath(ch.InRoom.IndexNumber, victim.InRoom.IndexNumber, ch, -40000, area); if (direction == Exit.Direction.invalid) { SocketConnection.Act("You can't sense $N&n's trail from here.", ch, null, victim, SocketConnection.MessageTarget.character); return; } /* * Give a random direction if the player misses the die roll. */ if ((ch.IsNPC() && MUDMath.NumberPercent() > 75) /* NPC @ 25% */ || (!ch.IsNPC() && MUDMath.NumberPercent() > /* PC @ norm */ ((PC)ch).SkillAptitude["track"])) { do { direction = Database.RandomDoor(); } while (!(ch.InRoom.ExitData[(int)direction]) || !(ch.InRoom.ExitData[(int)direction].TargetRoom)); } ch.PracticeSkill("track"); /* * Display the results of the search. */ ch.SetAffectBit(Affect.AFFECT_TRACK); string buf = String.Format("You sense $N&n's trail {0} from here...", direction.ToString()); SocketConnection.Act(buf, ch, null, victim, SocketConnection.MessageTarget.character); if (ch.CurrentPosition == Position.standing) { ch.Move(direction); } Combat.StartHunting(ch, victim); return; }
/// <summary> /// Immortal command to make a player shut up permanently. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Silence(CharData ch, string[] str) { if( ch == null ) return; CharData victim; CharData realChar = ch.GetChar(); if (!realChar.Authorized("silence")) { return; } if (str.Length == 0) { ch.SendText("Silence whom?\r\n"); return; } if (!(victim = ch.GetCharWorld(str[0]))) { 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; } if (victim.HasActionBit(PC.PLAYER_SILENCE)) { victim.RemoveActionBit(PC.PLAYER_SILENCE); victim.SendText("You can use channels again.\r\n"); ch.SendText("SILENCE removed.\r\n"); } else { victim.SetActionBit(PC.PLAYER_SILENCE); victim.SendText("You can't use channels!\r\n"); ch.SendText("SILENCE set.\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"); }
// reformatted - Xangis // Immortals can also see a player's skill list now. public static void Skills(CharData ch, string[] str) { if( ch == null ) return; if (ch.IsNPC()) { ch.SendText("&nYou do not need any stinking skills!\r\n"); return; } CharData charData = ch; if (ch.IsImmortal() && str.Length != 0) { charData = ch.GetCharWorld(str[0]); if (!charData) { ch.SendText("No such person.\r\n"); return; } if (charData.IsNPC()) { ch.SendText("NPCs don't have skills!\r\n"); return; } } string text; string output = "&n&+rALL Abilities available for your class.&n\r\n"; output += "&n&+RLv Abilities&n\r\n"; for (int level = 1; level <= Limits.LEVEL_HERO; level++) { bool skill = true; foreach (KeyValuePair<String, Skill> kvp in Skill.SkillList) { if (kvp.Value.ClassAvailability[(int)charData.CharacterClass.ClassNumber] != level) continue; if (skill) { text = String.Format("&+Y{0}&+y:&n", MUDString.PadInt(level, 2)); output += text; skill = false; } else { output += " "; } output += " "; // Show skills as words rather than numbers for non-immortals if (((PC)charData).SkillAptitude.ContainsKey(kvp.Key)) { if (!ch.IsImmortal()) { text = String.Format("&n&+c{0} &+Y{1}&n", MUDString.PadStr(kvp.Key, 20), StringConversion.SkillString(((PC)charData).SkillAptitude[kvp.Key])); } else { text = String.Format("&n&+c{0} &+Y{1}&n", MUDString.PadStr(kvp.Key, 20), ((PC)charData).SkillAptitude[kvp.Key]); } output += text; } else { text = String.Format("&n&+c{0} &+YAvailable at level {1}.&n", MUDString.PadStr(kvp.Key, 20), level); } output += "\r\n"; } } if ((charData.IsClass(CharClass.Names.monk) || charData.IsClass(CharClass.Names.mystic))) { output += "\r\n&+WMonk Skills:&n\r\n"; foreach (KeyValuePair<String, MonkSkill> kvp in Database.MonkSkillList) { if (((PC)charData).SkillAptitude[kvp.Key] != 0) { text = String.Format(" &n&+c{0} &+Y{1}&n\r\n", MUDString.PadStr(kvp.Key, 20), StringConversion.SkillString(((PC)charData).SkillAptitude[kvp.Key])); output += text; } } output += "\r\n"; } ch.SendText(output); return; }
public static void Ungroup(CharData ch, string[] str) { if( ch == null ) return; if (str.Length == 0) { ch.SendText("Ungroup who?\r\n"); return; } CharData victim = ch.GetCharWorld(str[0]); if (victim == null) { ch.SendText("They do not seem to exist!\r\n"); return; } if (ch != victim.GroupLeader && !ch.IsImmortal()) { SocketConnection.Act("You are not $S group leader!", ch, null, victim, SocketConnection.MessageTarget.character); return; } if (!victim.GroupLeader) { SocketConnection.Act("$N is not in a group!", ch, null, victim, SocketConnection.MessageTarget.character); victim.NextInGroup = null; return; } victim.GroupLeader.RemoveFromGroup(victim); return; }
/// <summary> /// Spy on the input and output of a character. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Snoop(CharData ch, string[] str) { if( ch == null ) return; SocketConnection socket; CharData realChar = ch.GetChar(); if (!realChar.Authorized("snoop")) { return; } if (str.Length == 0) { ch.SendText("Snoop whom?\r\n"); return; } CharData victim = ch.GetCharWorld(str[0]); if (!victim) { ch.SendText("They aren't here.\r\n"); return; } if (!victim.Socket) { ch.SendText("No descriptor to snoop.\r\n"); return; } if (victim == ch) { ch.SendText("Cancelling all snoops.\r\n"); foreach (SocketConnection it in Database.SocketList) { socket = it; if (socket.SnoopBy == ch.Socket) { socket.SnoopBy = null; } } return; } if (victim.Socket.SnoopBy != null) { ch.SendText("Busy already.\r\n"); return; } if (victim.GetTrust() >= ch.GetTrust() && MUDString.StringsNotEqual(ch.Name, "Xangis")) { ch.SendText("You failed.\r\n"); return; } if (ch.Socket) { for (socket = ch.Socket.SnoopBy; socket; socket = socket.SnoopBy) { if (socket.Character == victim || socket.Original == victim) { ch.SendText("No snoop loops.\r\n"); return; } } } victim.Socket.SnoopBy = ch.Socket; ch.SendText("Done.\r\n"); string text = String.Format("{0} is snooping {1}", ch.Name, victim.Name); ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_SNOOPS, realChar.GetTrust(), text); return; }
/// <summary> /// Give a player consent to do things, such as group you, portal you, etc. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Consent(CharData ch, string[] str) { if( ch == null ) return; CharData worldChar; if (ch.IsNPC()) { ch.SendText("No consenting for mobs!"); return; } if (str.Length == 0) { ch.SendText("Consent who?\r\n"); return; } if (!MUDString.StringsNotEqual(str[0], "who")) { bool found = false; // Sadly inefficient code. foreach (CharData it in Database.CharList) { if (ch.IsConsenting(it)) { SocketConnection.Act("You continue consenting $N&n.", ch, null, it.Name, SocketConnection.MessageTarget.character); found = true; } } if (!found) { ch.SendText("You are not consenting anyone.\r\n"); } foreach (CharData it in Database.CharList) { worldChar = it; if (worldChar.IsNPC()) continue; if (worldChar.IsConsenting(ch)) { SocketConnection.Act("$N&n is consenting you.", ch, null, worldChar, SocketConnection.MessageTarget.character); } } return; } CharData victim = ch.GetCharWorld(str[0]); if (!victim || (ch.IsRacewar(victim))) { ch.SendText("That person doesn't exist.\r\n"); return; } if (victim == ch) { ch.SendText("You no longer give consent to anyone.\r\n"); foreach (CharData it in Database.CharList) { if (ch.IsConsenting(it)) { ch.StopConsenting(it); SocketConnection.Act("$N&n stops consenting you.", it, null, ch, SocketConnection.MessageTarget.character); SocketConnection.Act("You stop consenting $N&n.", ch, null, it, SocketConnection.MessageTarget.character); } } return; } // Consenting a victim again turns off consenting. if (ch.IsConsenting(victim)) { ch.StopConsenting(victim); SocketConnection.Act("$N&n stops consenting you.", victim, null, ch, SocketConnection.MessageTarget.character); SocketConnection.Act("You stop consenting $N&n.", ch, null, victim, SocketConnection.MessageTarget.character); } else { ch.StartConsenting(victim); SocketConnection.Act("You now give consent to $N&n.", ch, null, victim, SocketConnection.MessageTarget.character); SocketConnection.Act("$n&n has given you $s consent.", ch, null, victim, SocketConnection.MessageTarget.victim); } return; }
/// <summary> /// Immortal command to display that stats of a mobile. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void StatMobile(CharData ch, string[] str) { if( ch == null ) return; if (str.Length == 0) { ch.SendText("Stat which mobile?\r\n"); return; } int value; CharData victim = null; Int32.TryParse(str[0], out value); // If non-numeric, check based on name. if (value == 0 && !(victim = ch.GetCharWorld(str[0]))) { ch.SendText("They aren't here.\r\n"); return; } // If numeric or name not found, check as a index number. if (!victim) { MobTemplate mobTemplate; if (!(mobTemplate = Database.GetMobTemplate(value))) { ch.SendText("No mobile has that index number.\r\n"); return; } foreach (CharData it in Database.CharList) { victim = it; if (victim.MobileTemplate == mobTemplate) { break; } } if (!victim) { ch.SendText("No mobile has that index number.\r\n"); return; } } string buf1 = String.Empty; string text = String.Format("Name: {0}.\r\n", victim.Name); buf1 += text; text = String.Format("Race: {0} ({1}) Original Race: {2} ({3}).\r\n", Race.RaceList[victim.GetRace()].ColorName, victim.GetRace(), Race.RaceList[victim.GetOrigRace()].ColorName, victim.GetOrigRace()); buf1 += text; text = String.Format("Parts: {0}.\r\n", StringConversion.PartsBitString(Race.RaceList[victim.GetRace()].BodyParts)); buf1 += text; text = String.Format("IndexNumber: {0}. Sex: {1}. Room: {2}. Load room: {3}.\r\n", victim.IsNPC() ? victim.MobileTemplate.IndexNumber : 0, victim.Gender, !victim.InRoom ? 0 : victim.InRoom.IndexNumber, victim.LoadRoomIndexNumber); buf1 += text; text = String.Format("&+WBase Stats&n Str: {0}. Int: {1}. Wis: {2}. Dex: {3}. Con: {4}.\r\n", victim.PermStrength, victim.PermIntelligence, victim.PermWisdom, victim.PermDexterity, victim.PermConstitution); buf1 += text; text = String.Format(" Agi: {0}. Cha: {1}. Pow: {2}. Luk: {3}.\r\n", victim.PermAgility, victim.PermCharisma, victim.PermPower, victim.PermLuck); buf1 += text; text = String.Format("&+WActual Stats&n Str: {0}. Int: {1}. Wis: {2}. Dex: {3}. Con: {4}.\r\n", victim.GetCurrStr(), victim.GetCurrInt(), victim.GetCurrWis(), victim.GetCurrDex(), victim.GetCurrCon()); buf1 += text; text = String.Format(" Agi: {0}. Cha: {1}. Pow: {2}. Luk: {3}.\r\n", victim.GetCurrAgi(), victim.GetCurrCha(), victim.GetCurrPow(), victim.GetCurrLuck()); buf1 += text; text = String.Format("Hp: {0}/{1} ({2} base). Mana: {3}/{4}. Move: {5}/{6}.\r\n", victim.Hitpoints, victim.GetMaxHit(), victim.MaxHitpoints, victim.CurrentMana, victim.MaxMana, victim.CurrentMoves, victim.MaxMoves); buf1 += text; text = String.Format( "Lv: {0}. Class: {1} ({2})&n. Align: {3}. AC: {4}.\r\n", victim.Level, victim.CharacterClass.Name, victim.CharacterClass.WholistName, victim.Alignment, victim.GetAC()); buf1 += text; /* show current and default size */ text = String.Format("Current Size: {0} ({1}) Default Size: {2} ({3})\r\n", Race.SizeString(victim.CurrentSize), victim.CurrentSize, Race.SizeString(Race.RaceList[victim.GetRace()].DefaultSize), Race.RaceList[victim.GetRace()].DefaultSize); buf1 += text; /* Added position in text. */ text = String.Format("Pos: {0} ({1}). Wimpy: {2}. Exp: {3}/{4}. Coins: {5}.\r\n", Position.PositionString(victim.CurrentPosition), victim.CurrentPosition, victim.Wimpy, victim.ExperiencePoints, ExperienceTable.Table[victim.Level].LevelExperience, victim.GetCash()); buf1 += text; /* Always displays the Hit/Dam bonus for the char's primary weapon. */ buf1 += "Primary Weapon: "; text = String.Format("Hitroll: {0} Damroll: {1}.\r\n", victim.GetHitroll(ObjTemplate.WearLocation.hand_one), victim.GetDamroll(ObjTemplate.WearLocation.hand_one)); buf1 += text; /* Changed location of the if statement. */ /* If char has a weapon in second hand and has dual wield.. */ Object obj; if ((victim.IsNPC() || victim.HasSkill("dual wield")) && ((obj = Object.GetEquipmentOnCharacter(victim, ObjTemplate.WearLocation.hand_two)) && (obj.ItemType == ObjTemplate.ObjectType.weapon))) { text = String.Format(" Second Weapon Hitroll: {0} Damroll: {1}.\r\n", victim.GetHitroll(ObjTemplate.WearLocation.hand_two), victim.GetDamroll(ObjTemplate.WearLocation.hand_two)); buf1 += text; } if (!victim.IsNPC()) { text = String.Format("Currhome: {0}, Orighome: {1}, Lastrent: {2}\r\n", ((PC)victim).CurrentHome, ((PC)victim).OriginalHome, ((PC)victim).LastRentLocation); buf1 += text; text = String.Format("Page Lines: {0}.\r\nLanguages learned:", ((PC)victim).PageLength); buf1 += text; int count; for (count = 0; count < Race.MAX_LANG; count++) { if (((PC)ch).LanguageAptitude[count] > 0) { text = String.Format(" {0}={1}", Race.LanguageTable[count], ((PC)victim).LanguageAptitude[count]); buf1 += text; } } buf1 += "\r\n"; } text = String.Format("Fighting: {0}.\r\n", victim.Fighting ? victim.Fighting.Name : "(none)"); buf1 += text; if (!victim.IsNPC()) { text = String.Format( "Thirst: {0}. Full: {1}. Drunk: {2}. Saving throws: {3} {4} {5} {6} {7}.\r\n", ((PC)victim).Thirst, ((PC)victim).Hunger, ((PC)victim).Drunk, victim.SavingThrows[0], victim.SavingThrows[1], victim.SavingThrows[2], victim.SavingThrows[3], victim.SavingThrows[4]); buf1 += text; if (victim.IsGuild()) { text = String.Format( "Guild: {0}. Rank: {1}.\r\n", ((PC)victim).GuildMembership.Name, ((PC)victim).GuildRank.ToString()); buf1 += text; } } else { text = String.Format( "Saving throws: {0} {1} {2} {3} {4}. Timer: {5}.\r\n", victim.SavingThrows[0], victim.SavingThrows[1], victim.SavingThrows[2], victim.SavingThrows[3], victim.SavingThrows[4], victim.Timer); buf1 += text; } text = String.Format("Carry number: {0}. Carry weight: {1}. Wait state: {2} ({3} seconds)\r\n", victim.CarryNumber, victim.CarryWeight, victim.Wait, (victim.Wait / Event.TICK_PER_SECOND)); buf1 += text; if (!victim.IsNPC()) { text = String.Format("Age: {0}. Played: {1}. Timer: {2}.\r\n", victim.GetAge(), victim.TimePlayed, victim.Timer); buf1 += text; } text = String.Format("ActFlags: {0} ({1} {2}).\r\n", PC.ActString(victim.AffectedBy, false, victim.IsNPC()), victim.ActionFlags[0], victim.ActionFlags[1]); buf1 += text; text = String.Format("Riding: {0}. Rider: {1}.\r\n", victim.Riding ? victim.Riding.Name : "(none)", victim.Rider ? victim.Rider.Name : "(none)"); buf1 += text; text = String.Format("Master: {0}. Leader: {1}.\r\n", victim.Master ? victim.Master.Name : "(none)", victim.GroupLeader ? victim.GroupLeader.Name : "(none)"); buf1 += text; text = String.Format("Hunting: {0}. Hating: {1} targets. Fearing: {2}.\r\n", victim.Hunting ? victim.Hunting.Name : "(none)", victim.Hating.Count, victim.Fearing ? victim.Fearing.Name : "(none)"); buf1 += text; text = String.Format("Resistant: {0}. Immune: {1}.\r\n", StringConversion.DamageTypeString(victim.Resistant), StringConversion.DamageTypeString(victim.Immune)); buf1 += text; text = String.Format("Susceptible: {0}. Vulnerable: {1}.\r\n", StringConversion.DamageTypeString(victim.Susceptible), StringConversion.DamageTypeString(victim.Vulnerable)); buf1 += text; text = String.Format("Affected by: {0}.\r\n", BitvectorFlagType.AffectString(victim.AffectedBy, false)); buf1 += text; if (!victim.IsNPC()) { text = String.Format("Security: {0}.\r\n", ((PC)victim).Security); } else { text = String.Format("Start Position: {0} ({1}).\r\n", Position.PositionString(victim.MobileTemplate.DefaultPosition), victim.MobileTemplate.DefaultPosition); } buf1 += text; text = String.Format("Short description: {0}&n.\r\nLong description: {1}&n\r\n", victim.ShortDescription, victim.FullDescription ); buf1 += text; /* Displays mob specials */ if (victim.IsNPC() && victim.SpecialFunction != null && victim.SpecialFunction.Count > 0) { text = String.Format("Mobile has special function {0}.\r\n", StringConversion.MobSpecialString(victim.SpecialFunction)); buf1 += text; } if (victim.IsNPC() && victim.MobileTemplate.DeathFun != null && victim.MobileTemplate.DeathFun.Count > 0) { text = String.Format("Mobile has death function {0}.\r\n", StringConversion.MobSpecialString(victim.MobileTemplate.DeathFun)); buf1 += text; } //if( victim.IsNPC() && victim.pIndexData.mobprogs ) //{ // buf = String.Format( "Mobile has a mobprog.\r\n" ); // buf1 += buf; //} /* Displays skills/spells currently on victim. */ foreach (Affect aff in victim.Affected) { // note that with this code if an affect has both a skill // and spell affect, they will both show up as individual affects. if (aff.Type == Affect.AffectType.skill && !String.IsNullOrEmpty(aff.Value)) { foreach (AffectApplyType apply in aff.Modifiers) { text = String.Format( "Skill: '{0}' modifies {1} by {2} for {3} hours with bits {4}.\r\n", Skill.SkillList[aff.Value].Name, StringConversion.AffectApplyString(apply.Location), apply.Amount, aff.Duration, aff.AffectString(false)); buf1 += text; } } if (aff.Type == Affect.AffectType.spell && !String.IsNullOrEmpty(aff.Value)) { foreach (AffectApplyType apply in aff.Modifiers) { text = String.Format( "Spell: '{0}' modifies {1} by {2} for {3} hours with bits {4}.\r\n", aff.Value, StringConversion.AffectApplyString(apply.Location), apply.Amount, aff.Duration, aff.AffectString(false)); buf1 += text; } } if (aff.Type == Affect.AffectType.song && !String.IsNullOrEmpty(aff.Value)) { foreach (AffectApplyType apply in aff.Modifiers) { text = String.Format( "Song: '{0}' modifies {1} by {2} for {3} hours with bits {4}.\r\n", aff.Value, StringConversion.AffectApplyString(apply.Location), apply.Amount, aff.Duration, aff.AffectString(false)); buf1 += text; } } if (aff.Value == null) { foreach (AffectApplyType apply in aff.Modifiers) { text = String.Format( "Unknown: modifies {0} by {1} for {2} hours with bits {3}.\r\n", StringConversion.AffectApplyString(apply.Location), apply.Amount, aff.Duration, aff.AffectString(false)); buf1 += text; } } } if (!victim.IsNPC()) { /* ADD deaf in text, once table is written for it. */ text = String.Format("Deaf to: {0}. ", victim.Deaf); buf1 += text; /* Added trust level. */ text = String.Format("Trust level: {0}.\r\n", victim.TrustLevel); buf1 += text; } /* Added # mobs killed, and # times killed by a mob. */ if (!victim.IsNPC()) { text = String.Format("Mobs killed: {0}. Times killed by a mob: {1}.\r\n", MUDString.PadInt(((PC)victim).MobKills, 4), MUDString.PadInt(((PC)victim).MobDeaths, 4)); buf1 += text; } /* Added # players killed, and # times killed by a player. */ if (!victim.IsNPC()) { text = String.Format("Players killed: {0}. Times killed by a player: {1}.\r\n", MUDString.PadInt(((PC)victim).PlayerKills, 4), MUDString.PadInt(((PC)victim).PlayerDeaths, 4)); buf1 += text; } /* Added # frags and illegal pkills. */ if (!victim.IsNPC()) { text = String.Format("Frags: {0}.\r\n", ((PC)victim).Frags); buf1 += text; } /* Added list of follower */ /* Made it check _targetType instead of imm */ if (victim.Followers != null && victim.Followers.Count > 0) { buf1 += "Followers: "; foreach (CharData follower in victim.Followers) { text = String.Format("{0}&n", follower.ShowNameTo(victim, true)); buf1 += text; } buf1 += "\r\n"; } ch.SendText(buf1); 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> /// 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; }
/// <summary> /// Exile a player from a guild. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Exile(CharData ch, string[] str) { if( ch == null ) return; if (str.Length == 0) { ch.SendText("Exile whom?\r\n"); return; } if (!ch.IsGuild() || ((PC)ch).GuildRank != Guild.Rank.leader) { ch.SendText("You don't have the power to do this.\r\n"); return; } Guild guild = ((PC)ch).GuildMembership; CharData victim = ch.GetCharWorld(str[0]); if (!victim) { ch.SendText("They aren't here.\r\n"); return; } if (victim.IsNPC() || victim == ch || victim.Level > ch.Level) return; if (!ch.IsSameGuild(victim)) { SocketConnection.Act("$N isn't even from $t.", ch, guild.WhoName, victim, SocketConnection.MessageTarget.character); return; } string text = String.Format("Log {0}: exiling {1} from {2}", ch.Name, victim.Name, ((PC)ch).GuildMembership.Name); Database.LogGuild(text); // This function handles resetting member data victim.RemoveFromGuild(); ((PC)victim).GuildRank = Guild.Rank.exiled; text = String.Format( "The grand Overlord of {0} {1} says:\r\n\r\n" + "'Then so be done, you {2} shall be exiled from {3}!'\r\n" + "You hear a thundering sound...\r\n\r\n" + "A booming voice says: 'You have been exiled. Only the gods can allow you\r\n" + "to join another clan, order or guild!'\r\n", guild.WhoName, guild.Overlord, victim.Name, guild.WhoName); victim.SendText(text); SocketConnection.Act("You have exiled $N&n from $t!", ch, guild.WhoName, victim, SocketConnection.MessageTarget.character); CharData.SavePlayer(victim); guild.Save(); return; }
/// <summary> /// Direct telepathy-like communication with another individual. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Tell(CharData ch, string[] str) { if( ch == null ) return; if (!ch.CanSpeak()) { ch.SendText("Your lips move but no sound comes out.\r\n"); return; } if (str.Length < 2) { ch.SendText("Tell what to who?\r\n"); return; } /* * PCs can receive a tell anywhere, but NPCs only can only hear them in the same room. * * get PC target first, if fails then get NPC */ CharData victim = ch.GetCharWorld(str[0]); if (!victim || (victim.IsNPC() && victim.InRoom != ch.InRoom)) { ch.SendText("They aren't here.\r\n"); return; } if (victim == ch) { ch.SendText("You listen to your own thoughts. *cricket* *cricket*\r\n"); return; } if ((ch.IsRacewar(victim)) && (!ch.IsImmortal() && !victim.IsImmortal()) && (ch.InRoom != victim.InRoom)) { ch.SendText("They aren't here.\r\n"); return; } /* Can tell to other side of racewar iff the opponent is in the same room or one of the people are Immortals. */ if ((!ch.IsImmortal() && !victim.IsImmortal()) && (ch.IsRacewar(victim)) && (victim.InRoom != ch.InRoom)) { ch.SendText("They aren't here.\r\n"); return; } if ((!ch.IsNPC() && (ch.HasActionBit(PC.PLAYER_SILENCE) || !ch.HasActionBit(PC.PLAYER_TELL) || (!victim.IsNPC() && !victim.HasActionBit(PC.PLAYER_TELL)))) || victim.InRoom.HasFlag(RoomTemplate.ROOM_SILENT)) { ch.SendText("They can't hear you.\r\n"); return; } if (!victim.Socket && !victim.IsNPC()) { SocketConnection.Act("$N&n is &+Llinkdead&n.", ch, null, victim, SocketConnection.MessageTarget.character); return; } if (!ch.IsImmortal() && !victim.IsAwake()) { SocketConnection.Act("$E isn't paying attention.", ch, null, victim, SocketConnection.MessageTarget.character); return; } if (victim.IsIgnoring(ch)) { SocketConnection.Act("$E is ignoring you.", ch, null, victim, SocketConnection.MessageTarget.character); return; } string text = String.Join(" ", str, 1, (str.Length - 1)); text = DrunkSpeech.MakeDrunk(text, ch); int position = victim.CurrentPosition; victim.CurrentPosition = Position.standing; Race.Language lang = ch.IsNPC() ? Race.RaceList[ch.GetOrigRace()].PrimaryLanguage : ((PC)ch).Speaking; if (lang == Race.Language.god || lang == Race.Language.unknown) { text = String.Format("&+WYou tell $N&+W '$t&+W'&n"); } else { text = String.Format("&+WYou tell $N&+W in {0} '$t&+W'&n", Race.LanguageTable[(int)lang]); } SocketConnection.Act(text, ch, text, victim, SocketConnection.MessageTarget.character); if (lang == Race.Language.god || lang == Race.Language.unknown) { text = String.Format("&+W$n&+W tells you '$t&+W'&n"); } else { text = String.Format("&+W$n&+W tells you in {0} '$t&+W'&n", Race.LanguageTable[(int)lang]); } SocketConnection.Act(text, ch, SocketConnection.TranslateText(text, ch, victim), victim, SocketConnection.MessageTarget.victim); victim.CurrentPosition = position; victim.ReplyTo = ch; if (victim.HasActionBit(PC.PLAYER_AFK)) { SocketConnection.Act("Just so you know, $E is &+RAFK&n.", ch, null, victim, SocketConnection.MessageTarget.character); } else if (victim.HasActionBit(PC.PLAYER_BOTTING)) { SocketConnection.Act("Just so you know, $E is a &+YBOT&n", ch, null, victim, SocketConnection.MessageTarget.character); } // players can't have talk files -- go home! Quest stuff. if (!victim.IsNPC()) { return; } bool questfound = false; foreach (QuestTemplate it in QuestTemplate.QuestList) { bool isquest = (ch.IsImmortal() && !MUDString.StringsNotEqual(text, "quest")) ? true : false; if (it.Messages == null || (it.IndexNumber != victim.MobileTemplate.IndexNumber)) continue; foreach (TalkData message in it.Messages) { if (MUDString.NameContainedIn(text, message.Keywords) || isquest) { ch.SendText("\r\n"); ch.SendText(message.Message); questfound = true; } } } // Chatterbot code. Bots won't check if a quest matched (prevents multiple statements). if (!questfound && victim.ChatBot != null) { victim.ChatBot.CheckConversation(victim, ch, text); } 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> /// Sets a character's title, cropped to a maximum length to avoid word wrap. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Title(CharData ch, string[] str) { if( ch == null ) return; int point; if (!ch || ch.IsNPC()) return; if (str.Length < 2) { ch.SendText("&nChange whose title to what?\r\n"); return; } CharData victim = ch.GetCharWorld(str[0]); if (!victim) { ch.SendText("&nThat person isn't here.\r\n"); return; } if (ch.IsSameGuild(victim) && !ch.IsImmortal()) { /* Officers and deputies can title themselves. */ if (ch == victim && ((PC)ch).GuildRank < Guild.Rank.officer) { ch.SendText("&nThey might not appreciate that.\r\n"); return; } /* Leaders can title others. */ if (ch != victim && ((PC)ch).GuildRank < Guild.Rank.leader) { ch.SendText("You can't do that to another at your rank.\r\n"); return; } } else if (!ch.IsImmortal() || (ch.Level <= victim.Level && ch != victim) || ch.IsNPC() || victim.IsNPC()) { SocketConnection.Act("$N&n might not appreciate that.", ch, null, victim, SocketConnection.MessageTarget.character); return; } string text = String.Join(" ", str, 1, (str.Length - 1)); int length = 0; for (point = 0; point < text.Length; ++point) { if (text[point] == '&') { /* Don't count color codes. */ point++; /* Skip the &n's. */ if (!(text[point] == 'N' || text[point] == 'n')) { /* Skip the &+'s and &-'s. */ if (text[point] == '+' || text[point] == '-') { point++; } else { // Cap title at max length if (++length >= Limits.MAX_TITLE_LENGTH) { text = text.Substring(0, point); break; } } } } else { // Cap title at max length. if (++length >= Limits.MAX_TITLE_LENGTH) { text = text.Substring(0, Limits.MAX_TITLE_LENGTH); break; } } } SetTitle(victim, text); ch.SendText("&nOk.\r\n"); }
/// <summary> /// Shows details about a guild. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void GuildInfo(CharData ch, string[] str) { if( ch == null ) return; int count; int members = 0; if (!ch.IsGuild()) { ch.SendText("You aren't a guildmember.\r\n"); return; } Guild guild = ((PC)ch).GuildMembership; string buf1 = String.Empty; string text = String.Format("{0}\r\n", guild.Name); buf1 += text; text = String.Format("Motto: \"{0}\"\r\n", guild.Motto); buf1 += text; buf1 += "-----------------------------------------------------------------------------\r\n"; text = String.Format("{0}\r\n", guild.Description); buf1 += text; text = String.Format("Leader: {0}\r\n", guild.Overlord); buf1 += text; text = String.Format("Members: {0}\r\nFrags: &+W{1}&n\r\n", guild.NumMembers, guild.Frags); buf1 += text; text = String.Format("Vault: {0} &+Wplatinum&n, {1} &+Ygold&n, {2} silver, {3} &+ycopper&n\r\n", guild.GuildBankAccount.Platinum, guild.GuildBankAccount.Gold, guild.GuildBankAccount.Silver, guild.GuildBankAccount.Copper); buf1 += text; text = String.Format("Current Applicant: {0}\r\n", guild.Applicant ? guild.Applicant.Name : "(none)"); buf1 += text; if (((PC)ch).GuildRank == Guild.Rank.leader) { text = String.Format("\r\n&+cRank Titles:&n\r\n Exile: {0}\r\n Parole: {1}\r\n Normal: {2}\r\n Senior: {3}\r\n" + " Officer: {4}\r\n Deputy: {5}\r\n Leader: {6}\r\n", guild.RankNames[(int)Guild.Rank.exiled], guild.RankNames[(int)Guild.Rank.parole], guild.RankNames[(int)Guild.Rank.normal], guild.RankNames[(int)Guild.Rank.senior], guild.RankNames[(int)Guild.Rank.officer], guild.RankNames[(int)Guild.Rank.deputy], guild.RankNames[(int)Guild.Rank.leader]); buf1 += text; } text = String.Format("\r\nMember Rank Fine:\r\n"); buf1 += text; for (count = 0; count < Limits.MAX_GUILD_MEMBERS; ++count) { if (guild.Members[count].Filled) { members++; text = String.Format("{0}) &+r{1}&n{2} {3} {4}&+yc&n\r\n", members, (ch.GetCharWorld(guild.Members[count].Name) ? 'o' : ' '), MUDString.PadStr(guild.Members[count].Name, 15), guild.RankNames[(int)guild.Members[count].Rank], MUDString.PadInt(guild.Members[count].Fine, 8)); buf1 += text; } } if (guild.Ostracized.Length > 0) { text = String.Format("Ostracized: {0}\r\n", guild.Ostracized); buf1 += text; } ch.SendText(buf1); return; }
/// <summary> /// Forgive someone for their crimes. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Pardon(CharData ch, string[] str) { if( ch == null ) return; CharData realChar = ch.GetChar(); string arg1 = String.Empty; string arg2 = String.Empty; if (!realChar.Authorized("pardon")) { return; } if (String.IsNullOrEmpty(arg1) || String.IsNullOrEmpty(arg2)) { ch.SendText("Syntax: pardon <character> <killer|thief>.\r\n"); return; } CharData victim = ch.GetCharWorld(arg1); if (!victim) { ch.SendText("They aren't here.\r\n"); return; } if (victim.IsNPC()) { ch.SendText("Not on NPC's.\r\n"); return; } ch.SendText("Justice system not complete, pardon command inoperable.\r\n"); return; }