public static void teleportch(CharacterInstance ch, RoomTemplate room, bool show) { if (room.IsPrivate()) { return; } comm.act(ATTypes.AT_ACTION, "$n disappears suddenly!", ch, null, null, ToTypes.Room); ch.CurrentRoom.RemoveFrom(ch); room.AddTo(ch); comm.act(ATTypes.AT_ACTION, "$n arrives suddenly!", ch, null, null, ToTypes.Room); if (show) { Look.do_look(ch, "auto"); } if (ch.CurrentRoom.Flags.IsSet(RoomFlags.Death) && !ch.IsImmortal()) { comm.act(ATTypes.AT_DEAD, "$n falls prey to a terrible death!", ch, null, null, ToTypes.Room); ch.SetColor(ATTypes.AT_DEAD); ch.SendTo("Oopsie... you're dead!"); var buffer = $"{ch.Name} hit a DEATH TRAP in room {ch.CurrentRoom.ID}!"; ChatManager.to_channel(buffer, ChannelTypes.Monitor, "Monitor", (short)LevelConstants.ImmortalLevel); ch.Extract(false); } }
public static void do_quit(CharacterInstance ch, string argument) { if (CheckFunctions.CheckIfNpc(ch, ch)) { return; } if (CheckFunctions.CheckIf(ch, HelperFunctions.IsInFightingPosition, "No way! You are fighting.", new List <object> { ch }, ATTypes.AT_RED)) { return; } if (CheckFunctions.CheckIf(ch, args => ((CharacterInstance)args[0]).CurrentPosition == PositionTypes.Stunned, "You're not DEAD yet.", new List <object> { ch }, ATTypes.AT_BLOOD)) { return; } var timer = ch.Timers.FirstOrDefault(x => x.Type == TimerTypes.RecentFight); if (timer != null && !ch.IsImmortal()) { ch.SetColor(ATTypes.AT_RED); ch.SendTo("Your adrenaline is pumping too hard to quit now!"); return; } // TODO: auction if (CheckFunctions.CheckIf(ch, args => { var actor = (CharacterInstance)args[0]; return(actor.IsPKill() && actor.wimpy > actor.MaximumHealth / 2.25f); }, "Your wimpy has been adjusted to the maximum level for deadlies.", new List <object> { ch })) { Wimpy.do_wimpy(ch, "max"); } if (ch.CurrentPosition == PositionTypes.Mounted) { Dismount.do_dismount(ch, string.Empty); } ch.SetColor(ATTypes.AT_WHITE); ch.SendTo("Your surroundings begin to fade as a mystical swirling vortex of colors\r\nenvelops your body... When you come to, things are not as they were.\r\n\r\n"); comm.act(ATTypes.AT_SAY, "A strange voice says, 'We await your return, $n...'", ch, null, null, ToTypes.Character); comm.act(ATTypes.AT_BYE, "$n has left the game.", ch, null, null, ToTypes.CanSee); ch.SetColor(ATTypes.AT_GREY); // TODO quitting_char = ch; save.save_char_obj(ch); if (GameManager.Instance.SystemData.SavePets && ((PlayerInstance)ch).PlayerData.Pet != null) { comm.act(ATTypes.AT_BYE, "$N follows $S master into the Void.", ch, null, ((PlayerInstance)ch).PlayerData.Pet, ToTypes.Room); ((PlayerInstance)ch).PlayerData.Pet.Extract(true); } //if (ch.PlayerData.Clan != null) // ch.PlayerData.Clan.Save(); // TODO saving_char = null; for (var x = 0; x < GameConstants.MaximumWearLocations; x++) { for (var y = 0; y < GameConstants.MaximumWearLayers; y++) { // TODO Save equipment } } LogManager.Instance.Info( $"{ch.Name} has quit (Room {ch.CurrentRoom?.ID ?? -1}).", LogTypes.Info, ch.Trust); ch.Extract(true); }
public static ObjectInstance RawKill(this CharacterInstance ch, CharacterInstance victim) { var victimPc = (PlayerInstance)victim; if (victim.IsNotAuthorized()) { LogManager.Instance.Bug("Killing unauthorized"); return(null); } victim.StopFighting(true); if (victim.CurrentMorph != null) { UnmorphChar.do_unmorph_char(victim, string.Empty); return(ch.RawKill(victim)); } MudProgHandler.ExecuteMobileProg(MudProgTypes.Death, ch, victim); if (victim.CharDied()) { return(null); } MudProgHandler.ExecuteRoomProg(MudProgTypes.Death, victim); if (victim.CharDied()) { return(null); } var corpse = ObjectFactory.CreateCorpse(victim, ch); switch (victim.CurrentRoom.SectorType) { case SectorTypes.OceanFloor: case SectorTypes.Underwater: case SectorTypes.ShallowWater: case SectorTypes.DeepWater: comm.act(ATTypes.AT_BLOOD, "$n's blood slowly clouds the surrounding water.", victim, null, null, ToTypes.Room); break; case SectorTypes.Air: comm.act(ATTypes.AT_BLOOD, "$n's blood sprays wildly through the air.", victim, null, null, ToTypes.Room); break; default: ObjectFactory.CreateBlood(victim); break; } if (victim.IsNpc()) { ((MobileInstance)victim).MobIndex.TimesKilled++; victim.Extract(true); victim = null; return(corpse); } victim.SetColor(ATTypes.AT_DIEMSG); Help.do_help(victim, ((PlayerInstance)victim).PlayerData.PvEDeaths + ((PlayerInstance)victim).PlayerData.PvPDeaths < 3 ? "new_death" : "_DIEMSG_"); victim.Extract(false); while (victim.Affects.Count > 0) { victim.RemoveAffect(victim.Affects.First()); } var victimRace = RepositoryManager.Instance.GetRace(victim.CurrentRace); victim.AffectedBy = victimRace.AffectedBy; victim.Resistance = 0; victim.Susceptibility = 0; victim.Immunity = 0; victim.CarryWeight = 0; victim.ArmorClass = 100 + victimRace.ArmorClassBonus; victim.Attacks = victimRace.Attacks; victim.Defenses = victimRace.Defenses; victim.ModStrength = 0; victim.ModDexterity = 0; victim.ModWisdom = 0; victim.ModIntelligence = 0; victim.ModConstitution = 0; victim.ModCharisma = 0; victim.ModLuck = 0; victim.DamageRoll = new DiceData(); victim.HitRoll = new DiceData(); victim.MentalState = -10; victim.CurrentAlignment = Macros.URANGE(-1000, victim.CurrentAlignment, 1000); victim.SavingThrows = victimRace.SavingThrows; victim.CurrentPosition = PositionTypes.Resting; victim.CurrentHealth = Macros.UMAX(1, victim.CurrentHealth); victim.CurrentMana = victim.Level < GetLevelAvatar() ? Macros.UMAX(1, victim.CurrentMana) : 1; victim.CurrentMovement = Macros.UMAX(1, victim.CurrentMovement); if (victim.Act.IsSet((int)PlayerFlags.Killer)) { victim.Act.RemoveBit((int)PlayerFlags.Killer); victim.SendTo("The gods have pardoned you for your murderous acts."); } if (victim.Act.IsSet((int)PlayerFlags.Thief)) { victim.Act.RemoveBit((int)PlayerFlags.Thief); victim.SendTo("The gods have pardoned you for your thievery."); } victimPc.PlayerData.SetConditionValue(ConditionTypes.Full, 12); victimPc.PlayerData.SetConditionValue(ConditionTypes.Thirsty, 12); if (victimPc.IsVampire()) { victimPc.PlayerData.SetConditionValue(ConditionTypes.Bloodthirsty, victim.Level / 2); } // TODO if (IS_SET(sysdata.save_flags, SV_DEATH)) // save_char_obj(victim); return(corpse); }