private static bool OnProfanityDetected(Mobile from) { switch (Action) { case ProfanityAction.None: return true; case ProfanityAction.Disallow: return false; case ProfanityAction.Criminal: from.Criminal = true; return true; case ProfanityAction.CriminalAction: from.CriminalAction(false); return true; case ProfanityAction.Disconnect: { NetState ns = from.NetState; if (ns != null) { ns.Dispose(); } return false; } default: case ProfanityAction.Other: // TODO: Provide custom implementation if this is chosen { return true; } } }
private bool CheckLoot(Mobile m, bool criminalAction) { if (m_Owner == null || m == m_Owner) { return(true); } Party p = Party.Get(m_Owner); if (p != null && p.Contains(m)) { return(true); } if (TreasureTheme.IsOverlandTheme(m_type) == true) { return(true); } Map map = this.Map; if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0) { if (criminalAction) { m.CriminalAction(true); } else { m.SendLocalizedMessage(1010630); // Taking someone else's treasure is a criminal offense! } return(true); } m.SendLocalizedMessage(1010631); // You did not discover this chest! return(false); }
private static bool OnProfanityDetected(Mobile from) { switch (Action) { case ProfanityAction.None: return(true); case ProfanityAction.Disallow: return(false); case ProfanityAction.Criminal: from.Criminal = true; return(true); case ProfanityAction.CriminalAction: from.CriminalAction(false); return(true); case ProfanityAction.Disconnect: { NetState ns = from.NetState; if (ns != null) { ns.Dispose(); } return(false); } default: case ProfanityAction.Other: // TODO: Provide custom implementation if this is chosen { return(true); } } }
private bool CheckLoot(Mobile m, bool criminalAction) { if (Temporary) { return(false); } if (m.AccessLevel >= AccessLevel.GameMaster || Owner == null || m == Owner) { return(true); } Party p = Party.Get(Owner); if (p != null && p.Contains(m)) { return(true); } Map map = Map; if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0) { if (criminalAction) { m.CriminalAction(true); } else { m.SendLocalizedMessage(1010630); // Taking someone else's treasure is a criminal offense! } return(true); } m.SendLocalizedMessage(1010631); // You did not discover this chest! return(false); }
public override void OnItemLifted(Mobile from, Item item) { base.OnItemLifted(from, item); if (item != this && from != m_Owner) { from.RevealingAction(); } if (item != this && IsCriminalAction(from)) { from.CriminalAction(true); } if (!m_Looters.Contains(from)) { m_Looters.Add(from); } if (m_InstancedItems != null && m_InstancedItems.ContainsKey(item)) { m_InstancedItems.Remove(item); } }
public override void OnItemLifted(Mobile from, Item item) { base.OnItemLifted(from, item); if (item != this && from != m_Owner) { from.RevealingAction(); } // Looting an evil corpse will make you gray to all evils for two minutes as well. if (item != this && IsCriminalAction(from) && !from.Evil && !from.Hero && m_Owner is PlayerMobile && (m_Owner as PlayerMobile).Evil) { from.ExpirationFlags.Add(new Mobile.ExpirationFlag(from, Mobile.ExpirationFlagID.EvilNoto, TimeSpan.FromMinutes(2))); } else if (item != this && IsCriminalAction(from)) { from.CriminalAction(true); } if (!m_Looters.Contains(from)) { m_Looters.Add(from); } }
public override void OnItemUsed(Mobile from, Item item) { base.OnItemUsed(from, item); if (item is Food) { from.RevealingAction(); } if (item != this && IsCriminalAction(from)) { from.CriminalAction(true); } if (!m_Looters.Contains(from)) { m_Looters.Add(from); } //if (m_InstancedItems != null && m_InstancedItems.ContainsKey(item)) //{ // m_InstancedItems.Remove(item); //} }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); LokaiSkill lokaiSkill = (LokaiSkillUtilities.XMLGetSkills(from)).PickPocket; if (targeted is Mobile) { Mobile mobile = targeted as Mobile; Container pack = mobile.Backpack; if (!from.InRange(mobile.Location, 1)) { from.NextSkillTime = Core.TickCount; from.SendMessage("You are too far away to do that."); return; } else if (pack == null) { from.NextSkillTime = Core.TickCount; from.SendMessage("That target has no backpack."); return; } else if (!from.CheckAlive()) { from.NextSkillTime = Core.TickCount; from.SendMessage("You cannot do that while you are dead."); return; } else if (!mobile.CheckAlive()) { from.NextSkillTime = Core.TickCount; from.SendMessage("That is dead, so you cannot do that."); return; } else if (mobile == from) { from.NextSkillTime = Core.TickCount; from.SendMessage("You wish to pick your own pocket?"); return; } else { bool withoutNotice = true; if (targeted is PlayerMobile) { if (ALLOW_PLAYER_THEFT) { SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 40.0, 100.0); withoutNotice = PickTry(from, mobile, rating, lokaiSkill, pack); } else { from.SendMessage("Pick-pocketing players is not allowed around here!"); } } else if (targeted is BaseVendor) { SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 60.0); withoutNotice = PickTry(from, mobile, rating, lokaiSkill, pack); } else if (targeted is BaseCreature && (!((targeted as BaseCreature).Controlled && (targeted as BaseCreature).ControlMaster == from))) { SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 20.0, 80.0); withoutNotice = PickTry(from, mobile, rating, lokaiSkill, pack); } else { from.NextSkillTime = Core.TickCount; from.SendMessage("You may not pick their pocket."); return; } if (!withoutNotice) { if (mobile is PlayerMobile) { from.CriminalAction(true); from.OnHarmfulAction(mobile, from.Criminal); } else if (mobile is BaseVendor) { mobile.Direction = mobile.GetDirectionTo(from); from.Direction = from.GetDirectionTo(mobile); mobile.Animate(31, 5, 1, true, false, 0); mobile.Say(Utility.RandomList(1005560, 1013046, 1079127, 1013038, 1013039, 1010634)); from.Animate(20, 5, 1, true, false, 0); from.Damage(Math.Max((Utility.Random(3) + 3), (int)(from.Hits / (Utility.Random(8) + 8)))); } else if (mobile is BaseCreature) { (mobile as BaseCreature).AggressiveAction(from, from.Criminal); } } } } else { from.SendMessage("That does not have a pocket you can pick."); } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolen = null; object root = null; bool caught = false; if (target is Item) { root = ((Item)target).RootParent; stolen = TryStealItem((Item)target, ref caught); } else if (target is Mobile) { Container pack = ((Mobile)target).Backpack; if (pack != null && pack.Items.Count > 0) { int randomIndex = Utility.Random(pack.Items.Count); root = target; stolen = TryStealItem(pack.Items[randomIndex], ref caught); } #region Monster Stealables if (target is BaseCreature && from is PlayerMobile) { Server.Engines.CreatureStealing.StealingHandler.HandleSteal(target as BaseCreature, from as PlayerMobile); } #endregion } else { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } if (stolen != null) { if (stolen is AddonComponent) { BaseAddon addon = ((AddonComponent)stolen).Addon as BaseAddon; from.AddToBackpack(addon.Deed); addon.Delete(); } else { from.AddToBackpack(stolen); } if (!(stolen is Container || stolen.Stackable)) { // do not return stolen containers or stackable items StolenItem.Add(stolen, m_Thief, root as Mobile); } } if (caught) { if (root == null) { m_Thief.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot)) { m_Thief.CriminalAction(false); } string message = String.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name); foreach (NetState ns in m_Thief.GetClientsInRange(8)) { if (ns.Mobile != m_Thief) { ns.Mobile.SendMessage(message); } } } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } if (root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild((Mobile)root)) { PlayerMobile pm = (PlayerMobile)m_Thief; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } }
public override void Confirm(Mobile from) { from.CriminalAction(false); // farm.Colhe(from, loc, map); new ColheitaTimer(farm, from, loc, map).Start(); }
protected override void OnTick() { m_Count++; if (!m_Mobile.Alive) { this.Stop(); if (m_bRepair) { m_Wall.CurrentRepairWorker = null; } else { m_Wall.CurrentDamageWorker = null; } } // make sure the player has the right tool to damage the wall else if (m_bRepair == false && m_Wall.CanDamageWall(m_Mobile, m_Wall) == false) { // CanDamageWall already sent the player a message this.Stop(); if (m_bRepair) { m_Wall.CurrentRepairWorker = null; } else { m_Wall.CurrentDamageWorker = null; } } else { if (m_Mobile.Hidden) { m_Mobile.Hidden = false; } bool bHasMoved = false; if (m_Mobile.Location != m_MobLoc) { bHasMoved = true; } if (bHasMoved || m_Mobile.Map == Map.Internal) { if (m_bRepair) { m_Mobile.SendMessage("You move and stop repairing the wall."); } else { m_Mobile.SendMessage("You move and stop damaging the wall."); } this.Stop(); if (m_bRepair) { m_Wall.CurrentRepairWorker = null; } else { m_Wall.CurrentDamageWorker = null; } } else { if (m_Count > SECONDS_UNTIL_DONE || (Server.Misc.TestCenter.Enabled && m_Count > 10)) //1 minute to repair the wall { this.Stop(); if (m_bRepair) { m_Wall.CurrentRepairWorker = null; } else { m_Wall.CurrentDamageWorker = null; } m_Wall.EndWork(m_Mobile, m_bRepair, m_bFull); } else if (m_Count % 5 == 0) { if (m_bRepair) { m_Mobile.Emote("*repairs the wall*"); } else { // damage the Damagers waepon m_Wall.DamageWeapon(m_Mobile.Weapon as BaseWeapon); m_Mobile.Emote("*damages the wall*"); m_Mobile.CriminalAction(m_Mobile.Criminal == false); m_Wall.NotifyOfDamager(m_Mobile); } m_Mobile.Animate(11, 5, 1, true, false, 0); } } } }
public static void CRIMINALACTION(TriggerObject trigObject, Mobile mob) { if (mob != null) { mob.CriminalAction(true); } }
private bool CheckLoot( Mobile m, bool criminalAction ) { if ( m_Temporary ) return false; if ( m.AccessLevel >= AccessLevel.GameMaster || m_Owner == null || m == m_Owner ) return true; Party p = Party.Get( m_Owner ); if ( p != null && p.Contains( m ) ) return true; Map map = Map; if ( map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0 ) { if ( criminalAction ) m.CriminalAction( true ); else m.SendLocalizedMessage( 1010630 ); // Taking someone else's treasure is a criminal offense! return true; } m.SendLocalizedMessage( 1010631 ); // You did not discover this chest! return false; }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolenItem = null; object root = null; Mobile mobileTarget = root as Mobile; bool turnPermaGrey = false; bool caught = false; int amountStolen = 0; //Stealing Attempt if (target is Item) { root = ((Item)target).RootParent; stolenItem = TryStealItem((Item)target, ref amountStolen); } else if (target is Mobile) { Container pack = ((Mobile)target).Backpack; if (pack != null && pack.Items.Count > 0) { int randomIndex = Utility.Random(pack.Items.Count); root = target; stolenItem = TryStealItem(pack.Items[randomIndex], ref amountStolen); } } else { from.SendLocalizedMessage(502710); // You can't steal that! } //Successful Steal Attempt if (stolenItem != null) { //See if Nearby Mobiles Notice IPooledEnumerable nearbyMobiles = from.Map.GetMobilesInRange(from.Location, NoticeRange); foreach (Mobile mobile in nearbyMobiles) { double noticeChance = 0; if (mobile == from) { continue; } if (!mobile.Alive) { continue; } if (mobile is PlayerMobile) { if (from.Map.InLOS(from.Location, mobile.Location)) { noticeChance += PlayerNoticeChance; } else { noticeChance += PlayerNoticeChance * LOSBlockedCatchScalar; } if (Utility.RandomDouble() <= noticeChance && mobileTarget != null) { mobile.SendMessage("You notice " + from.Name + " trying to steal from " + mobileTarget.Name + "."); caught = true; } continue; } BaseCreature bc_Creature = mobile as BaseCreature; if (bc_Creature != null && mobile.Body.IsHuman) { if (from.Map.InLOS(from.Location, mobile.Location)) { noticeChance += MobileNoticeChance; } else { noticeChance += MobileNoticeChance * LOSBlockedCatchScalar; } if (Utility.RandomDouble() <= noticeChance && mobileTarget != null) { caught = true; } continue; } } nearbyMobiles.Free(); //Resolve if (caught) { if (root == null) { from.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(from)) { from.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if (!IsInGuild(mobRoot) && IsInnocentTo(from, mobRoot)) { from.CriminalAction(false); } } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(from)) { from.CriminalAction(false); } //Flagging and Permagrey if (root is Mobile && ((Mobile)root).Player && from is PlayerMobile && IsInnocentTo(from, (Mobile)root) && !IsInGuild((Mobile)root) && turnPermaGrey) { PlayerMobile pm = (PlayerMobile)from; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } //Move Item: Delay to Allow for Guard Whacking Preventing Theft Timer.DelayCall(TimeSpan.FromSeconds(.1), delegate { if (!SpecialAbilities.Exists(from)) { return; } if (from.Backpack == null) { return; } if (stolenItem == null) { return; } if (stolenItem.Deleted) { return; } if (stolenItem.Stackable && stolenItem.Amount > 1) { if (amountStolen >= stolenItem.Amount) { from.AddToBackpack(stolenItem); if (!(stolenItem is Container || stolenItem.Stackable)) { StolenItem.Add(stolenItem, from, root as Mobile); } from.SendMessage("You successfully steal the item."); } else { Item newItem = Mobile.LiftItemDupe(stolenItem, stolenItem.Amount - amountStolen); from.AddToBackpack(newItem); if (!(newItem is Container || newItem.Stackable)) { StolenItem.Add(newItem, from, root as Mobile); } from.SendMessage("You successfully steal the item."); } } else { from.AddToBackpack(stolenItem); if (!(stolenItem is Container || stolenItem.Stackable)) { StolenItem.Add(stolenItem, from, root as Mobile); } from.SendMessage("You successfully steal the item."); } }); } else { from.SendMessage("You fail in your stealing attempt."); } }
public virtual void OnLoot(Mobile from) { Item m_Loot; string m_Collected = "You have recovered "; DefragLooters(); if (!FindLooter(from)) { List <Item> loots = new List <Item>(); bool rare = false; // improved chance of finding good loot based on certian skills // Calculated out of 200% double useskills = (from.Skills.Begging.Value + from.Skills.ItemID.Value) / 5000; // always one m_Loot = Loot.Construct(m_TrashCommonTypes); m_Loot.Movable = true; from.AddToBackpack(m_Loot); loots.Add(m_Loot); if (Utility.RandomBool()) // maybe two { m_Loot = Loot.Construct(m_TrashCommonTypes); m_Loot.Movable = true; from.AddToBackpack(m_Loot); loots.Add(m_Loot); } if ((m_ItemChance + (useskills * 2)) > Utility.RandomDouble()) // plus chance for a random item { m_Loot = Loot.Construct(m_TrashItemTypes); m_Loot.Movable = true; from.AddToBackpack(m_Loot); loots.Add(m_Loot); } else if (m_RareChance + useskills > Utility.RandomDouble()) // plus chance for a random prize { m_Loot = Loot.Construct(m_TrashRareTypes); m_Loot.Movable = true; from.AddToBackpack(m_Loot); loots.Add(m_Loot); rare = true; } else if ((m_RareChance + useskills) / 100.0 > Utility.RandomDouble()) { m_Loot = Loot.Construct(m_TrashVeryRareTypes); m_Loot.Movable = true; from.AddToBackpack(m_Loot); loots.Add(m_Loot); rare = true; } if (m_Sound > 0) { Effects.PlaySound(from.Location, from.Map, m_Sound); } for (int i = 0; i < loots.Count; i++) { if (i == 0) //First { m_Collected += GetName(loots[i]); } else if (i == loots.Count - 1) //Last { m_Collected += String.Format(", and {0}{1}", GetName(loots[i]), rare ? "!" : "."); } else { m_Collected += String.Format(", {0}", GetName(loots[i])); } } from.SendMessage(m_Collected); Looters.Add(new TrashLooter(from)); m_usesCount++; if (m_MaxUses > 0 && m_usesCount >= m_MaxUses) { from.SendMessage("You have recovered the last useable item!"); this.Delete(); } if (m_MakesCriminal) { from.CriminalAction(false); from.SendLocalizedMessage(1010630); // Taking someone else's treasure is a criminal offense! } } else { from.SendMessage("You find nothing of value at this time."); } }
public virtual void OnLoot(Mobile from) { Item m_Loot; string m_Collected = ""; DefragLooters(); if (!FindLooter(from)) { // always one m_Loot = Loot.Construct(m_TrashCommonTypes); from.AddToBackpack(m_Loot); m_Collected = "You have recovered " + GetName(m_Loot); if (Utility.RandomBool())// maybe two { m_Loot = Loot.Construct(m_TrashCommonTypes); from.AddToBackpack(m_Loot); m_Collected = m_Collected + ", " + GetName(m_Loot); } if (m_ItemChance > Utility.RandomDouble())// plus chance for a random item { m_Loot = Loot.Construct(m_TrashItemTypes); from.AddToBackpack(m_Loot); m_Collected = m_Collected + ", " + GetName(m_Loot); } if (m_RareChance > Utility.RandomDouble())// plus chance for a random prize { m_Loot = Loot.Construct(m_TrashRareTypes); from.AddToBackpack(m_Loot); m_Collected = m_Collected + ", and " + GetName(m_Loot) + "!"; } if (m_Sound > 0) { Effects.PlaySound(from.Location, from.Map, m_Sound); } from.SendMessage(m_Collected); Looters.Add(new TrashLooter(from)); m_usesCount++; if (m_MaxUses > 0 && m_usesCount >= m_MaxUses) { from.SendMessage("You have recovered the last useable item!"); this.Delete(); } if (m_MakesCriminal) { from.CriminalAction(false); from.SendLocalizedMessage(1010630); // Taking someone else's treasure is a criminal offense! } } else { from.SendMessage("You find nothing of value at this time."); } }
public virtual void OnCarve( Mobile from, Corpse corpse, Item with ) { int feathers = Feathers; int wool = Wool; int meat = Meat; int hides = Hides; if ( ( feathers == 0 && wool == 0 && meat == 0 && hides == 0 ) || Summoned || IsBonded || corpse.Animated ) { if ( corpse.Animated ) corpse.SendLocalizedMessageTo( from, 500464 ); // Use this on corpses to carve away meat and hide else from.SendLocalizedMessage( 500485 ); // You see nothing useful to carve from the corpse. } else { if ( corpse.Map == Map.Felucca ) { feathers *= 2; wool *= 2; hides *= 2; } new Blood( 0x122D ).MoveToWorld( corpse.Location, corpse.Map ); if ( feathers != 0 ) { corpse.AddCarvedItem( new Feather( feathers ), from ); from.SendLocalizedMessage( 500479 ); // You pluck the bird. The feathers are now on the corpse. } if ( wool != 0 ) { corpse.AddCarvedItem( new TaintedWool( wool ), from ); from.SendLocalizedMessage( 500483 ); // You shear it, and the wool is now on the corpse. } if ( meat != 0 ) { if ( MeatType == MeatType.Ribs ) corpse.AddCarvedItem( new RawRibs( meat ), from ); else if ( MeatType == MeatType.Bird ) corpse.AddCarvedItem( new RawBird( meat ), from ); else if ( MeatType == MeatType.LambLeg ) corpse.AddCarvedItem( new RawLambLeg( meat ), from ); from.SendLocalizedMessage( 500467 ); // You carve some meat, which remains on the corpse. } if ( hides != 0 ) { Item holding = from.Weapon as Item; if ( false && ( holding is SkinningKnife /* TODO: || holding is ButcherWarCleaver || with is ButcherWarCleaver */ ) ) { Item leather = null; switch ( HideType ) { case HideType.Regular: leather = new Leather( hides ); break; case HideType.Spined: leather = new SpinedLeather( hides ); break; case HideType.Horned: leather = new HornedLeather( hides ); break; case HideType.Barbed: leather = new BarbedLeather( hides ); break; } if ( leather != null ) { if ( !from.PlaceInBackpack( leather ) ) { corpse.DropItem( leather ); from.SendLocalizedMessage( 500471 ); // You skin it, and the hides are now in the corpse. } else { from.SendLocalizedMessage( 1073555 ); // You skin it and place the cut-up hides in your backpack. } } } else { if ( HideType == HideType.Regular ) corpse.DropItem( new Hides( hides ) ); else if ( HideType == HideType.Spined ) corpse.DropItem( new SpinedHides( hides ) ); else if ( HideType == HideType.Horned ) corpse.DropItem( new HornedHides( hides ) ); else if ( HideType == HideType.Barbed ) corpse.DropItem( new BarbedHides( hides ) ); from.SendLocalizedMessage( 500471 ); // You skin it, and the hides are now in the corpse. } } corpse.Carved = true; if ( corpse.IsCriminalAction( from ) ) from.CriminalAction( true ); } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Item.Deleted) { return; } if (targeted is ICarvable) { ((ICarvable)targeted).Carve(from, m_Item); } else if (targeted is Container) { Container body = (Container)targeted; if (body.ItemID >= 0x4B5A && body.ItemID <= 0x4BAB) { body.ItemID = Utility.RandomList(0xECA, 0xECB, 0xECC, 0xECD, 0xECE, 0xECF, 0xED0, 0xED1, 0xED2); body.Hue = 0; from.CriminalAction(true); Misc.Titles.AwardKarma(from, -50, true); body.DropItem(new BodyPart(0x1D9F)); body.DropItem(new BodyPart(0x1DA4)); body.DropItem(new BodyPart(0x1DA2)); body.DropItem(new BodyPart(0x1DA3)); body.DropItem(new BodyPart(0x1DA1)); body.DropItem(new BodyPart(0x1DA0)); from.SendMessage("You hack up the body into bloody pieces."); } } else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding) { SwampDragon pet = (SwampDragon)targeted; if (!pet.Controlled || pet.ControlMaster != from) { from.SendLocalizedMessage(1053022); // You cannot remove barding from a swamp dragon you do not own. } else { pet.HasBarding = false; } } else { HarvestSystem system = Lumberjacking.System; HarvestDefinition def = Lumberjacking.System.Definition; int tileID; Map map; Point3D loc; if (!system.GetHarvestDetails(from, m_Item, targeted, out tileID, out map, out loc)) { from.SendLocalizedMessage(500494); // You can't use a bladed item on that! } else if (!def.Validate(tileID)) { from.SendLocalizedMessage(500494); // You can't use a bladed item on that! } else { HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) { return; } if (bank.Current < 5) { from.SendMessage("There is not enough here to harvest."); //from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest. } else { bank.Consume(5, from); if (tileID == 0x4D96 || tileID == 0x4D9A) // apples { Item item = new Apple(); if (from.PlaceInBackpack(item)) { from.SendMessage("You put an apple into your backpack."); } else { from.SendMessage("You can't place any apples into your backpack!"); item.Delete(); } } else if (tileID == 0x4DA6 || tileID == 0x4DAA) // pears { Item item = new Pear(); if (from.PlaceInBackpack(item)) { from.SendMessage("You put a pear into your backpack."); } else { from.SendMessage("You can't place any pears into your backpack!"); item.Delete(); } } else if (tileID == 0x4D9E || tileID == 0x4DA2) // peaches { Item item = new Peach(); if (from.PlaceInBackpack(item)) { from.SendMessage("You put a peach into your backpack."); } else { from.SendMessage("You can't place any peaches into your backpack!"); item.Delete(); } } else if (tileID == 0x4CDA || tileID == 0x4CDB || tileID == 0x4CDC || tileID == 0x4CDD || tileID == 0x4CDE || tileID == 0x4CDF) // acorns { Item item = new Acorn(); if (from.PlaceInBackpack(item)) { from.SendMessage("You put an acorn into your backpack."); } else { from.SendMessage("You can't place any acorns into your backpack!"); item.Delete(); } } else if (tileID == 0x4CA8 || tileID == 0x4CAA || tileID == 0x4CAB) // bananas { Item item = new Banana(); if (from.PlaceInBackpack(item)) { from.SendMessage("You put a banana into your backpack."); } else { from.SendMessage("You can't place any bananas into your backpack!"); item.Delete(); } } else if (tileID == 0x4C95) // coconut { Item item = new Coconut(); if (from.PlaceInBackpack(item)) { from.SendMessage("You put a coconut into your backpack."); } else { from.SendMessage("You can't place any coconuts into your backpack!"); item.Delete(); } } else if (tileID == 0x4C96) // dates { Item item = new Dates(); if (from.PlaceInBackpack(item)) { from.SendMessage("You put some dates into your backpack."); } else { from.SendMessage("You can't place any dates into your backpack!"); item.Delete(); } } else { Item item = new Kindling(); if (from.PlaceInBackpack(item)) { from.SendLocalizedMessage(500491); // You put some kindling into your backpack. from.SendLocalizedMessage(500492); // An axe would probably get you more wood. } else { from.SendLocalizedMessage(500490); // You can't place any kindling into your backpack! item.Delete(); } } } } } }
public virtual void Carve(Mobile from, Item item) { if (from == null) { return; } if (DoesNotDecay) { from.SendMessage("A mystical force prevents you from carving the corpse!"); return; } var region1 = from.Region as CustomRegion; var captureZone = from.Region as CaptureZoneRegion; if ((region1 != null && !region1.AllowCutCorpse()) || (captureZone != null && !captureZone.Czone.NoCorpseCarving)) { from.SendMessage("A mystical force prevents you from carving the corpse!"); return; } if (IsCriminalAction(from) && Map != null && (Map.Rules & MapRules.HarmfulRestrictions) != 0) { if (m_Owner == null || !m_Owner.Player) { from.SendLocalizedMessage(1005035); // You did not earn the right to loot this creature! } else { from.SendLocalizedMessage(1010049); // You may not loot this corpse. } return; } if (region1 != null && region1.PlayingGame(from)) { from.SendMessage(32, "You cannot carve this corpse while an event is taking place!"); return; } Faction faction = Faction.Find(m_Owner); if (faction != null && Region.Find(Location, Map) is TownRegion) { from.SendMessage(32, "You cannot carve faction member corpses in town!"); return; } var p = m_Owner as PlayerMobile; if (FactionObelisks.Obelisks != null && p != null && p.FactionPlayerState != null && !(Region.Find(Location, Map) is DungeonRegion)) { var acct = p.Account as Account; foreach (var obelisk in FactionObelisks.Obelisks) { if (obelisk.ObeliskType == ObeliskType.Bloodshed && !String.IsNullOrEmpty(obelisk.OwningFaction) && acct != null) { if (obelisk.ObeliskUsers != null && obelisk.ObeliskUsers.ContainsKey(acct)) { from.SendMessage(61, "This player's body is protected by the point of bloodshed."); return; } } } } Mobile dead = m_Owner; if (GetFlag(CorpseFlag.Carved) || dead == null) { from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse. } else if (((Body)Amount).IsHuman && ItemID == 0x2006) { if (m_BloodHue > -1) { new Blood(0x122D, m_BloodHue).MoveToWorld(Location, Map); } if (dead is PlayerMobile) { new Head2((PlayerMobile)dead, dead.Region).MoveToWorld(Location, Map); new Torso().MoveToWorld(Location, Map); new LeftLeg().MoveToWorld(Location, Map); new LeftArm().MoveToWorld(Location, Map); new RightLeg().MoveToWorld(Location, Map); new RightArm().MoveToWorld(Location, Map); new RawHumanFlesh(2, dead).MoveToWorld(Location, Map); new RawHumanBrain(1, dead).MoveToWorld(Location, Map); } else { new Torso().MoveToWorld(Location, Map); new LeftLeg().MoveToWorld(Location, Map); new LeftArm().MoveToWorld(Location, Map); new RightLeg().MoveToWorld(Location, Map); new RightArm().MoveToWorld(Location, Map); new Head2(dead.RawName).MoveToWorld(Location, Map); new RawHumanFlesh(2, dead).MoveToWorld(Location, Map); new RawHumanBrain(1, dead).MoveToWorld(Location, Map); } SetFlag(CorpseFlag.Carved, true); ProcessDelta(); SendRemovePacket(); ItemID = Utility.Random(0xECA, 9); // bone graphic Hue = 0; ProcessDelta(); if (IsCriminalAction(from)) { from.CriminalAction(true); } } else if (dead is BaseCreature) { Conquests.CheckProgress<SkinningConquest>(from as PlayerMobile, this); ((BaseCreature)dead).OnCarve(from, this, item); } else { from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse. } }
public override void OnItemLifted(Mobile from, Item item) { base.OnItemLifted(from, item); if (item != this && from != this.m_Owner) from.RevealingAction(); if (item != this && this.IsCriminalAction(from)) from.CriminalAction(true); if (!this.m_Looters.Contains(from)) this.m_Looters.Add(from); if (this.m_InstancedItems != null && this.m_InstancedItems.ContainsKey(item)) this.m_InstancedItems.Remove(item); }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolen = null; object root = null; bool caught = false; if (target is Item) { root = ((Item)target).RootParent; stolen = TryStealItem((Item)target, ref caught); } else if (target is Mobile) { Container pack = ((Mobile)target).Backpack; if (pack != null && pack.Items.Count > 0) { int randomIndex = Utility.Random(pack.Items.Count); root = target; stolen = TryStealItem(pack.Items[randomIndex], ref caught); } } else { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } if (stolen != null) { from.AddToBackpack(stolen); StolenItem.Add(stolen, m_Thief, root as Mobile); } if (caught) { if (root == null) { m_Thief.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot)) { m_Thief.CriminalAction(false); } string message = String.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name); foreach (NetState ns in m_Thief.GetClientsInRange(8)) { if (ns.Mobile != m_Thief) { ns.Mobile.SendMessage(message); } } } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } if (root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild((Mobile)root)) { PlayerMobile pm = (PlayerMobile)m_Thief; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } }
private static bool OnProfanityDetected(Mobile from, string speech) { switch (Action) { case ProfanityAction.None: return true; case ProfanityAction.Disallow: { if (from.AccessLevel == AccessLevel.Player) { from.SendAsciiMessage("Harassing and cursing is not allowed! Repeated offences will get you jailed!"); return false; } from.SendAsciiMessage("You are staff so you can swear, but please try not to."); return true; } case ProfanityAction.Criminal: from.Criminal = true; return true; case ProfanityAction.CriminalAction: from.CriminalAction(false); return true; case ProfanityAction.Disconnect: { NetState ns = from.NetState; if (ns != null) ns.Dispose(); return false; } default: case ProfanityAction.Other: // TODO: Provide custom implementation if this is chosen { return true; } } }
public override void OnItemLifted( Mobile from, Item item ) { base.OnItemLifted(from, item); if( item != this && from != m_Owner ) from.RevealingAction(); if( item != this && IsCriminalAction(from) ) from.CriminalAction(true); if( !m_Looters.Contains(from) ) m_Looters.Add(from); if( m_InstancedItems != null && m_InstancedItems.ContainsKey(item) ) m_InstancedItems.Remove(item); if( from.Player && from != m_Owner ) { EventDispatcher.InvokeCorpseAction(new CorpseActionEventArgs((Player)from, this, CorpseActionEventArgs.CorpseAction.Looted)); } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); from.NextSkillTime = Core.TickCount + 1000; if (!m_Instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack! } else if (target is Mobile) { Mobile targ = (Mobile)target; if (IsInnocentTo(from, targ)) { from.CriminalAction(false); } if (targ == from || (targ is BaseCreature && (((BaseCreature)targ).BardImmune || !from.CanBeHarmful(targ, false)) && ((BaseCreature)targ).ControlMaster != from)) { from.SendLocalizedMessage(1049535); // A song of discord would have no effect on that. } else if (m_Table.Contains(targ)) //Already discorded { from.SendLocalizedMessage(1049537); // Your target is already in discord. } else { double diff = m_Instrument.GetDifficultyFor(targ) - 10.0; double music = from.Skills[SkillName.Musicianship].Value; if (music > 100.0) { diff -= (music - 100.0) * 0.5; } if (!BaseInstrument.CheckMusicianship(from)) { from.SendLocalizedMessage(500612); // You play poorly, and there is no effect. m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); } else if (from.CheckTargetSkill(SkillName.Discordance, target, diff - 25.0, diff + 25.0)) { from.SendLocalizedMessage(1049539); // You play the song surpressing your targets strength m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); ArrayList mods = new ArrayList(); int effect; double scalar; CampfireEntry casterEntry = Campfire.GetEntry(from); if (Core.AOS) { double discord = from.Skills[SkillName.Discordance].Value; if (discord > 100.0) { effect = -20 + (int)((discord - 100.0) / -2.5); } else { effect = (int)(discord / -5.0); } if (Core.SE && BaseInstrument.GetBaseDifficulty(targ) >= 160.0) { effect /= 2; } if (casterEntry != null && casterEntry.Safe) { effect = (int)(effect * 1.25); } if (targ.Player) { effect /= 4; } scalar = effect * 0.01; mods.Add(new ResistanceMod(ResistanceType.Physical, effect)); mods.Add(new ResistanceMod(ResistanceType.Fire, effect)); mods.Add(new ResistanceMod(ResistanceType.Cold, effect)); mods.Add(new ResistanceMod(ResistanceType.Poison, effect)); mods.Add(new ResistanceMod(ResistanceType.Energy, effect)); for (int i = 0; i < targ.Skills.Length; ++i) { if (targ.Skills[i].Value > 0) { mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar)); } } } else { effect = (int)(from.Skills[SkillName.Discordance].Value / -5.0); scalar = effect * 0.01; mods.Add(new StatMod(StatType.Str, "DiscordanceStr", (int)(targ.RawStr * scalar), TimeSpan.Zero)); mods.Add(new StatMod(StatType.Int, "DiscordanceInt", (int)(targ.RawInt * scalar), TimeSpan.Zero)); mods.Add(new StatMod(StatType.Dex, "DiscordanceDex", (int)(targ.RawDex * scalar), TimeSpan.Zero)); for (int i = 0; i < targ.Skills.Length; ++i) { if (targ.Skills[i].Value > 0) { mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar)); } } } DiscordanceInfo info = new DiscordanceInfo(from, targ, Math.Abs(effect), mods); info.m_Timer = Timer.DelayCall <DiscordanceInfo>(TimeSpan.Zero, TimeSpan.FromSeconds(1.25), new TimerStateCallback <DiscordanceInfo>(ProcessDiscordance), info); m_Table[targ] = info; } else { from.SendLocalizedMessage(1049540); // You fail to disrupt your target m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); } from.NextSkillTime = Core.TickCount + 12000; } } else { from.SendLocalizedMessage(1049535); // A song of discord would have no effect on that. } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolen = null; object root = null; bool caught = false; if (target is Item) { root = ((Item)target).RootParent; if (m_Thief.Map != Map.Felucca && root is BaseCreature && ((BaseCreature)root).ControlMaster != null) { m_Thief.SendLocalizedMessage(1005597); // The creature blocks your attempt to steal. } else { stolen = TryStealItem((Item)target, ref caught); } } else if (target is Mobile) { Container pack = ((Mobile)target).Backpack; if (m_Thief.Map != Map.Felucca && target is BaseCreature && ((BaseCreature)target).ControlMaster != null) { m_Thief.SendLocalizedMessage(1005597); // The creature blocks your attempt to steal. } else if (pack != null && pack.Items.Count > 0) { from.SendLocalizedMessage(1010579); // You reach into the backpack... and try to take something. int randomIndex = Utility.Random(pack.Items.Count); root = target; stolen = TryStealItem((Item)pack.Items[randomIndex], ref caught); } else { from.SendLocalizedMessage(1010578); // You reach into the backpack... but find it's empty. } } else { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } if (stolen != null) { from.AddToBackpack(stolen); StolenItem.Add(stolen, m_Thief, root as Mobile); } if (caught) { if (root == null) { m_Thief.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot)) { m_Thief.CriminalAction(false); } string message = String.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name); foreach (GameClient ns in m_Thief.GetClientsInRange(8)) { if (ns != m_Thief.Client) { ns.Mobile.SendMessage(message); } } } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } if (root is Mobile && ((Mobile)root).IsPlayer && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild((Mobile)root)) { PlayerMobile pm = (PlayerMobile)m_Thief; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } }
public static void OnCarve(Mobile from, Corpse corpse, BaseCreature mob, LokaiSkill lokaiSkill) { if (corpse.Carved) { return; } int feathers = mob.Feathers; int wool = mob.Wool; int meat = mob.Meat; int hides = mob.Hides; int scales = mob.Scales; if ((feathers == 0 && wool == 0 && meat == 0 && hides == 0 && scales == 0) || mob.Summoned || mob.IsBonded) { from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse. } else { if (Core.ML && from.Race == Race.Human) { hides = (int)Math.Ceiling(hides * 1.1); //10% Bonus Only applies to Hides, Ore & Logs } if (corpse.Map == Map.Felucca) { feathers *= 2; wool *= 2; hides *= 2; } int ratingFactor = 10; int skinFactor = 10; SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 100.0); switch (rating) { case SuccessRating.CriticalFailure: skinFactor = 3; ratingFactor = 0; break; case SuccessRating.HazzardousFailure: skinFactor = 6; ratingFactor = 0; break; case SuccessRating.Failure: skinFactor = 9; ratingFactor = 0; break; case SuccessRating.PartialSuccess: skinFactor = 11; ratingFactor = 0; break; case SuccessRating.Success: skinFactor = 14; ratingFactor = 3; break; case SuccessRating.CompleteSuccess: skinFactor = 17; ratingFactor = 6; break; case SuccessRating.ExceptionalSuccess: case SuccessRating.TooEasy: skinFactor = 20; ratingFactor = 9; break; default: case SuccessRating.TooDifficult: skinFactor = 0; ratingFactor = 0; break; } feathers *= skinFactor; wool *= skinFactor; hides *= skinFactor; scales *= skinFactor; meat *= ratingFactor; feathers /= 10; wool /= 10; hides /= 10; scales /= 10; meat /= 10; new Blood(0x122D).MoveToWorld(corpse.Location, corpse.Map); if (feathers != 0) { corpse.DropItem(new Feather(feathers)); from.SendLocalizedMessage(500479); // You pluck the bird. The feathers are now on the corpse. } if (wool != 0) { corpse.DropItem(new Wool(wool)); from.SendLocalizedMessage(500483); // You shear it, and the wool is now on the corpse. } if (meat != 0) { if (mob.MeatType == MeatType.Ribs) { corpse.DropItem(new RawRibs(meat)); } else if (mob.MeatType == MeatType.Bird) { corpse.DropItem(new RawBird(meat)); } else if (mob.MeatType == MeatType.LambLeg) { corpse.DropItem(new RawLambLeg(meat)); } from.SendLocalizedMessage(500467); // You carve some meat, which remains on the corpse. } if (hides != 0) { if (mob.HideType == HideType.Regular) { corpse.DropItem(new Hides(hides)); } else if (mob.HideType == HideType.Spined) { corpse.DropItem(new SpinedHides(hides)); } else if (mob.HideType == HideType.Horned) { corpse.DropItem(new HornedHides(hides)); } else if (mob.HideType == HideType.Barbed) { corpse.DropItem(new BarbedHides(hides)); } from.SendLocalizedMessage(500471); // You skin it, and the hides are now in the corpse. } if (scales != 0) { ScaleType sc = mob.ScaleType; switch (sc) { case ScaleType.Red: corpse.DropItem(new RedScales(scales)); break; case ScaleType.Yellow: corpse.DropItem(new YellowScales(scales)); break; case ScaleType.Black: corpse.DropItem(new BlackScales(scales)); break; case ScaleType.Green: corpse.DropItem(new GreenScales(scales)); break; case ScaleType.White: corpse.DropItem(new WhiteScales(scales)); break; case ScaleType.Blue: corpse.DropItem(new BlueScales(scales)); break; case ScaleType.All: { corpse.DropItem(new RedScales(scales)); corpse.DropItem(new YellowScales(scales)); corpse.DropItem(new BlackScales(scales)); corpse.DropItem(new GreenScales(scales)); corpse.DropItem(new WhiteScales(scales)); corpse.DropItem(new BlueScales(scales)); break; } } from.SendMessage("You cut away some scales, but they remain on the corpse."); } corpse.Carved = true; if (corpse.IsCriminalAction(from)) { from.CriminalAction(true); } } }
public static bool Mobile_AllowHarmful(Mobile from, Mobile target) { if (from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player) { return(true); } #region Dueling PlayerMobile pmFrom = from as PlayerMobile; PlayerMobile pmTarg = target as PlayerMobile; BaseCreature bcFrom = from as BaseCreature; if (pmFrom == null && bcFrom != null) { if (bcFrom.Summoned) { pmFrom = bcFrom.SummonMaster as PlayerMobile; } } if (pmFrom != null && pmFrom.Kills >= 5 && !MurderSystemController._RedAllowHarmfulToBluesInTown) { if (target != null && target.Region != null) { GuardedRegion region = (GuardedRegion)target.Region.GetRegion(typeof(GuardedRegion)); if (region != null && !region.Disabled) { if (Notoriety.Compute(from, target) == Notoriety.Innocent) { return(false); } } } } if (pmTarg == null && target is BaseCreature) { BaseCreature bcTarg = (BaseCreature)target; if (bcTarg.Summoned) { pmTarg = bcTarg.SummonMaster as PlayerMobile; } } if (pmFrom != null && pmTarg != null) { if (pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started))) { return(false); } if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated)) { return(false); } if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant == pmTarg.DuelPlayer.Participant) { return(false); } if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started) { return(true); } } if ((pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started)) { return(false); } Engines.ConPVP.SafeZone sz = from.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone; if (sz != null /*&& sz.IsDisabled()*/) { return(false); } sz = target.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone; if (sz != null /*&& sz.IsDisabled()*/) { return(false); } #endregion // Alan mod: custom teams if (from.CustomTeam && target.CustomTeam) { List <XmlTeam> targetTeams = XmlAttach.GetTeams(target); List <XmlTeam> fromTeams = XmlAttach.GetTeams(from); if (XmlTeam.SameTeam(fromTeams, targetTeams)) { return(XmlTeam.AllowTeamHarmful(fromTeams, targetTeams)); } // they are on the enemy team, allow harmful return(true); } // end Alan mod if (bcFrom != null) { if (!bcFrom.Pseu_CanAttackInnocents && Notoriety.Compute(from, target) == Notoriety.Innocent) { return(false); } } // end Alan mod // ALAN MOD: protect young players from other players in regions where they are given protection if (MurderSystemController._YoungProtectionRegionsEnabled) { if (target is PlayerMobile && ((PlayerMobile)target).CheckYoungProtection(from) && !CheckAggressor(from.Aggressors, target) && !CheckAggressed(from.Aggressed, target)) { return(false); } } // END ALAN MOD var g = (Guild)BaseGuild.FindByAbbrev("New");//don't allow people in the new guild to attack eachother if (g != null && g.IsMember(from) && g.IsMember(target)) { from.CriminalAction(true); return(true); } Map map = from.Map; if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0) { return(true); // In felucca, anything goes } // check uncontrolled NPC mobs--there's a chance they won't attack if young protection is on if (!from.Player && !(bcFrom != null && bcFrom.GetMaster() != null && bcFrom.GetMaster().AccessLevel == AccessLevel.Player)) { if (target is PlayerMobile && ((PlayerMobile)target).CheckYoungProtection(from) && !CheckAggressor(from.Aggressors, target) && !CheckAggressed(from.Aggressed, target)) { return(false); } return(true); // Uncontrolled NPCs are only restricted by the young system } Guild fromGuild = GetGuildFor(from.Guild as Guild, from); Guild targetGuild = GetGuildFor(target.Guild as Guild, target); if (fromGuild != null && targetGuild != null && (fromGuild == targetGuild || fromGuild.IsAlly(targetGuild) || fromGuild.IsEnemy(targetGuild))) { return(true); // Guild allies or enemies can be harmful } if (target is BaseCreature && (((BaseCreature)target).Controlled || (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster))) { return(false); // Cannot harm other controlled mobiles } if (target.Player) { return(false); // Cannot harm other players } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) { if (Notoriety.Compute(from, target) == Notoriety.Innocent) { return(false); // Cannot harm innocent mobiles } } return(true); }
public virtual void OnShipHit(object obj) { object[] list = (object[])obj; BaseGalleon target = list[0] as BaseGalleon; Point3D pnt = (Point3D)list[1]; AmmoInfo ammoInfo = list[2] as AmmoInfo; Mobile shooter = list[3] as Mobile; if (target != null && Galleon != null) { int damage = (int)(ammoInfo.GetDamage(this) * Galleon.CannonDamageMod); target.OnTakenDamage(shooter, damage); int z = target.ZSurface; if (target.TillerMan != null && target.TillerMan is IEntity) { z = ((IEntity)target.TillerMan).Z; } Direction d = Utility.GetDirection(this, pnt); int xOffset = 0; int yOffset = 0; Point3D hit = pnt; if (!ammoInfo.RequiresSurface) { switch (d) { default: case Direction.North: xOffset = Utility.RandomMinMax(-1, 1); yOffset = Utility.RandomMinMax(-2, 0); hit = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z); break; case Direction.South: xOffset = Utility.RandomMinMax(-1, 1); yOffset = Utility.RandomMinMax(0, 2); hit = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z); break; case Direction.East: xOffset = Utility.RandomMinMax(0, 2); yOffset = Utility.RandomMinMax(-1, 1); hit = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z); break; case Direction.West: xOffset = Utility.RandomMinMax(-2, 0); yOffset = Utility.RandomMinMax(-1, 1); hit = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z); break; } } Effects.SendLocationEffect(hit, target.Map, Utility.RandomBool() ? 14000 : 14013, 15, 10); Effects.PlaySound(hit, target.Map, 0x207); Mobile victim = target.Owner; if (victim != null && target.Contains(victim) && shooter.CanBeHarmful(victim, false)) { shooter.DoHarmful(victim); } else { List <Mobile> candidates = new List <Mobile>(); SecurityLevel highest = SecurityLevel.Passenger; foreach (var mob in target.GetMobilesOnBoard().OfType <PlayerMobile>().Where(pm => shooter.CanBeHarmful(pm, false))) { if (Galleon.GetSecurityLevel(mob) > highest) { candidates.Insert(0, mob); } else { candidates.Add(mob); } } if (candidates.Count > 0) { shooter.DoHarmful(candidates[0]); } else if (victim != null && shooter.IsHarmfulCriminal(victim)) { shooter.CriminalAction(false); } ColUtility.Free(candidates); } if (Galleon.Map != null) { IPooledEnumerable eable = Galleon.Map.GetItemsInRange(hit, 1); foreach (Item item in eable) { if (item is IShipCannon && !Galleon.Contains(item)) { ((IShipCannon)item).OnDamage(damage, shooter); } } eable.Free(); } } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolen = null; object root = null; bool caught = false; if (target is Item) { root = ((Item)target).RootParent; stolen = TryStealItem((Item)target, ref caught); } else if (target is Mobile) { Container pack = ((Mobile)target).Backpack; Item hat = from.FindItemOnLayer(Layer.Helm); // Added by OldSalty 6/12/04 from here... if (hat is OrcishKinMask && (target is Orc || target is OrcBomber || target is OrcBrute || target is OrcCaptain || target is OrcishLord || target is OrcishMage)) { AOS.Damage(from, 50, 0, 100, 0, 0, 0); hat.Delete(); from.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head); from.PlaySound(0x307); } // . . . to here if (pack != null && pack.Items.Count > 0) { int randomIndex = Utility.Random(pack.Items.Count); root = target; stolen = TryStealItem((Item)pack.Items[randomIndex], ref caught); } } else { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } if (stolen != null) { from.AddToBackpack(stolen); } if (caught) { if (root == null) { m_Thief.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if ( //!IsInGuild(mobRoot) && //Pix: we don't care if the target's also in the guild... IsInnocentTo(m_Thief, mobRoot)) { m_Thief.CriminalAction(false); } string message = String.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name); IPooledEnumerable eable = m_Thief.GetClientsInRange(8); foreach (NetState ns in eable) { if (ns != m_Thief.NetState) { ns.Mobile.SendMessage(message); } } eable.Free(); } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } if (root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) && //!IsInGuild( (Mobile)root ) && //Pix: we don't care if the target's also in the guild... stolen != null) { PlayerMobile pm = (PlayerMobile)m_Thief; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } //PIX: 11/17/07 - WTF is this? Why did I have this in my code? //if (stolen != null) //{ // if (root is Mobile) // { // ((Mobile)root).AggressiveAction(m_Thief, false); // } //} }
public void DoFireEffect(IPoint3D target, Mobile from) { Map map = Map; if (target == null || map == null) { return; } var startloc = new Point3D(Location); IPoint3D point = target; switch (Facing) { case 3: { Effects.SendLocationEffect(new Point3D(X, Y + 1, Z - 2), map, Utility.RandomList(0x3728), 16, 1); break; } case 1: { Effects.SendLocationEffect(new Point3D(X, Y - 1, Z - 2), map, Utility.RandomList(0x3728), 16, 1); break; } case 2: { Effects.SendLocationEffect(new Point3D(X + 1, Y, Z - 2), map, Utility.RandomList(0x3728), 16, 1); break; } case 0: { Effects.SendLocationEffect(new Point3D(X - 1, Y + 1, Z - 2), map, Utility.RandomList(0x3728), 16, 1); break; } } Effects.PlaySound(target, map, Utility.RandomList(0x11B, 0x11C, 0x11D)); var queue = new EffectQueue(); queue.Deferred = false; queue.Add( new MovingEffectInfo( startloc, point, Map, m_Projectile.AnimationID, m_Projectile.AnimationHue > 0 ? m_Projectile.AnimationHue - 1 : 0, 10, EffectRender.Normal, TimeSpan.FromSeconds(0.1), () => { if (Projectile.ShipDamage > 0) { for (int count = 8; count > 0; count--) { IPoint3D location = new Point3D(target.X + Utility.RandomMinMax(-1, 1), target.Y + Utility.RandomMinMax(-1, 1), target.Z); int effect = Utility.RandomList(0x36B0); Effects.SendLocationEffect(location, map, effect, 25, 1); Effects.PlaySound(target, map, Utility.RandomList(0x11B, 0x11C, 0x11D)); } } foreach (Mobile mob in AcquireAllTargets(new Point3D(point), Projectile.DamageRange)) { if (from.CanBeHarmful(mob)) { mob.Damage(Projectile.PlayerDamage, from); if (from.IsHarmfulCriminal(mob) && !from.Criminal) { from.CriminalAction(true); } else if (from.IsHarmfulCriminal(mob)) { from.CriminalAction(false); } } } foreach (Item item in from.Map.GetItemsInRange(new Point3D(point), Projectile.DamageRange)) { if (item is MainMast) { var mast = item as MainMast; if (mast.HullDurability < Projectile.ShipDamage) { mast.HullDurability = 0; } else { mast.HullDurability -= (ushort)Projectile.ShipDamage; } mast.PublicOverheadMessage(MessageType.Label, 61, true, mast.HullDurability + "/" + mast.MaxHullDurability); } if (item is BaseShipWeapon) { var cannon = item as BaseShipWeapon; if (cannon.Durability < Projectile.ShipDamage) { cannon.Durability = 0; } else { cannon.Durability -= Projectile.ShipDamage; } } if (item is NewBaseBoat) { var boat = item as NewBaseBoat; if (boat.HullDurability < Projectile.ShipDamage) { boat.HullDurability = 0; } else { boat.HullDurability -= (ushort)Projectile.ShipDamage; } boat.PublicOverheadMessage(MessageType.Label, 61, true, boat.HullDurability + "/" + boat.MaxHullDurability); } } })); queue.Process(); Projectile.Delete(); Projectile = null; this.m_NextFiringTime = DateTime.UtcNow + TimeSpan.FromSeconds(15); }
private Item TryStealItem(Item toSteal, ref bool caught) { Item stolen = null; object root = toSteal.RootParent; StealableArtifactsSpawner.StealableInstance si = null; if (toSteal.Parent == null || !toSteal.Movable) { si = StealableArtifactsSpawner.GetStealableInstance(toSteal); } if (toSteal is DungeonChest) { DungeonChest dBox = (DungeonChest)toSteal; if (m_Thief.Blessed) { m_Thief.SendMessage("You cannot steal while in this state."); } else if (dBox.ItemID == 0x3582 || dBox.ItemID == 0x3583 || dBox.ItemID == 0x35AD || dBox.ItemID == 0x3868 || (dBox.ItemID >= 0x4B5A && dBox.ItemID <= 0x4BAB) || (dBox.ItemID >= 0xECA && dBox.ItemID <= 0xED2)) { m_Thief.SendMessage("It is best to leave the dead be."); } else if (dBox.ItemID == 0x3564 || dBox.ItemID == 0x3565) { m_Thief.SendMessage("You have not use for this broken golem thing."); } else { if (m_Thief.CheckSkill(SkillName.Stealing, 0, 125)) { m_Thief.SendMessage("You dump out the entire contents while stealing the item."); StolenChest sBox = new StolenChest(); int dValue = 0; dValue = (dBox.ContainerLevel + 1) * 50; sBox.ContainerID = dBox.ContainerID; sBox.ContainerGump = dBox.ContainerGump; sBox.ContainerHue = dBox.ContainerHue; sBox.ContainerFlip = dBox.ContainerFlip; sBox.ContainerWeight = dBox.ContainerWeight; sBox.ContainerName = dBox.ContainerName; sBox.ContainerValue = dValue; Item iBox = (Item)sBox; iBox.ItemID = sBox.ContainerID; iBox.Hue = sBox.ContainerHue; iBox.Weight = sBox.ContainerWeight; iBox.Name = sBox.ContainerName; Bag oBox = (Bag)iBox; oBox.GumpID = sBox.ContainerGump; m_Thief.AddToBackpack(oBox); Titles.AwardFame(m_Thief, dValue, true); LoggingFunctions.LogStandard(m_Thief, "has stolen a " + iBox.Name + ""); } else { m_Thief.SendMessage("You were not quick enough to steal it."); m_Thief.RevealingAction(); // REVEALING ONLY WHEN FAILED } Item spawnBox = new DungeonChestSpawner(dBox.ContainerLevel, (double)(Utility.RandomMinMax(45, 105))); spawnBox.MoveToWorld(new Point3D(dBox.X, dBox.Y, dBox.Z), dBox.Map); toSteal.Delete(); } } else if (toSteal is LandChest && LandChest.isBody(toSteal.ItemID)) { m_Thief.SendMessage("It is best to leave the dead be."); } else if (toSteal is LandChest && !LandChest.isBody(toSteal.ItemID)) { m_Thief.SendMessage("You would be quite foolish looking stealing a wagon."); } else if (toSteal is SunkenShip) { m_Thief.SendMessage("You are just not that strong."); } else if (!IsEmptyHanded(m_Thief)) { m_Thief.SendMessage("You cannot be wielding a weapon when trying to steal something."); } else if (root is Mobile && ((Mobile)root).Player && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild(m_Thief)) { m_Thief.SendLocalizedMessage(1005596); // You must be in the thieves guild to steal from other players. } else if (toSteal is Coffer) { Coffer coffer = (Coffer)toSteal; bool Pilfer = true; if (m_Thief.Backpack.FindItemByType(typeof(ThiefNote)) != null) { Item mail = m_Thief.Backpack.FindItemByType(typeof(ThiefNote)); ThiefNote envelope = (ThiefNote)mail; if (envelope.NoteOwner == m_Thief) { if (envelope.NoteItemArea == Server.Misc.Worlds.GetRegionName(m_Thief.Map, m_Thief.Location) && envelope.NoteItemGot == 0 && envelope.NoteItemCategory == coffer.CofferType) { envelope.NoteItemGot = 1; m_Thief.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found " + envelope.NoteItem + "."); m_Thief.SendSound(0x3D); envelope.InvalidateProperties(); Pilfer = false; } } } if (Pilfer) { if (coffer.CofferGold < 1) { m_Thief.SendMessage("There seems to be no gold in the coffer."); } else if (m_Thief.CheckSkill(SkillName.Stealing, 0, 100)) { m_Thief.SendMessage("You slip out " + coffer.CofferGold + " gold from the coffer."); m_Thief.SendSound(0x2E6); m_Thief.AddToBackpack(new Gold(coffer.CofferGold)); Titles.AwardFame(m_Thief, (coffer.CofferGold * 2), true); Titles.AwardKarma(m_Thief, -(coffer.CofferGold * 2), true); coffer.CofferRobbed = 1; coffer.CofferRobber = m_Thief.Name + " the " + Server.Misc.GetPlayerInfo.GetSkillTitle(m_Thief); coffer.CofferGold = 0; LoggingFunctions.LogStandard(m_Thief, "has stolen " + coffer.CofferGold + " gold from a " + coffer.CofferType + " in " + Server.Misc.Worlds.GetRegionName(m_Thief.Map, m_Thief.Location) + ""); } else { m_Thief.SendMessage("You fingers slip, causing you to get noticed!"); m_Thief.RevealingAction(); // REVEALING ONLY WHEN FAILED if (!m_Thief.CheckSkill(SkillName.Snooping, 0, 150)) { List <Mobile> spotters = new List <Mobile>(); foreach (Mobile m in m_Thief.GetMobilesInRange(10)) { if (m is BaseVendor && m.CanSee(m_Thief) && m.InLOS(m_Thief)) { m_Thief.CriminalAction(false); m.PublicOverheadMessage(MessageType.Regular, 0, false, string.Format("Stop! Thief!")); } } } } } } else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable) { m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers. } else if (root is PlayerVendor || root is PlayerBarkeeper) { m_Thief.SendLocalizedMessage(502709); // You can't steal from vendors. } else if (!m_Thief.CanSee(toSteal)) { m_Thief.SendLocalizedMessage(500237); // Target can not be seen. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true)) { m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else. } else if (si == null && (toSteal.Parent == null || !toSteal.Movable)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (Core.AOS && si == null && toSteal is Container) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0) { m_Thief.SendLocalizedMessage(1060025, "", 0x66D); // You're not skilled enough to attempt the theft of this item. } else if (toSteal.Parent is Mobile) { m_Thief.SendLocalizedMessage(1005585); // You cannot steal items which are equipped. } else if (root == m_Thief) { m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed. } else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root)) { } else if (root is Corpse) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else { double w = toSteal.Weight + toSteal.TotalWeight; if (w > 10) { m_Thief.SendMessage("That is too heavy to steal."); } else { if (toSteal.Stackable && toSteal.Amount > 1) { int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight); if (maxAmount < 1) { maxAmount = 1; } else if (maxAmount > toSteal.Amount) { maxAmount = toSteal.Amount; } int amount = Utility.RandomMinMax(1, maxAmount); if (amount >= toSteal.Amount) { int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = toSteal; } } else { int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount); if (stolen == null) { stolen = toSteal; } } } } else { int iw = (int)Math.Ceiling(w); iw *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5)) { stolen = toSteal; } } if (stolen != null) { m_Thief.SendLocalizedMessage(502724); // You successfully steal the item. Titles.AwardKarma(m_Thief, -1000, true); if (si != null) { toSteal.Movable = true; si.Item = null; } } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. m_Thief.RevealingAction(); // REVEALING ONLY WHEN FAILED } caught = (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150)); } } return(stolen); }
public static string FilterText(Mobile m, string s) { try{ string filter = ""; string subOne = ""; string subTwo = ""; string subThree = ""; int index = 0; for (int i = 0; i < ChatInfo.Filters.Count; ++i) { filter = ChatInfo.Filters[i].ToString(); if (filter == "") { ChatInfo.Filters.Remove(filter); continue; } index = s.ToLower().IndexOf(filter); if (index >= 0) { if (m.AccessLevel == AccessLevel.Player) { if (!ChatInfo.NoFilterPenalty) { m.SendMessage(ChatInfo.GetInfo(m).SystemColor, "Filter violation detected: " + filter); } if (ChatInfo.FilterBan) { ChatInfo.GetInfo(m).Ban(ChatInfo.FilterBanLength); } else if (ChatInfo.FilterKick) { m.Say("I've been kicked!"); if (m.NetState != null) { m.NetState.Dispose(); } } else if (ChatInfo.FilterCriminal) { m.CriminalAction(false); } if (!ChatInfo.NoFilterPenalty) { return(""); } } subOne = s.Substring(0, index); subTwo = ""; for (int ii = 0; ii < filter.Length; ++ii) { subTwo += "*"; } subThree = s.Substring(index + filter.Length, s.Length - filter.Length - index); s = subOne + subTwo + subThree; i--; } } }catch { Errors.Report(String.Format("Filter-> FilterText-> |{0}|", m)); } return(s); }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolen = null; object root = null; bool caught = false; if (target is Item) { root = ((Item)target).RootParent; stolen = TryStealItem((Item)target, ref caught); } else if (target is Mobile) { var bc = target as BaseCreature; root = target; if (bc != null && from is PlayerMobile) { if (bc.Controlled || bc.Summoned) { from.SendLocalizedMessage(502708); //You can't steal from this. } if (bc.HasBeenStolen) { from.SendLocalizedMessage(1094948); //That creature has already been stolen from. There is nothing left to steal. } else { from.SendLocalizedMessage(1010579); // You reach into the backpack... and try to take something. Engines.CreatureStealing.StealingHandler.HandleSteal(bc, (PlayerMobile)from, ref stolen); if (stolen == null) { if (!bc.StealPackGenerated) { bc.GenerateLoot(LootStage.Stolen); } StealRandom((Mobile)target, ref caught, ref stolen); } } } else { from.SendLocalizedMessage(1010579); // You reach into the backpack... and try to take something. StealRandom((Mobile)target, ref caught, ref stolen); } } else { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } if (stolen != null) { if (stolen is AddonComponent) { BaseAddon addon = ((AddonComponent)stolen).Addon; from.AddToBackpack(addon.Deed); addon.Delete(); } else { from.AddToBackpack(stolen); } if (!(stolen is Container || stolen.Stackable)) { // do not return stolen containers or stackable items StolenItem.Add(stolen, m_Thief, root as Mobile); } if (target is BaseCreature) { ((BaseCreature)target).HasBeenStolen = true; } } if (caught) { if (root == null) { m_Thief.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot)) { m_Thief.CriminalAction(false); } string message = String.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name); foreach (NetState ns in m_Thief.GetClientsInRange(8)) { if (ns.Mobile != m_Thief) { ns.Mobile.SendMessage(message); } } } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } if (root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild((Mobile)root)) { PlayerMobile pm = (PlayerMobile)m_Thief; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } }
public void Carve(Mobile from, Item item) { if (IsCriminalAction(from) && this.Map != null && (this.Map.Rules & MapRules.HarmfulRestrictions) != 0) { if (m_Owner == null || !m_Owner.Player) { from.SendLocalizedMessage(1005035); // You did not earn the right to loot this creature! } else { from.SendLocalizedMessage(1010049); // You may not loot this corpse. } return; } Mobile dead = m_Owner; if (GetFlag(CorpseFlag.Carved) || dead == null) { from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse. } else if (((Body)Amount).IsHuman && ItemID == 0x2006) { new Blood(0x122D).MoveToWorld(Location, Map); new Torso().MoveToWorld(Location, Map); new LeftLeg().MoveToWorld(Location, Map); new LeftArm().MoveToWorld(Location, Map); new RightLeg().MoveToWorld(Location, Map); new RightArm().MoveToWorld(Location, Map); // new Head( dead.Name ).MoveToWorld( Location, Map ); if (dead is PlayerMobile) { string name = String.Format("the head of {0}", dead.Name); new BountyHead(name, m_Owner, m_Killer, m_TimeOfDeath).MoveToWorld(Location, Map); } else { new Head(dead.Name).MoveToWorld(Location, Map); } SetFlag(CorpseFlag.Carved, true); ProcessDelta(); SendRemovePacket(); ItemID = Utility.Random(0xECA, 9); // bone graphic Hue = 0; ProcessDelta(); if (IsCriminalAction(from)) { from.CriminalAction(true); } } else if (dead is BaseCreature) { ((BaseCreature)dead).OnCarve(from, this, item); } else { from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse. } }
public void Carve(Mobile from, Item item) { if (IsCriminalAction(from) && this.Map != null && (this.Map.Rules & MapRules.HarmfulRestrictions) != 0) { if (m_Owner == null || !m_Owner.Player) { from.SendLocalizedMessage(1005035); // You did not earn the right to loot this creature! } else { from.SendLocalizedMessage(1010049); // You may not loot this corpse. } return; } Mobile dead = m_Owner; string world = Server.Misc.Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y); bool HumanLands = false; if (world == "the Bottle World of Kuldar" || world == "the Land of Sosaria") { HumanLands = true; } if (GetFlag(CorpseFlag.Carved) || dead == null) { from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse. } else if (((Body)Amount).IsHuman && ItemID == 0x2006 && ( // DON'T WANT TO CARVE ORKS AND ELVES dead is EvilMage || dead is EvilMageLord || dead is Brigand || dead is Executioner || dead is Savage || dead is SavageRider || dead is Bandit || dead is Mangar || dead is ZuluuNative || dead is ZuluuArcher || dead is NativeWitchDoctor || dead is NativeArcher || dead is Native || dead is Rogue || dead is ZuluuWitchDoctor || dead is PirateLand || dead is PirateCrew || dead is Monks || dead is PirateCaptain || dead is EvilSailorArcher || dead is EvilSailorWizard || dead is Minstrel || dead is EvilSailorMinstrel || dead is SailorArcher || dead is SailorWizard || dead is Berserker || dead is SailorMinstrel || dead is BlackKnight || dead is BloodAssassin || dead is Archmage || dead is BombWorshipper || dead is Psionicist || dead is SavageAlien || (HumanLands == true && dead is BaseVendor) || (HumanLands == true && dead is BaseHealer) || (HumanLands == true && dead is BasePerson) )) { new Blood(0x122D).MoveToWorld(Location, Map); Corpse bodyBag = (Corpse)this; bodyBag.AddCarvedItem(new Torso(), from); bodyBag.AddCarvedItem(new LeftLeg(), from); bodyBag.AddCarvedItem(new LeftArm(), from); bodyBag.AddCarvedItem(new RightLeg(), from); bodyBag.AddCarvedItem(new RightArm(), from); bodyBag.AddCarvedItem(new TastyHeart(dead.Name), from); string myWork = ""; bool CriminalCarve = true; if (m_CorpseName != null && m_CorpseName != "") { if (m_CorpseName.Contains(" the assassin")) { myWork = "Assassin"; dead.Name = (dead.Name).Replace(" the assassin", ""); CriminalCarve = false; } else if (m_CorpseName.Contains(" the thief")) { myWork = "Thief"; dead.Name = (dead.Name).Replace(" the thief", ""); CriminalCarve = false; } else if (m_CorpseName.Contains(" the pirate")) { myWork = "Pirate"; dead.Name = (dead.Name).Replace(" the pirate", ""); CriminalCarve = false; } else if (m_CorpseName.Contains(" the bandit")) { myWork = "Bandit"; dead.Name = (dead.Name).Replace(" the bandit", ""); CriminalCarve = false; } else if (m_CorpseName.Contains(" the brigand")) { myWork = "Brigand"; dead.Name = (dead.Name).Replace(" the brigand", ""); CriminalCarve = false; } } if (CriminalCarve == true) { if (IsCriminalAction(from)) { from.CriminalAction(true); } Misc.Titles.AwardKarma(from, -50, true); } Head head = new Head(dead.Name); if (myWork != "") { head.m_Job = myWork; } bodyBag.AddCarvedItem(head, from); SetFlag(CorpseFlag.Carved, true); ProcessDelta(); SendRemovePacket(); ItemID = Utility.Random(0xECA, 9); // bone graphic Hue = 0; ProcessDelta(); } else if ( dead is ElfEvilSailorMinstrel || dead is ElfEvilSailorArcher || dead is ElfEvilSailorWizard || dead is ElfPirateCaptain || dead is ElfPirateCrew || dead is OrkRogue || dead is ElfRogue ) { string myWork = ""; if (m_CorpseName != null && m_CorpseName != "") { if (m_CorpseName.Contains(" the assassin")) { myWork = "Assassin"; dead.Name = (dead.Name).Replace(" the assassin", ""); } else if (m_CorpseName.Contains(" the thief")) { myWork = "Thief"; dead.Name = (dead.Name).Replace(" the thief", ""); } else if (m_CorpseName.Contains(" the pirate")) { myWork = "Pirate"; dead.Name = (dead.Name).Replace(" the pirate", ""); } else if (m_CorpseName.Contains(" the bandit")) { myWork = "Bandit"; dead.Name = (dead.Name).Replace(" the bandit", ""); } else if (m_CorpseName.Contains(" the brigand")) { myWork = "Brigand"; dead.Name = (dead.Name).Replace(" the brigand", ""); } } if (myWork != "") // ONLY ADD A HEAD FOR ORKS AND ELVES...ROGUES & PIRATES { Head head = new Head(dead.Name); head.Hue = dead.Hue; if (myWork != "") { head.m_Job = myWork; } Corpse bodyBag = (Corpse)this; bodyBag.AddCarvedItem(head, from); } ((BaseCreature)dead).OnCarve(from, this, item); } else if (dead is BaseCreature) { ((BaseCreature)dead).OnCarve(from, this, item); } else { from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse. } }
public void Carve(Mobile from, Item item) { if (IsCriminalAction(from) && this.Map != null && (this.Map.Rules & MapRules.HarmfulRestrictions) != 0) { if (m_Owner == null || !m_Owner.Player) { from.SendLocalizedMessage(1005035); // You did not earn the right to loot this creature! } else { from.SendLocalizedMessage(1010049); // You may not loot this corpse. } return; } Mobile dead = m_Owner; if (m_Carved || dead == null) { from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse. } else if (((Body)Amount).IsHuman && ItemID == 0x2006) { new Blood(0x122D).MoveToWorld(Location, Map); new Torso().MoveToWorld(Location, Map); new LeftLeg().MoveToWorld(Location, Map); new LeftArm().MoveToWorld(Location, Map); new RightLeg().MoveToWorld(Location, Map); new RightArm().MoveToWorld(Location, Map); Head head = new Head(HeadType.Regular, dead); PlayerMobile pm_Dead = dead as PlayerMobile; if (pm_Dead != null) { if (pm_Dead.Murderer) { head.PlayerType = PlayerType.Murderer; } if (pm_Dead.LastPlayerKilledBy != null) { head.Killer = pm_Dead.LastPlayerKilledBy; head.KillerName = pm_Dead.LastPlayerKilledBy.RawName; if (pm_Dead.LastPlayerKilledBy.Murderer) { head.KillerType = PlayerType.Murderer; } else { head.KillerType = PlayerType.None; } } } head.MoveToWorld(Location, Map); m_Carved = true; ProcessDelta(); SendRemovePacket(); ItemID = Utility.Random(0xECA, 9); // bone graphic Hue = 0; ProcessDelta(); if (IsCriminalAction(from)) { from.CriminalAction(true); } } else if (dead is BaseCreature) { ((BaseCreature)dead).OnCarve(from, this); } else { from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse. } }
public virtual void OnCarve( Mobile from, Corpse corpse, bool butcher ) { int feathers = Feathers; int wool = Wool; int meat = Meat; int hides = Hides; int scales = Scales; int blood = Blood; int fur = Fur; if ( ( feathers == 0 && wool == 0 && meat == 0 && hides == 0 && scales == 0 && blood == 0 && fur == 0 ) || Summoned || IsBonded ) { from.SendLocalizedMessage( 500485 ); // You see nothing useful to carve from the corpse. } else { if ( from.Race == Race.Human ) hides = (int) Math.Ceiling( hides * 1.1 ); // 10% Bonus Only applies to Hides, Ore & Logs if ( corpse.Map == Map.Felucca ) { feathers *= 2; wool *= 2; meat *= 2; hides *= 2; scales *= 2; blood *= 2; fur *= 2; } new Blood( 0x122D ).MoveToWorld( corpse.Location, corpse.Map ); if ( feathers != 0 ) { corpse.AddCarvedItem( new Feather( feathers ), from ); from.SendLocalizedMessage( 500479 ); // You pluck the bird. The feathers are now on the corpse. } if ( wool != 0 ) { corpse.AddCarvedItem( new Wool( wool ), from ); from.SendLocalizedMessage( 500483 ); // You shear it, and the wool is now on the corpse. } if ( meat != 0 ) { if ( MeatType == MeatType.Ribs ) corpse.AddCarvedItem( new RawRibs( meat ), from ); else if ( MeatType == MeatType.Bird ) corpse.AddCarvedItem( new RawBird( meat ), from ); else if ( MeatType == MeatType.LambLeg ) corpse.AddCarvedItem( new RawLambLeg( meat ), from ); else if ( MeatType == MeatType.Rotworm ) corpse.AddCarvedItem( new RawRotwormMeat( meat ), from ); from.SendLocalizedMessage( 500467 ); // You carve some meat, which remains on the corpse. } if ( hides != 0 ) { if ( butcher ) { Item item = null; if ( HideType == HideType.Regular ) item = new Leather( hides ); else if ( HideType == HideType.Spined ) item = new SpinedLeather( hides ); else if ( HideType == HideType.Horned ) item = new HornedLeather( hides ); else if ( HideType == HideType.Barbed ) item = new BarbedLeather( hides ); if ( item != null ) { if ( from.AddToBackpack( item ) ) { from.SendLocalizedMessage( 1073555 ); // You skin it and place the cut-up hides in your backpack. } else { corpse.AddCarvedItem( item, from ); from.SendLocalizedMessage( 500471 ); // You skin it, and the hides are now in the corpse. } } } else { if ( HideType == HideType.Regular ) corpse.AddCarvedItem( new Hides( hides ), from ); else if ( HideType == HideType.Spined ) corpse.AddCarvedItem( new SpinedHides( hides ), from ); else if ( HideType == HideType.Horned ) corpse.AddCarvedItem( new HornedHides( hides ), from ); else if ( HideType == HideType.Barbed ) corpse.AddCarvedItem( new BarbedHides( hides ), from ); from.SendLocalizedMessage( 500471 ); // You skin it, and the hides are now in the corpse. } } if ( scales != 0 ) { ScaleType sc = this.ScaleType; switch ( sc ) { case ScaleType.Red: corpse.AddCarvedItem( new RedScales( scales ), from ); break; case ScaleType.Yellow: corpse.AddCarvedItem( new YellowScales( scales ), from ); break; case ScaleType.Black: corpse.AddCarvedItem( new BlackScales( scales ), from ); break; case ScaleType.Green: corpse.AddCarvedItem( new GreenScales( scales ), from ); break; case ScaleType.White: corpse.AddCarvedItem( new WhiteScales( scales ), from ); break; case ScaleType.Blue: corpse.AddCarvedItem( new BlueScales( scales ), from ); break; case ScaleType.All: { corpse.AddCarvedItem( new RedScales( scales ), from ); corpse.AddCarvedItem( new YellowScales( scales ), from ); corpse.AddCarvedItem( new BlackScales( scales ), from ); corpse.AddCarvedItem( new GreenScales( scales ), from ); corpse.AddCarvedItem( new WhiteScales( scales ), from ); corpse.AddCarvedItem( new BlueScales( scales ), from ); break; } } from.SendLocalizedMessage( 1079284 ); // You cut away some scales, but they remain on the corpse. } if ( blood != 0 ) { corpse.AddCarvedItem( new DragonsBlood( blood ), from ); from.SendLocalizedMessage( 1094946 ); // Some blood is left on the corpse. } if ( fur != 0 ) { if ( FurType == FurType.Green ) corpse.AddCarvedItem( new GreenFur( fur ), from ); else if ( FurType == FurType.Red ) corpse.AddCarvedItem( new RedFur( fur ), from ); else if ( FurType == FurType.Yellow ) corpse.AddCarvedItem( new YellowFur( fur ), from ); else if ( FurType == FurType.DarkGreen ) corpse.AddCarvedItem( new DarkGreenFur( fur ), from ); from.SendLocalizedMessage( 1112765 ); // You shear it, and the fur is now on the corpse. } corpse.Carved = true; if ( corpse.IsCriminalAction( from ) ) from.CriminalAction( true ); } }
public override void OnItemLifted(Mobile from, Item item) { base.OnItemLifted(from, item); if (item != this && from != m_Owner) { from.RevealingAction(); } if (item != this && IsCriminalAction(from)) { from.CriminalAction(true); } if (from.AccessLevel == AccessLevel.Player && !m_Looters.Contains(from)) { m_Looters.Add(from); } //Ocean Creature Advanced Decay Rate LandTile landTile = this.Map.Tiles.GetLandTile(this.X, this.Y); StaticTile[] tiles = this.Map.Tiles.GetStaticTiles(this.X, this.Y, true); bool landHasWater = false; bool staticHasWater = false; if ((landTile.ID >= 168 && landTile.ID <= 171) || (landTile.ID >= 310 && landTile.ID <= 311)) { landHasWater = true; } for (int i = 0; i < tiles.Length; ++i) { StaticTile tile = tiles[i]; bool isWater = (tile.ID >= 0x1796 && tile.ID <= 0x17B2); if (isWater) { staticHasWater = true; } } //Last Item Lifted if ((landHasWater || staticHasWater) && this.TotalItems <= 1) { if (m_DecayTimer != null) { m_DecayTimer.Stop(); } //Empty PlayerMobile is 30 Seconds Decay if (this.Owner is PlayerMobile) { BeginDecay(TimeSpan.FromSeconds(30)); } //Empty Creature is 10 Seconds Decay else { BeginDecay(TimeSpan.FromSeconds(10)); } } }
public override void OnItemUsed( Mobile from, Item item ) { base.OnItemUsed( from, item ); if ( item is Food ) from.RevealingAction(); if ( item != this && IsCriminalAction( from ) ) from.CriminalAction( true ); if ( !m_Looters.Contains( from ) ) m_Looters.Add( from ); if ( m_InstancedItems != null && m_InstancedItems.ContainsKey( item ) ) m_InstancedItems.Remove( item ); }
protected override void OnTarget(Mobile from, object targeted) { //reset from's swingtimer BaseWeapon weapon = from.Weapon as BaseWeapon; if (weapon != null) { from.NextCombatTime = DateTime.Now + weapon.GetDelay(from); } if (m_Potion.Deleted || m_Potion.Map == Map.Internal) { return; } IPoint3D p = targeted as IPoint3D; if (p == null) { return; } Map map = from.Map; if (map == null) { return; } SpellHelper.GetSurfaceTop(ref p); // erl: 04/27/05, spawn mobile check at target location if (!map.CanSpawnMobile(p.X, p.Y, p.Z) && !(p is Mobile)) { from.SendLocalizedMessage(501942); // That location is blocked. return; } // adam: add target 'under house' exploit check if (!from.CanSee(p) || (p is Server.Targeting.LandTarget && Server.Multis.BaseHouse.FindHouseAt(((Server.Targeting.LandTarget)(p)).Location, from.Map, 16) != null)) { from.SendLocalizedMessage(500237); // Target can not be seen. return; } // reveal on throw from.RevealingAction(); // adam: criminal action on throw if (m_Potion.InTown(from)) { from.CriminalAction(true); } IEntity to; bool bMobile = CoreAI.ExplosionPotionTargetMethod == CoreAI.EPTM.MobileBased; // IN TOWN // if we're in town and the town uses smart guards, and a guard is on us and they have hit us at least once, ... if (m_Potion.InTown(from) && (from.Region as Regions.GuardedRegion).IsSmartGuards && from.Hits < from.HitsMax && m_Potion.IsGuardAttacking(from)) { if (m_Potion.ChanceBasedOnAbility(from) >= Utility.RandomDouble()) { // cool, just throw as per normal to = new Entity(Serial.Zero, new Point3D(p), map); Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0); m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, to, map }); } else { switch (Utility.Random(3)) { case 0: // You fumble and drop the potion to your feet. m_Potion.SetFlag(PotFlags.Dud1pt); // minimize collateral damage from.SendMessage("You fumble and drop the potion to your feet."); to = from; Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0); m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, to, map }); break; case 1: // The guard blocks you and the potion remains in your backpack! from.SendMessage("The guard blocks you and the potion remains in your backpack!"); break; case 2: // You attempt to toss the potion, but the guard bats it away. m_Potion.SetFlag(PotFlags.Dud1pt); // minimize collateral damage from.SendMessage("You attempt to toss the potion, but the guard bats it away."); to = new Entity(Serial.Zero, Server.Mobiles.Spawner.GetSpawnPosition(from.Map, from.Location, 7, false, m_Potion), map); Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0); m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, to, map }); break; } } } // OUT ON THE FIELD // Adam: You must be in top condition to target the player directly //if( bMobile && (from.Stam >= from.StamMax) && (from.Hits >= from.HitsMax) ) else if (bMobile && m_Potion.CheckHealth(from.Stam, from.StamMax, CoreAI.ExplosionPotionThreshold) && m_Potion.CheckHealth(from.Hits, from.HitsMax, CoreAI.ExplosionPotionThreshold)) { if (p is Mobile) { to = (Mobile)p; } else { to = new Entity(Serial.Zero, new Point3D(p), map); } Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0); m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, p, map }); } else { to = new Entity(Serial.Zero, new Point3D(p), map); Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0); m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, to, map }); } }
public void Carve(Mobile from, Item item) { if (this.IsCriminalAction(from) && this.Map != null && (this.Map.Rules & MapRules.HarmfulRestrictions) != 0) { if (this.m_Owner == null || !this.m_Owner.Player) from.SendLocalizedMessage(1005035); // You did not earn the right to loot this creature! else from.SendLocalizedMessage(1010049); // You may not loot this corpse. return; } Mobile dead = this.m_Owner; if (this.GetFlag(CorpseFlag.Carved) || dead == null) { from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse. } else if (((Body)this.Amount).IsHuman && this.ItemID == 0x2006) { new Blood(0x122D).MoveToWorld(this.Location, this.Map); new Torso().MoveToWorld(this.Location, this.Map); new LeftLeg().MoveToWorld(this.Location, this.Map); new LeftArm().MoveToWorld(this.Location, this.Map); new RightLeg().MoveToWorld(this.Location, this.Map); new RightArm().MoveToWorld(this.Location, this.Map); new Head(dead.Name).MoveToWorld(this.Location, this.Map); this.SetFlag(CorpseFlag.Carved, true); this.ProcessDelta(); this.SendRemovePacket(); this.ItemID = Utility.Random(0xECA, 9); // bone graphic this.Hue = 0; this.ProcessDelta(); if (this.IsCriminalAction(from)) from.CriminalAction(true); } else if (dead is BaseCreature) { ((BaseCreature)dead).OnCarve(from, this, item); } else { from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse. } }
public void Carve( Mobile from, Item item ) { if (IsCriminalAction(from) && this.Map != null && (this.Map.Rules & MapRules.HarmfulRestrictions) != 0) { if (m_Owner == null || !m_Owner.Player) from.SendLocalizedMessage(1005035); // You did not earn the right to loot this creature! else from.SendLocalizedMessage(1010049); // You may not loot this corpse. return; } //Taran: Had to add this or you could carve corpses with an axe without range or los checks //Couldn't find the range/los checks for daggers, they should be removed. if (!from.InRange(GetWorldLocation(), 3) || !from.InLOS(this)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. return; } if (from.Region is CustomRegion && !((CustomRegion)from.Region).Controller.CanCutCorpse) { from.SendAsciiMessage("You can't cut corpses here."); return; } Mobile dead = m_Owner; if (GetFlag(CorpseFlag.Carved) || dead == null) { from.SendLocalizedMessage( 500485 ); // You see nothing useful to carve from the corpse. } else if ( ((Body)Amount).IsHuman && (ItemID == 0x2006 || dead is PlayerMobile) ) { if (from.Mounted) from.Animate(28, 5, 1, true, false, 1); else from.Animate(32, 5, 1, true, false, 1); from.PublicOverheadMessage(MessageType.Regular, 906, true, "*Chop Chop*"); if (IsCriminalAction(from)) from.CriminalAction(true); new Blood(0x122D).MoveToWorld(Location, Map); Head head = new Head {Name = string.Format("head of {0}", dead.Name), PlayerName = Owner.Name, Owner = dead, Fame = (int)(dead.Fame / 0.9)}; head.MoveToWorld(Location, Map); Heart heart = new Heart {Name = string.Format("heart of {0}", dead.Name), Owner = dead}; heart.MoveToWorld(Location, Map); LeftLeg ll = new LeftLeg {Name = string.Format("leg of {0}", dead.Name), Owner = dead}; ll.MoveToWorld(Location, Map); LeftArm la = new LeftArm {Name = string.Format("arm of {0}", dead.Name), Owner = dead}; la.MoveToWorld(Location, Map); RightLeg rl = new RightLeg {Name = string.Format("leg of {0}", dead.Name), Owner = dead}; rl.MoveToWorld(Location, Map); RightArm ra = new RightArm {Name = string.Format("arm of {0}", dead.Name), Owner = dead}; ra.MoveToWorld(Location, Map); //bounty system here if (m_Killer is PlayerMobile) { head.Owner = m_Owner; head.Killer = m_Killer; head.CreationTime = DateTime.Now; head.IsPlayer = true; } //end bounty sytem new RawRibs(2).MoveToWorld(Location, Map); SetFlag(CorpseFlag.Carved, true); ProcessDelta(); SendRemovePacket(); ItemID = Utility.Random(0xECA, 9); // bone graphic Hue = 0; ProcessDelta(); } else if ( dead is BaseCreature ) { ((BaseCreature)dead).OnCarve(from, this, item); } else { from.SendLocalizedMessage( 500485 ); // You see nothing useful to carve from the corpse. } }
public virtual void OnCarve( Mobile from, Corpse corpse, Item with ) { int feathers = Feathers; int wool = Wool; int meat = Meat; int hides = Hides; int scales = Scales; if ( (feathers == 0 && wool == 0 && meat == 0 && hides == 0 && scales == 0) || Summoned || IsBonded || corpse.Animated ) { if ( corpse.Animated ) corpse.SendLocalizedMessageTo( from, 500464 ); // Use this on corpses to carve away meat and hide else from.SendLocalizedMessage( 500485 ); // You see nothing useful to carve from the corpse. } else { if( Core.ML && from.Race == Race.Human ) { hides = (int)Math.Ceiling( hides * 1.1 ); //10% Bonus Only applies to Hides, Ore & Logs } if ( corpse.Map == Map.Felucca ) { feathers *= 2; wool *= 2; hides *= 2; if (Core.ML) { meat *= 2; scales *= 2; } } new Blood( 0x122D ).MoveToWorld( corpse.Location, corpse.Map ); if ( feathers != 0 ) { corpse.AddCarvedItem( new Feather( feathers ), from ); from.SendLocalizedMessage( 500479 ); // You pluck the bird. The feathers are now on the corpse. } if ( wool != 0 ) { corpse.AddCarvedItem( new TaintedWool( wool ), from ); from.SendLocalizedMessage( 500483 ); // You shear it, and the wool is now on the corpse. } if ( meat != 0 ) { if ( MeatType == MeatType.Ribs ) corpse.AddCarvedItem( new RawRibs( meat ), from ); else if ( MeatType == MeatType.Bird ) corpse.AddCarvedItem( new RawBird( meat ), from ); else if ( MeatType == MeatType.LambLeg ) corpse.AddCarvedItem( new RawLambLeg( meat ), from ); from.SendLocalizedMessage( 500467 ); // You carve some meat, which remains on the corpse. } if ( hides != 0 ) { Item holding = from.Weapon as Item; if ( Core.AOS && ( holding is SkinningKnife /* TODO: || holding is ButcherWarCleaver || with is ButcherWarCleaver */ ) ) { Item leather = null; switch ( HideType ) { case HideType.Regular: leather = new Leather( hides ); break; case HideType.Spined: leather = new SpinedLeather( hides ); break; case HideType.Horned: leather = new HornedLeather( hides ); break; case HideType.Barbed: leather = new BarbedLeather( hides ); break; } if ( leather != null ) { if ( !from.PlaceInBackpack( leather ) ) { corpse.DropItem( leather ); from.SendLocalizedMessage( 500471 ); // You skin it, and the hides are now in the corpse. } else from.SendLocalizedMessage( 1073555 ); // You skin it and place the cut-up hides in your backpack. } } else { if ( HideType == HideType.Regular ) corpse.DropItem( new Hides( hides ) ); else if ( HideType == HideType.Spined ) corpse.DropItem( new SpinedHides( hides ) ); else if ( HideType == HideType.Horned ) corpse.DropItem( new HornedHides( hides ) ); else if ( HideType == HideType.Barbed ) corpse.DropItem( new BarbedHides( hides ) ); from.SendLocalizedMessage( 500471 ); // You skin it, and the hides are now in the corpse. } } if ( scales != 0 ) { ScaleType sc = this.ScaleType; switch ( sc ) { case ScaleType.Red: corpse.AddCarvedItem( new RedScales( scales ), from ); break; case ScaleType.Yellow: corpse.AddCarvedItem( new YellowScales( scales ), from ); break; case ScaleType.Black: corpse.AddCarvedItem( new BlackScales( scales ), from ); break; case ScaleType.Green: corpse.AddCarvedItem( new GreenScales( scales ), from ); break; case ScaleType.White: corpse.AddCarvedItem( new WhiteScales( scales ), from ); break; case ScaleType.Blue: corpse.AddCarvedItem( new BlueScales( scales ), from ); break; case ScaleType.All: { corpse.AddCarvedItem( new RedScales( scales ), from ); corpse.AddCarvedItem( new YellowScales( scales ), from ); corpse.AddCarvedItem( new BlackScales( scales ), from ); corpse.AddCarvedItem( new GreenScales( scales ), from ); corpse.AddCarvedItem( new WhiteScales( scales ), from ); corpse.AddCarvedItem( new BlueScales( scales ), from ); break; } } from.SendMessage( "You cut away some scales, but they remain on the corpse." ); } corpse.Carved = true; if ( corpse.IsCriminalAction( from ) ) from.CriminalAction( true ); } }
public override void OnItemLifted( Mobile from, Item item ) { base.OnItemLifted( from, item ); //if ( item != this && from != m_Owner ) // from.RevealingAction(); if ( item != this && IsCriminalAction( from ) ) from.CriminalAction( true ); if ( !m_Looters.Contains( from ) ) m_Looters.Add( from ); if (m_InstancedItems != null && m_InstancedItems.ContainsKey(item)) m_InstancedItems.Remove(item); //Taran: Corpse is in water if ( InDeepWater ) { //start sink timer after last item is looted if (TotalItems == 1) new SinkTimer(this).Start(); } }
public void Chop( Mobile from ) { if ( from.InRange( this.GetWorldLocation(), 1 ) ) { if ( ( chopTimer == null ) || ( !chopTimer.Running ) ) { if ( ( TreeHelper.TreeOrdinance ) && ( from.AccessLevel == AccessLevel.Player ) ) { if ( from.Region is Regions.GuardedRegion ) from.CriminalAction( true ); } chopTimer = new TreeHelper.ChopAction( from ); Point3D pnt = this.Location; Map map = this.Map; from.Direction = from.GetDirectionTo( this ); chopTimer.Start(); double lumberValue = from.Skills[SkillName.Lumberjacking].Value / 100; if ( ( lumberValue > .5 ) && ( Utility.RandomDouble() <= lumberValue ) ) { Blueberries fruit = new Blueberries( (int)Utility.Random( 13 ) + m_yield ); from.AddToBackpack( fruit ); int cnt = Utility.Random( (int)( lumberValue * 10 ) + 1 ); Log logs = new Log( cnt ); // Fruitwood Logs ?? from.AddToBackpack( logs ); FruitTreeStump i_stump = new FruitTreeStump( typeof( BlueberryTree ) ); Timer poof = new StumpTimer( this, i_stump, from ); poof.Start(); } else from.SendLocalizedMessage( 500495 ); // You hack at the tree for a while, but fail to produce any useable wood. //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", lumberValue )); } } else from.SendLocalizedMessage( 500446 ); // That is too far away. }
public void DoFireEffect(IPoint3D target, Mobile from) { Map map = Map; if (target == null || map == null) { return; } var startloc = new Point3D(Location); IPoint3D point = target; switch (Facing) { case 3: { Effects.SendLocationEffect(new Point3D(X, Y + 1, Z - 2), map, Utility.RandomList(0x3728), 16, 1); break; } case 1: { Effects.SendLocationEffect(new Point3D(X, Y - 1, Z - 2), map, Utility.RandomList(0x3728), 16, 1); break; } case 2: { Effects.SendLocationEffect(new Point3D(X + 1, Y, Z - 2), map, Utility.RandomList(0x3728), 16, 1); break; } case 0: { Effects.SendLocationEffect(new Point3D(X - 1, Y + 1, Z - 2), map, Utility.RandomList(0x3728), 16, 1); break; } } Effects.PlaySound(target, map, Utility.RandomList(0x11B, 0x11C, 0x11D)); var queue = new EffectQueue(); queue.Deferred = false; queue.Add( new MovingEffectInfo( startloc, point, Map, m_Projectile.AnimationID, m_Projectile.AnimationHue > 0 ? m_Projectile.AnimationHue-1 : 0, 10, EffectRender.Normal, TimeSpan.FromSeconds(0.1), () => { if (Projectile.ShipDamage > 0) { for (int count = 8; count > 0; count--) { IPoint3D location = new Point3D(target.X + Utility.RandomMinMax(-1, 1), target.Y + Utility.RandomMinMax(-1, 1), target.Z); int effect = Utility.RandomList(0x36B0); Effects.SendLocationEffect(location, map, effect, 25, 1); Effects.PlaySound(target, map, Utility.RandomList(0x11B, 0x11C, 0x11D)); } } foreach (Mobile mob in AcquireAllTargets(new Point3D(point), Projectile.DamageRange)) { if (from.CanBeHarmful(mob)) { mob.Damage(Projectile.PlayerDamage, from); if (from.IsHarmfulCriminal(mob) && !from.Criminal) from.CriminalAction(true); else if (from.IsHarmfulCriminal(mob)) from.CriminalAction(false); } } foreach (Item item in from.Map.GetItemsInRange(new Point3D(point), Projectile.DamageRange)) { if (item is MainMast) { var mast = item as MainMast; if (mast.HullDurability < Projectile.ShipDamage) mast.HullDurability = 0; else { mast.HullDurability -= (ushort)Projectile.ShipDamage; } mast.PublicOverheadMessage(MessageType.Label, 61, true, mast.HullDurability + "/" + mast.MaxHullDurability); } if (item is BaseShipWeapon) { var cannon = item as BaseShipWeapon; if (cannon.Durability < Projectile.ShipDamage) cannon.Durability = 0; else { cannon.Durability -= Projectile.ShipDamage; } } if (item is NewBaseBoat) { var boat = item as NewBaseBoat; if (boat.HullDurability < Projectile.ShipDamage) boat.HullDurability = 0; else { boat.HullDurability -= (ushort)Projectile.ShipDamage; } boat.PublicOverheadMessage(MessageType.Label, 61, true, boat.HullDurability + "/" + boat.MaxHullDurability); } } })); queue.Process(); Projectile.Delete(); Projectile = null; this.m_NextFiringTime = DateTime.UtcNow + TimeSpan.FromSeconds(15); }