public static void ReturnToLoad(CharData ch) { if (!ch || !ch.InRoom) { return; } if (ch.InRoom.Area != Room.GetRoom(ch.LoadRoomIndexNumber).Area) { return; } Exit.Direction dir = FindPath(ch.InRoom.IndexNumber, ch.LoadRoomIndexNumber, ch, -40000, true); if (dir == Exit.Direction.invalid) { return; } if (ch.InRoom.ExitData[(int)dir].HasFlag(Exit.ExitFlag.closed) && !ch.IsAffected(Affect.AFFECT_PASS_DOOR) && !ch.HasInnate(Race.RACE_PASSDOOR)) { CommandType.Interpret(ch, "unlock " + dir.ToString()); CommandType.Interpret(ch, "open " + dir.ToString()); return; } ch.Move(dir); if (!ch.InRoom) { string text = "Return_to_load: no ch._inRoom! Mob #" + ch.MobileTemplate.IndexNumber + ", _name: " + ch.Name + ". Placing mob in limbo (mob.AddToRoom())."; Log.Error(text, 0); ch.AddToRoom(Room.GetRoom(StaticRooms.GetRoomNumber("ROOM_NUMBER_LIMBO"))); ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_SPAM, 0, text); return; } return; }
/// <summary> /// Tracking code. /// </summary> /// <param name="ch"></param> public static void HuntVictim(CharData ch) { if (!ch || !ch.Hunting || !ch.IsAffected(Affect.AFFECT_TRACK)) { return; } if (ch.CurrentPosition != Position.standing) { if (ch.IsAffected(Affect.AFFECT_TRACK)) { ch.SendText("You abort your tracking effort.\r\n"); ch.RemoveAffect(Affect.AFFECT_TRACK); Combat.StopHunting(ch); } return; } CharData tmp = null; try { /* * Make sure the victim still exists. */ bool found = false; foreach (CharData it in Database.CharList) { ch = it; if (ch.Hunting != null && ch.Hunting.Who == tmp) { found = true; } } if (!found || !CharData.CanSee(ch, ch.Hunting.Who)) { if (!ch.IsAffected(Affect.AFFECT_TRACK)) { CommandType.Interpret(ch, "say Damn! My prey is gone!"); } else { ch.SendText("The trail seems to disappear.\r\n"); ch.RemoveAffect(Affect.AFFECT_TRACK); } Combat.StopHunting(ch); return; } if (ch.InRoom == ch.Hunting.Who.InRoom) { if (ch.Fighting) { return; } FoundPrey(ch, ch.Hunting.Who); return; } ch.WaitState(Skill.SkillList["track"].Delay); Exit.Direction dir = FindPath(ch.InRoom.IndexNumber, ch.Hunting.Who.InRoom.IndexNumber, ch, -40000, true); if (dir == Exit.Direction.invalid) { if (!ch.IsAffected(Affect.AFFECT_TRACK)) { SocketConnection.Act("$n&n says 'Damn! Lost $M!'", ch, null, ch.Hunting.Who, SocketConnection.MessageTarget.room); } else { ch.SendText("You lose the trail.\r\n"); ch.RemoveAffect(Affect.AFFECT_TRACK); Combat.StopHunting(ch); } return; } /* * Give a random direction if the mob misses the die roll. */ if (MUDMath.NumberPercent() > 75) /* @ 25% */ { do { dir = Database.RandomDoor(); }while (!(ch.InRoom.ExitData[(int)dir]) || !(ch.InRoom.ExitData[(int)dir].TargetRoom)); } if (ch.InRoom.ExitData[(int)dir].HasFlag(Exit.ExitFlag.closed)) { CommandType.Interpret(ch, "open " + dir.ToString()); return; } ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_HUNTING, 0, String.Format("{0}&n leaves room {1} to the {2}.", ch.ShortDescription, ch.InRoom.IndexNumber, dir.ToString())); if (ch.IsAffected(Affect.AFFECT_TRACK)) { SocketConnection.Act(String.Format("You sense $N&n's trail {0} from here...", dir.ToString()), ch, null, ch.Hunting.Who, SocketConnection.MessageTarget.character); } ch.Move(dir); if (ch.IsAffected(Affect.AFFECT_TRACK)) { SocketConnection.Act("$n&n peers around looking for tracks.", ch, null, null, SocketConnection.MessageTarget.room); } if (!ch.Hunting) { if (!ch.InRoom) { string text = String.Empty; text = String.Format("Hunt_victim: no ch.in_room! Mob #{0}, _name: {1}. Placing mob in limbo (ch.AddToRoom()).", ch.MobileTemplate.IndexNumber, ch.Name); Log.Error(text, 0); ch.AddToRoom(Room.GetRoom(StaticRooms.GetRoomNumber("ROOM_NUMBER_LIMBO"))); text = String.Format("{0}&n has gone to limbo while hunting {1}.", ch.ShortDescription, ch.Hunting.Name); ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_HUNTING, 0, text); return; } CommandType.Interpret(ch, "say Damn! Lost my prey!"); return; } if (ch.InRoom == ch.Hunting.Who.InRoom) { FoundPrey(ch, ch.Hunting.Who); } return; } catch (Exception ex) { Log.Error("Exception in HuntVictim: " + ex.ToString()); } }
/// <summary> /// Initialize a new PC with default values. /// </summary> public PC() { ++NumPc; Prompt = "&+g<%hhp %mm %vmv>\r\n<&n%D %B&+g>&n "; Score = 0.0; PageLength = 25; IsSwitched = false; Speaking = 0; ActionFlags[0] = PLAYER_CAST_TICK.Vector | PLAYER_TELL.Vector | PLAYER_SHOUT.Vector | PLAYER_PROMPT.Vector | PLAYER_COMBINE.Vector | PLAYER_MAP.Vector | PLAYER_PAGER.Vector | PLAYER_AUTOWRAP.Vector | PLAYER_COLOR.Vector | PLAYER_VICIOUS.Vector; HitpointModifier = 0; GuildRank = 0; Train = 0; Frags = 0; PlayerKills = 0; PlayerDeaths = 0; MobKills = 0; MobDeaths = 0; FirstaidTimer = 0; CreationTime = new DateTime(); // Creation time, actual. Created = new ItemStatus(); Destroyed = new ItemStatus(); Birthdate = new DateTime(); // Creation time used for age calculations. Unlike creation time, it can change. OriginalHome = StaticRooms.GetRoomNumber("ROOM_NUMBER_START"); CurrentHome = StaticRooms.GetRoomNumber("ROOM_NUMBER_START"); Height = 60 + MUDMath.Dice(2, 10); Weight = 15 + (Height * 2); RaceStrMod = 0; RaceIntMod = 0; RaceWisMod = 0; RaceDexMod = 0; RaceConMod = 0; RaceAgiMod = 0; RaceChaMod = 0; RacePowMod = 0; RaceLukMod = 0; MaxStrMod = 0; MaxIntMod = 0; MaxWisMod = 0; MaxDexMod = 0; MaxConMod = 0; MaxAgiMod = 0; MaxChaMod = 0; MaxPowMod = 0; MaxLukMod = 0; AggressiveLevel = -1; Tradition = 0; SkillPoints = 0; Chi = 0; MaxChi = 0; Stance = String.Empty; LastRentLocation = 0; LostHp = 0; MonkRestriction = 0; IsWieldingTwohanded = false; Editing = SocketConnection.EditState.none; Security = 0; int count; SpellAptitude = new SerializableDictionary <String, Int32>(); SkillAptitude = new SerializableDictionary <String, Int32>(); SongAptitude = new SerializableDictionary <String, Int32>(); MonkAptitude = new SerializableDictionary <String, Int32>(); LanguageAptitude = new int[Race.MAX_LANG]; for (count = 0; count < Race.MAX_LANG; ++count) { LanguageAptitude[count] = 0; } TrophyData = new TrophyData[Limits.MAX_LEVEL]; for (count = 0; count < Limits.MAX_LEVEL; ++count) { TrophyData[count] = new TrophyData(); TrophyData[count].MobIndexNumber = 0; TrophyData[count].NumberKilled = 0; } Thirst = 48; Hunger = 48; Drunk = 0; Bank = new Coins(); Bank.Copper = 0; Bank.Silver = 0; Bank.Gold = 0; Bank.Platinum = 0; }