public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); //Version 0 if (version >= 0) { m_ArenaGroupController = (ArenaGroupController)reader.ReadItem(); m_Tournament = (ArenaTournament)reader.ReadItem(); m_Creator = (PlayerMobile)reader.ReadMobile(); m_CreationDate = reader.ReadDateTime(); m_MatchStatus = (MatchStatusType)reader.ReadInt(); m_Ruleset = (ArenaRuleset)reader.ReadItem(); m_ArenaFight = (ArenaFight)reader.ReadItem(); int m_TeamsCount = reader.ReadInt(); for (int a = 0; a < m_TeamsCount; a++) { m_Teams.Add(reader.ReadItem() as ArenaTeam); } int m_BannedPlayersCount = reader.ReadInt(); for (int a = 0; a < m_BannedPlayersCount; a++) { m_BannedPlayers.Add(reader.ReadMobile() as PlayerMobile); } } }
public ArenaMatch(ArenaGroupController arenaGroupController, PlayerMobile player) : base(0x0) { m_ArenaGroupController = arenaGroupController; m_Creator = player; m_CreationDate = DateTime.UtcNow; Visible = false; Movable = false; }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); //Version 0 if (version >= 0) { m_ArenaGroupController = (ArenaGroupController)reader.ReadItem(); m_TournamentStatus = (TournamentStatusType)reader.ReadInt(); m_Ruleset = (ArenaRuleset)reader.ReadItem(); m_StartTime = reader.ReadDateTime(); } }
public static void RecordDamage(Mobile owner, Mobile from, Mobile target, DamageType damageType, int amount) { PlayerMobile player = owner as PlayerMobile; if (player == null) { return; } if (player.m_DamageTracker == null) { player.m_DamageTracker = new DamageTracker(player); } BaseCreature bc_From = from as BaseCreature; BaseCreature bc_Target = target as BaseCreature; PlayerMobile pm_From = from as PlayerMobile; PlayerMobile pm_Target = target as PlayerMobile; PlayerMobile rootPlayerFrom = pm_From; PlayerMobile rootPlayerTarget = pm_Target; #region Ship Damage to Creature: For Doubloon Distribution on Death if (bc_Target != null) { if (bc_Target.DoubloonValue > 0) { BaseShip shipFrom = null; if (bc_From != null) { if (bc_From.ShipOccupied != null) { shipFrom = bc_From.ShipOccupied; } } if (pm_From != null) { if (pm_From.ShipOccupied != null) { shipFrom = pm_From.ShipOccupied; } } if (shipFrom != null) { bool foundDamageEntry = false; foreach (DamageFromShipEntry damageFromShipEntry in bc_Target.m_DamageFromShipEntries) { if (damageFromShipEntry == null) { continue; } if (damageFromShipEntry.m_Ship == shipFrom) { damageFromShipEntry.m_TotalAmount += amount; damageFromShipEntry.m_LastDamageTime = DateTime.UtcNow; foundDamageEntry = true; } } if (!foundDamageEntry) { DamageFromShipEntry damageEntry = new DamageFromShipEntry(shipFrom, amount, DateTime.UtcNow); bc_Target.m_DamageFromShipEntries.Add(damageEntry); } } } } #endregion #region Arena bool checkArenaDamage = false; if (bc_From != null) { if (bc_From.ControlMaster is PlayerMobile) { rootPlayerFrom = bc_From.ControlMaster as PlayerMobile; } } if (bc_Target != null) { if (bc_Target.ControlMaster is PlayerMobile) { rootPlayerTarget = bc_Target.ControlMaster as PlayerMobile; } } if (rootPlayerFrom != null && rootPlayerTarget != null) { ArenaGroupController arenaGroupControllerFrom = ArenaGroupController.GetArenaGroupRegionAtLocation(rootPlayerFrom.Location, rootPlayerFrom.Map); ArenaGroupController arenaGroupControllerTarget = ArenaGroupController.GetArenaGroupRegionAtLocation(rootPlayerFrom.Location, rootPlayerFrom.Map); if (arenaGroupControllerFrom != null && arenaGroupControllerTarget != null && arenaGroupControllerFrom == arenaGroupControllerTarget) { if (rootPlayerFrom.m_ArenaMatch != null && rootPlayerTarget.m_ArenaMatch != null && rootPlayerFrom.m_ArenaMatch == rootPlayerTarget.m_ArenaMatch) { if (rootPlayerFrom.m_ArenaMatch.m_MatchStatus == ArenaMatch.MatchStatusType.Fighting) { checkArenaDamage = true; } } } } #endregion switch (damageType) { case DamageType.MeleeDamage: if (player.m_ShowMeleeDamage == DamageDisplayMode.PrivateMessage) { player.SendMessage(player.PlayerMeleeDamageTextHue, "You attack " + target.Name + " for " + amount.ToString() + " damage."); } if (player.m_ShowMeleeDamage == DamageDisplayMode.PrivateOverhead) { target.PrivateOverheadMessage(MessageType.Regular, player.PlayerMeleeDamageTextHue, false, "-" + amount.ToString(), player.NetState); } if (checkArenaDamage) { ArenaFight.CheckArenaDamage(player, DamageType.MeleeDamage, amount); } break; case DamageType.SpellDamage: if (player.m_ShowSpellDamage == DamageDisplayMode.PrivateMessage) { player.SendMessage(player.PlayerSpellDamageTextHue, "Your spell hits " + target.Name + " for " + amount.ToString() + " damage."); } if (player.m_ShowSpellDamage == DamageDisplayMode.PrivateOverhead) { target.PrivateOverheadMessage(MessageType.Regular, player.PlayerSpellDamageTextHue, false, "-" + amount.ToString(), player.NetState); } if (checkArenaDamage) { ArenaFight.CheckArenaDamage(player, DamageType.SpellDamage, amount); } break; case DamageType.FollowerDamage: if (player.m_ShowFollowerDamage == DamageDisplayMode.PrivateMessage) { player.SendMessage(player.PlayerFollowerDamageTextHue, "Follower: " + from.Name + " attacks " + target.Name + " for " + amount.ToString() + " damage."); } if (player.m_ShowFollowerDamage == DamageDisplayMode.PrivateOverhead) { target.PrivateOverheadMessage(MessageType.Regular, player.PlayerFollowerDamageTextHue, false, "-" + amount.ToString(), player.NetState); } if (checkArenaDamage) { ArenaFight.CheckArenaDamage(player, DamageType.FollowerDamage, amount); } break; case DamageType.ProvocationDamage: if (player.m_ShowProvocationDamage == DamageDisplayMode.PrivateMessage) { player.SendMessage(player.PlayerProvocationDamageTextHue, "Provocation: " + from.Name + " inflicts " + amount.ToString() + " damage on " + target.Name + "."); } if (player.m_ShowProvocationDamage == DamageDisplayMode.PrivateOverhead) { target.PrivateOverheadMessage(MessageType.Regular, player.PlayerProvocationDamageTextHue, false, "-" + amount.ToString(), player.NetState); } if (checkArenaDamage) { ArenaFight.CheckArenaDamage(player, DamageType.ProvocationDamage, amount); } break; case DamageType.PoisonDamage: if (player.m_ShowPoisonDamage == DamageDisplayMode.PrivateMessage) { player.SendMessage(player.PlayerPoisonDamageTextHue, "You inflict " + amount.ToString() + " poison damage on " + target.Name + "."); } if (player.m_ShowPoisonDamage == DamageDisplayMode.PrivateOverhead) { target.PrivateOverheadMessage(MessageType.Regular, player.PlayerPoisonDamageTextHue, false, "-" + amount.ToString(), player.NetState); } if (checkArenaDamage) { ArenaFight.CheckArenaDamage(player, DamageType.PoisonDamage, amount); } break; case DamageType.DamageTaken: if (player.m_ShowDamageTaken == DamageDisplayMode.PrivateMessage) { player.SendMessage(player.PlayerDamageTakenTextHue, from.Name + " attacks you for " + amount.ToString() + " damage."); } if (player.m_ShowDamageTaken == DamageDisplayMode.PrivateOverhead) { player.PrivateOverheadMessage(MessageType.Regular, player.PlayerDamageTakenTextHue, false, "-" + amount.ToString(), player.NetState); } if (checkArenaDamage) { ArenaFight.CheckArenaDamage(player, DamageType.DamageTaken, amount); } break; case DamageType.FollowerDamageTaken: if (player.m_ShowFollowerDamageTaken == DamageDisplayMode.PrivateMessage) { player.SendMessage(player.PlayerFollowerDamageTakenTextHue, "Follower: " + target.Name + " is hit for " + amount.ToString() + " damage."); } if (player.m_ShowFollowerDamageTaken == DamageDisplayMode.PrivateOverhead && player.NetState != null) { target.PrivateOverheadMessage(MessageType.Regular, player.PlayerFollowerDamageTakenTextHue, false, "-" + amount.ToString(), player.NetState); } break; } if (!player.m_DamageTracker.m_Running) { return; } switch (damageType) { case DamageType.MeleeDamage: player.m_DamageTracker.MeleeDamage += amount; break; case DamageType.SpellDamage: player.m_DamageTracker.SpellDamage += amount; break; case DamageType.FollowerDamage: player.m_DamageTracker.FollowerDamage += amount; break; case DamageType.ProvocationDamage: player.m_DamageTracker.ProvocationDamage += amount; break; case DamageType.PoisonDamage: player.m_DamageTracker.PoisonDamage += amount; break; case DamageType.DamageTaken: player.m_DamageTracker.DamageTaken += amount; break; case DamageType.FollowerDamageTaken: player.m_DamageTracker.FollowerDamageTaken += amount; break; case DamageType.HealingDealt: player.m_DamageTracker.HealingDealt += amount; break; } }
public ArenaGroupControllerTimer(ArenaGroupController arenaGroupController) : base(TimeSpan.Zero, TimeSpan.FromSeconds(3)) { m_ArenaGroupController = arenaGroupController; Priority = TimerPriority.OneSecond; }