public virtual void Activate(PlayerMobile player) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); UOACZUnlockableDetail unlockableDetail = UOACZUnlockables.GetUnlockableDetail(m_UnlockableType); UOACZUnlockableDetailEntry unlockableDetailEntry = UOACZUnlockables.GetUnlockableDetailEntry(player, m_UnlockableType); if (unlockableDetailEntry != null) { player.SendMessage("You have already unlocked the UOACZ Unlockable: " + unlockableDetail.Name + "."); return; } else { player.m_UOACZAccountEntry.m_Unlockables.Add(new UOACZUnlockableDetailEntry(m_UnlockableType, true, false)); player.SendMessage("You have unlocked the UOACZ Unlockable: " + unlockableDetail.Name + "."); player.PlaySound(0x0F7); player.FixedParticles(0x373A, 10, 15, 5012, 2587, 0, EffectLayer.Waist); player.CloseGump(typeof(UOACZScoreGump)); Delete(); } }
public override void OnDoubleClick(Mobile from) { PlayerMobile player = from as PlayerMobile; if (player == null) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (!IsChildOf(from.Backpack)) { from.SendMessage("That item must be in your pack in order to use it."); return; } if (m_Player != null) { if (m_Player != player) { from.SendMessage("That item may only be used by " + m_Player.Name + "."); return; } } UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.UndeadUpgradePoints, 1, true); player.SendSound(UOACZSystem.earnCorruptionSound); UOACZSystem.RefreshAllGumps(player); Delete(); }
public override bool GetScavengeResult(PlayerMobile player, bool lockpickAttempt) { bool scavengeResult = false; int minimumPlayerValue = 50; int playerForageValue = Utility.RandomMinMax(0, minimumPlayerValue + (int)(Math.Round(player.Skills.Camping.Value * UOACZSystem.scavengeSkillScalar))); int forageTarget = Utility.RandomMinMax(0, ScavengeDifficulty); if (playerForageValue >= forageTarget) { scavengeResult = true; } if (scavengeResult) { Effects.PlaySound(player.Location, player.Map, 0x5AB); UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.ScavengeableCottonItems++; } else { Effects.PlaySound(player.Location, player.Map, 0x059); } return(scavengeResult); }
public override void OnThink() { base.OnThink(); if (Combatant != null) { if ((LastMovement + AbortTargetDelay <= DateTime.UtcNow) && (LastAttackMade + AbortTargetDelay) <= DateTime.UtcNow) { Combatant = null; } } if (Utility.RandomDouble() < 0.001) { if (Combatant == null) { if (InWilderness && wildernessIdleSpeech.Length > 0) { Say(wildernessIdleSpeech[Utility.Random(wildernessIdleSpeech.Length - 1)]); } else if (idleSpeech.Length > 0) { Say(idleSpeech[Utility.Random(idleSpeech.Length - 1)]); } } else { bool undeadCombatant = false; if (Combatant is UOACZBaseUndead) { undeadCombatant = true; } PlayerMobile pm_Combatant = Combatant as PlayerMobile; if (pm_Combatant != null) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(pm_Combatant); if (pm_Combatant.m_UOACZAccountEntry.ActiveProfile == UOACZAccountEntry.ActiveProfileType.Undead) { undeadCombatant = true; } } if (undeadCombatant && undeadCombatSpeech.Length > 0) { Say(undeadCombatSpeech[Utility.Random(undeadCombatSpeech.Length - 1)]); } else if (humanCombatSpeech.Length > 0) { Say(humanCombatSpeech[Utility.Random(humanCombatSpeech.Length - 1)]); } } } }
public override void OnDoubleClick(Mobile from) { if (from == null) { return; } if (!Movable) { return; } if (!IsChildOf(from.Backpack)) { from.SendMessage("That item must be in your pack in order to use it."); return; } if (!from.CanBeginAction(typeof(UOACZConsumptionItem))) { from.SendMessage("You must wait a few moments before consuming another item."); return; } from.BeginAction(typeof(UOACZConsumptionItem)); Timer.DelayCall(TimeSpan.FromSeconds(1), delegate { if (from != null) { from.EndAction(typeof(UOACZConsumptionItem)); } }); PlayerMobile player = from as PlayerMobile; if (player == null) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (player.m_UOACZAccountEntry.ActiveProfile == UOACZAccountEntry.ActiveProfileType.Human) { if (ConsumptionQualityType == ConsumptionQuality.Raw || ConsumptionQualityType == ConsumptionQuality.Corrupted) { player.CloseGump(typeof(UOACZConsumeFoodGump)); player.SendGump(new UOACZConsumeFoodGump(this, player)); } else { Consume(player); } } }
public override bool GetScavengeResult(PlayerMobile player, bool lockpickAttempt) { bool scavengeResult = true; if (scavengeResult) { Effects.PlaySound(player.Location, player.Map, 0x2E2); UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.ScavengeableDebrisItems++; } else { Effects.PlaySound(player.Location, player.Map, 0x059); } return(scavengeResult); }
public override void OnDoubleClick(Mobile from) { PlayerMobile player = from as PlayerMobile; if (player == null) { return; } if (!UOACZPersistance.Enabled) { from.SendMessage("UOACZ system currently disabled."); return; } if (!IsChildOf(from.Backpack)) { from.SendMessage("That item must be in your pack in order to use it."); return; } if (m_Player != null) { Account ownerAccount = m_Player.Account as Account; Account playerAccount = player.Account as Account; if (ownerAccount != null && playerAccount != null && ownerAccount != playerAccount) { from.SendMessage("That item may only be used by " + m_Player.Name + "."); return; } } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.SurvivalPoints, 1, true); player.SendSound(UOACZSystem.earnSurvivalSound); UOACZSystem.RefreshAllGumps(player); Delete(); }
public virtual void UOACZCarve(Mobile from, Corpse corpse) { PlayerMobile player = from as PlayerMobile; if (player == null) { return; } from.Animate(32, 3, 1, true, false, 0); Effects.PlaySound(from.Location, from.Map, 0x3E3); new Blood(0x122D).MoveToWorld(corpse.Location, corpse.Map); corpse.Carved = true; from.SendMessage("You carve the corpse."); UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.WildlifeSkinned++; }
public override bool GetScavengeResult(PlayerMobile player, bool lockpickAttempt) { bool scavengeResult = false; int minimumPlayerValue = 50; double searcherValue = 1 + player.GetSpecialAbilityEntryValue(SpecialAbilityEffect.Searcher); minimumPlayerValue = (int)(Math.Round((double)minimumPlayerValue * searcherValue)); if (lockpickAttempt) { int playerLockpickValue = Utility.RandomMinMax(0, minimumPlayerValue + (int)(Math.Round(player.Skills.Lockpicking.Value * UOACZSystem.scavengeSkillScalar))); int lockpickTarget = Utility.RandomMinMax(0, LockDifficulty); if (playerLockpickValue >= LockDifficulty) { Effects.PlaySound(player.Location, player.Map, 0x4A); scavengeResult = true; } else { Effects.PlaySound(player.Location, player.Map, 0x3A4); } } else { scavengeResult = true; Effects.PlaySound(player.Location, player.Map, 0x2E2); } if (scavengeResult) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.ScavengeableContainerItems++; } return(scavengeResult); }
public override void OnDoubleClick(Mobile from) { base.OnDoubleClick(from); PlayerMobile player = from as PlayerMobile; if (player == null) { return; } if (!Visible) { return; } if (player.AccessLevel > AccessLevel.Player) { return; } if (Utility.GetDistance(from.Location, Location) > 1) { from.SendMessage("You are too far way from that to use it."); return; } if (player.LastPlayerCombatTime + UOACZSystem.TunnelDigPvPThreshold > DateTime.UtcNow) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.LastPlayerCombatTime + UOACZSystem.TunnelDigPvPThreshold, false, true, true, true, true); player.SendMessage("You have been in combat with another player too recently and must wait " + timeRemaining + " before you may use this a tunnel."); return; } List <UOACZTunnel> m_Destinations = new List <UOACZTunnel>(); foreach (UOACZTunnel tunnel in m_Instances) { if (tunnel == null) { continue; } if (tunnel.Deleted) { continue; } if (!UOACZRegion.ContainsItem(tunnel)) { continue; } if (TunnelType == TunnelLocation.Town && tunnel.TunnelType == TunnelLocation.Town) { continue; } if (TunnelType == TunnelLocation.Wilderness && tunnel.TunnelType == TunnelLocation.Wilderness) { continue; } m_Destinations.Add(tunnel); } if (m_Destinations.Count == 0) { return; } Effects.PlaySound(Location, Map, 0x247); Effects.SendLocationEffect(Location, Map, 0x3728, 10, 10, 0, 0); TimedStatic dirt = new TimedStatic(Utility.RandomList(7681, 7682), 5); dirt.Name = "dirt"; dirt.MoveToWorld(Location, Map); dirt.PublicOverheadMessage(MessageType.Regular, 0, false, "*goes into tunnel*"); UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.TunnelsUsed++; for (int b = 0; b < 8; b++) { dirt = new TimedStatic(Utility.RandomList(7681, 7682), 5); dirt.Name = "dirt"; Point3D dirtLocation = new Point3D(Location.X + Utility.RandomList(-2, -1, 1, 2), Location.Y + Utility.RandomList(-2, -1, 1, 2), Location.Z); SpellHelper.AdjustField(ref dirtLocation, from.Map, 12, false); dirt.MoveToWorld(dirtLocation, Map); } UOACZTunnel targetTunnel = m_Destinations[Utility.RandomMinMax(0, m_Destinations.Count - 1)]; Visible = false; player.Location = targetTunnel.Location; foreach (Mobile follower in player.AllFollowers) { if (UOACZSystem.IsUOACZValidMobile(follower)) { follower.Location = targetTunnel.Location; } } if (targetTunnel.TunnelType == TunnelLocation.Wilderness) { from.SendMessage("The tunnel collapses behind you and you find yourself in the wilderness."); } else { from.SendMessage("The tunnel collapses behind you and you find yourself in town."); } Effects.SendLocationEffect(targetTunnel.Location, targetTunnel.Map, 0x3728, 10, 10, 0, 0); Effects.PlaySound(targetTunnel.Location, targetTunnel.Map, 0x247); dirt = new TimedStatic(Utility.RandomList(7681, 7682), 5); dirt.Name = "dirt"; dirt.MoveToWorld(targetTunnel.Location, Map); dirt.PublicOverheadMessage(MessageType.Regular, 0, false, "*appears from tunnel*"); for (int b = 0; b < 8; b++) { dirt = new TimedStatic(Utility.RandomList(7681, 7682), 5); dirt.Name = "dirt"; Point3D dirtLocation = new Point3D(targetTunnel.Location.X + Utility.RandomList(-2, -1, 1, 2), targetTunnel.Location.Y + Utility.RandomList(-2, -1, 1, 2), targetTunnel.Location.Z); SpellHelper.AdjustField(ref dirtLocation, Map, 12, false); dirt.MoveToWorld(dirtLocation, Map); } }
public override void OnDoubleClick(Mobile from) { base.OnDoubleClick(from); PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!(player.IsUOACZHuman)) { return; } if (Utility.GetDistance(player.Location, Location) > 2) { from.SendMessage("You are too far away to use that."); return; } if (!Map.InLOS(player.Location, Location)) { from.SendMessage("That is not within your line of sight."); return; } if (player.Backpack == null) { return; } bool foundContainer = false; Item[] items = player.Backpack.FindItemsByType(typeof(UOACZWaterTub)); if (!foundContainer) { foreach (Item item in items) { UOACZWaterTub waterContainer = item as UOACZWaterTub; if (waterContainer.Charges < waterContainer.MaxCharges) { waterContainer.Charges++; foundContainer = true; player.SendMessage("You gather the water and place it into a water tub."); break; } } } if (!foundContainer) { items = player.Backpack.FindItemsByType(typeof(UOACZTub)); UOACZTub waterContainer = null; foreach (Item item in items) { waterContainer = item as UOACZTub; foundContainer = true; break; } if (waterContainer != null) { int oldX = waterContainer.X; int oldY = waterContainer.Y; if (waterContainer != null) { waterContainer.Delete(); UOACZWaterTub newWaterTub = new UOACZWaterTub(); newWaterTub.Charges = 1; player.Backpack.DropItem(newWaterTub); newWaterTub.X = oldX; newWaterTub.Y = oldY; player.SendMessage("You gather the water and place it into an empty tub."); } } } if (!foundContainer) { items = player.Backpack.FindItemsByType(typeof(UOACZBottleOfWater)); foreach (Item item in items) { UOACZBottleOfWater waterContainer = item as UOACZBottleOfWater; if (waterContainer.Charges < waterContainer.MaxCharges) { waterContainer.Charges++; foundContainer = true; player.SendMessage("You gather the water and add it to an existing bottle of water."); break; } } } if (!foundContainer) { Item item = player.Backpack.FindItemByType(typeof(Bottle)); if (item != null) { Bottle bottle = item as Bottle; if (bottle.Amount == 1) { bottle.Delete(); } else { bottle.Amount--; } UOACZBottleOfWater newBottleOfWater = new UOACZBottleOfWater(); player.Backpack.DropItem(newBottleOfWater); foundContainer = true; player.SendMessage("You gather the water and place it into an empty bottle."); } } if (!foundContainer) { items = player.Backpack.FindItemsByType(typeof(UOACZGlass)); UOACZGlass waterContainer = null; foreach (Item item in items) { waterContainer = item as UOACZGlass; foundContainer = true; break; } if (waterContainer != null) { int oldX = waterContainer.X; int oldY = waterContainer.Y; if (waterContainer != null) { waterContainer.Delete(); UOACZGlassOfWater newWaterGlass = new UOACZGlassOfWater(); newWaterGlass.Charges = 1; player.Backpack.DropItem(newWaterGlass); newWaterGlass.X = oldX; newWaterGlass.Y = oldY; player.SendMessage("You gather the water and place it into an empty glass."); } } } if (foundContainer) { player.Animate(32, 5, 1, true, false, 0); player.PlaySound(0x4d1); Charges--; UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.ScavengeableWaterItems++; } else { player.SendMessage("You must have a empty bottle, empty glass, or water tub available in order to gather water."); } }
public static int CorpseNotoriety(Mobile source, Corpse target) { if (target.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } #region UOACZ if (UOACZRegion.ContainsItem(target)) { PlayerMobile pm_Owner = target.Owner as PlayerMobile; BaseCreature bc_Owner = target.Owner as BaseCreature; if (pm_Owner != null) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(pm_Owner); if (pm_Owner.IsUOACZUndead) { return(Notoriety.Murderer); } if (pm_Owner.m_UOACZAccountEntry.ActiveProfile == UOACZAccountEntry.ActiveProfileType.Human) { if (pm_Owner.m_UOACZAccountEntry.HumanProfile.HonorPoints <= UOACZSystem.HonorAggressionThreshold) { return(Notoriety.Enemy); } if (pm_Owner.Criminal) { return(Notoriety.CanBeAttacked); } return(Notoriety.Innocent); } } if (bc_Owner != null) { if (bc_Owner is UOACZBaseUndead) { if (bc_Owner.ControlMaster == source) { return(Notoriety.Ally); } return(Notoriety.CanBeAttacked); } if (bc_Owner is UOACZBaseWildlife) { return(Notoriety.CanBeAttacked); } if (bc_Owner is UOACZBaseHuman) { return(Notoriety.Innocent); } } return(Notoriety.CanBeAttacked); } #endregion Body body = (Body)target.Amount; BaseCreature cretOwner = target.Owner as BaseCreature; if (cretOwner != null) { //TEST: GUILD /* * Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); * Guild targetGuild = GetGuildFor(target.Guild as Guild, target.Owner); * * if (sourceGuild != null && targetGuild != null) * { * if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) * return Notoriety.Ally; * * else if (sourceGuild.IsEnemy(targetGuild)) * return Notoriety.Enemy; * } */ if (cretOwner.IsLoHBoss() || cretOwner.FreelyLootable) { return(Notoriety.CanBeAttacked); } if (CheckHouseFlag(source, target.Owner, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } int actual = Notoriety.CanBeAttacked; if (target.Kills >= 5 || (body.IsMonster && IsSummoned(target.Owner as BaseCreature)) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).IsMurderer() || ((BaseCreature)target.Owner).IsAnimatedDead))) { actual = Notoriety.Murderer; } if (DateTime.UtcNow >= (target.TimeOfDeath + Corpse.MonsterLootRightSacrifice)) { return(actual); } Party sourceParty = Party.Get(source); List <Mobile> list = target.Aggressors; for (int i = 0; i < list.Count; ++i) { if (list[i] == source || (sourceParty != null && Party.Get(list[i]) == sourceParty)) { return(actual); } } return(Notoriety.Innocent); } else { if (target.Kills >= 5 || (body.IsMonster && IsSummoned(target.Owner as BaseCreature)) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).IsMurderer() || ((BaseCreature)target.Owner).IsAnimatedDead))) { return(Notoriety.Murderer); } if (target.Criminal) { return(Notoriety.Criminal); } //TEST: GUILD /* * Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); * Guild targetGuild = GetGuildFor(target.Guild as Guild, target.Owner); * * if (sourceGuild != null && targetGuild != null) * { * if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) * return Notoriety.Ally; * * else if (sourceGuild.IsEnemy(targetGuild)) * return Notoriety.Enemy; * } */ if (target.Owner != null && target.Owner is BaseCreature && ((BaseCreature)target.Owner).AlwaysAttackable) { return(Notoriety.CanBeAttacked); } if (CheckHouseFlag(source, target.Owner, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } if (!(target.Owner is PlayerMobile) && !IsPet(target.Owner as BaseCreature)) { return(Notoriety.CanBeAttacked); } List <Mobile> list = target.Aggressors; for (int i = 0; i < list.Count; ++i) { if (list[i] == source) { return(Notoriety.CanBeAttacked); } } if (SpellHelper.InBuccs(target.Map, target.Location) || SpellHelper.InYewOrcFort(target.Map, target.Location) || SpellHelper.InYewCrypts(target.Map, target.Location)) { return(Notoriety.CanBeAttacked); } if (GreyZoneTotem.InGreyZoneTotemArea(target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } //Hotspot Nearby if (Custom.Hotspot.InHotspotArea(target.Location, target.Map, true)) { return(Notoriety.CanBeAttacked); } if (target.IsBones) { return(Notoriety.CanBeAttacked); } return(Notoriety.Innocent); } }
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); }
public override void OnDoubleClick(Mobile from) { base.OnDoubleClick(from); PlayerMobile player = from as PlayerMobile; if (player == null) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (player.IsUOACZHuman) { player.SendMessage("You decide against consuming this."); return; } if (!IsChildOf(from.Backpack)) { from.SendMessage("That item must be in your pack in order to use it."); return; } if (DateTime.UtcNow < player.m_UOACZAccountEntry.UndeadProfile.NextUndeadItemAllowed) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.m_UOACZAccountEntry.UndeadProfile.NextUndeadItemAllowed, false, false, false, true, true); player.SendMessage("You may not use another undead item for " + timeRemaining + "."); return; } player.m_UOACZAccountEntry.UndeadProfile.NextUndeadItemAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(UOACZSystem.UndeadItemCooldownSeconds); player.PlaySound(Utility.RandomList(0x5DA, 0x5A9, 0x5AB, 0x03A, 0x03B, 0x03C)); TypeOfBrain brainType = m_BrainType; Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { switch (brainType) { case TypeOfBrain.Healing: int hitsRegained = (int)(Math.Round((double)player.HitsMax * .33)); player.Heal(hitsRegained); player.FixedParticles(0x376A, 9, 32, 5030, 0, 0, EffectLayer.Waist); player.PlaySound(0x202); break; case TypeOfBrain.Mana: int manaRegained = (int)(Math.Round((double)player.ManaMax * .66)); player.Mana += manaRegained; player.FixedParticles(0x376A, 9, 32, 5030, 1364, 0, EffectLayer.Waist); player.PlaySound(0x1EB); break; case TypeOfBrain.SwarmHeal: Queue m_Queue = new Queue(); foreach (BaseCreature follower in player.AllFollowers) { if (!UOACZSystem.IsUOACZValidMobile(follower)) { continue; } if (Utility.GetDistance(player.Location, follower.Location) > 12) { continue; } if (follower.Hits == follower.HitsMax) { continue; } m_Queue.Enqueue(follower); } while (m_Queue.Count > 0) { BaseCreature follower = (BaseCreature)m_Queue.Dequeue(); int healingAmount = (int)(Math.Round((double)follower.HitsMax * .25)); follower.Heal(healingAmount); follower.FixedParticles(0x376A, 9, 32, 5030, 0, 0, EffectLayer.Waist); follower.PlaySound(0x202); } break; case TypeOfBrain.CooldownReduction: player.FixedParticles(0x373A, 10, 15, 5036, EffectLayer.Head); player.PlaySound(0x3BD); foreach (UOACZUndeadAbilityEntry abilityEntry in player.m_UOACZAccountEntry.UndeadProfile.m_Abilities) { DateTime cooldown = abilityEntry.m_NextUsageAllowed; double cooldownReduction = abilityEntry.m_CooldownMinutes * .20; abilityEntry.m_NextUsageAllowed = abilityEntry.m_NextUsageAllowed.Subtract(TimeSpan.FromMinutes(cooldownReduction)); } UOACZSystem.RefreshAllGumps(player); break; } }); Delete(); }
public virtual void TurnCorrupted(Mobile from) { if (!UOACZSystem.IsUOACZValidMobile(from)) { return; } if (Corrupted) { return; } if (from is PlayerMobile) { PlayerMobile player = from as PlayerMobile; UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.WildlifeCorrupted++; } UOACZEvents.SpreadCorruption(); Combatant = null; Aggressed.Clear(); Aggressors.Clear(); Warmode = false; m_Corrupted = true; Hue = CorruptHue; Name = CorruptedName; CorpseNameOverride = CorruptedCorpseName; PublicOverheadMessage(MessageType.Regular, 2210, false, "*becomes corrupted*"); Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2530, 0, 2023, 0); TimedStatic greenGoo = new TimedStatic(0x122D, 5); greenGoo.Name = "corruption"; greenGoo.Hue = 2530; greenGoo.MoveToWorld(Location, Map); PlaySound(GetAngerSound()); PlaySound(0x62B); for (int a = 0; a < 4; a++) { greenGoo = new TimedStatic(Utility.RandomList(4651, 4652, 4653, 4654), 5); greenGoo.Name = "corruption"; greenGoo.Hue = 2530; Point3D targetLocation = new Point3D(Location.X + Utility.RandomList(-1, 1), Location.Y + Utility.RandomList(-1, 1), Location.Y); SpellHelper.AdjustField(ref targetLocation, Map, 12, false); greenGoo.MoveToWorld(targetLocation, Map); } SetCorruptAI(); DamageMin = (int)(Math.Round((double)DamageMin * CorruptedDamageScalar)); DamageMax = (int)(Math.Round((double)DamageMax * CorruptedDamageScalar)); AttackSpeed = (int)(Math.Round((double)AttackSpeed * CorruptedAttackSpeedScalar)); Skills.Wrestling.Base *= CorruptedWrestlingScalar; }
public override void OnDoubleClick(Mobile from) { PlayerMobile player = from as PlayerMobile; if (player == null) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (!IsChildOf(player.Backpack)) { player.SendMessage("That dye must be in your pack in order to use it."); return; } if (!player.IsUOACZUndead) { player.SendMessage("Only Undead players may use this."); return; } if (m_Owner != null) { if (m_Owner.Account != null) { string ownerAccountName = m_Owner.Account.Username; string playerAccountName = player.Account.Username; if (ownerAccountName != playerAccountName) { player.SendMessage("Only the owner of this item may use this."); return; } } } if (player.m_UOACZAccountEntry.UndeadProfile.DyedHueMod == DyedHue) { player.SendMessage("You are already that hue."); return; } player.m_UOACZAccountEntry.UndeadProfile.DyedHueMod = DyedHue; player.m_UOACZAccountEntry.UndeadProfile.HueMod = DyedHue; player.HueMod = DyedHue; from.PlaySound(0x23E); UsesRemaining--; if (UsesRemaining <= 0) { from.SendMessage("You use the last dye charge."); Delete(); } else { from.SendMessage("You change your hue."); } }
public override void OnResponse(NetState sender, RelayInfo info) { PlayerMobile player = sender.Mobile as PlayerMobile; if (player == null) { return; } if (player == null) { return; } if (player.Deleted) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); bool closeGump = true; switch (info.ButtonID) { //UOACZ Guide Website case 1: string url = "http://forum.uoancorp.com/threads/the-monstrous-uoacz-guide.10635/"; player.LaunchBrowser(url); closeGump = false; break; //Human Team case 2: player.m_UOACZAccountEntry.m_TeamSelectIndex = 0; player.SendSound(UOACZSystem.selectionSound); closeGump = false; break; //Undead Team case 3: player.m_UOACZAccountEntry.m_TeamSelectIndex = 1; player.SendSound(UOACZSystem.selectionSound); closeGump = false; break; //Confirm Team Change case 4: if ((player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Human && player.m_UOACZAccountEntry.m_TeamSelectIndex == 1) || (player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Undead && player.m_UOACZAccountEntry.m_TeamSelectIndex == 0)) { if (UOACZPersistance.Active) { if (player.m_UOACZAccountEntry.NextTeamSwitchAllowed <= DateTime.UtcNow) { if (player.LastPlayerCombatTime + UOACZSystem.TeamSwitchPvPThreshold > DateTime.UtcNow) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.LastPlayerCombatTime + UOACZSystem.TeamSwitchPvPThreshold, false, true, true, true, true); player.SendMessage("You have been in PvP too recently to switch teams. You must wait another " + timeRemaining + "."); } else if (player.Frozen || player.CantWalk) { player.SendMessage("You are currently frozen and must wait a few moments before you may switch teams."); } else { if (player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Human) { UOACZSystem.SwitchTeams(player, true); } else if (player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Undead) { UOACZSystem.SwitchTeams(player, false); } } } } else { if (player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Human) { UOACZSystem.SwitchTeams(player, true); } else if (player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Undead) { UOACZSystem.SwitchTeams(player, false); } } } closeGump = false; break; } if (!closeGump) { player.SendGump(new UOACZOverviewGump(player)); } else { player.CloseGump(typeof(UOACZOverviewGump)); player.SendSound(UOACZSystem.closeGumpSound); } }
public virtual void Consume(PlayerMobile player) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); switch (ConsumptionType) { case ConsumptionMode.Food: player.PlaySound(Utility.RandomList(0x5DA, 0x5A9, 0x5AB, 0x03A, 0x03B, 0x03C)); player.Animate(34, 5, 1, true, false, 0); player.m_UOACZAccountEntry.FoodItemsConsumed++; break; case ConsumptionMode.Drink: Effects.PlaySound(player.Location, player.Map, Utility.RandomList(0x030, 0x031, 0x050)); player.Animate(34, 5, 1, true, false, 0); player.m_UOACZAccountEntry.DrinkItemsConsumed++; break; } Charges--; DropContainerToPlayer(player); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (player == null) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (player.Deleted || !player.Alive) { return; } if (player.m_UOACZAccountEntry.ActiveProfile != UOACZAccountEntry.ActiveProfileType.Human) { return; } player.Heal(HitsChange); player.Stam += StamChange; player.Mana += ManaChange; int baseDiseaseAmount = 0; double diseaseAmount = 0; if (ConsumptionQualityType == ConsumptionQuality.Raw) { player.SendMessage("You eat the raw meat and wish it had been cooked first."); baseDiseaseAmount = UOACZSystem.RawMeatDiseaseAmount; diseaseAmount = UOACZSystem.RawMeatDiseaseAmount; } if (ConsumptionQualityType == ConsumptionQuality.Corrupted) { player.SendMessage("You eat the corrupted meat and wish it had been purified alchemically first."); baseDiseaseAmount = UOACZSystem.CorruptedMeatDiseaseAmount; diseaseAmount = UOACZSystem.CorruptedMeatDiseaseAmount; } if (diseaseAmount > 0) { bool foundDisease = false; Queue m_EntriesToRemove = new Queue(); foreach (SpecialAbilityEffectEntry entry in player.m_SpecialAbilityEffectEntries) { if (entry.m_SpecialAbilityEffect == SpecialAbilityEffect.Disease && DateTime.UtcNow < entry.m_Expiration) { if (!foundDisease) { diseaseAmount += entry.m_Value; foundDisease = true; } m_EntriesToRemove.Enqueue(entry); } } while (m_EntriesToRemove.Count > 0) { SpecialAbilityEffectEntry entry = (SpecialAbilityEffectEntry)m_EntriesToRemove.Dequeue(); player.m_SpecialAbilityEffectEntries.Remove(entry); } if (!player.Hidden) { Effects.PlaySound(player.Location, player.Map, 0x5CB); Effects.SendLocationParticles(EffectItem.Create(player.Location, player.Map, TimeSpan.FromSeconds(0.25)), 0x376A, 10, 20, 2199, 0, 5029, 0); player.PublicOverheadMessage(MessageType.Regular, 1103, false, "*looks violently ill*"); Blood blood = new Blood(); blood.Hue = 2200; blood.MoveToWorld(player.Location, player.Map); int extraBlood = Utility.RandomMinMax(1, 2); for (int i = 0; i < extraBlood; i++) { Blood moreBlood = new Blood(); moreBlood.Hue = 2200; moreBlood.MoveToWorld(new Point3D(player.Location.X + Utility.RandomMinMax(-1, 1), player.Location.Y + Utility.RandomMinMax(-1, 1), player.Location.Z), player.Map); } } AOS.Damage(player, null, baseDiseaseAmount, 0, 100, 0, 0, 0); SpecialAbilities.DiseaseSpecialAbility(1.0, player, player, diseaseAmount, UOACZSystem.FoodDiseaseSeconds, 0, false, "", ""); } UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.Hunger, HungerChange, true); UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.Thirst, ThirstChange, true); }); }
public override void AfterReceiveDamage(Mobile from, int damage, InteractionType interactionType) { base.AfterReceiveDamage(from, damage, interactionType); PlayerMobile player = from as PlayerMobile; if (player != null) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.TotalObjectDamage++; } if (this is UOACZCorruptionSourcestone) { UOACZEvents.SourceOfCorruptionDamaged(false); if (player != null) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (player.IsUOACZHuman) { if (Utility.RandomDouble() <= UOACZSystem.HumanDamageSourceStoneScoreChance) { UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.HumanScore, 1, true); } if (player.Backpack != null) { if (Utility.RandomDouble() <= UOACZSystem.HumanDamageSourceStoneSurvivalStoneChance * UOACZPersistance.HumanBalanceScalar) { player.Backpack.DropItem(new UOACZSurvivalStone(player)); player.SendMessage(UOACZSystem.greenTextHue, "You have earned a survival stone for damaging the corruption sourcestone!"); } if (Utility.RandomDouble() <= UOACZSystem.HumanDamageSourceStoneUpgradeTokenChance * UOACZPersistance.HumanBalanceScalar) { player.Backpack.DropItem(new UOACZHumanUpgradeToken(player)); player.SendMessage(UOACZSystem.greenTextHue, "You have earned an upgrade token for damaging the corruption sourcestone!"); } } } } } else if (this is UOACZStockpile) { if (player != null) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (player.IsUOACZUndead) { if (Utility.RandomDouble() <= UOACZSystem.UndeadDamageStockpileScoreChance) { UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.UndeadScore, 1, true); } if (Utility.RandomDouble() <= UOACZSystem.UndeadDamageStockpileCorruptionTokenChance * UOACZPersistance.UndeadBalanceScalar) { if (player.Backpack != null) { player.Backpack.DropItem(new UOACZCorruptionStone(player)); player.SendMessage(UOACZSystem.greenTextHue, "You have received a corruption stone for damaging a stockpile!"); } } if (Utility.RandomDouble() <= UOACZSystem.UndeadDamageStockpileUpgradeTokenChance * UOACZPersistance.UndeadBalanceScalar) { if (player.Backpack != null) { player.Backpack.DropItem(new UOACZUndeadUpgradeToken(player)); player.SendMessage(UOACZSystem.greenTextHue, "You have received an upgrade token for damaging a stockpile!"); } } if (Utility.RandomDouble() <= UOACZSystem.UndeadDamageStockpileRewardChance * UOACZPersistance.UndeadBalanceScalar) { if (player.Backpack != null) { player.Backpack.DropItem(new UOACZBrains()); player.SendMessage(UOACZSystem.greenTextHue, "You have received a reward for damaging a stockpile!"); } } } } } else { if (player != null) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (player.IsUOACZUndead) { bool outpostObject = false; if (UOACZPersistance.m_OutpostComponents.Contains(this)) { outpostObject = true; } double scoreChance = UOACZSystem.UndeadDamageObjectScoreChance; double corruptionChance = UOACZSystem.UndeadDamageObjectCorruptionTokenChance * UOACZPersistance.UndeadBalanceScalar; double upgradeChance = UOACZSystem.UndeadDamageObjectUpgradeTokenChance * UOACZPersistance.UndeadBalanceScalar; double rewardChance = UOACZSystem.UndeadDamageObjectRewardChance * UOACZPersistance.UndeadBalanceScalar; if (outpostObject) { scoreChance *= UOACZSystem.UndeadDamageOutpostRewardReduction; corruptionChance *= UOACZSystem.UndeadDamageOutpostRewardReduction; upgradeChance *= UOACZSystem.UndeadDamageOutpostRewardReduction; rewardChance *= UOACZSystem.UndeadDamageOutpostRewardReduction; if (UOACZPersistance.m_HumanObjective1 == UOACZPersistance.m_HumanObjective1Target) { scoreChance *= UOACZSystem.UndeadDamageOutpostAlreadyBuiltRewardReduction; corruptionChance *= UOACZSystem.UndeadDamageOutpostAlreadyBuiltRewardReduction; upgradeChance *= UOACZSystem.UndeadDamageOutpostAlreadyBuiltRewardReduction; rewardChance *= UOACZSystem.UndeadDamageOutpostAlreadyBuiltRewardReduction; } } if (Utility.RandomDouble() <= scoreChance) { UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.UndeadScore, 1, true); } if (player.Backpack != null) { if (Utility.RandomDouble() <= corruptionChance) { player.Backpack.DropItem(new UOACZCorruptionStone(player)); player.SendMessage(UOACZSystem.greenTextHue, "You have earned a corruption stone for destruction!"); } if (Utility.RandomDouble() <= upgradeChance) { player.Backpack.DropItem(new UOACZUndeadUpgradeToken(player)); player.SendMessage(UOACZSystem.greenTextHue, "You have earned an upgrade token for destruction!"); } if (Utility.RandomDouble() <= rewardChance) { player.Backpack.DropItem(new UOACZBrains()); player.SendMessage(UOACZSystem.greenTextHue, "You have received a reward for destruction."); } } } } } }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (from == null) { return; } if (from.Deleted) { return; } if (player == null) { return; } if (player.Deleted) { return; } bool resendGump = false; UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); //Score Pages if (player.m_UOACZAccountEntry.ScorePage == UOACZAccountEntry.ScorePageType.Previous || player.m_UOACZAccountEntry.ScorePage == UOACZAccountEntry.ScorePageType.Lifetime || player.m_UOACZAccountEntry.ScorePage == UOACZAccountEntry.ScorePageType.Best) { if (info.ButtonID == 6) { if (allowScoreRecordsPrevious) { player.m_UOACZAccountEntry.ScorePageNumber--; resendGump = true; } } if (info.ButtonID == 7) { if (allowScoreRecordsNext) { player.m_UOACZAccountEntry.ScorePageNumber++; resendGump = true; } } } //Rewards and Unlockables if (player.m_UOACZAccountEntry.ScorePage == UOACZAccountEntry.ScorePageType.RewardsTomesUnlocks) { if (info.ButtonID == 6) { if (allowRewardsPrevious) { player.SendSound(UOACZSystem.changeGumpSound); player.m_UOACZAccountEntry.RewardPage--; resendGump = true; } } if (info.ButtonID == 7) { if (allowRewardsNext) { player.SendSound(UOACZSystem.changeGumpSound); player.m_UOACZAccountEntry.RewardPage++; resendGump = true; } } if (info.ButtonID == 8) { if (allowUnlockablesPrevious) { player.SendSound(UOACZSystem.changeGumpSound); player.m_UOACZAccountEntry.UnlockablesPage--; resendGump = true; } } if (info.ButtonID == 9) { if (allowUnlockablesNext) { player.SendSound(UOACZSystem.changeGumpSound); player.m_UOACZAccountEntry.UnlockablesPage++; resendGump = true; } } //Reward: Purchase if (info.ButtonID >= 20 && info.ButtonID < 30) { int rewardIndex = (info.ButtonID - 20) + (player.m_UOACZAccountEntry.RewardPage * RewardsPerPage); int rewardsAvailable = Enum.GetNames(typeof(UOACZRewardType)).Length; if (rewardIndex >= rewardsAvailable) { return; } UOACZRewardType rewardType = (UOACZRewardType)rewardIndex; UOACZRewards.AttemptPurchase(player, rewardType); resendGump = true; } //Reward: Info if (info.ButtonID >= 30 && info.ButtonID < 40) { int rewardIndex = (info.ButtonID - 30) + (player.m_UOACZAccountEntry.RewardPage * RewardsPerPage); int rewardsAvailable = Enum.GetNames(typeof(UOACZRewardType)).Length; if (rewardIndex >= rewardsAvailable) { return; } UOACZRewardType rewardType = (UOACZRewardType)rewardIndex; UOACZRewardDetail rewardDetail = UOACZRewards.GetRewardDetail(rewardType); string description = ""; if (rewardDetail.Description != null) { for (int a = 0; a < rewardDetail.Description.Length; a++) { description += rewardDetail.Description[a]; } } player.SendMessage(UOACZSystem.yellowTextHue, description); resendGump = true; } //Unlockable: Activate if (info.ButtonID >= 40 && info.ButtonID < 50) { int unlockableIndex = (info.ButtonID - 40) + (player.m_UOACZAccountEntry.UnlockablesPage * RewardsPerPage); int unlockablesAvailable = Enum.GetNames(typeof(UOACZUnlockableType)).Length; if (unlockableIndex >= unlockablesAvailable) { return; } UOACZUnlockableType unlockableType = (UOACZUnlockableType)unlockableIndex; UOACZUnlockableDetail unlockableDetail = UOACZUnlockables.GetUnlockableDetail(unlockableType); UOACZUnlockableDetailEntry unlockableDetailEntry = UOACZUnlockables.GetUnlockableDetailEntry(player, unlockableType); bool deactivatedOthers = false; if (unlockableDetailEntry != null) { if (unlockableDetailEntry.m_Unlocked) { if (!unlockableDetailEntry.m_Active) { unlockableDetailEntry.m_Active = true; player.SendSound(UOACZSystem.selectionSound); if (unlockableDetail.UnlockableCategory == UOACZUnlockableCategory.UndeadDye) { player.SendMessage("You activate the unlockable."); } else { foreach (UOACZUnlockableDetailEntry otherUnlockableEntry in player.m_UOACZAccountEntry.m_Unlockables) { if (otherUnlockableEntry.m_UnlockableType == unlockableType) { continue; } UOACZUnlockableDetail otherUnlockableDetail = UOACZUnlockables.GetUnlockableDetail(otherUnlockableEntry.m_UnlockableType); if (otherUnlockableDetail.UnlockableCategory == unlockableDetail.UnlockableCategory) { if (otherUnlockableEntry.m_Unlocked) { otherUnlockableEntry.m_Active = false; deactivatedOthers = true; } } } string categoryName = UOACZUnlockables.GetCategoryName(unlockableDetail.UnlockableCategory); player.SendMessage("You set the item as your unlockable for the category: " + categoryName); } } else { unlockableDetailEntry.m_Active = false; player.SendSound(UOACZSystem.selectionSound); } } } resendGump = true; } //Unlockable: Info if (info.ButtonID >= 50 && info.ButtonID < 60) { int unlockableIndex = (info.ButtonID - 50) + (player.m_UOACZAccountEntry.UnlockablesPage * RewardsPerPage); int unlockablesAvailable = Enum.GetNames(typeof(UOACZUnlockableType)).Length; if (unlockableIndex >= unlockablesAvailable) { return; } UOACZUnlockableType unlockableType = (UOACZUnlockableType)unlockableIndex; UOACZUnlockableDetail unlockableDetail = UOACZUnlockables.GetUnlockableDetail(unlockableType); string description = ""; if (unlockableDetail.Description != null) { for (int a = 0; a < unlockableDetail.Description.Length; a++) { description += unlockableDetail.Description[a]; } } string categoryName = UOACZUnlockables.GetCategoryName(unlockableDetail.UnlockableCategory); description += " [Category: " + categoryName + "]"; player.SendMessage(UOACZSystem.yellowTextHue, description); resendGump = true; } } //Navigation if (info.ButtonID == 1) { player.m_UOACZAccountEntry.ScorePage = UOACZAccountEntry.ScorePageType.Lifetime; player.m_UOACZAccountEntry.ScorePageNumber = 0; player.SendSound(UOACZSystem.changeGumpSound); resendGump = true; } else if (info.ButtonID == 2) { player.m_UOACZAccountEntry.ScorePage = UOACZAccountEntry.ScorePageType.Best; player.m_UOACZAccountEntry.ScorePageNumber = 0; player.SendSound(UOACZSystem.changeGumpSound); resendGump = true; } else if (info.ButtonID == 3) { player.m_UOACZAccountEntry.ScorePage = UOACZAccountEntry.ScorePageType.Previous; player.m_UOACZAccountEntry.ScorePageNumber = 0; player.SendSound(UOACZSystem.changeGumpSound); resendGump = true; } else if (info.ButtonID == 4) { player.m_UOACZAccountEntry.ScorePage = UOACZAccountEntry.ScorePageType.RewardsTomesUnlocks; player.m_UOACZAccountEntry.ScorePageNumber = 0; player.SendSound(UOACZSystem.changeGumpSound); resendGump = true; } else if (info.ButtonID == 5) { if (player.AccessLevel > AccessLevel.Player) { player.m_UOACZAccountEntry.ScorePage = UOACZAccountEntry.ScorePageType.Admin; player.m_UOACZAccountEntry.ScorePageNumber = 0; player.SendSound(UOACZSystem.changeGumpSound); resendGump = true; } } if (resendGump) { player.CloseGump(typeof(UOACZScoreGump)); player.SendGump(new UOACZScoreGump(player)); } else { player.SendSound(UOACZSystem.closeGumpSound); } }
public UOACZScoreGump(PlayerMobile pm_Mobile) : base(10, 10) { if (pm_Mobile == null) { return; } if (pm_Mobile.Deleted) { return; } player = pm_Mobile; UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (player.m_UOACZAccountEntry == null) { return; } Closable = true; Disposable = true; Dragable = true; Resizable = false; AddImage(0, 44, 202); AddImage(44, 0, 201); AddImage(0, 0, 206); AddImage(0, 468, 204); AddImage(590, 1, 207); AddImage(590, 468, 205); AddImage(44, 468, 233); AddImage(590, 45, 203); AddImageTiled(44, 44, 546, 424, 200); AddImage(0, 152, 202); AddImage(163, 0, 201); AddImage(166, 468, 233); AddImage(590, 152, 203); AddImage(600, 46, 10441); //-------- int boldTextHue = 149; int normalTextHue = 2036; int startY = 75; int HumanRankX = 47; int HumanCharacterX = 115; int HumanScoreX = 187; int UndeadRankX = 247; int UndeadCharacterX = 315; int UndeadScoreX = 387; int TotalRankX = 447; int TotalCharacterX = 515; int TotalScoreX = 587; string nextSessionText = ""; if (UOACZPersistance.Enabled) { if (UOACZPersistance.Active) { nextSessionText = "Active UOACZ Session Ends in " + Utility.CreateTimeRemainingString(DateTime.UtcNow, UOACZPersistance.m_CurrentSessionExpiration, true, true, true, true, true); } else { nextSessionText = "Next UOACZ Session Starts in " + Utility.CreateTimeRemainingString(DateTime.UtcNow, UOACZPersistance.m_NextScheduledSessionStartTime, true, true, true, true, true); } } string headerText = ""; string rankText = ""; string nameText = ""; string scoreText = ""; int textHue = UOACZSystem.greenTextHue; int characterHue = normalTextHue; int startingIndex = 0; bool useScoringTemplate = false; if (player.m_UOACZAccountEntry.ScorePage == UOACZAccountEntry.ScorePageType.Previous) { useScoringTemplate = true; } if (player.m_UOACZAccountEntry.ScorePage == UOACZAccountEntry.ScorePageType.Best) { useScoringTemplate = true; } if (player.m_UOACZAccountEntry.ScorePage == UOACZAccountEntry.ScorePageType.Lifetime) { useScoringTemplate = true; } if (useScoringTemplate) { AddLabel(70, startY, UOACZSystem.blueTextHue, "Human Scores"); AddLabel(275, startY, UOACZSystem.redTextHue, "Undead Scores"); AddLabel(480, startY, UOACZSystem.purpleTextHue, "Total Scores"); startY += 35; AddLabel(30, startY, boldTextHue, "Rank"); AddLabel(85, startY, boldTextHue, "Character"); AddLabel(170, startY, boldTextHue, "Score"); AddLabel(230, startY, boldTextHue, "Rank"); AddLabel(285, startY, boldTextHue, "Character"); AddLabel(370, startY, boldTextHue, "Score"); AddLabel(430, startY, boldTextHue, "Rank"); AddLabel(485, startY, boldTextHue, "Character"); AddLabel(570, startY, boldTextHue, "Score"); startY += 40; AddImage(30, 100, 3001); AddImage(270, 100, 3001); AddImage(350, 100, 3001); AddImage(30, 135, 3001); AddImage(270, 135, 3001); AddImage(350, 135, 3001); AddImage(30, 400, 3001); AddImage(270, 400, 3001); AddImage(350, 400, 3001); AddImage(215, 105, 3003); AddImage(215, 158, 3003); AddImage(415, 105, 3003); AddImage(415, 158, 3003); } switch (player.m_UOACZAccountEntry.ScorePage) { case UOACZAccountEntry.ScorePageType.Previous: headerText = "UOACZ Most Recent Session Scores"; AddLabel(Utility.CenteredTextOffset(320, headerText), 16, boldTextHue, headerText); AddLabel(Utility.CenteredTextOffset(320, nextSessionText), 34, normalTextHue, nextSessionText); startingIndex = player.m_UOACZAccountEntry.ScorePageNumber * RecordsPerPage; if (startingIndex + RecordsPerPage <= UOACZPersistance.m_PreviousHumanScores.Count) { allowScoreRecordsNext = true; } if (startingIndex + RecordsPerPage <= UOACZPersistance.m_PreviousUndeadScores.Count) { allowScoreRecordsNext = true; } if (startingIndex + RecordsPerPage <= UOACZPersistance.m_PreviousTotalScores.Count) { allowScoreRecordsNext = true; } allowScoreRecordsPrevious = true; if (player.m_UOACZAccountEntry.ScorePageNumber == 0) { allowScoreRecordsPrevious = false; } //Populate Public Records for (int a = 0; a < RecordsPerPage; a++) { int adjustedIndex = startingIndex + a; //Human if (adjustedIndex <= UOACZPersistance.m_PreviousHumanScores.Count - 1) { UOACZAccountEntry HumanEntry = UOACZPersistance.m_PreviousHumanScores[adjustedIndex]; if (HumanEntry != null) { textHue = normalTextHue; characterHue = UOACZSystem.blueTextHue; if (player.m_UOACZAccountEntry == HumanEntry) { textHue = UOACZSystem.greenTextHue; characterHue = UOACZSystem.greenTextHue; } rankText = (adjustedIndex + 1).ToString(); nameText = HumanEntry.MostRecentPlayerString; scoreText = HumanEntry.PreviousSessionHumanScore.ToString(); AddLabel(Utility.CenteredTextOffset(HumanRankX, rankText), startY, textHue, rankText); AddLabel(Utility.CenteredTextOffset(HumanCharacterX, nameText), startY, characterHue, nameText); AddLabel(Utility.CenteredTextOffset(HumanScoreX, scoreText), startY, textHue, scoreText); } } //Undead if (adjustedIndex <= UOACZPersistance.m_PreviousUndeadScores.Count - 1) { UOACZAccountEntry UndeadEntry = UOACZPersistance.m_PreviousUndeadScores[adjustedIndex]; if (UndeadEntry != null) { textHue = normalTextHue; characterHue = UOACZSystem.redTextHue; if (player.m_UOACZAccountEntry == UndeadEntry) { textHue = UOACZSystem.greenTextHue; characterHue = UOACZSystem.greenTextHue; } rankText = (adjustedIndex + 1).ToString(); nameText = UndeadEntry.MostRecentPlayerString; scoreText = UndeadEntry.PreviousSessionUndeadScore.ToString(); AddLabel(Utility.CenteredTextOffset(UndeadRankX, rankText), startY, textHue, rankText); AddLabel(Utility.CenteredTextOffset(UndeadCharacterX, nameText), startY, characterHue, nameText); AddLabel(Utility.CenteredTextOffset(UndeadScoreX, scoreText), startY, textHue, scoreText); } } //Total if (adjustedIndex <= UOACZPersistance.m_PreviousTotalScores.Count - 1) { UOACZAccountEntry TotalEntry = UOACZPersistance.m_PreviousTotalScores[adjustedIndex]; if (TotalEntry != null) { textHue = normalTextHue; characterHue = UOACZSystem.purpleTextHue; if (player.m_UOACZAccountEntry == TotalEntry) { textHue = UOACZSystem.greenTextHue; characterHue = UOACZSystem.greenTextHue; } rankText = (adjustedIndex + 1).ToString(); nameText = TotalEntry.MostRecentPlayerString; scoreText = TotalEntry.PreviousSessionTotalScore.ToString(); AddLabel(Utility.CenteredTextOffset(TotalRankX, rankText), startY, textHue, rankText); AddLabel(Utility.CenteredTextOffset(TotalCharacterX, nameText), startY, characterHue, nameText); AddLabel(Utility.CenteredTextOffset(TotalScoreX, scoreText), startY, textHue, scoreText); } } startY += 25; } break; case UOACZAccountEntry.ScorePageType.Best: headerText = "UOACZ Top Session Scores"; AddLabel(Utility.CenteredTextOffset(320, headerText), 16, boldTextHue, headerText); AddLabel(Utility.CenteredTextOffset(320, nextSessionText), 34, normalTextHue, nextSessionText); startingIndex = player.m_UOACZAccountEntry.ScorePageNumber * RecordsPerPage; if (startingIndex + RecordsPerPage <= UOACZPersistance.m_BestHumanScores.Count) { allowScoreRecordsNext = true; } if (startingIndex + RecordsPerPage <= UOACZPersistance.m_BestUndeadScores.Count) { allowScoreRecordsNext = true; } if (startingIndex + RecordsPerPage <= UOACZPersistance.m_BestTotalScores.Count) { allowScoreRecordsNext = true; } allowScoreRecordsPrevious = true; if (player.m_UOACZAccountEntry.ScorePageNumber == 0) { allowScoreRecordsPrevious = false; } //Populate Public Records for (int a = 0; a < RecordsPerPage; a++) { int adjustedIndex = startingIndex + a; //Human if (adjustedIndex <= UOACZPersistance.m_BestHumanScores.Count - 1) { UOACZAccountEntry HumanEntry = UOACZPersistance.m_BestHumanScores[adjustedIndex]; if (HumanEntry != null) { textHue = normalTextHue; characterHue = UOACZSystem.blueTextHue; if (player.m_UOACZAccountEntry == HumanEntry) { textHue = UOACZSystem.greenTextHue; characterHue = UOACZSystem.greenTextHue; } rankText = (adjustedIndex + 1).ToString(); nameText = HumanEntry.MostRecentPlayerString; scoreText = HumanEntry.BestHumanScore.ToString(); AddLabel(Utility.CenteredTextOffset(HumanRankX, rankText), startY, textHue, rankText); AddLabel(Utility.CenteredTextOffset(HumanCharacterX, nameText), startY, characterHue, nameText); AddLabel(Utility.CenteredTextOffset(HumanScoreX, scoreText), startY, textHue, scoreText); } } //Undead if (adjustedIndex <= UOACZPersistance.m_BestUndeadScores.Count - 1) { UOACZAccountEntry UndeadEntry = UOACZPersistance.m_BestUndeadScores[adjustedIndex]; if (UndeadEntry != null) { textHue = normalTextHue; characterHue = UOACZSystem.redTextHue; if (player.m_UOACZAccountEntry == UndeadEntry) { textHue = UOACZSystem.greenTextHue; characterHue = UOACZSystem.greenTextHue; } rankText = (adjustedIndex + 1).ToString(); nameText = UndeadEntry.MostRecentPlayerString; scoreText = UndeadEntry.BestUndeadScore.ToString(); AddLabel(Utility.CenteredTextOffset(UndeadRankX, rankText), startY, textHue, rankText); AddLabel(Utility.CenteredTextOffset(UndeadCharacterX, nameText), startY, characterHue, nameText); AddLabel(Utility.CenteredTextOffset(UndeadScoreX, scoreText), startY, textHue, scoreText); } } //Total if (adjustedIndex <= UOACZPersistance.m_BestTotalScores.Count - 1) { UOACZAccountEntry TotalEntry = UOACZPersistance.m_BestTotalScores[adjustedIndex]; if (TotalEntry != null) { textHue = normalTextHue; characterHue = UOACZSystem.purpleTextHue; if (player.m_UOACZAccountEntry == TotalEntry) { textHue = UOACZSystem.greenTextHue; characterHue = UOACZSystem.greenTextHue; } rankText = (adjustedIndex + 1).ToString(); nameText = TotalEntry.MostRecentPlayerString; scoreText = TotalEntry.BestTotalScore.ToString(); AddLabel(Utility.CenteredTextOffset(TotalRankX, rankText), startY, textHue, rankText); AddLabel(Utility.CenteredTextOffset(TotalCharacterX, nameText), startY, characterHue, nameText); AddLabel(Utility.CenteredTextOffset(TotalScoreX, scoreText), startY, textHue, scoreText); } } startY += 25; } break; case UOACZAccountEntry.ScorePageType.Lifetime: headerText = "UOACZ Lifetime Total Scores"; AddLabel(Utility.CenteredTextOffset(320, headerText), 16, boldTextHue, headerText); AddLabel(Utility.CenteredTextOffset(320, nextSessionText), 34, normalTextHue, nextSessionText); startingIndex = player.m_UOACZAccountEntry.ScorePageNumber * RecordsPerPage; if (startingIndex + RecordsPerPage <= UOACZPersistance.m_LifetimeHumanScores.Count) { allowScoreRecordsNext = true; } if (startingIndex + RecordsPerPage <= UOACZPersistance.m_LifetimeUndeadScores.Count) { allowScoreRecordsNext = true; } if (startingIndex + RecordsPerPage <= UOACZPersistance.m_LifetimeTotalScores.Count) { allowScoreRecordsNext = true; } allowScoreRecordsPrevious = true; if (player.m_UOACZAccountEntry.ScorePageNumber == 0) { allowScoreRecordsPrevious = false; } //Populate Public Records for (int a = 0; a < RecordsPerPage; a++) { int adjustedIndex = startingIndex + a; //Human if (adjustedIndex <= UOACZPersistance.m_LifetimeHumanScores.Count - 1) { UOACZAccountEntry HumanEntry = UOACZPersistance.m_LifetimeHumanScores[adjustedIndex]; if (HumanEntry != null) { textHue = normalTextHue; characterHue = UOACZSystem.blueTextHue; if (player.m_UOACZAccountEntry == HumanEntry) { textHue = UOACZSystem.greenTextHue; characterHue = UOACZSystem.greenTextHue; } rankText = (adjustedIndex + 1).ToString(); nameText = HumanEntry.MostRecentPlayerString; scoreText = HumanEntry.LifetimeHumanScore.ToString(); AddLabel(Utility.CenteredTextOffset(HumanRankX, rankText), startY, textHue, rankText); AddLabel(Utility.CenteredTextOffset(HumanCharacterX, nameText), startY, characterHue, nameText); AddLabel(Utility.CenteredTextOffset(HumanScoreX, scoreText), startY, textHue, scoreText); } } //Undead if (adjustedIndex <= UOACZPersistance.m_LifetimeUndeadScores.Count - 1) { UOACZAccountEntry UndeadEntry = UOACZPersistance.m_LifetimeUndeadScores[adjustedIndex]; if (UndeadEntry != null) { textHue = normalTextHue; characterHue = UOACZSystem.redTextHue; if (player.m_UOACZAccountEntry == UndeadEntry) { textHue = UOACZSystem.greenTextHue; characterHue = UOACZSystem.greenTextHue; } rankText = (adjustedIndex + 1).ToString(); nameText = UndeadEntry.MostRecentPlayerString; scoreText = UndeadEntry.LifetimeUndeadScore.ToString(); AddLabel(Utility.CenteredTextOffset(UndeadRankX, rankText), startY, textHue, rankText); AddLabel(Utility.CenteredTextOffset(UndeadCharacterX, nameText), startY, characterHue, nameText); AddLabel(Utility.CenteredTextOffset(UndeadScoreX, scoreText), startY, textHue, scoreText); } } //Total if (adjustedIndex <= UOACZPersistance.m_LifetimeTotalScores.Count - 1) { UOACZAccountEntry TotalEntry = UOACZPersistance.m_LifetimeTotalScores[adjustedIndex]; if (TotalEntry != null) { textHue = normalTextHue; characterHue = UOACZSystem.purpleTextHue; if (player.m_UOACZAccountEntry == TotalEntry) { textHue = UOACZSystem.greenTextHue; characterHue = UOACZSystem.greenTextHue; } rankText = (adjustedIndex + 1).ToString(); nameText = TotalEntry.MostRecentPlayerString; scoreText = TotalEntry.LifetimeTotalScore.ToString(); AddLabel(Utility.CenteredTextOffset(TotalRankX, rankText), startY, textHue, rankText); AddLabel(Utility.CenteredTextOffset(TotalCharacterX, nameText), startY, characterHue, nameText); AddLabel(Utility.CenteredTextOffset(TotalScoreX, scoreText), startY, textHue, scoreText); } } startY += 25; } break; case UOACZAccountEntry.ScorePageType.RewardsTomesUnlocks: headerText = "UOACZ Rewards and Unlockables"; AddLabel(Utility.CenteredTextOffset(320, headerText), 16, boldTextHue, headerText); AddLabel(130, 40, UOACZSystem.honorTextHue, "Tomes / Rewards"); AddLabel(25, 60, UOACZSystem.yellowTextHue, UOACZSystem.ParticipationRewardPoints.ToString() + " Points Earned For Session Total Score Above " + UOACZSystem.MinScoreToQualifyAsParticipant.ToString()); AddLabel(25, 80, UOACZSystem.yellowTextHue, UOACZSystem.HighestTotalScoreRewardPoints.ToString() + " Point Earned For Highest Session Total Score"); AddLabel(437, 40, UOACZSystem.lightPurpleTextHue, "UOACZ Unlockables"); AddLabel(410, 60, UOACZSystem.yellowTextHue, "Acquired in Dungeons as Loot"); AddLabel(410, 80, UOACZSystem.yellowTextHue, "Bonus UOACZ Starting Gear"); textHue = UOACZSystem.whiteTextHue; //normalTextHue //Tomes - Rewards int rewardIndex = player.m_UOACZAccountEntry.RewardPage * RewardsPerPage; int rewardsAvailable = Enum.GetNames(typeof(UOACZRewardType)).Length; int leftX = 45; int rightX = 345; startY = 115; if (player.m_UOACZAccountEntry.RewardPage > 0) { allowRewardsPrevious = true; } if (rewardIndex + RewardsPerPage < rewardsAvailable) { allowRewardsNext = true; } for (int a = 0; a < RewardsPerPage; a++) { rewardIndex = (player.m_UOACZAccountEntry.RewardPage * RewardsPerPage) + a; if (rewardIndex < rewardsAvailable) { UOACZRewardType rewardType = (UOACZRewardType)rewardIndex; UOACZRewardDetail rewardDetail = UOACZRewards.GetRewardDetail(rewardType); AddItem(leftX + rewardDetail.OffsetX, startY + rewardDetail.OffsetY, rewardDetail.ItemId, rewardDetail.ItemHue); AddButton(leftX + 45, startY + 5, 2151, 2154, 20 + a, GumpButtonType.Reply, 0); AddLabel(leftX + 85, startY, UOACZSystem.whiteTextHue, rewardDetail.Name); AddLabel(leftX + 85, startY + 20, normalTextHue, "Cost:"); if (rewardDetail.RewardCost >= 2) { AddLabel(leftX + 135, startY + 20, UOACZSystem.blueTextHue, rewardDetail.RewardCost.ToString() + " points"); } else if (rewardDetail.RewardCost == 1) { AddLabel(leftX + 135, startY + 20, UOACZSystem.blueTextHue, rewardDetail.RewardCost.ToString() + " point"); } else { AddLabel(leftX + 135, startY + 20, UOACZSystem.blueTextHue, "No Cost"); } AddButton(leftX + 205, startY + 23, 2118, 2118, 30 + a, GumpButtonType.Reply, 0); AddLabel(leftX + 225, startY + 20, UOACZSystem.lightGreenTextHue, "Info"); } startY += 50; } int pointsAvailable = player.m_UOACZAccountEntry.RewardPoints; AddLabel(leftX + 60, 370, UOACZSystem.blueTextHue, pointsAvailable.ToString() + " Points Available to Spend"); if (allowRewardsPrevious) { AddButton(leftX + 110, 395, 4014, 4016, 6, GumpButtonType.Reply, 0); //Previous } if (allowRewardsNext) { AddButton(leftX + 160, 395, 4005, 4007, 7, GumpButtonType.Reply, 0); //Next } //Unlockables int unlockablesIndex = player.m_UOACZAccountEntry.UnlockablesPage * RewardsPerPage; int unlockablesAvailable = Enum.GetNames(typeof(UOACZUnlockableType)).Length; startY = 115; if (player.m_UOACZAccountEntry.UnlockablesPage > 0) { allowUnlockablesPrevious = true; } if (unlockablesIndex + RewardsPerPage < unlockablesAvailable) { allowUnlockablesNext = true; } for (int a = 0; a < RewardsPerPage; a++) { unlockablesIndex = (player.m_UOACZAccountEntry.UnlockablesPage * RewardsPerPage) + a; if (unlockablesIndex < unlockablesAvailable) { UOACZUnlockableType unlockableType = (UOACZUnlockableType)unlockablesIndex; UOACZUnlockableDetail unlockableDetail = UOACZUnlockables.GetUnlockableDetail(unlockableType); UOACZUnlockableDetailEntry unlockableDetailEntry = UOACZUnlockables.GetUnlockableDetailEntry(player, unlockableType); bool unlocked = false; bool active = false; string textStatus = "Not Acquired"; if (unlockableDetailEntry != null) { unlocked = true; active = unlockableDetailEntry.m_Active; } textHue = UOACZSystem.whiteTextHue; if (unlocked) { if (active) { textStatus = "Active"; AddButton(rightX + 50, startY, 2154, 2151, 40 + a, GumpButtonType.Reply, 0); textHue = UOACZSystem.greenTextHue; } else { textStatus = "Disabled"; AddButton(rightX + 50, startY, 2151, 2154, 40 + a, GumpButtonType.Reply, 0); } } else { AddButton(rightX + 50, startY, 9721, 9721, 40 + a, GumpButtonType.Reply, 0); } AddItem(rightX + unlockableDetail.OffsetX, startY + unlockableDetail.OffsetY, unlockableDetail.ItemId, unlockableDetail.ItemHue); AddLabel(rightX + 90, startY, textHue, unlockableDetail.Name); AddLabel(rightX + 90, startY + 20, normalTextHue, textStatus); AddButton(rightX + 180, startY + 23, 2118, 2118, 50 + a, GumpButtonType.Reply, 0); AddLabel(rightX + 205, startY + 20, UOACZSystem.lightGreenTextHue, "Info"); } startY += 50; } if (allowUnlockablesPrevious) { AddButton(rightX + 60, 395, 4014, 4016, 8, GumpButtonType.Reply, 0); //Previous } if (allowUnlockablesNext) { AddButton(rightX + 110, 395, 4005, 4007, 9, GumpButtonType.Reply, 0); //Next } break; case UOACZAccountEntry.ScorePageType.Admin: headerText = "UOACZ Admin"; AddLabel(Utility.CenteredTextOffset(320, headerText), 16, boldTextHue, headerText); AddLabel(Utility.CenteredTextOffset(320, nextSessionText), 34, normalTextHue, nextSessionText); break; } //Page Buttons if (player.m_UOACZAccountEntry.ScorePage == UOACZAccountEntry.ScorePageType.Lifetime) { AddLabel(28, 440, boldTextHue, "Lifetime Totals"); AddButton(65, 460, 9724, 9721, 1, GumpButtonType.Reply, 0); } else { AddLabel(28, 440, normalTextHue, "Lifetime Totals"); AddButton(65, 460, 9721, 9724, 1, GumpButtonType.Reply, 0); } if (player.m_UOACZAccountEntry.ScorePage == UOACZAccountEntry.ScorePageType.Best) { AddLabel(185, 440, boldTextHue, "Top Sessions"); AddButton(210, 460, 9724, 9721, 2, GumpButtonType.Reply, 0); } else { AddLabel(185, 440, normalTextHue, "Top Sessions"); AddButton(210, 460, 9721, 9724, 2, GumpButtonType.Reply, 0); } if (player.m_UOACZAccountEntry.ScorePage == UOACZAccountEntry.ScorePageType.Previous) { AddLabel(320, 440, boldTextHue, "Most Recent Session"); AddButton(370, 460, 9724, 9721, 3, GumpButtonType.Reply, 0); } else { AddLabel(320, 440, normalTextHue, "Most Recent Session"); AddButton(370, 460, 9721, 9724, 3, GumpButtonType.Reply, 0); } if (player.m_UOACZAccountEntry.ScorePage == UOACZAccountEntry.ScorePageType.RewardsTomesUnlocks) { AddLabel(462, 440, boldTextHue, "Rewards / Unlockables"); AddButton(515, 460, 9724, 9721, 4, GumpButtonType.Reply, 0); } else { AddLabel(462, 440, normalTextHue, "Rewards / Unlockables"); AddButton(515, 460, 9721, 9724, 4, GumpButtonType.Reply, 0); } if (player.AccessLevel > AccessLevel.Player) { if (player.m_UOACZAccountEntry.ScorePage == UOACZAccountEntry.ScorePageType.Admin) { AddLabel(535, 415, boldTextHue, "Admin"); AddButton(578, 413, 9724, 9721, 5, GumpButtonType.Reply, 0); } else { AddLabel(535, 415, normalTextHue, "Admin"); AddButton(578, 413, 9721, 9724, 5, GumpButtonType.Reply, 0); } } //Previous if (allowScoreRecordsPrevious) { AddButton(185, 415, 4014, 4016, 6, GumpButtonType.Reply, 0); AddLabel(220, 415, normalTextHue, "Previous"); } //Next if (allowScoreRecordsNext) { AddButton(385, 415, 4005, 4007, 7, GumpButtonType.Reply, 0); AddLabel(425, 415, normalTextHue, "Next"); } }
public override void OnDeath(Container c) { base.OnDeath(c); //Player Swarm Followers if (TimesTamed > 0) { return; } int scoreValue = 1; int intestines = 0; int bones = 0; double intestineChance = 0; double normalItemChance = 0; double magicItemChance = 0; double survivalStoneChance = 0; double upgradeTokenChance = 0; #region Upgrade Chances switch (DifficultyValue) { case 1: scoreValue = 1; bones = 1; intestines = 1; intestineChance = .20; normalItemChance = .1; magicItemChance = .02; survivalStoneChance = .04; upgradeTokenChance = .02; break; case 2: scoreValue = 1; bones = 1; intestines = 1; intestineChance = .20; normalItemChance = 0.125; magicItemChance = 0.025; survivalStoneChance = .05; upgradeTokenChance = .025; break; case 3: scoreValue = 2; bones = 2; intestines = 1; intestineChance = .30; normalItemChance = .15; magicItemChance = .03; survivalStoneChance = .06; upgradeTokenChance = .03; break; case 4: scoreValue = 2; bones = 2; intestines = 1; intestineChance = .4; normalItemChance = .2; magicItemChance = .04; survivalStoneChance = .08; upgradeTokenChance = .04; break; case 5: scoreValue = 3; bones = 3; intestines = 1; intestineChance = .5; normalItemChance = .25; magicItemChance = .05; survivalStoneChance = .1; upgradeTokenChance = .05; break; case 6: scoreValue = 3; bones = 3; intestines = 1; intestineChance = .6; normalItemChance = .3; magicItemChance = .06; survivalStoneChance = .12; upgradeTokenChance = .06; break; case 7: scoreValue = 4; bones = 4; intestines = 1; intestineChance = .7; normalItemChance = .4; magicItemChance = .08; survivalStoneChance = .15; upgradeTokenChance = 0.075; break; case 8: scoreValue = 5; bones = 5; intestines = 1; intestineChance = .8; normalItemChance = .5; magicItemChance = .1; survivalStoneChance = .2; upgradeTokenChance = .1; break; case 9: scoreValue = 6; bones = 6; intestines = 1; intestineChance = .9; normalItemChance = 1; magicItemChance = .2; survivalStoneChance = .25; upgradeTokenChance = .125; break; case 10: scoreValue = 40; bones = 30; intestines = 1; intestineChance = 1; normalItemChance = 2; magicItemChance = 2; survivalStoneChance = 2; upgradeTokenChance = 2; break; case 11: scoreValue = 80; bones = 50; intestines = 1; intestineChance = 1; normalItemChance = 2; magicItemChance = 2; survivalStoneChance = 2; upgradeTokenChance = 2; break; } #endregion Dictionary <PlayerMobile, int> m_PlayerDamageDealt = new Dictionary <PlayerMobile, int>(); List <PlayerMobile> m_PotentialPlayers = new List <PlayerMobile>(); bool playerThresholdReached = false; int totalDamage = 0; int totalPlayerDamage = 0; //Determine Total Damaged Inflicted and Per Player foreach (DamageEntry entry in DamageEntries) { if (!entry.HasExpired) { Mobile damager = entry.Damager; if (damager == null) { continue; } totalDamage += entry.DamageGiven; PlayerMobile playerDamager = damager as PlayerMobile; if (playerDamager != null) { totalPlayerDamage += entry.DamageGiven; } BaseCreature creatureDamager = damager as BaseCreature; if (creatureDamager != null) { if (creatureDamager.ControlMaster is PlayerMobile) { totalPlayerDamage += entry.DamageGiven; } } } } foreach (DamageEntry entry in DamageEntries) { if (!entry.HasExpired && entry.DamageGiven > 0) { PlayerMobile player = null; Mobile damager = entry.Damager; if (damager == null) { continue; } if (damager.Deleted) { continue; } PlayerMobile pm_Damager = damager as PlayerMobile; BaseCreature bc_Damager = damager as BaseCreature; if (pm_Damager != null) { player = pm_Damager; } if (bc_Damager != null) { if (bc_Damager.Controlled && bc_Damager.ControlMaster is PlayerMobile) { if (!bc_Damager.ControlMaster.Deleted) { player = bc_Damager.ControlMaster as PlayerMobile; } } } if (player != null) { if (m_PlayerDamageDealt.ContainsKey(player)) { m_PlayerDamageDealt[player] += entry.DamageGiven; } else { m_PlayerDamageDealt.Add(player, entry.DamageGiven); } } } } Queue m_Queue = new Queue(); foreach (KeyValuePair <PlayerMobile, int> playerEntry in m_PlayerDamageDealt) { PlayerMobile player = playerEntry.Key; int damage = playerEntry.Value; if (player.IsUOACZHuman) { double damagePercentOfTotal = (double)damage / totalDamage; if (damage >= 100 || damagePercentOfTotal > .10) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.UndeadKilledAsHuman++; UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.HumanScore, scoreValue, true); m_PotentialPlayers.Add(player); } } } if (totalDamage == 0) { totalDamage = 1; } double playerDamageRatio = (double)totalPlayerDamage / (double)totalDamage; double npcHelpScalar = playerDamageRatio; intestineChance *= UOACZPersistance.HumanBalanceScalar; normalItemChance *= UOACZPersistance.HumanBalanceScalar; magicItemChance *= UOACZPersistance.HumanBalanceScalar; survivalStoneChance *= UOACZPersistance.HumanBalanceScalar; upgradeTokenChance *= UOACZPersistance.HumanBalanceScalar; if (playerDamageRatio >= .25) { if (bones > 0) { c.AddItem(new Bone(bones)); } if (Utility.RandomDouble() <= (intestineChance * npcHelpScalar)) { for (int a = 0; a < intestines; a++) { c.AddItem(new UOACZIntestines()); } } } if (Utility.RandomDouble() <= (normalItemChance * npcHelpScalar)) { if (Utility.RandomDouble() <= .4) { BaseWeapon weapon = UOACZSystem.GetRandomCrudeBoneWeapon(); if (weapon != null) { c.AddItem(weapon); } } else { BaseArmor armor = UOACZSystem.GetRandomCrudeBoneArmor(); if (armor != null) { c.AddItem(armor); } } } if (Utility.RandomDouble() <= (magicItemChance * npcHelpScalar)) { switch (Utility.RandomMinMax(1, 2)) { case 1: BaseWeapon weapon = Loot.RandomWeapon(); weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.RandomMinMax(1, 2); weapon.DamageLevel = (WeaponDamageLevel)Utility.RandomMinMax(1, 2); weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.RandomMinMax(1, 2); weapon.Identified = true; c.AddItem(weapon); break; case 2: BaseArmor armor = Loot.RandomArmorOrShield(); armor.ProtectionLevel = (ArmorProtectionLevel)Utility.RandomMinMax(1, 2); armor.DurabilityLevel = (ArmorDurabilityLevel)Utility.RandomMinMax(1, 2); armor.Identified = true; c.AddItem(armor); break; } } bool dropSurvivalStone = false; bool dropUpgradeToken = false; if (m_PotentialPlayers.Count >= 3) { survivalStoneChance *= .75; upgradeTokenChance *= .75; } if (m_PotentialPlayers.Count >= 5) { survivalStoneChance *= .75; upgradeTokenChance *= .75; } if (Utility.RandomDouble() <= (survivalStoneChance * npcHelpScalar)) { dropSurvivalStone = true; } if (Utility.RandomDouble() <= (upgradeTokenChance * npcHelpScalar)) { dropUpgradeToken = true; } foreach (PlayerMobile player in m_PotentialPlayers) { if (dropSurvivalStone) { c.AddItem(new UOACZSurvivalStone(player)); } if (dropUpgradeToken) { c.AddItem(new UOACZHumanUpgradeToken(player)); } } }
protected override void OnTarget(Mobile from, object target) { if (from == null || m_Net == null) { return; } if (from.Deleted || !from.Alive || m_Net.Deleted || m_Net.RootParent != from) { return; } PlayerMobile player = from as PlayerMobile; if (player == null) { return; } if (!m_Net.IsChildOf(player.Backpack)) { player.SendMessage("That item must be in your pack in order to use it."); return; } if (!player.CanBeginAction(typeof(UOACZThrowingNet))) { player.SendMessage("You may only use a net once every " + m_Net.CooldownSeconds.ToString() + " seconds."); return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } Mobile mobileTarget = null; if (target is Mobile) { mobileTarget = target as Mobile; } else { player.SendMessage("That is not a valid target."); return; } if (mobileTarget == player) { player.SendMessage("You cannot target yourself."); return; } if (!UOACZSystem.IsUOACZValidMobile(mobileTarget)) { player.SendMessage("That is not a valid target."); return; } if (Utility.GetDistance(player.Location, mobileTarget.Location) > 8) { from.SendMessage("That is too far away"); return; } if (!player.Map.InLOS(player.Location, mobileTarget.Location)) { player.SendMessage("That is not within in your line of sight."); return; } SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1, 1, true, 0, false, "", "", "-1"); if (!from.Mounted) { player.Animate(31, 7, 1, true, false, 0); } double duration = 60; if (mobileTarget is UOACZBaseWildlife) { duration = 60; } if (mobileTarget is UOACZBaseUndead) { UOACZBaseUndead bc_Undead = mobileTarget as UOACZBaseUndead; double reduction = 1 - (bc_Undead.Difficulty * .10); if (reduction < .10) { reduction = .10; } duration *= reduction; } if (mobileTarget is UOACZBaseHuman) { UOACZBaseCivilian bc_Human = mobileTarget as UOACZBaseCivilian; double reduction = 1 - (bc_Human.Difficulty * .10); if (reduction < .10) { reduction = .10; } duration *= reduction; } PlayerMobile playerTarget = mobileTarget as PlayerMobile; if (playerTarget != null) { if (playerTarget.IsUOACZHuman) { duration = Utility.RandomMinMax(2, 4); } if (playerTarget.IsUOACZUndead) { duration = Utility.RandomMinMax(5, 10); } } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.NetsThrown++; int itemId = m_Net.ItemID; int itemHue = m_Net.Hue; Effects.PlaySound(player.Location, player.Map, 0x5D3); player.DoHarmful(mobileTarget); Point3D playerLocation = player.Location; Map playerMap = player.Map; Point3D mobileLocation = mobileTarget.Location; Map mobileMap = mobileTarget.Map; IEntity startLocation = new Entity(Serial.Zero, new Point3D(playerLocation.X, playerLocation.Y, playerLocation.Z + 7), playerMap); IEntity endLocation = new Entity(Serial.Zero, new Point3D(mobileTarget.X, mobileTarget.Y, mobileTarget.Z), mobileMap); double distance = from.GetDistanceToSqrt(endLocation); double destinationDelay = (double)distance * .08; m_Net.Delete(); Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (!UOACZSystem.IsUOACZValidMobile(mobileTarget)) { return; } if (Utility.GetDistance(playerLocation, mobileLocation) >= 25) { return; } SpecialAbilities.HinderSpecialAbility(1.0, player, mobileTarget, 1, duration, true, -1, true, "You ensnare them in a net", "You have been ensnared in a net!", "-1"); for (int a = 0; a < 9; a++) { TimedStatic net = new TimedStatic(3538, duration - destinationDelay); Point3D netLocation = mobileTarget.Location; switch (a) { //Row 1 case 0: net.ItemID = 3538; netLocation = new Point3D(netLocation.X - 1, netLocation.Y - 1, netLocation.Z); break; case 1: net.ItemID = 3528; netLocation = new Point3D(netLocation.X, netLocation.Y - 1, netLocation.Z); break; case 2: net.ItemID = 3537; netLocation = new Point3D(netLocation.X + 1, netLocation.Y - 1, netLocation.Z); break; //Row 2 case 3: net.ItemID = 3539; netLocation = new Point3D(netLocation.X - 1, netLocation.Y, netLocation.Z); break; case 4: net.ItemID = 3530; netLocation = new Point3D(netLocation.X, netLocation.Y, netLocation.Z); break; case 5: net.ItemID = 3531; netLocation = new Point3D(netLocation.X + 1, netLocation.Y, netLocation.Z); break; //Row 3 case 6: net.ItemID = 3540; netLocation = new Point3D(netLocation.X - 1, netLocation.Y + 1, netLocation.Z); break; case 7: net.ItemID = 3529; netLocation = new Point3D(netLocation.X, netLocation.Y + 1, netLocation.Z); break; case 8: net.ItemID = 3541; netLocation = new Point3D(netLocation.X + 1, netLocation.Y + 1, netLocation.Z); break; } net.Hue = itemHue; net.Name = "a net"; net.MoveToWorld(netLocation, mobileMap); } }); }
public override void OnDoubleClick(Mobile from) { PlayerMobile player = from as PlayerMobile; if (player == null) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (player.IsUOACZHuman && DamageState != DamageStateType.Broken) { if (Utility.GetDistance(player.Location, Location) > InteractionRange) { player.SendMessage("You are too far away to use that."); return; } if (!from.CanBeginAction(typeof(UOACZBreakableDoor))) { from.SendMessage("You must wait a few moments before you may enter or exit again."); return; } if (player.m_UOACZAccountEntry.HumanProfile.HonorPoints <= UOACZSystem.HonorAggressionThreshold) { from.SendMessage("You are an outcast and not allowed to use this."); return; } Direction directionToDoor = Utility.GetDirection(Location, player.Location); Direction exitDirection = Server.Direction.Down; if (DoorFacing == DoorFacingType.EastWest) { switch (directionToDoor) { case Direction.Up: exitDirection = Direction.South; break; case Direction.North: exitDirection = Direction.South; break; case Direction.Right: exitDirection = Direction.South; break; case Direction.East: exitDirection = Direction.South; break; case Direction.Left: exitDirection = Direction.North; break; case Direction.South: exitDirection = Direction.North; break; case Direction.Down: exitDirection = Direction.North; break; case Direction.West: exitDirection = Direction.North; break; } } else { switch (directionToDoor) { case Direction.Left: exitDirection = Direction.East; break; case Direction.West: exitDirection = Direction.East; break; case Direction.Up: exitDirection = Direction.East; break; case Direction.North: exitDirection = Direction.East; break; case Direction.Right: exitDirection = Direction.West; break; case Direction.East: exitDirection = Direction.West; break; case Direction.Down: exitDirection = Direction.West; break; case Direction.South: exitDirection = Direction.West; break; } } Point3D newLocation = SpecialAbilities.GetPointByDirection(Location, exitDirection); player.Location = newLocation; player.PlaySound(InteractSound); player.RevealingAction(); from.BeginAction(typeof(UOACZBreakableDoor)); Timer.DelayCall(TimeSpan.FromSeconds(5), delegate { if (from != null) { from.EndAction(typeof(UOACZBreakableDoor)); } }); } else { base.OnDoubleClick(from); } }
public virtual void ResolveTrap(Mobile from) { switch (m_TrapType) { case ScavengeTrapType.Undead: PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, ScavengeUndeadTrapText); int creatures = Utility.RandomMinMax(3, 5); for (int a = 0; a < creatures; a++) { UOACZSystem.SpawnRandomCreature(from, Location, Map, UOACZPersistance.m_ThreatLevel - 50, 0, 3, false); } break; case ScavengeTrapType.Explosion: PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, "*a trap is sprung*"); from.FixedParticles(0x36BD, 20, 10, 5044, 0, 0, EffectLayer.Head); from.PlaySound(0x307); int damageMin = (int)(Math.Round((double)TrapDifficulty / 4)); int damageMax = (int)(Math.Round((double)TrapDifficulty / 2)); int damage = Utility.RandomMinMax(damageMin, damageMax); from.SendMessage("You have been hit by an explosive trap!"); new Blood().MoveToWorld(from.Location, from.Map); AOS.Damage(from, damage, 0, 100, 0, 0, 0); break; case ScavengeTrapType.Hinder: PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, "*a trap is sprung*"); from.FixedEffect(0x376A, 10, 30, 0, 0); from.PlaySound(0x204); int duration = Utility.RandomMinMax(15, 30); from.SendMessage("You are trapped in place!"); SpecialAbilities.EntangleSpecialAbility(1.0, null, from, 1.0, duration, -1, true, "", "", "-1"); break; case ScavengeTrapType.Poison: PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, "*a trap is sprung*"); int poisonLevel = 0; double poisonChance = Utility.RandomDouble(); if (poisonChance <= .25) { poisonLevel = 0; } else if (poisonChance <= .70) { poisonLevel = 1; } else if (poisonChance <= .95) { poisonLevel = 2; } else { poisonLevel = 3; } Poison poison = Poison.GetPoison(poisonLevel); from.SendMessage("You have been poisoned!"); from.FixedEffect(0x372A, 10, 30, 2208, 0); Effects.PlaySound(from.Location, from.Map, 0x22F); from.ApplyPoison(from, poison); break; } m_TrapType = ScavengeTrapType.None; PlayerMobile player = from as PlayerMobile; if (player == null) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.TrapsSprung++; }
public override void OnDeath(Mobile mobile) { base.OnDeath(mobile); PlayerMobile player = mobile as PlayerMobile; if (player == null) { return; } if (player.AccessLevel > AccessLevel.Player) { return; } if (!UOACZPersistance.Active) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.Frozen = true; Queue m_Queue = new Queue(); foreach (BaseCreature creature in player.AllFollowers) { if (UOACZRegion.ContainsMobile(creature)) { m_Queue.Enqueue(creature); } } while (m_Queue.Count > 0) { BaseCreature creature = (BaseCreature)m_Queue.Dequeue(); int damage = (int)(Math.Round((double)creature.HitsMax * UOACZSystem.SwarmControllerDeathDamageScalar)); new Blood().MoveToWorld(creature.Location, creature.Map); AOS.Damage(creature, damage, 0, 100, 0, 0, 0); if (UOACZSystem.IsUOACZValidMobile(creature)) { if (creature.AIObject != null && creature.Controlled) { creature.AIObject.DoOrderRelease(); if (creature is UOACZBaseUndead) { UOACZBaseUndead undeadCreature = creature as UOACZBaseUndead; undeadCreature.m_LastActivity = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(3)); undeadCreature.m_NeedWaypoint = true; undeadCreature.CanTeleportToBaseNode = true; undeadCreature.InWilderness = true; } } } } Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (player == null) { return; } if (player.Deleted) { return; } if (!UOACZRegion.ContainsMobile(player)) { return; } if (!UOACZPersistance.Active) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.UndeadProfile.Deaths++; }); Timer.DelayCall(TimeSpan.FromSeconds(2), delegate { if (player == null) { return; } if (player.Deleted) { return; } if (!UOACZRegion.ContainsMobile(player)) { return; } if (!UOACZPersistance.Active) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); UOACZDestination destination; bool lostFoodWater = false; bool lostBrains = false; player.m_UOACZAccountEntry.FatigueExpiration = DateTime.UtcNow + UOACZSystem.FatigueDuration; switch (player.m_UOACZAccountEntry.ActiveProfile) { case UOACZAccountEntry.ActiveProfileType.Human: if (player.m_UOACZAccountEntry.HumanProfile.HonorPoints <= UOACZSystem.HonorAggressionThreshold) { destination = UOACZDestination.GetRandomEntrance(false); if (destination != null) { player.MoveToWorld(destination.Location, destination.Map); } else { player.MoveToWorld(UOACZPersistance.DefaultUndeadLocation, UOACZPersistance.DefaultMap); } } else { destination = UOACZDestination.GetRandomEntrance(true); if (destination != null) { player.MoveToWorld(destination.Location, destination.Map); } else { player.MoveToWorld(UOACZPersistance.DefaultHumanLocation, UOACZPersistance.DefaultMap); } } player.Resurrect(); player.RevealingAction(); player.Frozen = false; #region Auto-Reequip Blessed Gear if (player.Backpack != null) { if (!player.Backpack.Deleted) { Item deathRobe = player.FindItemOnLayer(Layer.OuterTorso); if (!(deathRobe is DeathRobe)) { deathRobe = null; } UOACZSurvivalMachete survivalMachete = null; UOACZSurvivalLantern survivalLantern = null; List <Item> m_LayerShirt = new List <Item>(); List <Item> m_MiddleTorso = new List <Item>(); List <Item> m_OuterLegs = new List <Item>(); List <Item> m_Pants = new List <Item>(); List <Item> m_Shoes = new List <Item>(); List <Item> m_BackpackItems = player.Backpack.Items; bool foundPants = false; foreach (Item item in m_BackpackItems) { if (item is UOACZSurvivalMachete) { survivalMachete = item as UOACZSurvivalMachete; } //if (item is UOACZSurvivalLantern) //survivalLantern = item as UOACZSurvivalLantern; if (item.Layer == Layer.Shirt) { m_LayerShirt.Add(item); } if (item.Layer == Layer.MiddleTorso) { m_MiddleTorso.Add(item); } if (item.Layer == Layer.OuterLegs) { m_OuterLegs.Add(item); foundPants = true; } if (item.Layer == Layer.Pants) { m_Pants.Add(item); foundPants = true; } if (item.Layer == Layer.Shoes) { m_Shoes.Add(item); } } if (survivalMachete != null) { player.AddItem(survivalMachete); } //if (survivalLantern != null) //player.AddItem(survivalLantern); if (foundPants && deathRobe != null) { deathRobe.Delete(); } if (m_LayerShirt.Count > 0) { player.AddItem(m_LayerShirt[0]); } if (m_MiddleTorso.Count > 0) { player.AddItem(m_MiddleTorso[0]); } if (m_OuterLegs.Count > 0) { player.AddItem(m_OuterLegs[0]); } if (m_Pants.Count > 0) { player.AddItem(m_Pants[0]); } if (m_Shoes.Count > 0) { player.AddItem(m_Shoes[0]); } } } #endregion UOACZSystem.ApplyActiveProfile(player); player.Hits = (int)Math.Ceiling(UOACZSystem.HumanRessStatsPercent * (double)player.HitsMax); player.Stam = (int)Math.Ceiling(UOACZSystem.HumanRessStatsPercent * (double)player.StamMax); player.Mana = (int)Math.Ceiling(UOACZSystem.HumanRessStatsPercent * (double)player.ManaMax); if (player.Backpack != null) { Item[] consumptionItem = player.Backpack.FindItemsByType(typeof(UOACZConsumptionItem)); m_Queue = new Queue(); for (int a = 0; a < consumptionItem.Length; a++) { UOACZConsumptionItem foodItem = consumptionItem[a] as UOACZConsumptionItem; if (foodItem == null) { continue; } if (Utility.RandomDouble() <= UOACZSystem.HumanDeathFoodWaterLossChance) { lostFoodWater = true; if (foodItem.Charges > 1) { foodItem.Charges = (int)Math.Floor((double)foodItem.Charges / 2); } else { m_Queue.Enqueue(foodItem); } } } while (m_Queue.Count > 0) { Item item = (Item)m_Queue.Dequeue(); item.Delete(); } } Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } player.m_UOACZAccountEntry.HumanProfile.CauseOfDeath = UOACZAccountEntry.HumanProfileEntry.CauseOfDeathType.Misc; player.m_UOACZAccountEntry.HumanDeaths++; if (player.IsUOACZHuman) { if (player.m_UOACZAccountEntry.HumanAbilitiesHotbarDisplayed) { player.CloseGump(typeof(HumanProfileAbilitiesHotbarGump)); player.SendGump(new HumanProfileAbilitiesHotbarGump(player)); } if (player.m_UOACZAccountEntry.HumanStatsHotbarDisplayed) { player.CloseGump(typeof(HumanProfileStatsHotbarGump)); player.SendGump(new HumanProfileStatsHotbarGump(player)); } if (player.m_UOACZAccountEntry.ObjectivesDisplayed) { player.CloseGump(typeof(ObjectivesHotbarGump)); player.SendGump(new ObjectivesHotbarGump(player)); } } }); break; case UOACZAccountEntry.ActiveProfileType.Undead: destination = UOACZDestination.GetRandomEntrance(false); player.m_UOACZAccountEntry.UndeadDeaths++; if (destination != null) { player.MoveToWorld(destination.Location, destination.Map); } else { player.MoveToWorld(UOACZPersistance.DefaultUndeadLocation, UOACZPersistance.DefaultMap); } player.Resurrect(); player.RevealingAction(); player.Frozen = false; if (player.Backpack != null) { Item[] brainItems = player.Backpack.FindItemsByType(typeof(UOACZBrains)); m_Queue = new Queue(); for (int a = 0; a < brainItems.Length; a++) { UOACZBrains brainItem = brainItems[a] as UOACZBrains; if (brainItem == null) { continue; } if (Utility.RandomDouble() <= UOACZSystem.UndeadDeathBrainLossChance) { lostBrains = true; m_Queue.Enqueue(brainItem); } } while (m_Queue.Count > 0) { Item item = (Item)m_Queue.Dequeue(); item.Delete(); } } UOACZSystem.ApplyActiveProfile(player); player.Hits = (int)Math.Ceiling(UOACZSystem.UndeadRessStatsPercent * (double)player.HitsMax); player.Stam = (int)Math.Ceiling(UOACZSystem.UndeadRessStatsPercent * (double)player.StamMax); player.Mana = (int)Math.Ceiling(UOACZSystem.UndeadRessStatsPercent * (double)player.ManaMax); if (player.m_UOACZAccountEntry.UndeadAbilitiesHotbarDisplayed) { player.CloseGump(typeof(UndeadProfileAbilitiesHotbarGump)); player.SendGump(new UndeadProfileAbilitiesHotbarGump(player)); } if (player.m_UOACZAccountEntry.UndeadStatsHotbarDisplayed) { player.CloseGump(typeof(UndeadProfileStatsHotbarGump)); player.SendGump(new UndeadProfileStatsHotbarGump(player)); } if (player.m_UOACZAccountEntry.ObjectivesDisplayed) { player.CloseGump(typeof(ObjectivesHotbarGump)); player.SendGump(new ObjectivesHotbarGump(player)); } break; } string fatigueDuration = Utility.CreateTimeRemainingString(DateTime.UtcNow, DateTime.UtcNow + UOACZSystem.FatigueDuration, false, true, true, true, true); string fatiguePercentText = ((1.0 - UOACZSystem.FatigueActiveScalar) * 100).ToString() + "%"; player.SendMessage(UOACZSystem.orangeTextHue, "You have died and will be subject to a -" + fatiguePercentText + " PvP penalty for " + fatigueDuration + "."); Timer.DelayCall(TimeSpan.FromSeconds(2), delegate { if (player == null) { return; } if (player.IsUOACZHuman && lostFoodWater) { player.SendMessage(UOACZSystem.orangeTextHue, "As a result of your death, some of your food and water has been been lost."); } if (player.IsUOACZUndead && lostBrains) { player.SendMessage(UOACZSystem.orangeTextHue, "As a result of your death, some of your brains have been been lost."); } }); }); }
public override void OnDoubleClick(Mobile from) { base.OnDoubleClick(from); if (!Visible) { if (from.AccessLevel == AccessLevel.Player) { return; } } PlayerMobile player = from as PlayerMobile; if (player == null) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (!player.Alive) { player.SendMessage("You are dead and cannot do that."); return; } //UOACZ Restrictions if (player.AccessLevel == AccessLevel.Player) { if (Utility.GetDistance(from.Location, Location) >= 3) { return; } switch (m_GateDirection) { case GateDirectionType.Entrance: if (player.Criminal) { player.SendMessage("You are currently a criminal and cannot enter."); return; } if (player.Followers > 0) { player.SendMessage("You must stable your followers before entering."); return; } if (player.HasTrade) { player.SendMessage("You must cancel your pending trade before entering."); return; } if (!from.CanBeginAction(typeof(IncognitoSpell))) { from.SendMessage("You may not enter while under the effects of incognito."); return; } if (!from.CanBeginAction(typeof(PolymorphSpell))) { from.SendMessage("You may not enter while under the effects of polymorph."); return; } if (DisguiseTimers.IsDisguised(from)) { from.SendMessage("You may not enter while being disguised."); } if (DateTime.UtcNow < player.LastCombatTime + UOACZSystem.CombatDelayBeforeEnteringMoongate) { DateTime cooldown = player.LastCombatTime + UOACZSystem.CombatDelayBeforeEnteringMoongate; string nextActivationAllowed = Utility.CreateTimeRemainingString(DateTime.UtcNow, cooldown, false, false, false, true, true); player.SendMessage("You have been in combat recently and must wait another " + nextActivationAllowed + " before entering."); return; } if (player.m_UOACZAccountEntry.NextEntryAllowed > DateTime.UtcNow && player.AccessLevel == AccessLevel.Player) { string nextEntranceAllowed = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.m_UOACZAccountEntry.NextEntryAllowed, false, false, false, true, true); from.SendMessage("You may not use this for another " + nextEntranceAllowed + "."); return; } break; case GateDirectionType.Exit: if (player.HasTrade) { player.SendMessage("You must cancel your pending trade before exiting."); return; } if (DateTime.UtcNow < player.LastPlayerCombatTime + UOACZSystem.TunnelDigPvPThreshold) { DateTime cooldown = player.LastPlayerCombatTime + UOACZSystem.TunnelDigPvPThreshold; string nextActivationAllowed = Utility.CreateTimeRemainingString(DateTime.UtcNow, cooldown, false, false, false, true, true); player.SendMessage("You have been in PvP recently and must wait another " + nextActivationAllowed + " before exiting."); return; } if (player.m_UOACZAccountEntry.NextEntryAllowed > DateTime.UtcNow && player.AccessLevel == AccessLevel.Player) { string nextEntranceAllowed = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.m_UOACZAccountEntry.NextEntryAllowed, false, false, false, true, true); from.SendMessage("You may not use this for another " + nextEntranceAllowed + "."); return; } break; } } switch (m_GateDirection) { case GateDirectionType.Entrance: player.SendSound(0x103); if (player.AccessLevel > AccessLevel.Player) { player.MoveToWorld(UOACZPersistance.DefaultHumanLocation, UOACZPersistance.DefaultMap); return; } UOACZSystem.PlayerEnterUOACZRegion(player); break; case GateDirectionType.Exit: player.SendSound(0x0FC); if (player.AccessLevel > AccessLevel.Player) { player.MoveToWorld(UOACZPersistance.DefaultBritainLocation, UOACZPersistance.DefaultBritainMap); return; } UOACZDestination destination = UOACZDestination.GetRandomExit(player.Murderer); if (destination != null) { player.MoveToWorld(destination.Location, destination.Map); } else { player.MoveToWorld(UOACZPersistance.DefaultBritainLocation, UOACZPersistance.DefaultBritainMap); } break; } if (player.AccessLevel == AccessLevel.Player) { player.m_UOACZAccountEntry.NextEntryAllowed = DateTime.UtcNow + UOACZSystem.DelayBetweenMoongateActivation; } }
protected override void OnTick() { if (m_RepairHammer == null || m_Player == null) { if (m_RepairHammer != null) { m_RepairHammer.m_Owner = null; } if (m_RepairHammer != null) { m_Player.EndAction(typeof(UOACZRepairHammer)); } Stop(); return; } if (m_RepairHammer.Deleted || m_Player.Deleted) { m_RepairHammer.m_Owner = null; m_Player.EndAction(typeof(UOACZRepairHammer)); Stop(); return; } List <UOACZBreakableStatic> m_NearbyBreakableStatics = GetNearbyBreakableStatics(m_Player); if (m_NearbyBreakableStatics.Count == 0) { m_RepairHammer.m_Owner = null; m_Player.EndAction(typeof(UOACZRepairHammer)); Stop(); return; } UOACZBreakableStatic randomBreakableStatic = m_NearbyBreakableStatics[Utility.RandomMinMax(0, m_NearbyBreakableStatics.Count - 1)]; int repairableCount = 0; foreach (UOACZBreakableStatic breakableStatic in m_NearbyBreakableStatics) { if (breakableStatic.CanRepair(m_Player, m_RepairHammer, 1.0, false)) { repairableCount++; } } if (repairableCount == 0) { m_RepairHammer.m_Owner = null; m_Player.EndAction(typeof(UOACZRepairHammer)); m_Player.SendMessage("You stop making repairs."); Stop(); return; } if (m_RepairTicks == 0) { m_Player.BeginAction(typeof(BreakableStatic)); TimeSpan repairCooldown = TimeSpan.FromSeconds(RepairActionTickDuration.TotalSeconds * (double)RepairActionTicksNeeded); Timer.DelayCall(repairCooldown, delegate { if (m_Player != null) { m_Player.EndAction(typeof(BreakableStatic)); } }); } m_RepairTicks++; if (randomBreakableStatic.RepairSound != -1) { Effects.PlaySound(m_Player.Location, m_Player.Map, randomBreakableStatic.RepairSound); } m_Player.Animate(12, 5, 1, true, false, 0); m_Player.RevealingAction(); if (m_RepairTicks >= UOACZRepairHammer.RepairActionTicksNeeded) { m_RepairTicks = 0; int minRepairAmount = 40; int maxRepairAmount = 60; double baseRepairScalarBonus = 1.0; double carpentryScalar = 1 + (baseRepairScalarBonus * m_Player.Skills.Carpentry.Value / 100); double blacksmithingScalar = 1 + (baseRepairScalarBonus * m_Player.Skills.Carpentry.Value / 100); double tinkeringScalar = 1 + (baseRepairScalarBonus * m_Player.Skills.Carpentry.Value / 100); double bestScalar = 1; if (carpentryScalar > bestScalar) { bestScalar = carpentryScalar; } if (blacksmithingScalar > bestScalar) { bestScalar = blacksmithingScalar; } if (tinkeringScalar > bestScalar) { bestScalar = tinkeringScalar; } double repairValue = m_Player.GetSpecialAbilityEntryValue(SpecialAbilityEffect.EmergencyRepairs); bestScalar += repairValue; bool outpostWasRepaired = false; foreach (UOACZBreakableStatic breakableStatic in m_NearbyBreakableStatics) { int repairAmount = Utility.RandomMinMax(minRepairAmount, maxRepairAmount); repairAmount = (int)(Math.Round(((double)repairAmount * bestScalar))); if (breakableStatic.RequiresFullRepair) { BreakableStatic.DamageStateType damageState = breakableStatic.DamageState; breakableStatic.HitPoints += repairAmount; breakableStatic.PublicOverheadMessage(MessageType.Regular, UOACZSystem.greenTextHue, false, "+" + repairAmount); if (breakableStatic.HitPoints < breakableStatic.MaxHitPoints) { breakableStatic.DamageState = damageState; } else { breakableStatic.DamageState = BreakableStatic.DamageStateType.Normal; } } else { breakableStatic.HitPoints += repairAmount; breakableStatic.PublicOverheadMessage(MessageType.Regular, UOACZSystem.greenTextHue, false, "+" + repairAmount); } UOACZPersistance.CheckAndCreateUOACZAccountEntry(m_Player); m_Player.m_UOACZAccountEntry.TotalRepairAmount += repairAmount; m_Player.SendMessage("You repair an object for " + repairAmount.ToString() + " hitpoints."); if (UOACZPersistance.m_OutpostComponents.Contains(breakableStatic)) { outpostWasRepaired = true; UOACZEvents.RepairOutpostComponent(); } } UOACZPersistance.CheckAndCreateUOACZAccountEntry(m_Player); m_Player.m_UOACZAccountEntry.TimesRepaired++; bool scored = false; double scoreChance = UOACZSystem.HumanRepairScoreChance; if (outpostWasRepaired) { scoreChance += UOACZSystem.HumanOutpostRepairScoreChance; } if (Utility.RandomDouble() <= UOACZSystem.HumanRepairScoreChance) { UOACZSystem.ChangeStat(m_Player, UOACZSystem.UOACZStatType.HumanScore, 1, true); scored = true; } if (m_Player.Backpack != null) { if (Utility.RandomDouble() <= UOACZSystem.HumanRepairSurvivalStoneChance * UOACZPersistance.HumanBalanceScalar) { m_Player.Backpack.DropItem(new UOACZSurvivalStone(m_Player)); m_Player.SendMessage(UOACZSystem.greenTextHue, "You have earned a survival stone for your repair efforts!"); } if (Utility.RandomDouble() <= UOACZSystem.HumanRepairUpgradeTokenChance * UOACZPersistance.HumanBalanceScalar) { m_Player.Backpack.DropItem(new UOACZHumanUpgradeToken(m_Player)); m_Player.SendMessage(UOACZSystem.greenTextHue, "You have earned an upgrade token for your repair efforts!"); } } m_RepairHammer.Charges--; if (m_RepairHammer.Charges <= 0) { m_RepairHammer.Delete(); } } }
public static void AttemptPurchase(PlayerMobile player, UOACZRewardType rewardType) { if (player == null) { return; } if (player.Deleted || !player.Alive) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (UOACZSystem.IsUOACZValidMobile(player)) { player.SendMessage("You may not purchase UOACZ Rewards while participating in a UOACZ session."); return; } UOACZRewardDetail rewardDetail = UOACZRewards.GetRewardDetail(rewardType); int rewardPointsAvailable = player.m_UOACZAccountEntry.RewardPoints; if (rewardDetail.RewardCost > rewardPointsAvailable && player.AccessLevel == AccessLevel.Player) { player.SendMessage("You don't have enough UOACZ Reward Points to purchase that."); return; } if (player.Backpack.Items.Count >= player.Backpack.MaxItems && player.AccessLevel == AccessLevel.Player) { player.SendMessage("You are carrying too many items to receive that item."); return; } bool madePurchase = false; switch (rewardType) { case UOACZRewardType.SurvivalTome: Item[] item = player.Backpack.FindItemsByType(typeof(UOACZSurvivalTome)); if (item.Length == 0) { if (player.Backpack.Items.Count < player.Backpack.MaxItems) { if (!player.CanBeginAction(typeof(UOACZSurvivalTome))) { player.SendMessage("You have acquired a Survival Tome too recently to acquire another one and must wait 10 minutes."); return; } player.Backpack.DropItem(new UOACZSurvivalTome()); player.SendMessage("You recieve a UOACZ Survival Tome."); madePurchase = true; player.BeginAction(typeof(UOACZSurvivalTome)); Timer.DelayCall(TimeSpan.FromMinutes(10), delegate { if (player != null) { player.EndAction(typeof(UOACZSurvivalTome)); } }); } else { player.SendMessage("You are carrying too many items to receive that item."); return; } } else { player.SendMessage("You already have a UOACZ Survival Tome in your backpack."); return; } break; case UOACZRewardType.CorruptionTome: item = player.Backpack.FindItemsByType(typeof(UOACZCorruptionTome)); if (item.Length == 0) { if (player.Backpack.Items.Count < player.Backpack.MaxItems) { if (!player.CanBeginAction(typeof(UOACZCorruptionTome))) { player.SendMessage("You have acquired a Corruption Tome too recently to acquire another one and must wait 10 minutes."); return; } player.Backpack.DropItem(new UOACZCorruptionTome()); player.SendMessage("You recieve a UOACZ Corruption Tome."); madePurchase = true; player.BeginAction(typeof(UOACZCorruptionTome)); Timer.DelayCall(TimeSpan.FromMinutes(10), delegate { if (player != null) { player.EndAction(typeof(UOACZCorruptionTome)); } }); } else { player.SendMessage("You are carrying too many items to receive that item."); return; } } else { player.SendMessage("You already have a UOACZ Corruption Tome in your backpack."); return; } break; case UOACZRewardType.SilverWeapon: BaseWeapon weapon = Loot.RandomWeapon(); if (weapon != null) { int accuracyLevel = 1; int damageLevel = 1; int durabilityLevel = 1; double accuracyResult = Utility.RandomDouble(); double damageResult = Utility.RandomDouble(); //Accuracy if (accuracyResult <= .50) { accuracyLevel = 1; } else if (accuracyResult <= .90) { accuracyLevel = 2; } else if (accuracyResult <= .97) { accuracyLevel = 3; } else if (accuracyResult <= .99) { accuracyLevel = 4; } else { accuracyLevel = 5; } //Damage if (damageResult <= .50) { damageLevel = 1; } else if (damageResult <= .90) { damageLevel = 2; } else if (damageResult <= .97) { damageLevel = 3; } else if (damageResult <= .99) { damageLevel = 4; } else { damageLevel = 5; } //Durability durabilityLevel = Utility.RandomMinMax(1, 5); weapon.AccuracyLevel = (WeaponAccuracyLevel)accuracyLevel; weapon.DamageLevel = (WeaponDamageLevel)damageLevel; weapon.DurabilityLevel = (WeaponDurabilityLevel)durabilityLevel; madePurchase = true; player.Backpack.DropItem(weapon); player.SendMessage("You receive a silver weapon."); } break; case UOACZRewardType.UOACZLotteryTicket: UOACZLotteryTicket lotteryTicket = new UOACZLotteryTicket(); if (lotteryTicket == null) { return; } madePurchase = true; player.Backpack.DropItem(lotteryTicket); player.SendMessage("You receive a UOACZ Lottery Ticket."); break; case UOACZRewardType.LargeDecoration: Item largeItem = null; switch (Utility.RandomMinMax(1, 5)) { case 1: largeItem = new UOACZDeadTree1RewardAddonDeed(); break; case 2: largeItem = new UOACZDeadTree2RewardAddonDeed(); break; case 3: largeItem = new UOACZDeadTree3RewardAddonDeed(); break; case 4: largeItem = new UOACZDeadTree4RewardAddonDeed(); break; case 5: largeItem = new UOACZDeadTree5RewardAddonDeed(); break; } if (largeItem == null) { return; } madePurchase = true; player.Backpack.DropItem(largeItem); player.SendMessage("You receive a large reward item."); break; case UOACZRewardType.EpicDecoration: Item epicItem = new UOACZSkullPileRewardAddonDeed(); if (epicItem == null) { return; } madePurchase = true; player.Backpack.DropItem(epicItem); player.SendMessage("You receive an epic reward item."); break; } if (madePurchase) { player.SendSound(UOACZSystem.purchaseUpgradeSound); if (player.AccessLevel == AccessLevel.Player) { player.m_UOACZAccountEntry.RewardPoints -= rewardDetail.RewardCost; } } }
public static void PurchaseUpgrade(PlayerMobile player, UOACZHumanUpgradeType upgradeType) { if (player == null) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); UOACZHumanUpgradeEntry upgradeEntry = GetUpgradeEntry(player.m_UOACZAccountEntry, upgradeType); if (upgradeEntry == null) { player.m_UOACZAccountEntry.HumanProfile.m_Upgrades.Add(new UOACZHumanUpgradeEntry(upgradeType, 1)); } else { upgradeEntry.m_TimesPurchased++; } player.m_UOACZAccountEntry.HumanProfile.UpgradesSpent++; if (player.m_UOACZAccountEntry.HumanProfile.UpgradesSpent > player.m_UOACZAccountEntry.MostHumanUpgradesSpentInASession) { player.m_UOACZAccountEntry.MostHumanUpgradesSpentInASession = player.m_UOACZAccountEntry.HumanProfile.UpgradesSpent; } UOACZHumanUpgradeDetail upgradeDetail = GetUpgradeDetail(upgradeType); player.m_UOACZAccountEntry.HumanProfile.HungerPoints += upgradeDetail.m_HungerPoints; player.m_UOACZAccountEntry.HumanProfile.MaxHungerPoints += upgradeDetail.m_MaxHungerPoints; player.m_UOACZAccountEntry.HumanProfile.ThirstPoints += upgradeDetail.m_ThirstPoints; player.m_UOACZAccountEntry.HumanProfile.MaxThirstPoints += upgradeDetail.m_MaxThirstPoints; player.m_UOACZAccountEntry.HumanProfile.HumanityPoints += upgradeDetail.m_HumanityPoints; player.m_UOACZAccountEntry.HumanProfile.MaxHumanityPoints += upgradeDetail.m_MaxHumanityPoints; player.m_UOACZAccountEntry.HumanProfile.HonorPoints += upgradeDetail.m_HonorPoints; player.m_UOACZAccountEntry.HumanProfile.MaxHonorPoints += upgradeDetail.m_MaxHonorPoints; int currentHits = player.Hits; int currentStam = player.Stam; int currentMana = player.Mana; player.m_UOACZAccountEntry.HumanProfile.m_Stats[StatType.Str] += upgradeDetail.m_Stats[StatType.Str]; player.m_UOACZAccountEntry.HumanProfile.m_Stats[StatType.Dex] += upgradeDetail.m_Stats[StatType.Dex]; player.m_UOACZAccountEntry.HumanProfile.m_Stats[StatType.Int] += upgradeDetail.m_Stats[StatType.Int]; for (int a = 0; a < player.m_UOACZAccountEntry.HumanProfile.m_Skills.Count; a++) { player.m_UOACZAccountEntry.HumanProfile.m_Skills[(SkillName)a] += upgradeDetail.m_Skills[(SkillName)a]; SkillName skillname = (SkillName)a; List <SkillName> m_Skills = new List <SkillName>(); m_Skills.Add(SkillName.Alchemy); m_Skills.Add(SkillName.Blacksmith); m_Skills.Add(SkillName.Carpentry); m_Skills.Add(SkillName.Cooking); m_Skills.Add(SkillName.Tailoring); m_Skills.Add(SkillName.Tinkering); if (m_Skills.Contains(skillname) && player.m_UOACZAccountEntry.HumanProfile.m_Skills[(SkillName)a] >= 100) { if (player.m_UOACZAccountEntry.HumanProfile.m_GMCraftingSkills.Contains(skillname)) { player.m_UOACZAccountEntry.HumanProfile.m_GMCraftingSkills.Add(skillname); } } } for (int a = 0; a < upgradeDetail.m_Abilities.Count; a++) { UOACZHumanAbilityType abilityType = upgradeDetail.m_Abilities[a]; UOACZHumanAbilityEntry playerAbilityEntry = UOACZHumanAbilities.GetAbilityEntry(player.m_UOACZAccountEntry, abilityType); UOACZHumanAbilityDetail abilityDetail = UOACZHumanAbilities.GetAbilityDetail(abilityType); if (playerAbilityEntry == null) { player.m_UOACZAccountEntry.HumanProfile.m_Abilities.Add(new UOACZHumanAbilityEntry(abilityType, 1, abilityDetail.CooldownMinutes, DateTime.UtcNow)); } else { playerAbilityEntry.m_TimesAcquired++; if (playerAbilityEntry.m_CooldownMinutes != abilityDetail.CooldownMinimumMinutes) { playerAbilityEntry.m_CooldownMinutes -= abilityDetail.CooldownMinutesDecreasePerTimesAcquired; } } } UOACZHumanUpgrades.ShuffleAvailableUpgrades(player.m_UOACZAccountEntry); UOACZSystem.ApplyActiveProfile(player); player.Hits = currentHits; player.Stam = currentStam; player.Mana = currentMana; }