public void FireCannon(ShipCannon shipCannon, Mobile from, Point3D targetLocation, Map map, bool hit, bool showSmoke) { if (shipCannon == null) { return; } int cannonballItemID = 0xE73; int cannonballHue = 0; int smokeHue = 0; bool fixedDirection = false; double shotDelay = .04; int shotSpeed = 6; Point3D smokeLocation = shipCannon.Location; switch (shipCannon.Facing) { case Direction.North: { } break; case Direction.East: { smokeLocation.X++; } break; case Direction.South: { smokeLocation.Y++; } break; case Direction.West: { smokeLocation.X--; } break; } if (m_Boat != null) { double gunsPercent = (double)((float)m_Boat.GunPoints / (float)m_Boat.MaxGunPoints); double misfireChance = BaseBoat.CannonMaxMisfireChance * (1 - gunsPercent); double chance = Utility.RandomDouble(); double distance = Utility.GetDistanceToSqrt(shipCannon.Location, targetLocation); double flatDistance = Utility.GetDistance(shipCannon.Location, targetLocation); //Misfire if (chance < misfireChance) { List <Mobile> m_MobilesOnBoat = m_Boat.GetMobilesOnBoat(true, true); foreach (Mobile mobile in m_MobilesOnBoat) { if (m_Boat.IsOwner(mobile) || m_Boat.IsCoOwner(mobile) || m_Boat.IsFriend(mobile)) { mobile.SendMessage("Misfire!"); } } Effects.SendLocationEffect(shipCannon.Location, map, 0x3735, 10); Effects.PlaySound(shipCannon.Location, map, 0x475); return; } if (m_Boat.MobileFactionType == MobileFactionType.Undead) { cannonballItemID = Utility.RandomList(6880, 6881, 6882, 6883, 6884); smokeHue = 2630; } //Hit if (hit) { m_Boat.LastCombatTime = DateTime.UtcNow; Effects.PlaySound(shipCannon.Location, map, 0x664); if (showSmoke) { Effects.SendLocationEffect(smokeLocation, map, 0x36CB, 10, smokeHue, 0); } SpellHelper.AdjustField(ref targetLocation, map, 12, false); IEntity startLocation = new Entity(Serial.Zero, new Point3D(shipCannon.Location.X, shipCannon.Location.Y, shipCannon.Location.Z + 10), map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(targetLocation.X, targetLocation.Y, targetLocation.Z + 5), map); Effects.SendMovingEffect(startLocation, endLocation, cannonballItemID, shotSpeed, 0, fixedDirection, false, cannonballHue, 0); double effectDelay = distance * shotDelay; Timer.DelayCall(TimeSpan.FromSeconds(effectDelay), delegate { ResolveCannon(shipCannon, from, targetLocation, map, hit); }); } //Miss else { int xOffset = 0; int yOffset = 0; double effectiveDistance = distance; int distanceOffset = (int)(Math.Floor(effectiveDistance / 2)); if (distance >= 2) { xOffset = Utility.RandomMinMax(0, distanceOffset); if (Utility.RandomDouble() > .5) { xOffset *= -1; } yOffset = Utility.RandomMinMax(0, distanceOffset); if (Utility.RandomDouble() > .5) { yOffset *= -1; } } Effects.PlaySound(shipCannon.Location, map, 0x664); Effects.SendLocationEffect(smokeLocation, map, 0x36CB, 10, smokeHue, 0); IEntity startLocation = new Entity(Serial.Zero, new Point3D(shipCannon.Location.X, shipCannon.Location.Y, shipCannon.Location.Z + 10), map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(targetLocation.X + xOffset, targetLocation.Y + yOffset, targetLocation.Z + 5), map); Effects.SendMovingEffect(startLocation, endLocation, cannonballItemID, shotSpeed, 0, fixedDirection, false, cannonballHue, 0); Point3D splashLocation = new Point3D(targetLocation.X + xOffset, targetLocation.Y + yOffset, +targetLocation.Z); double newDistance = from.GetDistanceToSqrt(splashLocation); double effectDelay = newDistance * shotDelay; Timer.DelayCall(TimeSpan.FromSeconds(effectDelay), delegate { ResolveCannon(shipCannon, from, splashLocation, map, hit); }); } } }
public override Item Construct(Type type, Mobile from, Item _i, HarvestDefinition _d, HarvestBank _b, HarvestResource _r) { if (type == typeof(TreasureMap)) { int level = 1; return(new TreasureMap(level, Map.Felucca)); } else if (type == typeof(MessageInABottle)) { return(new MessageInABottle(Map.Felucca)); } Container pack = from.Backpack; if (pack != null) { List <SOS> messages = pack.FindItemsByType <SOS>(); for (int i = 0; i < messages.Count; ++i) { SOS sos = messages[i]; if (from.Map == sos.TargetMap && from.InRange(sos.TargetLocation, 60) && !sos.Completed) { Item preLoot = null; switch (Utility.Random(7)) { case 0: // Body parts { int[] list = new int[] { 0x1CDD, 0x1CE5, // arm 0x1CE0, 0x1CE8, // torso 0x1CE1, 0x1CE9, // head 0x1CE2, 0x1CEC // leg }; preLoot = new ShipwreckedItem(Utility.RandomList(list)); break; } case 1: // Bone parts { int[] list = new int[] { 0x1AE0, 0x1AE1, 0x1AE2, 0x1AE3, 0x1AE4, // skulls 0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, // bone piles 0x1B15, 0x1B16 // pelvis bones }; preLoot = new ShipwreckedItem(Utility.RandomList(list)); break; } case 2: // Pillows { preLoot = new ShipwreckedItem(Utility.Random(0x13A4, 11)); break; } case 3: // Shells { preLoot = new ShipwreckedItem(Utility.Random(0xFC4, 9)); break; } case 4: //Hats { if (Utility.RandomBool()) { preLoot = new SkullCap(); } else { preLoot = new TricorneHat(); } break; } case 5: // Misc { int[] list = new int[] { 0x1EB5, // unfinished barrel 0xA2A, // stool 0xC1F, // broken clock 0x1EB1, 0x1EB2, 0x1EB3, 0x1EB4 // barrel staves }; if (Utility.Random(list.Length + 1) == 0) { preLoot = new Candelabra(); } else { preLoot = new ShipwreckedItem(Utility.RandomList(list)); } break; } } if (preLoot != null) { if (preLoot is IShipwreckedItem) { ((IShipwreckedItem)preLoot).IsShipwreckedItem = true; } return(preLoot); } LockableContainer chest; if (Utility.RandomBool()) { chest = new MetalGoldenChest(); } else { chest = new WoodenChest(); } if (sos.IsAncient) { chest.Hue = 0x481; } TreasureMapChest.Fill(chest, Math.Max(1, Math.Min(3, (sos.Level + 1)))); if (sos.IsAncient) { chest.DropItem(new FabledFishingNet()); } else { chest.DropItem(new SpecialFishingNet()); } if (Utility.Random(500) == 0) { Item mask = new HornedTribalMask(); mask.Hue = 2715; mask.Name = "Mask of Cthulu"; chest.DropItem(mask); } switch (Utility.Random(300)) { case 0: { Item rustedchest = new PlateChest(); rustedchest.Hue = 2718; rustedchest.Name = "a rusted platemail chest recovered from a shipwreck"; chest.DropItem(rustedchest); break; } case 1: { Item rustedarms = new PlateArms(); rustedarms.Hue = 2718; rustedarms.Name = "rusted platemail arms recovered from a shipwreck"; chest.DropItem(rustedarms); break; } case 2: { Item rustedlegs = new PlateLegs(); rustedlegs.Hue = 2718; rustedlegs.Name = "rusted platemail legguards recovered from a shipwreck"; chest.DropItem(rustedlegs); break; } case 3: { Item rustedgloves = new PlateGloves(); rustedgloves.Hue = 2718; rustedgloves.Name = "rusted platemail gloves recovered from a shipwreck"; chest.DropItem(rustedgloves); break; } case 4: { Item rustedgorget = new PlateGorget(); rustedgorget.Hue = 2718; rustedgorget.Name = "rusted platemail gorget recovered from a shipwreck"; chest.DropItem(rustedgorget); break; } case 5: { Item rustedhelm = new PlateHelm(); rustedhelm.Hue = 2718; rustedhelm.Name = "a rusted platemail helmet recovered from a shipwreck"; chest.DropItem(rustedhelm); break; } } switch (Utility.Random(400)) { case 0: { Item lamp = new LampPost1(); lamp.Name = "Britannia Head Light"; lamp.Hue = 2601; chest.DropItem(lamp); break; } case 1: { Item lantern = new HangingLantern(); lantern.Name = "Fog Lamp"; lantern.Hue = 2601; lantern.Movable = true; chest.DropItem(lantern); break; } } chest.Movable = true; chest.Locked = false; chest.TrapType = TrapType.None; chest.TrapPower = 0; chest.TrapLevel = 0; sos.Completed = true; BaseBoat ownerBoat = BaseBoat.FindBoatAt(from.Location, from.Map); PlayerMobile player = from as PlayerMobile; if (ownerBoat != null && player != null) { if (ownerBoat.IsFriend(player) || ownerBoat.IsOwner(player) || ownerBoat.IsCoOwner(player)) { double doubloonValue = Utility.RandomMinMax(25, 50); int finalDoubloonAmount = (int)doubloonValue; bool shipOwner = ownerBoat.IsOwner(player); bool bankDoubloonsValid = false; bool holdPlacementValid = false; //Deposit Half In Player's Bank if (Banker.DepositUniqueCurrency(player, typeof(Doubloon), finalDoubloonAmount)) { Doubloon doubloonPile = new Doubloon(finalDoubloonAmount); player.SendSound(doubloonPile.GetDropSound()); doubloonPile.Delete(); bankDoubloonsValid = true; } //Deposit Other Half in Ship if (ownerBoat.DepositDoubloons(finalDoubloonAmount)) { Doubloon doubloonPile = new Doubloon(finalDoubloonAmount); player.SendSound(doubloonPile.GetDropSound()); doubloonPile.Delete(); holdPlacementValid = true; } if (shipOwner) { player.PirateScore += finalDoubloonAmount; //ownerBoat.doubloonsEarned += finalDoubloonAmount * 2; if (bankDoubloonsValid && holdPlacementValid) { player.SendMessage("You've received " + (finalDoubloonAmount * 2).ToString() + " doubloons for completing a message in a bottle! They have been evenly split between your bank box and your ship's hold."); } else if (bankDoubloonsValid && !holdPlacementValid) { player.SendMessage("You've earned " + (finalDoubloonAmount * 2).ToString() + " doubloons, however there was not enough room to place all of them in your ship's hold."); } else if (!bankDoubloonsValid && holdPlacementValid) { player.SendMessage("You've earned " + (finalDoubloonAmount * 2).ToString() + " doubloons, however there was not enough room to place all of them in your bank box."); } } else { //ownerBoat.doubloonsEarned += finalDoubloonAmount; player.PirateScore += finalDoubloonAmount; if (bankDoubloonsValid) { player.SendMessage("You've earned " + finalDoubloonAmount.ToString() + " doubloons for completing a message in a bottle! They have been placed in your bank box."); } else { player.SendMessage("You've earned doubloons, but there was not enough room to place all of them in your bank box."); } } } } return(chest); } } } return(base.Construct(type, from, _i, _d, _b, _r)); }
public static int DetermineMobileNotoriety(Mobile source, Mobile target, bool useVengeance) { BaseCreature bc_Source = source as BaseCreature; PlayerMobile pm_Source = source as PlayerMobile; Mobile m_SourceController = null; BaseCreature bc_SourceController = null; PlayerMobile pm_SourceController = null; BaseCreature bc_Target = target as BaseCreature; PlayerMobile pm_Target = target as PlayerMobile; Mobile m_TargetController = null; BaseCreature bc_TargetController = null; PlayerMobile pm_TargetController = null; #region UOACZ if (UOACZRegion.ContainsMobile(target)) { if (pm_Target != null) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(pm_Target); if (pm_Target.IsUOACZUndead) { if (pm_Source != null) { if (pm_Source.IsUOACZHuman) { return(Notoriety.Enemy); } if (pm_Source.IsUOACZUndead) { if (pm_Target.Criminal) { return(Notoriety.CanBeAttacked); } return(Notoriety.Innocent); } } return(Notoriety.CanBeAttacked); } if (pm_Target.IsUOACZHuman) { if (pm_Source != null) { if (pm_Source.IsUOACZUndead) { return(Notoriety.Enemy); } } if (pm_Target.m_UOACZAccountEntry.HumanProfile.HonorPoints <= UOACZSystem.HonorAggressionThreshold) { return(Notoriety.Enemy); } if (pm_Target.Criminal) { return(Notoriety.CanBeAttacked); } if (pm_Source != null) { return(Notoriety.Innocent); } return(Notoriety.CanBeAttacked); } } if (bc_Target != null) { if (bc_Target is UOACZBaseUndead) { UOACZBaseUndead bc_Undead = bc_Target as UOACZBaseUndead; if (bc_Undead.ControlMaster == source) { return(Notoriety.Ally); } if (pm_Source != null && (bc_Undead == UOACZPersistance.UndeadChampion || bc_Undead == UOACZPersistance.UndeadBoss)) { if (pm_Source.IsUOACZHuman) { return(Notoriety.Murderer); } } return(Notoriety.CanBeAttacked); } if (bc_Target is UOACZBaseWildlife) { return(Notoriety.CanBeAttacked); } if (bc_Target is UOACZBaseHuman) { UOACZBaseHuman bc_Human = bc_Target as UOACZBaseHuman; if (source is UOACZBaseWildlife || source is UOACZBaseUndead) { return(Notoriety.CanBeAttacked); } if (pm_Source != null) { if (pm_Source.IsUOACZUndead) { if (bc_Human == UOACZPersistance.HumanChampion || bc_Human == UOACZPersistance.HumanBoss) { return(Notoriety.Murderer); } return(Notoriety.CanBeAttacked); } } return(Notoriety.Innocent); } } return(Notoriety.Innocent); } #endregion if (bc_Source != null) { m_SourceController = bc_Source.ControlMaster as Mobile; bc_SourceController = bc_Source.ControlMaster as BaseCreature; pm_SourceController = bc_Source.ControlMaster as PlayerMobile; } if (bc_Target != null) { m_TargetController = bc_Target.ControlMaster as Mobile; bc_TargetController = bc_Target.ControlMaster as BaseCreature; pm_TargetController = bc_Target.ControlMaster as PlayerMobile; } //Berserk Creatures if (bc_Source != null && (source is BladeSpirits || source is EnergyVortex)) { if (bc_Source.ControlMaster != null && pm_Target != null) { //Blade Spirits + Energy Vortexes Can Freely Attack Their Control Master Without Causing Criminal Action if (bc_Source.ControlMaster == pm_Target) { return(Notoriety.CanBeAttacked); } } if (bc_Source.ControlMaster != null && bc_Target != null) { //Blade Spirits + Energy Vortexes Can Freely Attack Other Followers Of Their Control Master Without Causing Criminal Action if (bc_Source.ControlMaster == bc_Target.ControlMaster) { return(Notoriety.CanBeAttacked); } } } if (target is BladeSpirits || target is EnergyVortex) { return(Notoriety.Murderer); } //Staff Members Always Attackable if (target.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } if (m_TargetController != null) { //Creature Controlled By Staff Member if (m_TargetController.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } } //Consensual PvP if (pm_Source != null && pm_Target != null) { //Duel if (pm_Source.DuelContext != null && pm_Source.DuelContext.StartedBeginCountdown && !pm_Source.DuelContext.Finished && pm_Source.DuelContext == pm_Target.DuelContext) { return(pm_Source.DuelContext.IsAlly(pm_Source, pm_Target) ? Notoriety.Ally : Notoriety.Enemy); } } //Enemy of One if (pm_Source != null && bc_Target != null) { if (!bc_Target.Summoned && !bc_Target.Controlled && pm_Source.EnemyOfOneType == target.GetType()) { return(Notoriety.Enemy); } } //Justice Free Zone if (SpellHelper.InBuccs(target.Map, target.Location) || SpellHelper.InYewOrcFort(target.Map, target.Location) || SpellHelper.InYewCrypts(target.Map, target.Location)) { return(Notoriety.CanBeAttacked); } //Grey Zone Totem Nearby if (GreyZoneTotem.InGreyZoneTotemArea(target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } //Hotspot Nearby if (Custom.Hotspot.InHotspotArea(target.Location, target.Map, true)) { return(Notoriety.CanBeAttacked); } //Player Notoriety if (pm_Target != null) { //Friendly if (pm_SourceController != null) { if (pm_SourceController == pm_Target) { return(Notoriety.Ally); } } //Murderer if (pm_Target.Murderer && !pm_Target.HideMurdererStatus) { return(Notoriety.Murderer); } //Criminal if (pm_Target.Criminal) { return(Notoriety.Criminal); } //Perma-Grey if (SkillHandlers.Stealing.ClassicMode && pm_Target.PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (pm_SourceController != null) { //Target is Perma-Grey to Source Creature's Controller if (SkillHandlers.Stealing.ClassicMode && pm_Target.PermaFlags.Contains(pm_SourceController)) { return(Notoriety.CanBeAttacked); } } } //Guilds //TEST: GUILD /* * Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); * Guild targetGuild = GetGuildFor(target.Guild as Guild, target); * * if (sourceGuild != null && targetGuild != null) * { * if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) * return Notoriety.Ally; * * else if (sourceGuild.IsEnemy(targetGuild)) * return Notoriety.Enemy; * } */ //Creature Notoriety if (bc_Target != null) { //Friendly if (m_TargetController != null) { //Target is Source's Controller if (source == m_TargetController) { return(Notoriety.Ally); } } if (m_SourceController != null) { //Source is Target's Controller if (m_SourceController == bc_Target) { return(Notoriety.Ally); } } //Murderer if (bc_Target.IsMurderer()) { return(Notoriety.Murderer); } if (pm_TargetController != null) { if (pm_TargetController.Murderer) { return(Notoriety.Murderer); } } if (bc_TargetController != null) { if (bc_TargetController.IsMurderer()) { return(Notoriety.Murderer); } } //Criminal if (bc_Target.Criminal) { return(Notoriety.Criminal); } if (pm_TargetController != null) { if (pm_TargetController.Criminal) { return(Notoriety.Criminal); } } if (bc_TargetController != null) { if (bc_TargetController.Criminal) { return(Notoriety.Criminal); } } //Perma-Grey if (pm_TargetController != null) { if (SkillHandlers.Stealing.ClassicMode && pm_TargetController.PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (pm_SourceController != null) { //Target is Perma-Grey to Source Creature's Controller if (SkillHandlers.Stealing.ClassicMode && pm_TargetController.PermaFlags.Contains(pm_SourceController)) { return(Notoriety.CanBeAttacked); } } } } //Housing if (CheckHouseFlag(source, target, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } //Aggressor: Source to Target if (CheckAggressor(source.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, target) && useVengeance) { return(Notoriety.CanBeAttacked); } //Aggressor: Source Controller to Target if (m_SourceController != null) { if (CheckAggressor(m_SourceController.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(m_SourceController.Aggressed, target) && useVengeance) { return(Notoriety.CanBeAttacked); } } //Aggressor: Source to Target's Controller if (m_TargetController != null) { if (CheckAggressor(source.Aggressors, m_TargetController)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, m_TargetController) && useVengeance) { return(Notoriety.CanBeAttacked); } } //Aggressor: Source Controller to Target's Controller if (m_SourceController != null && m_TargetController != null) { if (CheckAggressor(m_SourceController.Aggressors, m_TargetController)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(m_SourceController.Aggressed, m_TargetController) && useVengeance) { return(Notoriety.CanBeAttacked); } } //Player Followers: If A Player or Any of Their Followers Have been Aggressed or Barded, the Player and All Other Followers Can Attack the Aggressor PlayerMobile pm_Player = null; if (pm_Source != null) { pm_Player = pm_Source; } if (pm_SourceController != null) { pm_Player = pm_SourceController; } if (pm_Player != null) { if (pm_Player.AllFollowers.Count > 0) { //Any of the Player's Other Followers foreach (Mobile follower in pm_Player.AllFollowers) { BaseCreature bc_Follower = follower as BaseCreature; if (bc_Follower == null) { continue; } //Follower Has Been Aggressed/Aggresor to Target if (CheckAggressor(bc_Follower.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(bc_Follower.Aggressed, target) && useVengeance) { return(Notoriety.CanBeAttacked); } //Follower Has Been Aggressed/Aggresor by/to Target's Controller if (m_TargetController != null) { if (CheckAggressor(bc_Follower.Aggressors, m_TargetController)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(bc_Follower.Aggressed, m_TargetController) && useVengeance) { return(Notoriety.CanBeAttacked); } } } } } //Boats: Players and Creatures Friendly to a Boat Can Freely Attack Non-Friendly Mobiles on their Boat BaseBoat sourceBoat = null; if (bc_Source != null) { if (bc_Source.BoatOccupied != null) { sourceBoat = bc_Source.BoatOccupied; } } if (pm_Source != null) { if (pm_Source.BoatOccupied != null) { sourceBoat = pm_Source.BoatOccupied; } } if (sourceBoat != null) { BaseBoat targetBoat = null; if (bc_Target != null) { if (bc_Target.BoatOccupied != null) { targetBoat = bc_Target.BoatOccupied; } } if (pm_Target != null) { if (pm_Target.BoatOccupied != null) { targetBoat = pm_Target.BoatOccupied; } } //On Same Boat if (sourceBoat != null && targetBoat != null && !sourceBoat.Deleted && !targetBoat.Deleted && sourceBoat == targetBoat) { bool sourceBelongs = false; bool targetBelongs = false; //Source Belongs n the Boat if (sourceBoat.Crew.Contains(source) || sourceBoat.IsFriend(source) || sourceBoat.IsCoOwner(source) || sourceBoat.IsOwner(source)) { sourceBelongs = true; } //Source's Owner Belongs on the Boat else if (bc_Source != null) { if (m_SourceController != null) { if (sourceBoat.Crew.Contains(m_SourceController) || sourceBoat.IsFriend(m_SourceController) || sourceBoat.IsCoOwner(m_SourceController) || sourceBoat.IsOwner(m_SourceController)) { sourceBelongs = true; } } } //Target Belongs On The Boat if (sourceBoat.Crew.Contains(target) || sourceBoat.IsFriend(target) || sourceBoat.IsCoOwner(target) || sourceBoat.IsOwner(target)) { targetBelongs = true; } //Target's Owner Belongs On the Boat else if (bc_Target != null) { if (m_TargetController != null) { if (sourceBoat.Crew.Contains(m_TargetController) || sourceBoat.IsFriend(m_TargetController) || sourceBoat.IsCoOwner(m_TargetController) || sourceBoat.IsOwner(m_TargetController)) { targetBelongs = true; } } } //Target May Be Freely Attacked on Boat if (sourceBelongs && !targetBelongs) { return(Notoriety.CanBeAttacked); } } } //Polymorph or Body Transformation if (!(bc_Target != null && bc_Target.InitialInnocent)) { if (target.Player && target.BodyMod > 0) { } else if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(bc_Target) && !TransformationSpellHelper.UnderTransformation(target)) { return(Notoriety.CanBeAttacked); } } //If somehow a player is attacking us with their tamed creatures, and their creatures are flagged to us but the player isn't //if (pm_Source != null && pm_Target != null) //{ // if (pm_Target.AllFollowers.Count > 0) // { // //Any of the Player's Other Followers // foreach (Mobile follower in pm_Target.AllFollowers) // { // int notorietyResult = Notoriety.Compute(source, follower); // //Enemy Tamer Adopts Notoriety of Their Creature (Anything other than Innocent) // if (notorietyResult != 1) // { // foreach(var aggressor in source.Aggressors) // { // if (aggressor.Attacker == follower) // return notorietyResult; // } // } // } // } //} return(Notoriety.Innocent); }
protected override void OnTarget(Mobile from, object target) { bool foundAnyone = false; from.RevealingAction(); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DetectHiddenCooldown * 1000); Point3D p; if (target is Mobile) { p = ((Mobile)target).Location; } else if (target is Item) { p = ((Item)target).Location; } else if (target is IPoint3D) { p = new Point3D((IPoint3D)target); } else { p = from.Location; } //Boat Searching: Automatic Success for Owner, Co-Owner, Owner BaseBoat boat = BaseBoat.FindBoatAt(p, from.Map); if (boat != null) { if (!boat.Contains(from)) { from.SendMessage("You must be onboard this boat in order to search it."); return; } if (boat.IsFriend(from) || boat.IsCoOwner(from) || boat.IsOwner(from)) { List <Mobile> m_MobilesOnBoard = boat.GetMobilesOnBoat(false, true); foreach (Mobile mobile in m_MobilesOnBoard) { if (mobile == from) { continue; } if (mobile.Hidden && !mobile.RevealImmune && from.AccessLevel >= mobile.AccessLevel) { mobile.RevealingAction(); mobile.SendLocalizedMessage(500814); // You have been revealed! foundAnyone = true; } } if (foundAnyone) { from.SendMessage("You reveal what was hidden."); } else { from.SendMessage("You search the decks and find no one hiding onboard."); } } return; } //House Searching: Automatic Success for Owner, Co-Owner, Owner BaseHouse house = BaseHouse.FindHouseAt(p, from.Map, 16); if (house != null) { if (!house.Contains(from.Location)) { from.SendMessage("You must be inside this house in order to search it."); return; } if (house.IsFriend(from) || house.IsCoOwner(from) || house.IsOwner(from)) { IPooledEnumerable nearbyMobiles = from.Map.GetMobilesInRange(p, HouseSearchRange); foreach (Mobile mobile in nearbyMobiles) { if (mobile == from) { continue; } BaseHouse mobileHouse = BaseHouse.FindHouseAt(p, from.Map, 16); if (mobile == null || mobileHouse != house) { continue; } if (mobile.Hidden && !mobile.RevealImmune && from.AccessLevel >= mobile.AccessLevel) { mobile.RevealingAction(); mobile.SendLocalizedMessage(500814); // You have been revealed! foundAnyone = true; } } nearbyMobiles.Free(); if (foundAnyone) { from.SendMessage("You reveal what was hidden."); } else { from.SendMessage("You search the home and find no one hiding within."); } } return; } from.CheckSkill(SkillName.DetectHidden, 0.0, 100.0, 1.0); double successChance = (from.Skills[SkillName.DetectHidden].Value / 100); int searchRadius = (int)(Math.Floor(from.Skills[SkillName.DetectHidden].Value / 100) * MaxSearchRadius); if (Utility.RandomDouble() <= successChance) { IPooledEnumerable nearbyMobiles = from.Map.GetMobilesInRange(p, searchRadius); foreach (Mobile mobile in nearbyMobiles) { if (mobile == from) { continue; } if (mobile.Hidden && !mobile.RevealImmune && from.AccessLevel >= mobile.AccessLevel) { mobile.RevealingAction(); mobile.SendLocalizedMessage(500814); // You have been revealed! foundAnyone = true; } } nearbyMobiles.Free(); if (foundAnyone) { from.SendMessage("You reveal what was hidden."); } else { from.SendMessage("You search the area but find nothing hidden."); } } else { from.SendMessage("You are not certain what lies hidden nearby."); return; } }
public virtual void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { from.EndAction(locked); from.RevealingAction(); if (!CheckHarvest(from, tool)) { return; } int tileID; Map map; Point3D loc; if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc)) { OnBadHarvestTarget(from, tool, toHarvest); return; } else if (!def.Validate(tileID)) { OnBadHarvestTarget(from, tool, toHarvest); return; } if (!CheckRange(from, tool, def, map, loc, true)) { return; } else if (!CheckResources(from, tool, def, map, loc, true)) { return; } else if (!CheckHarvest(from, tool, def, toHarvest)) { return; } if (SpecialHarvest(from, tool, def, map, loc)) { return; } HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) { return; } HarvestVein vein = bank.Vein; if (vein != null) { vein = MutateVein(from, tool, def, bank, toHarvest, vein); } if (vein == null) { return; } HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = vein.FallbackResource; HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, primary, fallback); double skillBase = from.Skills[def.Skill].Base; double skillValue = from.Skills[def.Skill].Value; Type type = null; if (skillBase >= resource.ReqSkill && from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill, 1.0)) { type = GetResourceType(from, tool, def, map, loc, resource); if (type != null) { type = MutateType(type, from, tool, def, map, loc, resource); } if (type != null) { Item item = Construct(type, from, tool, def, bank, resource); if (item == null) { type = null; } else { BaseBoat ownerBoat = BaseBoat.FindBoatAt(from.Location, from.Map); if (item is MessageInABottle) { } else if (item is RawFish || item is RawLargeFish) { if (ownerBoat != null) { if (ownerBoat.IsOwner(from) || ownerBoat.IsCoOwner(from) || ownerBoat.IsFriend(from)) { //ownerBoat.fishCaught++; } } } if (item.Stackable) { int amount = def.ConsumedPerHarvest; int feluccaAmount = def.ConsumedPerFeluccaHarvest; int racialAmount = (int)Math.Ceiling(amount * 1.1); int feluccaRacialAmount = (int)Math.Ceiling(feluccaAmount * 1.1); bool eligableForRacialBonus = (def.RaceBonus && from.Race == Race.Human); bool inFelucca = (map == Map.Felucca); if (eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount && 0.1 > Utility.RandomDouble()) { item.Amount = feluccaRacialAmount; } else if (inFelucca && bank.Current >= feluccaAmount) { item.Amount = feluccaAmount; } else if (eligableForRacialBonus && bank.Current >= racialAmount && 0.1 > Utility.RandomDouble()) { item.Amount = racialAmount; } else { item.Amount = amount; } } bank.Consume(item.Amount, from); if (Give(from, item, def.PlaceAtFeetIfFull)) { SendSuccessTo(from, item, resource); } else { SendPackFullTo(from, item, def, resource); item.Delete(); } BonusHarvestResource bonus = def.GetBonusResource(); if (bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill) { Item bonusItem = Construct(bonus.Type, from, tool, def, bank, resource); if (Give(from, bonusItem, true)) { bonus.SendSuccessTo(from); } else { item.Delete(); } } WearTool(from, tool, def); } } if (type == null) { if ((def.Skill != SkillName.Mining && def.Skill != SkillName.Lumberjacking) || !Mining.UseMiningCaptcha) { def.SendMessageTo(from, def.FailMessage); FailHarvest(from, def); } } } else { def.SendMessageTo(from, def.FailMessage); FailHarvest(from, def); } OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest); }
public void OnTarget(Mobile from, Point3D point) { BaseBoat fromBoat = BaseBoat.FindBoatAt(from.Location, from.Map); BaseBoat targetBoat = BaseBoat.FindBoatAt(point, this.Map); if (targetBoat != null) { bool automaticBoarding = false; if (targetBoat.MobileControlType != MobileControlType.Player && !targetBoat.HasCrewAlive()) { automaticBoarding = true; } double shipHullPercent = (double)((float)targetBoat.HitPoints / (float)targetBoat.MaxHitPoints); if (targetBoat.IsOwner(from) || targetBoat.IsCoOwner(from) || targetBoat.IsFriend(from)) { from.SendMessage("You already have access to that boat."); return; } else if (shipHullPercent > m_MinimumHullPercent && !automaticBoarding) { from.SendMessage("The hull of that ship is not yet damaged enough to risk a boarding attempt."); return; } else { double baseSuccessChance = m_FullSuccessChancePercent; double hullPercentFactor = (m_MinimumHullPercent - shipHullPercent) * (1 / m_MinimumHullPercent); if (hullPercentFactor < 0) { hullPercentFactor = 0; } double finalSuccessChance = hullPercentFactor * baseSuccessChance; if (targetBoat.MobileControlType != MobileControlType.Player) { ; } finalSuccessChance *= m_NPCShipBonusMultiplier; //Successful Boarding if ((Utility.RandomDouble() <= finalSuccessChance) || automaticBoarding) { //Valid Boarding if (targetBoat.Embark(from, true)) { List <Mobile> targets = targetBoat.GetMobilesOnBoat(false, false); //Mobile Boarding Boat Becomes Aggressor to Everyone on Target Boat (Who Belongs on the Boat) foreach (Mobile target in targets) { //Target Belongs on Boat if (targetBoat.Crew.Contains(target) || targetBoat.IsFriend(target) || targetBoat.IsCoOwner(target) || targetBoat.IsOwner(target)) { //Do Harmful Action to Target if (from.CanBeHarmful(target, false)) { from.DoHarmful(target); } } } from.SendMessage("You board the ship!"); Effects.PlaySound(from.Location, from.Map, 0x056); //Alternate Sound 0x0EF if (targetBoat.TillerMan != null) { if (targetBoat.HasCrewAlive()) { targetBoat.TillerMan.Say("Arr! We've been boarded!"); } } from.NextBoardingAttemptAllowed = DateTime.UtcNow + boardingCooldown; CurrentCharges--; return; } else { from.NextBoardingAttemptAllowed = DateTime.UtcNow + boardingCooldown; from.SendMessage("You fail to board the ship"); Effects.PlaySound(from.Location, from.Map, 0x5D2); CurrentCharges--; return; } } //Failed Boarding Attempt else { from.NextBoardingAttemptAllowed = DateTime.UtcNow + boardingCooldown; from.SendMessage("You fail to board the ship"); Effects.PlaySound(from.Location, from.Map, 0x5D2); CurrentCharges--; return; } } } }
public override void OnDoubleClick(Mobile from) { if (m_Boat == null) { return; } if (m_Boat.Deleted) { return; } if (this == null) { return; } if (Deleted) { return; } if (from.AccessLevel > AccessLevel.Player) { from.SendMessage("You use your godly power's to access the hold."); base.OnDoubleClick(from); return; } if (m_Boat == null || !m_Boat.Contains(from)) { from.SendMessage("You must be onboard that ship to access it's hold."); return; } //NPC Boat if (m_Boat.MobileControlType != MobileControlType.Player) { if (m_Boat.HasCrewAlive()) { from.SendMessage("You cannot attempt to access that ship's hold while it's crew members still live."); return; } } //Player Boat else { //Refresh Boat if (m_Boat.IsOwner(from) || m_Boat.IsCoOwner(from) || m_Boat.IsFriend(from)) { m_Boat.Refresh(); } //Don't Have Access if (!(m_Boat.IsOwner(from) || m_Boat.IsCoOwner(from))) { from.SendMessage("You must use a lockpick to attempt to access that."); return; } } base.OnDoubleClick(from); }
public void OnTarget(Mobile from, object obj) { if (Deleted || m_InUse) { return; } IPoint3D p3D = obj as IPoint3D; if (p3D == null) { return; } Map map = from.Map; if (map == null || map == Map.Internal) { return; } int x = p3D.X, y = p3D.Y, z = map.GetAverageZ(x, y); // OSI just takes the targeted Z if (!from.InRange(p3D, 6)) { from.SendLocalizedMessage(500976); // You need to be closer to the water to fish! } else if (!from.InLOS(obj)) { from.SendLocalizedMessage(500979); // You cannot see that location. } else if (RequireDeepWater ? FullValidation(map, x, y) : (ValidateDeepWater(map, x, y) || ValidateUndeepWater(map, obj, ref z))) { Point3D p = new Point3D(x, y, z); if (GetType() == typeof(SpecialFishingNet)) { for (int i = 1; i < Amount; ++i) // these were stackable before, doh { from.AddToBackpack(new SpecialFishingNet()); } } BaseBoat ownerBoat = BaseBoat.FindBoatAt(from.Location, from.Map); PlayerMobile player = from as PlayerMobile; if (ownerBoat != null && player != null) { if (ownerBoat.IsFriend(player) || ownerBoat.IsOwner(player) || ownerBoat.IsCoOwner(player)) { double doubloonValue = Utility.RandomMinMax(5, 10); int finalDoubloonAmount = (int)doubloonValue; bool shipOwner = ownerBoat.IsOwner(player); bool bankDoubloonsValid = false; bool holdPlacementValid = false; //Deposit Half In Player's Bank if (Banker.DepositUniqueCurrency(player, typeof(Doubloon), finalDoubloonAmount)) { Doubloon doubloonPile = new Doubloon(finalDoubloonAmount); player.SendSound(doubloonPile.GetDropSound()); doubloonPile.Delete(); bankDoubloonsValid = true; } //Deposit Other Half in Ship if (ownerBoat.DepositDoubloons(finalDoubloonAmount)) { Doubloon doubloonPile = new Doubloon(finalDoubloonAmount); player.SendSound(doubloonPile.GetDropSound()); doubloonPile.Delete(); holdPlacementValid = true; } if (shipOwner) { player.PirateScore += finalDoubloonAmount; //ownerBoat.doubloonsEarned += finalDoubloonAmount * 2; if (bankDoubloonsValid && holdPlacementValid) { player.SendMessage("You've received " + (finalDoubloonAmount * 2).ToString() + " doubloons for using a net! They have been evenly split between your bank box and your ship's hold."); } else if (bankDoubloonsValid && !holdPlacementValid) { player.SendMessage("You've earned " + (finalDoubloonAmount * 2).ToString() + " doubloons, however there was not enough room to place all of them in your ship's hold."); } else if (!bankDoubloonsValid && holdPlacementValid) { player.SendMessage("You've earned " + (finalDoubloonAmount * 2).ToString() + " doubloons, however there was not enough room to place all of them in your bank box."); } } else { player.PirateScore += finalDoubloonAmount; //ownerBoat.doubloonsEarned += finalDoubloonAmount; if (bankDoubloonsValid) { player.SendMessage("You've earned " + finalDoubloonAmount.ToString() + " doubloons for using a net! They have been placed in your bank box."); } else { player.SendMessage("You've earned doubloons, but there was not enough room to place all of them in your bank box."); } } } } m_InUse = true; Movable = false; MoveToWorld(p, map); SpellHelper.Turn(from, p); from.Animate(12, 5, 1, true, false, 0); Effects.SendLocationEffect(p, map, 0x352D, 16, 4); Effects.PlaySound(p, map, 0x364); Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 14, new TimerStateCallback(DoEffect), new object[] { p, 0, from }); from.SendLocalizedMessage(RequireDeepWater ? 1010487 : 1074492); // You plunge the net into the sea... / You plunge the net into the water... } else { from.SendLocalizedMessage(RequireDeepWater ? 1010485 : 1074491); // You can only use this net in deep water! / You can only use this net in water! } }