From 06fa31a7bf2cbdc4dd757776007bca4746f954e7 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Fri, 14 Sep 2018 15:23:29 -0700 Subject: [PATCH] Changes properties to use automatic property initializers --- Scripts/Accounting/Account.cs | 204 ++--- Scripts/Accounting/AccountAttackLimiter.cs | 28 +- Scripts/Accounting/AccountComment.cs | 20 +- Scripts/Accounting/AccountHandler.cs | 10 +- Scripts/Accounting/AccountTag.cs | 26 +- Scripts/Accounting/Firewall.cs | 32 +- Scripts/Commands/Attributes.cs | 18 +- Scripts/Commands/Batch.cs | 73 +- Scripts/Commands/Decorate.cs | 10 +- Scripts/Commands/DecorateMag.cs | 10 +- Scripts/Commands/Docs.cs | 58 +- Scripts/Commands/GenCategorization.cs | 70 +- .../Commands/Generic/Commands/BaseCommand.cs | 50 +- Scripts/Commands/Generic/Commands/Commands.cs | 6 +- .../Generic/Extensions/BaseExtension.cs | 31 +- .../Compilers/ConditionalCompiler.cs | 70 +- .../Extensions/Compilers/SortCompiler.cs | 9 +- .../Generic/Extensions/LimitExtension.cs | 12 +- .../Generic/Extensions/WhereExtension.cs | 10 +- .../Implementors/AreaCommandImplementor.cs | 6 +- .../Implementors/BaseCommandImplementor.cs | 58 +- .../Generic/Implementors/ObjectConditional.cs | 14 +- .../Implementors/RangeCommandImplementor.cs | 6 +- Scripts/Commands/HelpInfo.cs | 21 +- Scripts/Commands/Logging.cs | 25 +- Scripts/Commands/Properties.cs | 17 +- Scripts/Engines/BulkOrders/Books/BOBFilter.cs | 55 +- .../Engines/BulkOrders/Books/BOBLargeEntry.cs | 88 ++- .../BulkOrders/Books/BOBLargeSubEntry.cs | 38 +- .../Engines/BulkOrders/Books/BOBSmallEntry.cs | 97 ++- .../Engines/BulkOrders/Books/BulkOrderBook.cs | 70 +- Scripts/Engines/BulkOrders/LargeBulkEntry.cs | 25 +- Scripts/Engines/BulkOrders/Rewards.cs | 68 +- Scripts/Engines/BulkOrders/SmallBOD.cs | 24 +- Scripts/Engines/BulkOrders/SmallBulkEntry.cs | 16 +- .../CannedEvil/ChampionSkullBrazier.cs | 15 +- Scripts/Engines/CannedEvil/ChampionSpawn.cs | 155 ++-- .../Engines/CannedEvil/ChampionSpawnType.cs | 159 ++-- Scripts/Engines/Chat/Channel.cs | 29 +- Scripts/Engines/Chat/Chat.cs | 12 +- Scripts/Engines/Chat/ChatActionHandler.cs | 16 +- Scripts/Engines/Chat/ChatUser.cs | 78 +- Scripts/Engines/ConPVP/Arena.cs | 211 +++--- Scripts/Engines/ConPVP/DuelContext.cs | 372 +++++----- Scripts/Engines/ConPVP/DuelContextGump.cs | 38 +- Scripts/Engines/ConPVP/Games/BombingRun.cs | 211 ++---- Scripts/Engines/ConPVP/Games/CTF.cs | 236 +++--- Scripts/Engines/ConPVP/Games/DoubleDom.cs | 271 +++---- Scripts/Engines/ConPVP/Games/KingOfTheHill.cs | 331 ++++----- Scripts/Engines/ConPVP/Ladder.cs | 40 +- Scripts/Engines/ConPVP/LadderGump.cs | 16 +- Scripts/Engines/ConPVP/Participant.cs | 103 ++- Scripts/Engines/ConPVP/ParticipantGump.cs | 72 +- Scripts/Engines/ConPVP/Preferences.cs | 48 +- Scripts/Engines/ConPVP/Ruleset.cs | 70 +- Scripts/Engines/ConPVP/RulesetLayout.cs | 74 +- Scripts/Engines/ConPVP/Tournament.cs | 543 +++++--------- Scripts/Engines/ConPVP/Trophy.cs | 45 +- Scripts/Engines/Craft/Core/CraftContext.cs | 52 +- Scripts/Engines/Craft/Core/CraftGroup.cs | 19 +- Scripts/Engines/Craft/Core/CraftItem.cs | 188 ++--- .../Craft/Core/CraftItemIDAttribute.cs | 6 +- Scripts/Engines/Craft/Core/CraftRes.cs | 41 +- Scripts/Engines/Craft/Core/CraftSkill.cs | 16 +- Scripts/Engines/Craft/Core/CraftSubRes.cs | 31 +- Scripts/Engines/Craft/Core/CraftSubResCol.cs | 31 +- Scripts/Engines/Craft/Core/CraftSystem.cs | 146 ++-- Scripts/Engines/Craft/Core/CustomCraft.cs | 34 +- Scripts/Engines/Craft/Core/Recipes.cs | 43 +- Scripts/Engines/Craft/DefTinkering.cs | 6 +- Scripts/Engines/Doom/GauntletSpawner.cs | 179 ++--- .../Doom/LeverPuzzle/LeverPuzzleController.cs | 31 +- .../Doom/LeverPuzzle/LeverPuzzleItems.cs | 11 +- Scripts/Engines/Ethics/Core/Persistance.cs | 10 +- Scripts/Engines/Ethics/Core/Player.cs | 70 +- .../Ethics/Definitions/EthicDefinition.cs | 28 +- .../Ethics/Definitions/PowerDefinition.cs | 20 +- Scripts/Engines/Factions/Core/Election.cs | 250 +++---- Scripts/Engines/Factions/Core/Faction.cs | 46 +- Scripts/Engines/Factions/Core/FactionItem.cs | 40 +- Scripts/Engines/Factions/Core/FactionState.cs | 123 ++-- Scripts/Engines/Factions/Core/GuardList.cs | 12 +- .../Engines/Factions/Core/MerchantTitles.cs | 55 +- Scripts/Engines/Factions/Core/Persistance.cs | 10 +- Scripts/Engines/Factions/Core/PlayerState.cs | 115 ++- .../Engines/Factions/Core/SilverGivenEntry.cs | 12 +- .../Engines/Factions/Core/StrongholdRegion.cs | 10 +- Scripts/Engines/Factions/Core/Town.cs | 34 +- Scripts/Engines/Factions/Core/TownState.cs | 77 +- Scripts/Engines/Factions/Core/VendorList.cs | 12 +- .../Factions/Definitions/FactionDefinition.cs | 132 ++-- .../Definitions/FactionItemDefinition.cs | 10 +- .../Factions/Definitions/GuardDefinition.cs | 35 +- .../Factions/Definitions/RankDefinition.cs | 22 +- .../Definitions/StrongholdDefintion.cs | 20 +- .../Factions/Definitions/TownDefinition.cs | 69 +- .../Factions/Definitions/VendorDefinition.cs | 112 ++- .../Instances/Factions/CouncilOfMages.cs | 6 +- .../Factions/Instances/Factions/Minax.cs | 6 +- .../Instances/Factions/Shadowlords.cs | 6 +- .../Instances/Factions/TrueBritannians.cs | 6 +- .../Engines/Factions/Items/BaseMonolith.cs | 14 +- .../Power Faction Items/PowerFactionItem.cs | 13 +- Scripts/Engines/Factions/Items/Sigil.cs | 97 +-- .../Factions/Items/Traps/BaseFactionTrap.cs | 64 +- .../Items/Traps/FactionTrapRemovalKit.cs | 22 +- .../Mobiles/Guards/BaseFactionGuard.cs | 30 +- .../Factions/Mobiles/Guards/GuardAI.cs | 30 +- .../Engines/Factions/Mobiles/Guards/Orders.cs | 51 +- .../Mobiles/Vendors/BaseFactionVendor.cs | 3 +- .../Mobiles/Vendors/FactionBoardVendor.cs | 8 +- .../Mobiles/Vendors/FactionBottleVendor.cs | 8 +- .../Mobiles/Vendors/FactionOreVendor.cs | 8 +- .../Mobiles/Vendors/FactionReagentVendor.cs | 8 +- .../Harvest/Core/BonusHarvestResource.cs | 28 +- Scripts/Engines/Harvest/Core/HarvestBank.cs | 16 +- .../Engines/Harvest/Core/HarvestDefinition.cs | 220 +++--- .../Engines/Harvest/Core/HarvestResource.cs | 38 +- Scripts/Engines/Harvest/Core/HarvestSystem.cs | 10 +- Scripts/Engines/Harvest/Core/HarvestVein.cs | 30 +- Scripts/Engines/Harvest/Fishing.cs | 6 +- Scripts/Engines/Harvest/Lumberjacking.cs | 6 +- Scripts/Engines/Harvest/Mining.cs | 18 +- Scripts/Engines/Help/PageQueue.cs | 62 +- Scripts/Engines/Help/PageQueueGump.cs | 14 +- Scripts/Engines/Help/SpeechLog.cs | 16 +- Scripts/Engines/Help/StuckMenu.cs | 10 +- .../Engines/Khaldun/KhaldunPitTeleporter.cs | 52 +- Scripts/Engines/Khaldun/PuzzleChest.cs | 105 ++- Scripts/Engines/Khaldun/RaisableItem.cs | 33 +- Scripts/Engines/Khaldun/RaiseSwitch.cs | 12 +- .../Engines/MLQuests/Gumps/BaseQuestGump.cs | 16 +- Scripts/Engines/MLQuests/Items/Teleporters.cs | 30 +- Scripts/Engines/MLQuests/MLQuest.cs | 126 +--- Scripts/Engines/MLQuests/MLQuestContext.cs | 49 +- Scripts/Engines/MLQuests/MLQuestEntry.cs | 157 ++-- Scripts/Engines/MLQuests/MLQuestSystem.cs | 44 +- .../MLQuests/Objectives/BaseObjective.cs | 32 +- .../MLQuests/Objectives/CollectObjective.cs | 86 +-- .../MLQuests/Objectives/DeliverObjective.cs | 111 +-- .../MLQuests/Objectives/EscortObjective.cs | 37 +- .../MLQuests/Objectives/GainSkillObjective.cs | 54 +- .../MLQuests/Objectives/KillObjective.cs | 100 +-- Scripts/Engines/MLQuests/QuestArea.cs | 36 +- .../Engines/MLQuests/QuesterNameAttribute.cs | 6 +- .../Engines/MLQuests/Rewards/BaseReward.cs | 12 +- .../Engines/MyRunUO/DatabaseCommandQueue.cs | 8 +- Scripts/Engines/MyRunUO/LayerComparer.cs | 12 +- Scripts/Engines/Party/Party.cs | 77 +- Scripts/Engines/Party/PartyMemberInfo.cs | 12 +- Scripts/Engines/Pathing/Movement.cs | 28 +- Scripts/Engines/Pathing/MovementPath.cs | 39 +- Scripts/Engines/Pathing/PathFollower.cs | 20 +- .../Engines/Plants/MiscItems/GreenThorns.cs | 26 +- .../Engines/Plants/MiscItems/OrangePetals.cs | 6 +- Scripts/Engines/Plants/PlantHue.cs | 30 +- Scripts/Engines/Plants/PlantItem.cs | 86 +-- Scripts/Engines/Plants/PlantResources.cs | 18 +- Scripts/Engines/Plants/PlantSystem.cs | 127 ++-- Scripts/Engines/Plants/PlantType.cs | 60 +- .../AmbitiousQueenQuest.cs | 10 +- .../Ambitious Solen Queen/Objectives.cs | 34 +- .../Quests/Collector/Items/ImageType.cs | 24 +- .../Quests/Core/Items/HornOfRetreat.cs | 22 +- .../Engines/Quests/Core/QuestConversation.cs | 19 +- Scripts/Engines/Quests/Core/QuestItemInfo.cs | 19 +- Scripts/Engines/Quests/Core/QuestObjective.cs | 29 +- .../Engines/Quests/Core/QuestRestartInfo.cs | 25 +- Scripts/Engines/Quests/Core/QuestSystem.cs | 144 ++-- .../Quests/Dark Tides/Items/MaabusCoffin.cs | 43 +- .../Mobiles/HiddenFigure.cs | 14 +- .../Quests/Emino's Undertaking/Objectives.cs | 24 +- .../Quests/Haochi's Trials/Objectives.cs | 34 +- .../Solen Matriarch/SolenMatriarchQuest.cs | 10 +- .../Study of the Solen Hive/NestArea.cs | 5 +- .../Study of the Solen Hive/Objectives.cs | 9 +- .../StudyOfSolenQuest.cs | 12 +- .../The Summoning/Items/BellOfTheDead.cs | 64 +- .../Quests/The Summoning/Mobiles/Chyloth.cs | 53 +- .../Quests/The Summoning/Objectives.cs | 13 +- .../Quests/The Summoning/TheSummoningQuest.cs | 29 +- .../Quests/Uzeraan Turmoil/Items/Cannon.cs | 37 +- .../Quests/Uzeraan Turmoil/Mobiles/Dryad.cs | 8 +- .../Mobiles/MilitiaCanoneer.cs | 16 +- .../Quests/Uzeraan Turmoil/Objectives.cs | 36 +- .../Quests/Witch Apprentice/Ingredient.cs | 16 +- .../Witch Apprentice/Items/HangoverCure.cs | 20 +- .../Quests/Witch Apprentice/Objectives.cs | 79 +- .../Engines/RemoteAdmin/RemoteAdminLogging.cs | 27 +- .../Reports/Objects/Charts/BarGraph.cs | 70 +- .../Reports/Objects/Charts/ChartItem.cs | 22 +- .../Reports/Objects/Charts/PieChart.cs | 12 +- .../Reports/Objects/Reports/ItemValue.cs | 13 +- .../Engines/Reports/Objects/Reports/Report.cs | 46 +- .../Reports/Objects/Reports/ReportColumn.cs | 34 +- .../Reports/Objects/Reports/ReportItem.cs | 12 +- .../Reports/Objects/Snapshots/Snapshot.cs | 22 +- .../Objects/Snapshots/SnapshotHistory.cs | 14 +- .../Engines/Reports/Objects/Staffing/Info.cs | 37 +- .../Reports/Objects/Staffing/PageInfo.cs | 75 +- .../Reports/Objects/Staffing/QueueStatus.cs | 22 +- .../Reports/Objects/Staffing/ResponseInfo.cs | 34 +- .../Reports/Objects/Staffing/StaffHistory.cs | 80 +- .../Reports/Persistance/PersistableType.cs | 10 +- .../Reports/Rendering/BarGraphRenderer.cs | 108 +-- .../Reports/Rendering/ChartRenderer.cs | 7 +- Scripts/Engines/Reports/Rendering/DataItem.cs | 55 +- .../Reports/Rendering/PieChartRenderer.cs | 7 +- Scripts/Engines/Reports/Reports.cs | 13 +- Scripts/Engines/Spawner/ProximitySpawner.cs | 54 +- Scripts/Engines/Spawner/Spawner.cs | 229 +++--- .../BasePigmentsOfTokuno.cs | 5 +- .../Treasures of Tokuno/LesserArtifacts.cs | 79 +- .../Treasures of Tokuno/TreasuresOfTokuno.cs | 79 +- .../TreasuresOfTokunoPersistance.cs | 12 +- .../Character Statue Maker/CharacterStatue.cs | 82 +-- .../Engines/VeteranRewards/RewardCategory.cs | 18 +- Scripts/Engines/VeteranRewards/RewardEntry.cs | 70 +- Scripts/Engines/VeteranRewards/RewardList.cs | 10 +- .../VeteranRewards/RewardOptionGump.cs | 10 +- Scripts/Engines/Virtues/Honor.cs | 88 ++- Scripts/Gumps/BaseGridGump.cs | 53 +- Scripts/Gumps/BaseImageTileButtonsGump.cs | 6 +- Scripts/Gumps/CategorizedAddGump.cs | 60 +- Scripts/Gumps/Go/ChildNode.cs | 19 +- Scripts/Gumps/Go/LocationTree.cs | 16 +- Scripts/Gumps/Go/ParentNode.cs | 21 +- .../Guilds/New Guild System/BaseGuildGump.cs | 10 +- .../New Guild System/BaseGuildListGump.cs | 17 +- Scripts/Gumps/PlayerVendorGumps.cs | 68 +- Scripts/Gumps/PolymorphGump.cs | 38 +- Scripts/Gumps/Props/SetBodyGump.cs | 32 +- Scripts/Gumps/RewardGump.cs | 44 +- Scripts/Gumps/RunebookGump.cs | 70 +- Scripts/Gumps/SkillsGump.cs | 177 +++-- .../Halloween/2012/Engines/PlayerZombies.cs | 16 +- .../Valentine/2011/Items/StValentinesBears.cs | 10 +- Scripts/Items/Addons/AddonComponent.cs | 47 +- .../Items/Addons/AddonContainerComponent.cs | 49 +- Scripts/Items/Addons/ArcheryButteAddon.cs | 105 +-- Scripts/Items/Addons/BallotBox.cs | 48 +- Scripts/Items/Addons/BaseAddon.cs | 29 +- Scripts/Items/Addons/BaseAddonContainer.cs | 30 +- Scripts/Items/Addons/LoomEastAddon.cs | 10 +- Scripts/Items/Addons/LoomSouthAddon.cs | 10 +- Scripts/Items/Addons/PickpocketDips.cs | 37 +- Scripts/Items/Addons/SHTeleporter.cs | 113 ++- Scripts/Items/Addons/TrainingDummies.cs | 37 +- Scripts/Items/Aquarium/Aquarium.cs | 91 ++- Scripts/Items/Aquarium/AquariumState.cs | 33 +- Scripts/Items/Armor/BaseArmor.cs | 28 +- Scripts/Items/Body Parts/Head.cs | 45 +- Scripts/Items/Books/BaseBook.cs | 105 ++- Scripts/Items/Books/Defined/BookContent.cs | 24 +- Scripts/Items/Clothing/BaseClothing.cs | 17 +- Scripts/Items/Clothing/Cloaks.cs | 15 +- Scripts/Items/Clothing/Hats.cs | 16 +- Scripts/Items/Clothing/OuterTorso.cs | 30 +- Scripts/Items/Construction/Doors/BaseDoor.cs | 98 +-- .../Items/Construction/Doors/HouseDoors.cs | 35 +- Scripts/Items/Containers/BaseTreasureChest.cs | 41 +- .../Items/Containers/FillableContainers.cs | 28 +- Scripts/Items/Containers/LockableContainer.cs | 95 +-- Scripts/Items/Containers/MarkContainer.cs | 47 +- .../Items/Containers/TrappableContainer.cs | 66 +- Scripts/Items/Containers/TreasureMapChest.cs | 77 +- .../StealableArtifactsSpawner.cs | 307 ++++---- Scripts/Items/Deeds/CommodityDeed.cs | 48 +- Scripts/Items/Deeds/NewPlayerTicket.cs | 16 +- Scripts/Items/Deeds/VendorRentalContract.cs | 24 +- Scripts/Items/Food/Beverage.cs | 26 +- Scripts/Items/Food/CookableFood.cs | 14 +- Scripts/Items/Food/Food.cs | 56 +- Scripts/Items/Games/BaseBoard.cs | 12 +- Scripts/Items/Games/BasePiece.cs | 30 +- .../Games/Mahjong/MahjongDealerIndicator.cs | 46 +- Scripts/Items/Games/Mahjong/MahjongDices.cs | 34 +- Scripts/Items/Games/Mahjong/MahjongGame.cs | 111 ++- .../Items/Games/Mahjong/MahjongPieceDim.cs | 28 +- Scripts/Items/Games/Mahjong/MahjongPlayers.cs | 85 ++- Scripts/Items/Games/Mahjong/MahjongTile.cs | 71 +- .../Games/Mahjong/MahjongTileTypeGenerator.cs | 14 +- .../Mahjong/MahjongWallBreakIndicator.cs | 22 +- Scripts/Items/Guilds/Guildstone.cs | 72 +- Scripts/Items/Lights/BaseLight.cs | 36 +- Scripts/Items/Lights/Candelabra.cs | 17 +- Scripts/Items/Maps/MapItem.cs | 105 ++- Scripts/Items/Maps/PresetMap.cs | 84 ++- Scripts/Items/Maps/TreasureMap.cs | 21 +- Scripts/Items/Misc/BulletinBoards.cs | 141 ++-- Scripts/Items/Misc/CommunicationCrystals.cs | 19 +- Scripts/Items/Misc/Corpses/Corpse.cs | 195 +++-- .../Items/Misc/Corpses/CorpseNameAttribute.cs | 6 +- Scripts/Items/Misc/DeceitBrazier.cs | 144 ++-- Scripts/Items/Misc/EffectController.cs | 239 +++--- Scripts/Items/Misc/Firebomb.cs | 8 +- Scripts/Items/Misc/FlippableAddonAttribute.cs | 22 +- Scripts/Items/Misc/FlippableAttribute.cs | 16 +- Scripts/Items/Misc/HairDye.cs | 16 +- Scripts/Items/Misc/Key.cs | 32 +- Scripts/Items/Misc/KeyRing.cs | 30 +- Scripts/Items/Misc/MorphItem.cs | 22 +- Scripts/Items/Misc/PlayerBulletinBoards.cs | 97 +-- Scripts/Items/Misc/PowerGenerator.cs | 33 +- Scripts/Items/Misc/PublicMoongate.cs | 31 +- Scripts/Items/Misc/SerpentPillar.cs | 42 +- Scripts/Items/Misc/SpecialBeardDye.cs | 16 +- Scripts/Items/Misc/SpecialHairDye.cs | 16 +- Scripts/Items/Misc/Teleporter.cs | 113 +-- Scripts/Items/Misc/WarningItem.cs | 72 +- Scripts/Items/Misc/WindChimes.cs | 6 +- Scripts/Items/Skill Items/Camping/Campfire.cs | 22 +- .../Carpenter Items/TaxidermyKit.cs | 98 +-- .../Fishing/Misc/MessageInABottle.cs | 21 +- Scripts/Items/Skill Items/Fishing/Misc/SOS.cs | 107 ++- .../Fishing/Misc/SpecialFishingNet.cs | 20 +- .../Skill Items/Magical/Misc/Moongate.cs | 145 ++-- .../Skill Items/Magical/Misc/RecallRune.cs | 19 +- .../BaseConflagrationPotion.cs | 35 +- .../BaseConfusionBlastPotion.cs | 12 +- .../Potions/Cure Potions/BaseCurePotion.cs | 11 +- .../Explosion Potions/BaseExplosionPotion.cs | 34 +- Scripts/Items/Skill Items/Magical/Runebook.cs | 148 ++-- .../Magical/Scrolls/SpellScroll.cs | 12 +- .../Items/Skill Items/Magical/Spellbook.cs | 25 +- Scripts/Items/Skill Items/Misc/Bandage.cs | 122 ++- Scripts/Items/Skill Items/Misc/RepairDeed.cs | 40 +- .../Musical Instruments/BaseInstrument.cs | 37 +- .../Tailor Items/Dyetubs/CustomHuePicker.cs | 47 +- .../Tailor Items/Dyetubs/DyeTub.cs | 11 +- .../Tailor Items/Dyetubs/FurnitureDyeTub.cs | 16 +- .../Tailor Items/Dyetubs/LeatherDyeTub.cs | 16 +- .../Tailor Items/Dyetubs/RewardBlackDyeTub.cs | 16 +- .../Tailor Items/Dyetubs/RunebookDyeTub.cs | 16 +- .../Tailor Items/Dyetubs/SpecialDyeTub.cs | 16 +- .../Tailor Items/Dyetubs/StatuetteDyeTub.cs | 16 +- .../Items/Skill Items/Thief/DisguiseKit.cs | 20 +- .../Skill Items/Thief/DisguisePersistance.cs | 10 +- Scripts/Items/Skill Items/Tinkering/Clocks.cs | 6 +- .../Dawn's Music Box/DawnsMusicBox.cs | 42 +- .../Dawn's Music Box/DawnsMusicGear.cs | 18 +- .../Dawn's Music Box/DawnsMusicInfo.cs | 12 +- Scripts/Items/Special/Gifts/RoseOfTrinsic.cs | 12 +- .../Items/Special/Gifts/TapestryOfSosaria.cs | 12 +- .../Items/Special/Heritage Items/Curtains.cs | 14 +- .../Special/Holiday/Christmas/HolidayTree.cs | 15 +- Scripts/Items/Special/Holiday/HolidayFoods.cs | 46 +- .../Special/House Raffle/HouseRaffleStone.cs | 94 +-- Scripts/Items/Special/MiniHouses.cs | 16 +- Scripts/Items/Special/MonsterStatuette.cs | 35 +- .../Mutation Core/PlagueBeastInnard.cs | 24 +- .../Mutation Core/PlagueBeastMutationCore.cs | 18 +- .../Mutation Core/PlagueBeastOrgans.cs | 42 +- .../Special/Mutation Core/PlagueBeastVein.cs | 14 +- .../Special/Solen Items/BallOfSummoning.cs | 17 +- Scripts/Items/Special/SoulStone.cs | 26 +- .../Special/Special Scrolls/SpecialScroll.cs | 46 +- .../Items/Special/Veteran Rewards/Cannon.cs | 9 +- .../Special/Veteran Rewards/MiningCart.cs | 104 +-- Scripts/Items/Suits/BaseSuit.cs | 20 +- Scripts/Items/Talismans/TalismanAttribute.cs | 66 +- Scripts/Items/Traps/GasTrap.cs | 18 +- Scripts/Items/Weapons/Abilities/DualWield.cs | 8 +- Scripts/Items/Weapons/Abilities/Feint.cs | 8 +- .../Weapons/Abilities/FrenziedWhirlwind.cs | 3 +- .../Items/Weapons/Abilities/TalonStrike.cs | 3 +- .../Items/Weapons/Abilities/WeaponAbility.cs | 152 ++-- Scripts/Items/Weapons/BaseWeapon.cs | 50 +- Scripts/Items/Weapons/SlayerEntry.cs | 22 +- Scripts/Items/Weapons/SlayerGroup.cs | 43 +- Scripts/Misc/AOS.cs | 25 +- Scripts/Misc/Assistants.cs | 8 +- Scripts/Misc/AutoRestart.cs | 9 +- Scripts/Misc/AutoSave.cs | 14 +- Scripts/Misc/BuffIcons.cs | 49 +- Scripts/Misc/ClientVerification.cs | 35 +- Scripts/Misc/Emitter.cs | 127 ++-- Scripts/Misc/Geometry.cs | 18 +- .../Winter2004/LightOfTheWinterSolstice.cs | 22 +- Scripts/Misc/Guild.cs | 441 +++++------ Scripts/Misc/HardwareInfo.cs | 119 ++- Scripts/Misc/InhumanSpeech.cs | 55 +- Scripts/Misc/LanguageStatistics.cs | 47 +- Scripts/Misc/Loot.cs | 673 ++++++++--------- Scripts/Misc/LootPack.cs | 168 ++--- Scripts/Misc/MondainsLegacy.cs | 7 +- Scripts/Misc/NameList.cs | 22 +- Scripts/Misc/NameVerification.cs | 177 +++-- Scripts/Misc/Poison.cs | 24 +- Scripts/Misc/ProfanityProtection.cs | 110 ++- Scripts/Misc/ResourceInfo.cs | 182 ++--- Scripts/Misc/ShardPoller.cs | 145 ++-- Scripts/Misc/TextDefinition.cs | 92 ++- Scripts/Misc/ToggleItem.cs | 46 +- Scripts/Misc/Weather.cs | 112 ++- Scripts/Misc/WeightOverloading.cs | 10 +- Scripts/Mobiles/AI/AIControlMobileTarget.cs | 7 +- Scripts/Mobiles/AI/BaseAI.cs | 16 +- Scripts/Mobiles/AI/OppositionGroup.cs | 154 ++-- Scripts/Mobiles/AI/SpeedInfo.cs | 28 +- Scripts/Mobiles/Animals/Cows/Cow.cs | 33 +- Scripts/Mobiles/Animals/Mounts/BaseMount.cs | 46 +- Scripts/Mobiles/Animals/Mounts/Ethereals.cs | 15 +- Scripts/Mobiles/BaseCreature.cs | 673 ++++++----------- Scripts/Mobiles/Healers/BaseHealer.cs | 3 +- Scripts/Mobiles/Healers/PricedHealer.cs | 16 +- Scripts/Mobiles/Monsters/AOS/DemonKnight.cs | 17 +- .../Mobiles/Monsters/Ants/BlackSolenQueen.cs | 9 +- .../Monsters/Ants/BlackSolenWarrior.cs | 9 +- .../Mobiles/Monsters/Ants/RedSolenQueen.cs | 9 +- .../Mobiles/Monsters/Ants/RedSolenWarrior.cs | 9 +- .../Monsters/LBR/Exodus/ExodusMinion.cs | 26 +- .../Monsters/LBR/Exodus/ExodusOverseer.cs | 26 +- .../Mobiles/Monsters/ML/Special/Ilhenir.cs | 15 +- .../Monsters/Misc/Melee/PlagueBeast.cs | 26 +- .../Monsters/Misc/Melee/PlagueBeastLord.cs | 50 +- .../Monsters/Misc/Melee/PlagueSpawn.cs | 20 +- .../Monsters/Reptile/Magic/Leviathan.cs | 26 +- Scripts/Mobiles/PlayerMobile.cs | 695 ++++++------------ Scripts/Mobiles/Special/Harrower.cs | 14 +- Scripts/Mobiles/Special/HarrowerTentacles.cs | 13 +- Scripts/Mobiles/Special/Neira.cs | 11 +- Scripts/Mobiles/Townfolk/BaseEscortable.cs | 24 +- Scripts/Mobiles/Townfolk/TownCrier.cs | 86 +-- Scripts/Mobiles/Vendors/AnimalBuy.cs | 6 +- Scripts/Mobiles/Vendors/BaseVendor.cs | 22 +- Scripts/Mobiles/Vendors/GenericBuy.cs | 91 +-- .../Mobiles/Vendors/NPC/CustomHairstylist.cs | 82 +-- .../NPC/Guildmasters/BaseGuildmaster.cs | 3 +- Scripts/Mobiles/Vendors/PlayerBarkeeper.cs | 94 +-- Scripts/Mobiles/Vendors/PlayerVendor.cs | 114 ++- Scripts/Mobiles/Vendors/RentedVendor.cs | 99 +-- .../Vendors/SBInfo/Armors/SBChainmailArmor.cs | 8 +- .../Vendors/SBInfo/Armors/SBHelmetArmor.cs | 8 +- .../Vendors/SBInfo/Armors/SBLeatherArmor.cs | 8 +- .../Vendors/SBInfo/Armors/SBMetalShields.cs | 8 +- .../Vendors/SBInfo/Armors/SBPlateArmor.cs | 8 +- .../Vendors/SBInfo/Armors/SBRingmailArmor.cs | 8 +- .../Vendors/SBInfo/Armors/SBStuddedArmor.cs | 8 +- .../Vendors/SBInfo/Armors/SBWoodenShields.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBAlchemist.cs | 8 +- .../Mobiles/Vendors/SBInfo/SBAnimalTrainer.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBArchitect.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBBaker.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBBanker.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBBard.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBBarkeeper.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBBeekeeper.cs | 8 +- .../Mobiles/Vendors/SBInfo/SBBlacksmith.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBBowyer.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBButcher.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBCarpenter.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBCobbler.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBCook.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBFarmer.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBFisherman.cs | 8 +- .../Mobiles/Vendors/SBInfo/SBFortuneTeller.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBFurtrader.cs | 8 +- .../Mobiles/Vendors/SBInfo/SBGlassblower.cs | 8 +- .../Mobiles/Vendors/SBInfo/SBHairStylist.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBHealer.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBHerbalist.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBHolyMage.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBHouseDeed.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBInnKeeper.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBJewel.cs | 8 +- .../Vendors/SBInfo/SBKeeperOfChivalry.cs | 8 +- .../Mobiles/Vendors/SBInfo/SBLeatherWorker.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBMage.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBMapmaker.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBMiller.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBMiner.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBMonk.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBNinja.cs | 8 +- .../Vendors/SBInfo/SBPlayerBarkeeper.cs | 8 +- .../Mobiles/Vendors/SBInfo/SBProvisioner.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBRancher.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBRanger.cs | 8 +- .../Vendors/SBInfo/SBRealEstateBroker.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBSECook.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBSEHats.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBSamurai.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBScribe.cs | 8 +- .../Mobiles/Vendors/SBInfo/SBShipwright.cs | 8 +- .../Mobiles/Vendors/SBInfo/SBSmithTools.cs | 8 +- .../Mobiles/Vendors/SBInfo/SBStoneCrafter.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBTailor.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBTanner.cs | 8 +- .../Mobiles/Vendors/SBInfo/SBTavernKeeper.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBThief.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBTinker.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBVagabond.cs | 8 +- .../Mobiles/Vendors/SBInfo/SBVarietyDealer.cs | 8 +- .../Mobiles/Vendors/SBInfo/SBVeterinarian.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBWaiter.cs | 8 +- .../Mobiles/Vendors/SBInfo/SBWeaponSmith.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SBWeaver.cs | 8 +- .../Mobiles/Vendors/SBInfo/SE/SBSEArmor.cs | 8 +- .../Mobiles/Vendors/SBInfo/SE/SBSEBowyer.cs | 8 +- .../Vendors/SBInfo/SE/SBSECarpenter.cs | 8 +- Scripts/Mobiles/Vendors/SBInfo/SE/SBSEFood.cs | 8 +- .../Vendors/SBInfo/SE/SBSELeatherArmor.cs | 8 +- .../Mobiles/Vendors/SBInfo/SE/SBSEWeapons.cs | 8 +- .../Vendors/SBInfo/Weapons/SBAxeWeapon.cs | 8 +- .../Vendors/SBInfo/Weapons/SBKnifeWeapon.cs | 8 +- .../Vendors/SBInfo/Weapons/SBMaceWeapon.cs | 8 +- .../Vendors/SBInfo/Weapons/SBPoleArmWeapon.cs | 8 +- .../Vendors/SBInfo/Weapons/SBRangedWeapon.cs | 8 +- .../SBInfo/Weapons/SBSpearForkWeapon.cs | 8 +- .../Vendors/SBInfo/Weapons/SBStavesWeapon.cs | 8 +- .../Vendors/SBInfo/Weapons/SBSwordWeapon.cs | 8 +- Scripts/Mobiles/Vendors/VendorInventory.cs | 87 +-- Scripts/Multis/BaseHouse.cs | 637 +++++++--------- Scripts/Multis/Boats/BaseBoat.cs | 348 ++++----- Scripts/Multis/Boats/BaseBoatDeed.cs | 27 +- Scripts/Multis/Boats/BaseDockedBoat.cs | 24 +- Scripts/Multis/Boats/Plank.cs | 59 +- Scripts/Multis/ComponentVerification.cs | 19 +- Scripts/Multis/Deeds.cs | 33 +- Scripts/Multis/DynamicDecay.cs | 11 +- Scripts/Multis/HouseFoundation.cs | 267 ++++--- Scripts/Multis/HousePlacementTool.cs | 346 +++++---- Scripts/Multis/HouseSign.cs | 83 +-- Scripts/Multis/HouseTeleporter.cs | 37 +- Scripts/Multis/MovingCrate.cs | 18 +- Scripts/Regions/BaseRegion.cs | 18 +- Scripts/Regions/DungeonRegion.cs | 7 +- Scripts/Regions/GuardedRegion.cs | 7 +- Scripts/Regions/HouseRegion.cs | 90 ++- Scripts/Regions/Spawning/SpawnDefinition.cs | 58 +- Scripts/Regions/Spawning/SpawnEntry.cs | 136 ++-- Scripts/Skills/AnimalTaming.cs | 10 +- Scripts/Skills/Hiding.cs | 12 +- Scripts/Skills/Stealing.cs | 38 +- Scripts/Skills/Stealth.cs | 34 +- .../SpecialSystems/Engines/PreventInaccess.cs | 10 +- Scripts/Spells/Base/SpecialMove.cs | 22 +- Scripts/Spells/Base/Spell.cs | 290 ++++---- Scripts/Spells/Base/SpellHelper.cs | 32 +- Scripts/Spells/Base/SpellInfo.cs | 65 +- Scripts/Spells/Base/SpellRegistry.cs | 9 +- Scripts/Spells/First/CreateFood.cs | 16 +- Scripts/Spells/Necromancy/SummonFamiliar.cs | 47 +- Scripts/Spells/Ninjitsu/AnimalForm.cs | 134 ++-- Scripts/Spells/Second/Protection.cs | 7 +- Scripts/Spells/Spellweaving/EssenceOfWind.cs | 24 +- Scripts/Spells/Spellweaving/GiftOfLife.cs | 6 +- .../Spells/Spellweaving/Items/ArcaneFocus.cs | 16 +- .../Spellweaving/Items/TransientItem.cs | 36 +- Server/AggressorInfo.cs | 10 +- Server/Attributes.cs | 49 +- Server/BaseVendor.cs | 74 +- Server/Body.cs | 138 ++-- Server/ClientVersion.cs | 104 ++- Server/Commands.cs | 92 +-- Server/ContextMenus/ContextMenu.cs | 24 +- Server/ContextMenus/ContextMenuEntry.cs | 53 +- Server/Diagnostics/BaseProfile.cs | 27 +- Server/Diagnostics/PacketProfile.cs | 8 +- Server/Diagnostics/TimerProfile.cs | 19 +- Server/Effects.cs | 10 +- Server/EventSink.cs | 591 ++++++--------- Server/Geometry.cs | 53 +- Server/Guild.cs | 31 +- Server/Gumps/Gump.cs | 22 +- Server/Gumps/GumpImageTileButton.cs | 18 +- Server/Gumps/RelayInfo.cs | 37 +- Server/HuePicker.cs | 13 +- Server/IEntity.cs | 33 +- Server/Insensitive.cs | 12 +- Server/Item.cs | 102 +-- Server/ItemBounds.cs | 10 +- Server/Items/Container.cs | 103 +-- Server/Items/Containers.cs | 49 +- Server/Items/SecureTradeContainer.cs | 20 +- Server/Items/VirtualHair.cs | 25 +- Server/KeywordList.cs | 19 +- Server/Main.cs | 174 ++--- Server/Map.cs | 132 ++-- Server/Menus/ItemListMenu.cs | 33 +- Server/Menus/QuestionMenu.cs | 17 +- Server/Movement.cs | 16 +- Server/MultiData.cs | 190 +++-- Server/Network/BufferPool.cs | 14 +- Server/Network/ByteQueue.cs | 29 +- Server/Network/EncodedPacketHandler.cs | 16 +- Server/Network/Listener.cs | 7 +- Server/Network/MessagePump.cs | 23 +- Server/Network/NetState.cs | 339 ++++----- Server/Network/PacketHandler.cs | 28 +- Server/Network/PacketHandlers.cs | 31 +- Server/Network/PacketReader.cs | 112 ++- Server/Network/Packets.cs | 193 ++--- Server/Network/SendQueue.cs | 21 +- Server/Notoriety.cs | 39 +- Server/ObjectPropertyList.cs | 33 +- Server/Party.cs | 6 +- Server/Persistence/FileOperations.cs | 36 +- Server/Persistence/FileQueue.cs | 16 +- Server/Persistence/StandardSaveStrategy.cs | 9 +- Server/Point3DList.cs | 37 +- Server/Poison.cs | 22 +- Server/Prompt.cs | 7 +- Server/QuestArrow.cs | 36 +- Server/Race.cs | 86 +-- Server/Region.cs | 315 ++++---- Server/ScriptCompiler.cs | 53 +- Server/Sector.cs | 30 +- Server/SecureTrade.cs | 188 +++-- Server/Serial.cs | 48 +- Server/Serialization.cs | 9 +- Server/Skills.cs | 368 ++++------ Server/Targeting/LandTarget.cs | 9 +- Server/Targeting/MultiTarget.cs | 19 +- Server/Targeting/StaticTarget.cs | 11 +- Server/Targeting/Target.cs | 75 +- Server/TileData.cs | 95 +-- Server/TileList.cs | 27 +- Server/TileMatrix.cs | 132 ++-- Server/TileMatrixPatch.cs | 10 +- Server/Timer.cs | 35 +- Server/VirtueInfo.cs | 26 +- Server/World.cs | 154 ++-- 623 files changed, 13072 insertions(+), 19304 deletions(-) diff --git a/Scripts/Accounting/Account.cs b/Scripts/Accounting/Account.cs index b156a40d6..e1705c929 100644 --- a/Scripts/Accounting/Account.cs +++ b/Scripts/Accounting/Account.cs @@ -19,17 +19,11 @@ namespace Server.Accounting public static readonly TimeSpan EmptyInactiveDuration = TimeSpan.FromDays(30.0); - private string m_Username, m_Email, m_PlainPassword, m_CryptPassword, m_NewCryptPassword; private AccessLevel m_AccessLevel; - private int m_Flags; - private DateTime m_Created, m_LastLogin; private TimeSpan m_TotalGameTime; private List m_Comments; private List m_Tags; private Mobile[] m_Mobiles; - private string[] m_IPRestrictions; - private IPAddress[] m_LoginIPs; - private HardwareInfo m_HardwareInfo; /// /// Deletes the account, all characters of the account, and all houses of those characters @@ -54,38 +48,26 @@ namespace Server.Accounting m_Mobiles[i] = null; } - if ( m_LoginIPs.Length != 0 && AccountHandler.IPTable.ContainsKey( m_LoginIPs[0] ) ) - --AccountHandler.IPTable[m_LoginIPs[0]]; + if ( LoginIPs.Length != 0 && AccountHandler.IPTable.ContainsKey( LoginIPs[0] ) ) + --AccountHandler.IPTable[LoginIPs[0]]; - Accounts.Remove( m_Username ); + Accounts.Remove( Username ); } /// /// Object detailing information about the hardware of the last person to log into this account /// - public HardwareInfo HardwareInfo - { - get => m_HardwareInfo; - set => m_HardwareInfo = value; - } + public HardwareInfo HardwareInfo { get; set; } /// /// List of IP addresses for restricted access. '*' wildcard supported. If the array contains zero entries, all IP addresses are allowed. /// - public string[] IPRestrictions - { - get => m_IPRestrictions; - set => m_IPRestrictions = value; - } + public string[] IPRestrictions { get; set; } /// /// List of IP addresses which have successfully logged into this account. /// - public IPAddress[] LoginIPs - { - get => m_LoginIPs; - set => m_LoginIPs = value; - } + public IPAddress[] LoginIPs { get; set; } /// /// List of account comments. Type of contained objects is AccountComment. @@ -106,47 +88,27 @@ namespace Server.Accounting /// /// Account username. Case insensitive validation. /// - public string Username - { - get => m_Username; - set => m_Username = value; - } + public string Username { get; set; } /// /// Account email address. /// - public string Email - { - get => m_Email; - set => m_Email = value; - } + public string Email { get; set; } /// /// Account password. Plain text. Case sensitive validation. May be null. /// - public string PlainPassword - { - get => m_PlainPassword; - set => m_PlainPassword = value; - } + public string PlainPassword { get; set; } /// /// Account password. Hashed with MD5. May be null. /// - public string CryptPassword - { - get => m_CryptPassword; - set => m_CryptPassword = value; - } + public string CryptPassword { get; set; } /// /// Account username and password hashed with SHA1. May be null. /// - public string NewCryptPassword - { - get => m_NewCryptPassword; - set => m_NewCryptPassword = value; - } + public string NewCryptPassword { get; set; } /// /// Initial AccessLevel for new characters created on this account. @@ -160,11 +122,7 @@ namespace Server.Accounting /// /// Internal bitfield of account flags. Consider using direct access properties (Banned, Young), or GetFlag/SetFlag methods /// - public int Flags - { - get => m_Flags; - set => m_Flags = value; - } + public int Flags { get; set; } /// /// Gets or sets a flag indicating if this account is banned. @@ -217,16 +175,12 @@ namespace Server.Accounting /// /// The date and time of when this account was created. /// - public DateTime Created => m_Created; + public DateTime Created { get; } /// /// Gets or sets the date and time when this account was last accessed. /// - public DateTime LastLogin - { - get => m_LastLogin; - set => m_LastLogin = value; - } + public DateTime LastLogin { get; set; } /// /// An account is considered inactive based upon LastLogin and InactiveDuration. If the account is empty, it is based upon EmptyInactiveDuration @@ -238,7 +192,7 @@ namespace Server.Accounting if ( AccessLevel != AccessLevel.Player ) return false; - TimeSpan inactiveLength = DateTime.UtcNow - m_LastLogin; + TimeSpan inactiveLength = DateTime.UtcNow - LastLogin; return (inactiveLength > ((Count == 0) ? EmptyInactiveDuration : InactiveDuration)); } @@ -268,7 +222,7 @@ namespace Server.Accounting /// The zero-based flag index. public bool GetFlag( int index ) { - return ( m_Flags & ( 1 << index ) ) != 0; + return ( Flags & ( 1 << index ) ) != 0; } /// @@ -279,9 +233,9 @@ namespace Server.Accounting public void SetFlag( int index, bool value ) { if ( value ) - m_Flags |= ( 1 << index ); + Flags |= ( 1 << index ); else - m_Flags &= ~( 1 << index ); + Flags &= ~( 1 << index ); } /// @@ -437,25 +391,25 @@ namespace Server.Accounting { case PasswordProtection.None: { - m_PlainPassword = plainPassword; - m_CryptPassword = null; - m_NewCryptPassword = null; + PlainPassword = plainPassword; + CryptPassword = null; + NewCryptPassword = null; break; } case PasswordProtection.Crypt: { - m_PlainPassword = null; - m_CryptPassword = HashMD5( plainPassword ); - m_NewCryptPassword = null; + PlainPassword = null; + CryptPassword = HashMD5( plainPassword ); + NewCryptPassword = null; break; } default: // PasswordProtection.NewCrypt { - m_PlainPassword = null; - m_CryptPassword = null; - m_NewCryptPassword = HashSHA1( m_Username + plainPassword ); + PlainPassword = null; + CryptPassword = null; + NewCryptPassword = HashSHA1( Username + plainPassword ); break; } @@ -467,19 +421,19 @@ namespace Server.Accounting bool ok; PasswordProtection curProt; - if ( m_PlainPassword != null ) + if ( PlainPassword != null ) { - ok = ( m_PlainPassword == plainPassword ); + ok = ( PlainPassword == plainPassword ); curProt = PasswordProtection.None; } - else if ( m_CryptPassword != null ) + else if ( CryptPassword != null ) { - ok = ( m_CryptPassword == HashMD5( plainPassword ) ); + ok = ( CryptPassword == HashMD5( plainPassword ) ); curProt = PasswordProtection.Crypt; } else { - ok = ( m_NewCryptPassword == HashSHA1( m_Username + plainPassword ) ); + ok = ( NewCryptPassword == HashSHA1( Username + plainPassword ) ); curProt = PasswordProtection.NewCrypt; } @@ -591,26 +545,26 @@ namespace Server.Accounting public Account( string username, string password ) { - m_Username = username; + Username = username; SetPassword( password ); m_AccessLevel = AccessLevel.Player; - m_Created = m_LastLogin = DateTime.UtcNow; + Created = LastLogin = DateTime.UtcNow; m_TotalGameTime = TimeSpan.Zero; m_Mobiles = new Mobile[7]; - m_IPRestrictions = new string[0]; - m_LoginIPs = new IPAddress[0]; + IPRestrictions = new string[0]; + LoginIPs = new IPAddress[0]; Accounts.Add( this ); } public Account( XmlElement node ) { - m_Username = Utility.GetText( node["username"], "empty" ); + Username = Utility.GetText( node["username"], "empty" ); string plainPassword = Utility.GetText( node["password"], null ); string cryptPassword = Utility.GetText( node["cryptPassword"], null ); @@ -623,9 +577,9 @@ namespace Server.Accounting if ( plainPassword != null ) SetPassword( plainPassword ); else if ( newCryptPassword != null ) - m_NewCryptPassword = newCryptPassword; + NewCryptPassword = newCryptPassword; else if ( cryptPassword != null ) - m_CryptPassword = cryptPassword; + CryptPassword = cryptPassword; else SetPassword( "empty" ); @@ -634,11 +588,11 @@ namespace Server.Accounting case PasswordProtection.Crypt: { if ( cryptPassword != null ) - m_CryptPassword = cryptPassword; + CryptPassword = cryptPassword; else if ( plainPassword != null ) SetPassword( plainPassword ); else if ( newCryptPassword != null ) - m_NewCryptPassword = newCryptPassword; + NewCryptPassword = newCryptPassword; else SetPassword( "empty" ); @@ -647,11 +601,11 @@ namespace Server.Accounting default: // PasswordProtection.NewCrypt { if ( newCryptPassword != null ) - m_NewCryptPassword = newCryptPassword; + NewCryptPassword = newCryptPassword; else if ( plainPassword != null ) SetPassword( plainPassword ); else if ( cryptPassword != null ) - m_CryptPassword = cryptPassword; + CryptPassword = cryptPassword; else SetPassword( "empty" ); @@ -660,9 +614,9 @@ namespace Server.Accounting } Enum.TryParse( Utility.GetText( node["accessLevel"], "Player" ), true, out m_AccessLevel ); - m_Flags = Utility.GetXMLInt32( Utility.GetText( node["flags"], "0" ), 0 ); - m_Created = Utility.GetXMLDateTime( Utility.GetText( node["created"], null ), DateTime.UtcNow ); - m_LastLogin = Utility.GetXMLDateTime( Utility.GetText( node["lastLogin"], null ), DateTime.UtcNow ); + Flags = Utility.GetXMLInt32( Utility.GetText( node["flags"], "0" ), 0 ); + Created = Utility.GetXMLDateTime( Utility.GetText( node["created"], null ), DateTime.UtcNow ); + LastLogin = Utility.GetXMLDateTime( Utility.GetText( node["lastLogin"], null ), DateTime.UtcNow ); TotalGold = Utility.GetXMLInt32( Utility.GetText(node["totalGold"], "0" ), 0 ); TotalPlat = Utility.GetXMLInt32(Utility.GetText(node["totalPlat"], "0"), 0); @@ -670,8 +624,8 @@ namespace Server.Accounting m_Mobiles = LoadMobiles( node ); m_Comments = LoadComments( node ); m_Tags = LoadTags( node ); - m_LoginIPs = LoadAddressList( node ); - m_IPRestrictions = LoadAccessCheck( node ); + LoginIPs = LoadAddressList( node ); + IPRestrictions = LoadAccessCheck( node ); for ( int i = 0; i < m_Mobiles.Length; ++i ) { @@ -896,10 +850,10 @@ namespace Server.Accounting return false; } - bool accessAllowed = ( m_IPRestrictions.Length == 0 || IPLimiter.IsExempt( ipAddress ) ); + bool accessAllowed = ( IPRestrictions.Length == 0 || IPLimiter.IsExempt( ipAddress ) ); - for ( int i = 0; !accessAllowed && i < m_IPRestrictions.Length; ++i ) - accessAllowed = Utility.IPMatch( m_IPRestrictions[i], ipAddress ); + for ( int i = 0; !accessAllowed && i < IPRestrictions.Length; ++i ) + accessAllowed = Utility.IPMatch( IPRestrictions[i], ipAddress ); return accessAllowed; } @@ -919,7 +873,7 @@ namespace Server.Accounting if ( IPLimiter.IsExempt( ipAddress ) ) return; - if ( m_LoginIPs.Length == 0 ) { + if ( LoginIPs.Length == 0 ) { if ( AccountHandler.IPTable.ContainsKey( ipAddress ) ) AccountHandler.IPTable[ipAddress]++; else @@ -928,19 +882,19 @@ namespace Server.Accounting bool contains = false; - for ( int i = 0; !contains && i < m_LoginIPs.Length; ++i ) - contains = m_LoginIPs[i].Equals( ipAddress ); + for ( int i = 0; !contains && i < LoginIPs.Length; ++i ) + contains = LoginIPs[i].Equals( ipAddress ); if ( contains ) return; - IPAddress[] old = m_LoginIPs; - m_LoginIPs = new IPAddress[old.Length + 1]; + IPAddress[] old = LoginIPs; + LoginIPs = new IPAddress[old.Length + 1]; for ( int i = 0; i < old.Length; ++i ) - m_LoginIPs[i] = old[i]; + LoginIPs[i] = old[i]; - m_LoginIPs[old.Length] = ipAddress; + LoginIPs[old.Length] = ipAddress; } /// @@ -972,27 +926,27 @@ namespace Server.Accounting xml.WriteStartElement( "account" ); xml.WriteStartElement( "username" ); - xml.WriteString( m_Username ); + xml.WriteString( Username ); xml.WriteEndElement(); - if ( m_PlainPassword != null ) + if ( PlainPassword != null ) { xml.WriteStartElement( "password" ); - xml.WriteString( m_PlainPassword ); + xml.WriteString( PlainPassword ); xml.WriteEndElement(); } - if ( m_CryptPassword != null ) + if ( CryptPassword != null ) { xml.WriteStartElement( "cryptPassword" ); - xml.WriteString( m_CryptPassword ); + xml.WriteString( CryptPassword ); xml.WriteEndElement(); } - if ( m_NewCryptPassword != null ) + if ( NewCryptPassword != null ) { xml.WriteStartElement( "newCryptPassword" ); - xml.WriteString( m_NewCryptPassword ); + xml.WriteString( NewCryptPassword ); xml.WriteEndElement(); } @@ -1003,19 +957,19 @@ namespace Server.Accounting xml.WriteEndElement(); } - if ( m_Flags != 0 ) + if ( Flags != 0 ) { xml.WriteStartElement( "flags" ); - xml.WriteString( XmlConvert.ToString( m_Flags ) ); + xml.WriteString( XmlConvert.ToString( Flags ) ); xml.WriteEndElement(); } xml.WriteStartElement( "created" ); - xml.WriteString( XmlConvert.ToString( m_Created, XmlDateTimeSerializationMode.Utc ) ); + xml.WriteString( XmlConvert.ToString( Created, XmlDateTimeSerializationMode.Utc ) ); xml.WriteEndElement(); xml.WriteStartElement( "lastLogin" ); - xml.WriteString( XmlConvert.ToString( m_LastLogin, XmlDateTimeSerializationMode.Utc ) ); + xml.WriteString( XmlConvert.ToString( LastLogin, XmlDateTimeSerializationMode.Utc ) ); xml.WriteEndElement(); xml.WriteStartElement( "totalGameTime" ); @@ -1061,30 +1015,30 @@ namespace Server.Accounting xml.WriteEndElement(); } - if ( m_LoginIPs.Length > 0 ) + if ( LoginIPs.Length > 0 ) { xml.WriteStartElement( "addressList" ); - xml.WriteAttributeString( "count", m_LoginIPs.Length.ToString() ); + xml.WriteAttributeString( "count", LoginIPs.Length.ToString() ); - for ( int i = 0; i < m_LoginIPs.Length; ++i ) + for ( int i = 0; i < LoginIPs.Length; ++i ) { xml.WriteStartElement( "ip" ); - xml.WriteString( m_LoginIPs[i].ToString() ); + xml.WriteString( LoginIPs[i].ToString() ); xml.WriteEndElement(); } xml.WriteEndElement(); } - if ( m_IPRestrictions.Length > 0 ) + if ( IPRestrictions.Length > 0 ) { xml.WriteStartElement( "accessCheck" ); - for ( int i = 0; i < m_IPRestrictions.Length; ++i ) + for ( int i = 0; i < IPRestrictions.Length; ++i ) { xml.WriteStartElement( "ip" ); - xml.WriteString( m_IPRestrictions[i] ); + xml.WriteString( IPRestrictions[i] ); xml.WriteEndElement(); } @@ -1170,7 +1124,7 @@ namespace Server.Accounting public override string ToString() { - return m_Username; + return Username; } public int CompareTo( Account other ) @@ -1178,7 +1132,7 @@ namespace Server.Accounting if ( other == null ) return 1; - return m_Username.CompareTo( other.m_Username ); + return Username.CompareTo( other.Username ); } public int CompareTo( IAccount other ) @@ -1186,7 +1140,7 @@ namespace Server.Accounting if ( other == null ) return 1; - return m_Username.CompareTo( other.Username ); + return Username.CompareTo( other.Username ); } public int CompareTo( object obj ) diff --git a/Scripts/Accounting/AccountAttackLimiter.cs b/Scripts/Accounting/AccountAttackLimiter.cs index a40b6be3b..87cfffedc 100644 --- a/Scripts/Accounting/AccountAttackLimiter.cs +++ b/Scripts/Accounting/AccountAttackLimiter.cs @@ -104,38 +104,22 @@ namespace Server.Accounting public class InvalidAccountAccessLog { - private IPAddress m_Address; - private DateTime m_LastAccessTime; - private int m_Counts; + public IPAddress Address { get; set; } - public IPAddress Address - { - get => m_Address; - set => m_Address = value; - } + public DateTime LastAccessTime { get; set; } - public DateTime LastAccessTime - { - get => m_LastAccessTime; - set => m_LastAccessTime = value; - } + public bool HasExpired => ( DateTime.UtcNow >= ( LastAccessTime + TimeSpan.FromHours( 1.0 ) ) ); - public bool HasExpired => ( DateTime.UtcNow >= ( m_LastAccessTime + TimeSpan.FromHours( 1.0 ) ) ); - - public int Counts - { - get => m_Counts; - set => m_Counts = value; - } + public int Counts { get; set; } public void RefreshAccessTime() { - m_LastAccessTime = DateTime.UtcNow; + LastAccessTime = DateTime.UtcNow; } public InvalidAccountAccessLog( IPAddress address ) { - m_Address = address; + Address = address; RefreshAccessTime(); } } diff --git a/Scripts/Accounting/AccountComment.cs b/Scripts/Accounting/AccountComment.cs index c9cc78123..e55d6db1f 100644 --- a/Scripts/Accounting/AccountComment.cs +++ b/Scripts/Accounting/AccountComment.cs @@ -5,14 +5,12 @@ namespace Server.Accounting { public class AccountComment { - private string m_AddedBy; private string m_Content; - private DateTime m_LastModified; /// /// A string representing who added this comment. /// - public string AddedBy => m_AddedBy; + public string AddedBy { get; } /// /// Gets or sets the body of this comment. Setting this value will reset LastModified. @@ -20,13 +18,13 @@ namespace Server.Accounting public string Content { get => m_Content; - set{ m_Content = value; m_LastModified = DateTime.UtcNow; } + set{ m_Content = value; LastModified = DateTime.UtcNow; } } /// /// The date and time when this account was last modified -or- the comment creation time, if never modified. /// - public DateTime LastModified => m_LastModified; + public DateTime LastModified { get; private set; } /// /// Constructs a new AccountComment instance. @@ -35,9 +33,9 @@ namespace Server.Accounting /// Initial Content value. public AccountComment( string addedBy, string content ) { - m_AddedBy = addedBy; + AddedBy = addedBy; m_Content = content; - m_LastModified = DateTime.UtcNow; + LastModified = DateTime.UtcNow; } /// @@ -46,8 +44,8 @@ namespace Server.Accounting /// The XmlElement instance from which to deserialize. public AccountComment( XmlElement node ) { - m_AddedBy = Utility.GetAttribute( node, "addedBy", "empty" ); - m_LastModified = Utility.GetXMLDateTime( Utility.GetAttribute( node, "lastModified" ), DateTime.UtcNow ); + AddedBy = Utility.GetAttribute( node, "addedBy", "empty" ); + LastModified = Utility.GetXMLDateTime( Utility.GetAttribute( node, "lastModified" ), DateTime.UtcNow ); m_Content = Utility.GetText( node, "" ); } @@ -59,9 +57,9 @@ namespace Server.Accounting { xml.WriteStartElement( "comment" ); - xml.WriteAttributeString( "addedBy", m_AddedBy ); + xml.WriteAttributeString( "addedBy", AddedBy ); - xml.WriteAttributeString( "lastModified", XmlConvert.ToString( m_LastModified, XmlDateTimeSerializationMode.Utc ) ); + xml.WriteAttributeString( "lastModified", XmlConvert.ToString( LastModified, XmlDateTimeSerializationMode.Utc ) ); xml.WriteString( m_Content ); diff --git a/Scripts/Accounting/AccountHandler.cs b/Scripts/Accounting/AccountHandler.cs index 4f0a5db72..a6c2967db 100644 --- a/Scripts/Accounting/AccountHandler.cs +++ b/Scripts/Accounting/AccountHandler.cs @@ -26,13 +26,7 @@ namespace Server.Misc public static PasswordProtection ProtectPasswords = PasswordProtection.NewCrypt; - private static AccessLevel m_LockdownLevel; - - public static AccessLevel LockdownLevel - { - get => m_LockdownLevel; - set => m_LockdownLevel = value; - } + public static AccessLevel LockdownLevel { get; set; } private static CityInfo[] StartingCities = { new CityInfo( "New Haven", "New Haven Bank", 1150168, 3667, 2625, 0 ), @@ -330,7 +324,7 @@ namespace Server.Misc else if ( !acct.HasAccess( e.State ) ) { Console.WriteLine( "Login: {0}: Access denied for '{1}'", e.State, un ); - e.RejectReason = ( m_LockdownLevel > AccessLevel.Player ? ALRReason.BadComm : ALRReason.BadPass ); + e.RejectReason = ( LockdownLevel > AccessLevel.Player ? ALRReason.BadComm : ALRReason.BadPass ); } else if ( !acct.CheckPassword( pw ) ) { diff --git a/Scripts/Accounting/AccountTag.cs b/Scripts/Accounting/AccountTag.cs index a5760e074..5d7f17ebb 100644 --- a/Scripts/Accounting/AccountTag.cs +++ b/Scripts/Accounting/AccountTag.cs @@ -4,25 +4,15 @@ namespace Server.Accounting { public class AccountTag { - private string m_Name, m_Value; - /// /// Gets or sets the name of this tag. /// - public string Name - { - get => m_Name; - set => m_Name = value; - } + public string Name { get; set; } /// /// Gets or sets the value of this tag. /// - public string Value - { - get => m_Value; - set => m_Value = value; - } + public string Value { get; set; } /// /// Constructs a new AccountTag instance with a specific name and value. @@ -31,8 +21,8 @@ namespace Server.Accounting /// Initial value. public AccountTag( string name, string value ) { - m_Name = name; - m_Value = value; + Name = name; + Value = value; } /// @@ -41,8 +31,8 @@ namespace Server.Accounting /// The XmlElement instance from which to deserialize. public AccountTag( XmlElement node ) { - m_Name = Utility.GetAttribute( node, "name", "empty" ); - m_Value = Utility.GetText( node, "" ); + Name = Utility.GetAttribute( node, "name", "empty" ); + Value = Utility.GetText( node, "" ); } /// @@ -52,8 +42,8 @@ namespace Server.Accounting public void Save( XmlTextWriter xml ) { xml.WriteStartElement( "tag" ); - xml.WriteAttributeString( "name", m_Name ); - xml.WriteString( m_Value ); + xml.WriteAttributeString( "name", Name ); + xml.WriteString( Value ); xml.WriteEndElement(); } } diff --git a/Scripts/Accounting/Firewall.cs b/Scripts/Accounting/Firewall.cs index 9abc61493..e7d444944 100644 --- a/Scripts/Accounting/Firewall.cs +++ b/Scripts/Accounting/Firewall.cs @@ -145,11 +145,9 @@ namespace Server } #endregion - private static List m_Blocked; - static Firewall() { - m_Blocked = new List(); + List = new List(); string path = "firewall.cfg"; @@ -166,7 +164,7 @@ namespace Server if ( line.Length == 0 ) continue; - m_Blocked.Add( ToFirewallEntry( line ) ); + List.Add( ToFirewallEntry( line ) ); /* object toAdd; @@ -184,7 +182,7 @@ namespace Server } } - public static List List => m_Blocked; + public static List List { get; } public static IFirewallEntry ToFirewallEntry( object entry ) { @@ -220,7 +218,7 @@ namespace Server public static void RemoveAt( int index ) { - m_Blocked.RemoveAt( index ); + List.RemoveAt( index ); Save(); } @@ -230,7 +228,7 @@ namespace Server if ( entry != null ) { - m_Blocked.Remove( entry ); + List.Remove( entry ); Save(); } } @@ -247,8 +245,8 @@ namespace Server public static void Add( IFirewallEntry entry ) { - if ( !m_Blocked.Contains( entry ) ) - m_Blocked.Add( entry ); + if ( !List.Contains( entry ) ) + List.Add( entry ); Save(); } @@ -257,8 +255,8 @@ namespace Server { IFirewallEntry entry = ToFirewallEntry( pattern ); - if ( !m_Blocked.Contains( entry ) ) - m_Blocked.Add( entry ); + if ( !List.Contains( entry ) ) + List.Add( entry ); Save(); } @@ -267,8 +265,8 @@ namespace Server { IFirewallEntry entry = new IPFirewallEntry( ip ); - if ( !m_Blocked.Contains( entry ) ) - m_Blocked.Add( entry ); + if ( !List.Contains( entry ) ) + List.Add( entry ); Save(); } @@ -279,16 +277,16 @@ namespace Server using ( StreamWriter op = new StreamWriter( path ) ) { - for ( int i = 0; i < m_Blocked.Count; ++i ) - op.WriteLine( m_Blocked[i] ); + for ( int i = 0; i < List.Count; ++i ) + op.WriteLine( List[i] ); } } public static bool IsBlocked( IPAddress ip ) { - for( int i = 0; i < m_Blocked.Count; i++ ) + for( int i = 0; i < List.Count; i++ ) { - if ( m_Blocked[i].IsBlocked( ip ) ) + if ( List[i].IsBlocked( ip ) ) return true; } diff --git a/Scripts/Commands/Attributes.cs b/Scripts/Commands/Attributes.cs index 6d05aca85..cdaa4d0d0 100644 --- a/Scripts/Commands/Attributes.cs +++ b/Scripts/Commands/Attributes.cs @@ -4,37 +4,31 @@ namespace Server { public class UsageAttribute : Attribute { - private string m_Usage; - - public string Usage => m_Usage; + public string Usage { get; } public UsageAttribute( string usage ) { - m_Usage = usage; + Usage = usage; } } public class DescriptionAttribute : Attribute { - private string m_Description; - - public string Description => m_Description; + public string Description { get; } public DescriptionAttribute( string description ) { - m_Description = description; + Description = description; } } public class AliasesAttribute : Attribute { - private string[] m_Aliases; - - public string[] Aliases => m_Aliases; + public string[] Aliases { get; } public AliasesAttribute( params string[] aliases ) { - m_Aliases = aliases; + Aliases = aliases; } } } \ No newline at end of file diff --git a/Scripts/Commands/Batch.cs b/Scripts/Commands/Batch.cs index 51a30e4c5..c674bf0a8 100644 --- a/Scripts/Commands/Batch.cs +++ b/Scripts/Commands/Batch.cs @@ -9,31 +9,19 @@ namespace Server.Commands { public class Batch : BaseCommand { - private BaseCommandImplementor m_Scope; - private string m_Condition; - private ArrayList m_BatchCommands; + public BaseCommandImplementor Scope { get; set; } - public BaseCommandImplementor Scope - { - get => m_Scope; - set => m_Scope = value; - } + public string Condition { get; set; } - public string Condition - { - get => m_Condition; - set => m_Condition = value; - } - - public ArrayList BatchCommands => m_BatchCommands; + public ArrayList BatchCommands { get; } public Batch() { Commands = new[]{ "Batch" }; ListOptimized = true; - m_BatchCommands = new ArrayList(); - m_Condition = ""; + BatchCommands = new ArrayList(); + Condition = ""; } public override void ExecuteList( CommandEventArgs e, ArrayList list ) @@ -46,19 +34,19 @@ namespace Server.Commands try { - BaseCommand[] commands = new BaseCommand[m_BatchCommands.Count]; - CommandEventArgs[] eventArgs = new CommandEventArgs[m_BatchCommands.Count]; + BaseCommand[] commands = new BaseCommand[BatchCommands.Count]; + CommandEventArgs[] eventArgs = new CommandEventArgs[BatchCommands.Count]; - for ( int i = 0; i < m_BatchCommands.Count; ++i ) + for ( int i = 0; i < BatchCommands.Count; ++i ) { - BatchCommand bc = (BatchCommand)m_BatchCommands[i]; + BatchCommand bc = (BatchCommand)BatchCommands[i]; string commandString, argString; string[] args; bc.GetDetails( out commandString, out argString, out args ); - BaseCommand command = m_Scope.Commands[commandString]; + BaseCommand command = Scope.Commands[commandString]; commands[i] = command; eventArgs[i] = new CommandEventArgs( e.Mobile, commandString, argString, args ); @@ -74,7 +62,7 @@ namespace Server.Commands e.Mobile.SendMessage( "You do not have access to that command: {0}.", commandString ); return; } - if ( !command.ValidateArgs( m_Scope, eventArgs[i] ) ) + if ( !command.ValidateArgs( Scope, eventArgs[i] ) ) { return; } @@ -83,7 +71,7 @@ namespace Server.Commands for ( int i = 0; i < commands.Length; ++i ) { BaseCommand command = commands[i]; - BatchCommand bc = (BatchCommand)m_BatchCommands[i]; + BatchCommand bc = (BatchCommand)BatchCommands[i]; if ( list.Count > 20 ) CommandLogging.Enabled = false; @@ -153,26 +141,26 @@ namespace Server.Commands public bool Run( Mobile from ) { - if ( m_Scope == null ) + if ( Scope == null ) { from.SendMessage( "You must select the batch command scope." ); return false; } - if ( m_Condition.Length > 0 && !m_Scope.SupportsConditionals ) + if ( Condition.Length > 0 && !Scope.SupportsConditionals ) { from.SendMessage( "This command scope does not support conditionals." ); return false; } - if ( m_Condition.Length > 0 && !Utility.InsensitiveStartsWith( m_Condition, "where" ) ) + if ( Condition.Length > 0 && !Utility.InsensitiveStartsWith( Condition, "where" ) ) { from.SendMessage( "The condition field must start with \"where\"." ); return false; } - string[] args = CommandSystem.Split( m_Condition ); + string[] args = CommandSystem.Split( Condition ); - m_Scope.Process( from, this, args ); + Scope.Process( from, this, args ); return true; } @@ -194,44 +182,33 @@ namespace Server.Commands public class BatchCommand { - private string m_Command; - private string m_Object; + public string Command { get; set; } - public string Command - { - get => m_Command; - set => m_Command = value; - } - - public string Object - { - get => m_Object; - set => m_Object = value; - } + public string Object { get; set; } public void GetDetails( out string command, out string argString, out string[] args ) { - int indexOf = m_Command.IndexOf( ' ' ); + int indexOf = Command.IndexOf( ' ' ); if ( indexOf >= 0 ) { - argString = m_Command.Substring( indexOf + 1 ); + argString = Command.Substring( indexOf + 1 ); - command = m_Command.Substring( 0, indexOf ); + command = Command.Substring( 0, indexOf ); args = CommandSystem.Split( argString ); } else { argString = ""; - command = m_Command.ToLower(); + command = Command.ToLower(); args = new string[0]; } } public BatchCommand( string command, string obj ) { - m_Command = command; - m_Object = obj; + Command = command; + Object = obj; } } diff --git a/Scripts/Commands/Decorate.cs b/Scripts/Commands/Decorate.cs index ae4d8133b..eb2ecc242 100644 --- a/Scripts/Commands/Decorate.cs +++ b/Scripts/Commands/Decorate.cs @@ -1105,11 +1105,9 @@ namespace Server.Commands public class DecorationEntry { - private Point3D m_Location; - private string m_Extra; + public Point3D Location { get; } - public Point3D Location => m_Location; - public string Extra => m_Extra; + public string Extra { get; } public DecorationEntry( string line ) { @@ -1119,8 +1117,8 @@ namespace Server.Commands Pop( out y, ref line ); Pop( out z, ref line ); - m_Location = new Point3D( Utility.ToInt32( x ), Utility.ToInt32( y ), Utility.ToInt32( z ) ); - m_Extra = line; + Location = new Point3D( Utility.ToInt32( x ), Utility.ToInt32( y ), Utility.ToInt32( z ) ); + Extra = line; } public void Pop( out string v, ref string line ) diff --git a/Scripts/Commands/DecorateMag.cs b/Scripts/Commands/DecorateMag.cs index f5d49eff4..8a972021b 100644 --- a/Scripts/Commands/DecorateMag.cs +++ b/Scripts/Commands/DecorateMag.cs @@ -1102,11 +1102,9 @@ namespace Server.Commands public class DecorationEntryMag { - private Point3D m_Location; - private string m_Extra; + public Point3D Location { get; } - public Point3D Location => m_Location; - public string Extra => m_Extra; + public string Extra { get; } public DecorationEntryMag( string line ) { @@ -1116,8 +1114,8 @@ namespace Server.Commands Pop( out y, ref line ); Pop( out z, ref line ); - m_Location = new Point3D( Utility.ToInt32( x ), Utility.ToInt32( y ), Utility.ToInt32( z ) ); - m_Extra = line; + Location = new Point3D( Utility.ToInt32( x ), Utility.ToInt32( y ), Utility.ToInt32( z ) ); + Extra = line; } public void Pop( out string v, ref string line ) diff --git a/Scripts/Commands/Docs.cs b/Scripts/Commands/Docs.cs index f59f369e2..4a6c7a788 100644 --- a/Scripts/Commands/Docs.cs +++ b/Scripts/Commands/Docs.cs @@ -1402,16 +1402,14 @@ namespace Server.Commands private class SpeechEntry { - private int m_Index; - private List m_Strings; + public int Index { get; } - public int Index => m_Index; - public List Strings => m_Strings; + public List Strings { get; } public SpeechEntry( int index ) { - m_Index = index; - m_Strings = new List(); + Index = index; + Strings = new List(); } } @@ -1475,25 +1473,23 @@ namespace Server.Commands public class DocCommandEntry { - private AccessLevel m_AccessLevel; - private string m_Name; - private string[] m_Aliases; - private string m_Usage; - private string m_Description; + public AccessLevel AccessLevel { get; } - public AccessLevel AccessLevel => m_AccessLevel; - public string Name => m_Name; - public string[] Aliases => m_Aliases; - public string Usage => m_Usage; - public string Description => m_Description; + public string Name { get; } + + public string[] Aliases { get; } + + public string Usage { get; } + + public string Description { get; } public DocCommandEntry( AccessLevel accessLevel, string name, string[] aliases, string usage, string description ) { - m_AccessLevel = accessLevel; - m_Name = name; - m_Aliases = aliases; - m_Usage = usage; - m_Description = description; + AccessLevel = accessLevel; + Name = name; + Aliases = aliases; + Usage = usage; + Description = description; } } @@ -2530,31 +2526,29 @@ namespace Server.Commands public class BodyEntry { - private Body m_Body; - private ModelBodyType m_BodyType; - private string m_Name; + public Body Body { get; } - public Body Body => m_Body; - public ModelBodyType BodyType => m_BodyType; - public string Name => m_Name; + public ModelBodyType BodyType { get; } + + public string Name { get; } public BodyEntry( Body body, ModelBodyType bodyType, string name ) { - m_Body = body; - m_BodyType = bodyType; - m_Name = name; + Body = body; + BodyType = bodyType; + Name = name; } public override bool Equals( object obj ) { BodyEntry e = (BodyEntry)obj; - return (m_Body == e.m_Body && m_BodyType == e.m_BodyType && m_Name == e.m_Name); + return (Body == e.Body && BodyType == e.BodyType && Name == e.Name); } public override int GetHashCode() { - return m_Body.BodyID ^ (int)m_BodyType ^ m_Name.GetHashCode(); + return Body.BodyID ^ (int)BodyType ^ Name.GetHashCode(); } } diff --git a/Scripts/Commands/GenCategorization.cs b/Scripts/Commands/GenCategorization.cs index b49847004..e9f4d3cb0 100644 --- a/Scripts/Commands/GenCategorization.cs +++ b/Scripts/Commands/GenCategorization.cs @@ -269,63 +269,59 @@ namespace Server.Commands public class CategoryTypeEntry { - private Type m_Type; - private object m_Object; + public Type Type { get; } - public Type Type => m_Type; - public object Object => m_Object; + public object Object { get; } public CategoryTypeEntry( Type type ) { - m_Type = type; - m_Object = Activator.CreateInstance( type ); + Type = type; + Object = Activator.CreateInstance( type ); } } public class CategoryEntry { - private string m_Title; - private Type[] m_Matches; - private CategoryEntry[] m_SubCategories; - private CategoryEntry m_Parent; - private ArrayList m_Matched; + public string Title { get; } - public string Title => m_Title; - public Type[] Matches => m_Matches; - public CategoryEntry Parent => m_Parent; - public CategoryEntry[] SubCategories => m_SubCategories; - public ArrayList Matched => m_Matched; + public Type[] Matches { get; } + + public CategoryEntry Parent { get; } + + public CategoryEntry[] SubCategories { get; } + + public ArrayList Matched { get; } public CategoryEntry() { - m_Title = "(empty)"; - m_Matches = new Type[0]; - m_SubCategories = new CategoryEntry[0]; - m_Matched = new ArrayList(); + Title = "(empty)"; + Matches = new Type[0]; + SubCategories = new CategoryEntry[0]; + Matched = new ArrayList(); } public CategoryEntry( CategoryEntry parent, string title, CategoryEntry[] subCats ) { - m_Parent = parent; - m_Title = title; - m_SubCategories = subCats; - m_Matches = new Type[0]; - m_Matched = new ArrayList(); + Parent = parent; + Title = title; + SubCategories = subCats; + Matches = new Type[0]; + Matched = new ArrayList(); } public bool IsMatch( Type type ) { bool isMatch = false; - for ( int i = 0; !isMatch && i < m_Matches.Length; ++i ) - isMatch = ( type == m_Matches[i] || type.IsSubclassOf( m_Matches[i] ) ); + for ( int i = 0; !isMatch && i < Matches.Length; ++i ) + isMatch = ( type == Matches[i] || type.IsSubclassOf( Matches[i] ) ); return isMatch; } public CategoryEntry( CategoryEntry parent, CategoryLine[] lines, ref int index ) { - m_Parent = parent; + Parent = parent; string text = lines[index].Text; @@ -334,7 +330,7 @@ namespace Server.Commands if ( start < 0 ) throw new FormatException($"Input string not correctly formatted ('{text}')"); - m_Title = text.Substring( 0, start ).Trim(); + Title = text.Substring( 0, start ).Trim(); int end = text.IndexOf( ')', ++start ); @@ -356,7 +352,7 @@ namespace Server.Commands list.Add( type ); } - m_Matches = (Type[])list.ToArray( typeof( Type ) ); + Matches = (Type[])list.ToArray( typeof( Type ) ); list.Clear(); int ourIndentation = lines[index].Indentation; @@ -366,20 +362,18 @@ namespace Server.Commands while ( index < lines.Length && lines[index].Indentation > ourIndentation ) list.Add( new CategoryEntry( this, lines, ref index ) ); - m_SubCategories = (CategoryEntry[])list.ToArray( typeof( CategoryEntry ) ); + SubCategories = (CategoryEntry[])list.ToArray( typeof( CategoryEntry ) ); list.Clear(); - m_Matched = list; + Matched = list; } } public class CategoryLine { - private int m_Indentation; - private string m_Text; + public int Indentation { get; } - public int Indentation => m_Indentation; - public string Text => m_Text; + public string Text { get; } public CategoryLine( string input ) { @@ -394,8 +388,8 @@ namespace Server.Commands if ( index >= input.Length ) throw new FormatException($"Input string not correctly formatted ('{input}')"); - m_Indentation = index; - m_Text = input.Substring( index ); + Indentation = index; + Text = input.Substring( index ); } public static CategoryLine[] Load( string path ) diff --git a/Scripts/Commands/Generic/Commands/BaseCommand.cs b/Scripts/Commands/Generic/Commands/BaseCommand.cs index cca26d9b1..a3c7a35ae 100644 --- a/Scripts/Commands/Generic/Commands/BaseCommand.cs +++ b/Scripts/Commands/Generic/Commands/BaseCommand.cs @@ -14,55 +14,19 @@ namespace Server.Commands.Generic public abstract class BaseCommand { - private string[] m_Commands; - private AccessLevel m_AccessLevel; - private CommandSupport m_Implementors; - private ObjectTypes m_ObjectTypes; - private bool m_ListOptimized; - private string m_Usage; - private string m_Description; + public bool ListOptimized { get; set; } - public bool ListOptimized - { - get => m_ListOptimized; - set => m_ListOptimized = value; - } + public string[] Commands { get; set; } - public string[] Commands - { - get => m_Commands; - set => m_Commands = value; - } + public string Usage { get; set; } - public string Usage - { - get => m_Usage; - set => m_Usage = value; - } + public string Description { get; set; } - public string Description - { - get => m_Description; - set => m_Description = value; - } + public AccessLevel AccessLevel { get; set; } - public AccessLevel AccessLevel - { - get => m_AccessLevel; - set => m_AccessLevel = value; - } + public ObjectTypes ObjectTypes { get; set; } - public ObjectTypes ObjectTypes - { - get => m_ObjectTypes; - set => m_ObjectTypes = value; - } - - public CommandSupport Supports - { - get => m_Implementors; - set => m_Implementors = value; - } + public CommandSupport Supports { get; set; } public BaseCommand() { diff --git a/Scripts/Commands/Generic/Commands/Commands.cs b/Scripts/Commands/Generic/Commands/Commands.cs index 52c2cbb0c..36dc5f4d4 100644 --- a/Scripts/Commands/Generic/Commands/Commands.cs +++ b/Scripts/Commands/Generic/Commands/Commands.cs @@ -58,13 +58,11 @@ namespace Server.Commands.Generic Register( new TraceLockdownCommand() ); } - private static List m_AllCommands = new List(); - - public static List AllCommands => m_AllCommands; + public static List AllCommands { get; } = new List(); public static void Register( BaseCommand command ) { - m_AllCommands.Add( command ); + AllCommands.Add( command ); List impls = BaseCommandImplementor.Implementors; diff --git a/Scripts/Commands/Generic/Extensions/BaseExtension.cs b/Scripts/Commands/Generic/Extensions/BaseExtension.cs index b8a7b1a3e..977e28beb 100644 --- a/Scripts/Commands/Generic/Extensions/BaseExtension.cs +++ b/Scripts/Commands/Generic/Extensions/BaseExtension.cs @@ -8,40 +8,31 @@ namespace Server.Commands.Generic public sealed class ExtensionInfo { - private static Dictionary m_Table = new Dictionary( StringComparer.InvariantCultureIgnoreCase ); - - public static Dictionary Table => m_Table; + public static Dictionary Table { get; } = new Dictionary( StringComparer.InvariantCultureIgnoreCase ); public static void Register( ExtensionInfo ext ) { - m_Table[ext.m_Name] = ext; + Table[ext.Name] = ext; } - private int m_Order; + public int Order { get; } - private string m_Name; - private int m_Size; + public string Name { get; } - private ExtensionConstructor m_Constructor; + public int Size { get; } - public int Order => m_Order; + public bool IsFixedSize => ( Size >= 0 ); - public string Name => m_Name; - - public int Size => m_Size; - - public bool IsFixedSize => ( m_Size >= 0 ); - - public ExtensionConstructor Constructor => m_Constructor; + public ExtensionConstructor Constructor { get; } public ExtensionInfo( int order, string name, int size, ExtensionConstructor constructor ) { - m_Name = name; - m_Size = size; + Name = name; + Size = size; - m_Order = order; + Order = order; - m_Constructor = constructor; + Constructor = constructor; } } diff --git a/Scripts/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs b/Scripts/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs index df2cb1d56..415869ef4 100644 --- a/Scripts/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs +++ b/Scripts/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs @@ -40,52 +40,48 @@ namespace Server.Commands.Generic public sealed class PropertyValue { - private Type m_Type; - private object m_Value; - private FieldInfo m_Field; + public Type Type { get; } - public Type Type => m_Type; + public object Value { get; private set; } - public object Value => m_Value; + public FieldInfo Field { get; private set; } - public FieldInfo Field => m_Field; - - public bool HasField => ( m_Field != null ); + public bool HasField => ( Field != null ); public PropertyValue( Type type, object value ) { - m_Type = type; - m_Value = value; + Type = type; + Value = value; } public void Load( MethodEmitter method ) { - if ( m_Field != null ) + if ( Field != null ) { method.LoadArgument( 0 ); - method.LoadField( m_Field ); + method.LoadField( Field ); } - else if ( m_Value == null ) + else if ( Value == null ) { - method.LoadNull( m_Type ); + method.LoadNull( Type ); } else { - if ( m_Value is int i ) + if ( Value is int i ) method.Load( i ); - else if ( m_Value is long l ) + else if ( Value is long l ) method.Load( l ); - else if ( m_Value is float f ) + else if ( Value is float f ) method.Load( f ); - else if ( m_Value is double d ) + else if ( Value is double d ) method.Load( d ); - else if ( m_Value is char c ) + else if ( Value is char c ) method.Load( c ); - else if ( m_Value is bool b ) + else if ( Value is bool b ) method.Load( b ); - else if ( m_Value is string s ) + else if ( Value is string s ) method.Load( s ); - else if ( m_Value is Enum e ) + else if ( Value is Enum e ) method.Load( e ); else throw new InvalidOperationException( "Unrecognized comparison value." ); @@ -94,29 +90,29 @@ namespace Server.Commands.Generic public void Acquire( TypeBuilder typeBuilder, ILGenerator il, string fieldName ) { - if ( m_Value is string toParse ) + if ( Value is string toParse ) { - if ( !m_Type.IsValueType && toParse == "null" ) + if ( !Type.IsValueType && toParse == "null" ) { - m_Value = null; + Value = null; } - else if ( m_Type == typeof( string ) ) + else if ( Type == typeof( string ) ) { if ( toParse == @"@""null""" ) toParse = "null"; - m_Value = toParse; + Value = toParse; } - else if ( m_Type.IsEnum ) + else if ( Type.IsEnum ) { - m_Value = Enum.Parse( m_Type, toParse, true ); + Value = Enum.Parse( Type, toParse, true ); } else { MethodInfo parseMethod = null; object[] parseArgs = null; - MethodInfo parseNumber = m_Type.GetMethod( + MethodInfo parseNumber = Type.GetMethod( "Parse", BindingFlags.Public | BindingFlags.Static, null, @@ -139,7 +135,7 @@ namespace Server.Commands.Generic } else { - MethodInfo parseGeneral = m_Type.GetMethod( + MethodInfo parseGeneral = Type.GetMethod( "Parse", BindingFlags.Public | BindingFlags.Static, null, @@ -153,13 +149,13 @@ namespace Server.Commands.Generic if ( parseMethod != null ) { - m_Value = parseMethod.Invoke( null, parseArgs ); + Value = parseMethod.Invoke( null, parseArgs ); - if ( !m_Type.IsPrimitive ) + if ( !Type.IsPrimitive ) { - m_Field = typeBuilder.DefineField( + Field = typeBuilder.DefineField( fieldName, - m_Type, + Type, FieldAttributes.Private | FieldAttributes.InitOnly ); @@ -171,13 +167,13 @@ namespace Server.Commands.Generic il.Emit( OpCodes.Ldc_I4, (int) parseArgs[1] ); il.Emit( OpCodes.Call, parseMethod ); - il.Emit( OpCodes.Stfld, m_Field ); + il.Emit( OpCodes.Stfld, Field ); } } else { throw new InvalidOperationException( - $"Unable to convert string \"{m_Value}\" into type '{m_Type}'." + $"Unable to convert string \"{Value}\" into type '{Type}'." ); } } diff --git a/Scripts/Commands/Generic/Extensions/Compilers/SortCompiler.cs b/Scripts/Commands/Generic/Extensions/Compilers/SortCompiler.cs index f241b943f..c23f4392b 100644 --- a/Scripts/Commands/Generic/Extensions/Compilers/SortCompiler.cs +++ b/Scripts/Commands/Generic/Extensions/Compilers/SortCompiler.cs @@ -7,14 +7,9 @@ namespace Server.Commands.Generic { public sealed class OrderInfo { - private Property m_Property; private int m_Order; - public Property Property - { - get => m_Property; - set => m_Property = value; - } + public Property Property { get; set; } public bool IsAscending { @@ -42,7 +37,7 @@ namespace Server.Commands.Generic public OrderInfo( Property property, bool isAscending ) { - m_Property = property; + Property = property; IsAscending = isAscending; } diff --git a/Scripts/Commands/Generic/Extensions/LimitExtension.cs b/Scripts/Commands/Generic/Extensions/LimitExtension.cs index bce7aa9c0..9ee3f37ff 100644 --- a/Scripts/Commands/Generic/Extensions/LimitExtension.cs +++ b/Scripts/Commands/Generic/Extensions/LimitExtension.cs @@ -14,9 +14,7 @@ namespace Server.Commands.Generic public override ExtensionInfo Info => ExtInfo; - private int m_Limit; - - public int Limit => m_Limit; + public int Limit { get; private set; } public LimitExtension() { @@ -24,16 +22,16 @@ namespace Server.Commands.Generic public override void Parse( Mobile from, string[] arguments, int offset, int size ) { - m_Limit = Utility.ToInt32( arguments[offset] ); + Limit = Utility.ToInt32( arguments[offset] ); - if ( m_Limit < 0 ) + if ( Limit < 0 ) throw new Exception( "Limit cannot be less than zero." ); } public override void Filter( ArrayList list ) { - if ( list.Count > m_Limit ) - list.RemoveRange( m_Limit, list.Count - m_Limit ); + if ( list.Count > Limit ) + list.RemoveRange( Limit, list.Count - Limit ); } } } diff --git a/Scripts/Commands/Generic/Extensions/WhereExtension.cs b/Scripts/Commands/Generic/Extensions/WhereExtension.cs index c755a452c..90c997399 100644 --- a/Scripts/Commands/Generic/Extensions/WhereExtension.cs +++ b/Scripts/Commands/Generic/Extensions/WhereExtension.cs @@ -13,9 +13,7 @@ namespace Server.Commands.Generic public override ExtensionInfo Info => ExtInfo; - private ObjectConditional m_Conditional; - - public ObjectConditional Conditional => m_Conditional; + public ObjectConditional Conditional { get; private set; } public WhereExtension() { @@ -26,7 +24,7 @@ namespace Server.Commands.Generic if ( baseType == null ) throw new InvalidOperationException( "Insanity." ); - m_Conditional.Compile( ref assembly ); + Conditional.Compile( ref assembly ); } public override void Parse( Mobile from, string[] arguments, int offset, int size ) @@ -34,12 +32,12 @@ namespace Server.Commands.Generic if ( size < 1 ) throw new Exception( "Invalid condition syntax." ); - m_Conditional = ObjectConditional.ParseDirect( from, arguments, offset, size ); + Conditional = ObjectConditional.ParseDirect( from, arguments, offset, size ); } public override bool IsValid( object obj ) { - return m_Conditional.CheckCondition( obj ); + return Conditional.CheckCondition( obj ); } } } diff --git a/Scripts/Commands/Generic/Implementors/AreaCommandImplementor.cs b/Scripts/Commands/Generic/Implementors/AreaCommandImplementor.cs index 8de243b93..2d56a2599 100644 --- a/Scripts/Commands/Generic/Implementors/AreaCommandImplementor.cs +++ b/Scripts/Commands/Generic/Implementors/AreaCommandImplementor.cs @@ -5,9 +5,7 @@ namespace Server.Commands.Generic { public class AreaCommandImplementor : BaseCommandImplementor { - private static AreaCommandImplementor m_Instance; - - public static AreaCommandImplementor Instance => m_Instance; + public static AreaCommandImplementor Instance { get; private set; } public AreaCommandImplementor() { @@ -18,7 +16,7 @@ namespace Server.Commands.Generic Usage = "Area [condition]"; Description = "Invokes the command on all appropriate objects in a targeted area. Optional condition arguments can further restrict the set of objects."; - m_Instance = this; + Instance = this; } public override void Process( Mobile from, BaseCommand command, string[] args ) diff --git a/Scripts/Commands/Generic/Implementors/BaseCommandImplementor.cs b/Scripts/Commands/Generic/Implementors/BaseCommandImplementor.cs index 0360b30bd..240ec45e4 100644 --- a/Scripts/Commands/Generic/Implementors/BaseCommandImplementor.cs +++ b/Scripts/Commands/Generic/Implementors/BaseCommandImplementor.cs @@ -47,55 +47,23 @@ namespace Server.Commands.Generic Register( new FacetCommandImplementor() ); } - private string[] m_Accessors; - private AccessLevel m_AccessLevel; - private CommandSupport m_SupportRequirement; - private Dictionary m_Commands; - private string m_Usage; - private string m_Description; - private bool m_SupportsConditionals; + public bool SupportsConditionals { get; set; } - public bool SupportsConditionals - { - get => m_SupportsConditionals; - set => m_SupportsConditionals = value; - } + public string[] Accessors { get; set; } - public string[] Accessors - { - get => m_Accessors; - set => m_Accessors = value; - } + public string Usage { get; set; } - public string Usage - { - get => m_Usage; - set => m_Usage = value; - } + public string Description { get; set; } - public string Description - { - get => m_Description; - set => m_Description = value; - } + public AccessLevel AccessLevel { get; set; } - public AccessLevel AccessLevel - { - get => m_AccessLevel; - set => m_AccessLevel = value; - } + public CommandSupport SupportRequirement { get; set; } - public CommandSupport SupportRequirement - { - get => m_SupportRequirement; - set => m_SupportRequirement = value; - } - - public Dictionary Commands => m_Commands; + public Dictionary Commands { get; } public BaseCommandImplementor() { - m_Commands = new Dictionary( StringComparer.OrdinalIgnoreCase ); + Commands = new Dictionary( StringComparer.OrdinalIgnoreCase ); } public virtual void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj ) @@ -106,7 +74,7 @@ namespace Server.Commands.Generic public virtual void Register( BaseCommand command ) { for ( int i = 0; i < command.Commands.Length; ++i ) - m_Commands[command.Commands[i]] = command; + Commands[command.Commands[i]] = command; } public bool CheckObjectTypes( Mobile from, BaseCommand command, Extensions ext, out bool items, out bool mobiles ) @@ -274,7 +242,7 @@ namespace Server.Commands.Generic { if ( e.Length >= 1 ) { - m_Commands.TryGetValue( e.GetString( 0 ), out BaseCommand command ); + Commands.TryGetValue( e.GetString( 0 ), out BaseCommand command ); if ( command == null ) { @@ -303,11 +271,11 @@ namespace Server.Commands.Generic public void Register() { - if ( m_Accessors == null ) + if ( Accessors == null ) return; - for ( int i = 0; i < m_Accessors.Length; ++i ) - CommandSystem.Register( m_Accessors[i], m_AccessLevel, Execute ); + for ( int i = 0; i < Accessors.Length; ++i ) + CommandSystem.Register( Accessors[i], AccessLevel, Execute ); } public static void Register( BaseCommandImplementor impl ) diff --git a/Scripts/Commands/Generic/Implementors/ObjectConditional.cs b/Scripts/Commands/Generic/Implementors/ObjectConditional.cs index 613427f20..158b60420 100644 --- a/Scripts/Commands/Generic/Implementors/ObjectConditional.cs +++ b/Scripts/Commands/Generic/Implementors/ObjectConditional.cs @@ -9,17 +9,15 @@ namespace Server.Commands.Generic private static readonly Type typeofItem = typeof( Item ); private static readonly Type typeofMobile = typeof( Mobile ); - private Type m_ObjectType; - private ICondition[][] m_Conditions; private IConditional[] m_Conditionals; - public Type Type => m_ObjectType; + public Type Type { get; } - public bool IsItem => ( m_ObjectType == null || m_ObjectType == typeofItem || m_ObjectType.IsSubclassOf( typeofItem ) ); + public bool IsItem => ( Type == null || Type == typeofItem || Type.IsSubclassOf( typeofItem ) ); - public bool IsMobile => ( m_ObjectType == null || m_ObjectType == typeofMobile || m_ObjectType.IsSubclassOf( typeofMobile ) ); + public bool IsMobile => ( Type == null || Type == typeofMobile || Type.IsSubclassOf( typeofMobile ) ); public static readonly ObjectConditional Empty = new ObjectConditional( null, null ); @@ -33,12 +31,12 @@ namespace Server.Commands.Generic m_Conditionals = new IConditional[m_Conditions.Length]; for ( int i = 0; i < m_Conditionals.Length; ++i ) - m_Conditionals[i] = ConditionalCompiler.Compile( emitter, m_ObjectType, m_Conditions[i], i ); + m_Conditionals[i] = ConditionalCompiler.Compile( emitter, Type, m_Conditions[i], i ); } public bool CheckCondition( object obj ) { - if ( m_ObjectType == null ) + if ( Type == null ) return true; // null type means no condition if ( !HasCompiled ) @@ -243,7 +241,7 @@ namespace Server.Commands.Generic public ObjectConditional( Type objectType, ICondition[][] conditions ) { - m_ObjectType = objectType; + Type = objectType; m_Conditions = conditions; } } diff --git a/Scripts/Commands/Generic/Implementors/RangeCommandImplementor.cs b/Scripts/Commands/Generic/Implementors/RangeCommandImplementor.cs index b7574ac7f..30aaccef8 100644 --- a/Scripts/Commands/Generic/Implementors/RangeCommandImplementor.cs +++ b/Scripts/Commands/Generic/Implementors/RangeCommandImplementor.cs @@ -2,9 +2,7 @@ namespace Server.Commands.Generic { public class RangeCommandImplementor : BaseCommandImplementor { - private static RangeCommandImplementor m_Instance; - - public static RangeCommandImplementor Instance => m_Instance; + public static RangeCommandImplementor Instance { get; private set; } public RangeCommandImplementor() { @@ -15,7 +13,7 @@ namespace Server.Commands.Generic Usage = "Range [condition]"; Description = "Invokes the command on all appropriate objects within a specified range of you. Optional condition arguments can further restrict the set of objects."; - m_Instance = this; + Instance = this; } public override void Execute( CommandEventArgs e ) diff --git a/Scripts/Commands/HelpInfo.cs b/Scripts/Commands/HelpInfo.cs index 54d40a868..784a192fe 100644 --- a/Scripts/Commands/HelpInfo.cs +++ b/Scripts/Commands/HelpInfo.cs @@ -12,12 +12,9 @@ namespace Server.Commands { public class HelpInfo { + public static Dictionary HelpInfos { get; } = new Dictionary(); - private static Dictionary m_HelpInfos = new Dictionary(); - private static List m_SortedHelpInfo = new List(); //No need for SortedList cause it's only sorted once at creation... - - public static Dictionary HelpInfos => m_HelpInfos; - public static List SortedHelpInfo => m_SortedHelpInfo; + public static List SortedHelpInfo { get; private set; } = new List(); [CallPriority( 100 )] public static void Initialize() @@ -34,7 +31,7 @@ namespace Server.Commands if ( e.Length > 0 ) { string arg = e.GetString( 0 ).ToLower(); - if (m_HelpInfos.TryGetValue( arg, out CommandInfo c )) + if (HelpInfos.TryGetValue( arg, out CommandInfo c )) { Mobile m = e.Mobile; @@ -213,12 +210,12 @@ namespace Server.Commands list.Sort( new CommandInfoSorter() ); - m_SortedHelpInfo = list; + SortedHelpInfo = list; - foreach( CommandInfo c in m_SortedHelpInfo ) + foreach( CommandInfo c in SortedHelpInfo ) { - if ( !m_HelpInfos.ContainsKey( c.Name.ToLower() ) ) - m_HelpInfos.Add( c.Name.ToLower(), c ); + if ( !HelpInfos.ContainsKey( c.Name.ToLower() ) ) + HelpInfos.Add( c.Name.ToLower(), c ); } } @@ -238,7 +235,7 @@ namespace Server.Commands { m_List = new List(); - foreach( CommandInfo c in m_SortedHelpInfo ) + foreach( CommandInfo c in SortedHelpInfo ) { if ( from.AccessLevel >= c.AccessLevel ) m_List.Add( c ); @@ -311,7 +308,7 @@ namespace Server.Commands } case 2: { - if ( (m_Page + 1) * EntriesPerPage < m_SortedHelpInfo.Count ) + if ( (m_Page + 1) * EntriesPerPage < SortedHelpInfo.Count ) m.SendGump( new CommandListGump( m_Page + 1, m, m_List ) ); break; diff --git a/Scripts/Commands/Logging.cs b/Scripts/Commands/Logging.cs index 6a95ae36e..d81a574b2 100644 --- a/Scripts/Commands/Logging.cs +++ b/Scripts/Commands/Logging.cs @@ -6,14 +6,9 @@ namespace Server.Commands { public class CommandLogging { - private static StreamWriter m_Output; - private static bool m_Enabled = true; + public static bool Enabled { get; set; } = true; - public static bool Enabled{ get => m_Enabled; - set => m_Enabled = value; - } - - public static StreamWriter Output => m_Output; + public static StreamWriter Output { get; private set; } public static void Initialize() { @@ -29,13 +24,13 @@ namespace Server.Commands try { - m_Output = new StreamWriter( Path.Combine( directory, $"{DateTime.UtcNow.ToLongDateString()}.log"), true ); + Output = new StreamWriter( Path.Combine( directory, $"{DateTime.UtcNow.ToLongDateString()}.log"), true ); - m_Output.AutoFlush = true; + Output.AutoFlush = true; - m_Output.WriteLine( "##############################" ); - m_Output.WriteLine( "Log started on {0}", DateTime.UtcNow ); - m_Output.WriteLine(); + Output.WriteLine( "##############################" ); + Output.WriteLine( "Log started on {0}", DateTime.UtcNow ); + Output.WriteLine(); } catch { @@ -61,7 +56,7 @@ namespace Server.Commands public static void WriteLine( Mobile from, string format, params object[] args ) { - if ( !m_Enabled ) + if ( !Enabled ) return; WriteLine( from, string.Format( format, args ) ); @@ -69,12 +64,12 @@ namespace Server.Commands public static void WriteLine( Mobile from, string text ) { - if ( !m_Enabled ) + if ( !Enabled ) return; try { - m_Output.WriteLine( "{0}: {1}: {2}", DateTime.UtcNow, from.NetState, text ); + Output.WriteLine( "{0}: {1}: {2}", DateTime.UtcNow, from.NetState, text ); string path = Core.BaseDirectory; diff --git a/Scripts/Commands/Properties.cs b/Scripts/Commands/Properties.cs index baaf3f5a4..3ac0e1315 100644 --- a/Scripts/Commands/Properties.cs +++ b/Scripts/Commands/Properties.cs @@ -686,16 +686,13 @@ namespace Server public sealed class Property { - private string m_Binding; - private PropertyInfo[] m_Chain; - private PropertyAccess m_Access; - public string Binding => m_Binding; + public string Binding { get; } public bool IsBound => ( m_Chain != null ); - public PropertyAccess Access => m_Access; + public PropertyAccess Access { get; private set; } public PropertyInfo[] Chain { @@ -730,7 +727,7 @@ namespace Server bool isFinal = ( i == ( m_Chain.Length - 1 ) ); - PropertyAccess access = m_Access; + PropertyAccess access = Access; if ( !isFinal ) access |= PropertyAccess.Read; @@ -755,7 +752,7 @@ namespace Server if ( IsBound ) throw new AlreadyBoundException( this ); - string[] split = m_Binding.Split( '.' ); + string[] split = Binding.Split( '.' ); PropertyInfo[] chain = new PropertyInfo[split.Length]; @@ -782,13 +779,13 @@ namespace Server throw new ReadOnlyException( this ); } - m_Access = desiredAccess; + Access = desiredAccess; m_Chain = chain; } public Property( string binding ) { - m_Binding = binding; + Binding = binding; } public Property( PropertyInfo[] chain ) @@ -799,7 +796,7 @@ namespace Server public override string ToString() { if ( !IsBound ) - return m_Binding; + return Binding; string[] toJoin = new string[m_Chain.Length]; diff --git a/Scripts/Engines/BulkOrders/Books/BOBFilter.cs b/Scripts/Engines/BulkOrders/Books/BOBFilter.cs index acad09af0..fc827cea7 100644 --- a/Scripts/Engines/BulkOrders/Books/BOBFilter.cs +++ b/Scripts/Engines/BulkOrders/Books/BOBFilter.cs @@ -2,44 +2,23 @@ namespace Server.Engines.BulkOrders { public class BOBFilter { - private int m_Type; - private int m_Quality; - private int m_Material; - private int m_Quantity; - - public bool IsDefault => ( m_Type == 0 && m_Quality == 0 && m_Material == 0 && m_Quantity == 0 ); + public bool IsDefault => ( Type == 0 && Quality == 0 && Material == 0 && Quantity == 0 ); public void Clear() { - m_Type = 0; - m_Quality = 0; - m_Material = 0; - m_Quantity = 0; + Type = 0; + Quality = 0; + Material = 0; + Quantity = 0; } - public int Type - { - get => m_Type; - set => m_Type = value; - } + public int Type { get; set; } - public int Quality - { - get => m_Quality; - set => m_Quality = value; - } + public int Quality { get; set; } - public int Material - { - get => m_Material; - set => m_Material = value; - } + public int Material { get; set; } - public int Quantity - { - get => m_Quantity; - set => m_Quantity = value; - } + public int Quantity { get; set; } public BOBFilter() { @@ -53,10 +32,10 @@ namespace Server.Engines.BulkOrders { case 1: { - m_Type = reader.ReadEncodedInt(); - m_Quality = reader.ReadEncodedInt(); - m_Material = reader.ReadEncodedInt(); - m_Quantity = reader.ReadEncodedInt(); + Type = reader.ReadEncodedInt(); + Quality = reader.ReadEncodedInt(); + Material = reader.ReadEncodedInt(); + Quantity = reader.ReadEncodedInt(); break; } @@ -73,10 +52,10 @@ namespace Server.Engines.BulkOrders { writer.WriteEncodedInt( 1 ); // version - writer.WriteEncodedInt( m_Type ); - writer.WriteEncodedInt( m_Quality ); - writer.WriteEncodedInt( m_Material ); - writer.WriteEncodedInt( m_Quantity ); + writer.WriteEncodedInt( Type ); + writer.WriteEncodedInt( Quality ); + writer.WriteEncodedInt( Material ); + writer.WriteEncodedInt( Quantity ); } } } diff --git a/Scripts/Engines/BulkOrders/Books/BOBLargeEntry.cs b/Scripts/Engines/BulkOrders/Books/BOBLargeEntry.cs index b9f8af055..ace3b2f99 100644 --- a/Scripts/Engines/BulkOrders/Books/BOBLargeEntry.cs +++ b/Scripts/Engines/BulkOrders/Books/BOBLargeEntry.cs @@ -2,30 +2,26 @@ namespace Server.Engines.BulkOrders { public class BOBLargeEntry { - private bool m_RequireExceptional; - private BODType m_DeedType; - private BulkMaterialType m_Material; - private int m_AmountMax; - private int m_Price; - private BOBLargeSubEntry[] m_Entries; + public bool RequireExceptional { get; } - public bool RequireExceptional => m_RequireExceptional; - public BODType DeedType => m_DeedType; - public BulkMaterialType Material => m_Material; - public int AmountMax => m_AmountMax; - public int Price{ get => m_Price; - set => m_Price = value; - } - public BOBLargeSubEntry[] Entries => m_Entries; + public BODType DeedType { get; } + + public BulkMaterialType Material { get; } + + public int AmountMax { get; } + + public int Price { get; set; } + + public BOBLargeSubEntry[] Entries { get; } public Item Reconstruct() { LargeBOD bod = null; - if ( m_DeedType == BODType.Smith ) - bod = new LargeSmithBOD( m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries() ); - else if ( m_DeedType == BODType.Tailor ) - bod = new LargeTailorBOD( m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries() ); + if ( DeedType == BODType.Smith ) + bod = new LargeSmithBOD( AmountMax, RequireExceptional, Material, ReconstructEntries() ); + else if ( DeedType == BODType.Tailor ) + bod = new LargeTailorBOD( AmountMax, RequireExceptional, Material, ReconstructEntries() ); for ( int i = 0; bod != null && i < bod.Entries.Length; ++i ) bod.Entries[i].Owner = bod; @@ -35,12 +31,12 @@ namespace Server.Engines.BulkOrders private LargeBulkEntry[] ReconstructEntries() { - LargeBulkEntry[] entries = new LargeBulkEntry[m_Entries.Length]; + LargeBulkEntry[] entries = new LargeBulkEntry[Entries.Length]; - for ( int i = 0; i < m_Entries.Length; ++i ) + for ( int i = 0; i < Entries.Length; ++i ) { - entries[i] = new LargeBulkEntry( null, new SmallBulkEntry( m_Entries[i].ItemType, m_Entries[i].Number, m_Entries[i].Graphic ) ); - entries[i].Amount = m_Entries[i].AmountCur; + entries[i] = new LargeBulkEntry( null, new SmallBulkEntry( Entries[i].ItemType, Entries[i].Number, Entries[i].Graphic ) ); + entries[i].Amount = Entries[i].AmountCur; } return entries; @@ -48,20 +44,20 @@ namespace Server.Engines.BulkOrders public BOBLargeEntry( LargeBOD bod ) { - m_RequireExceptional = bod.RequireExceptional; + RequireExceptional = bod.RequireExceptional; if ( bod is LargeTailorBOD ) - m_DeedType = BODType.Tailor; + DeedType = BODType.Tailor; else if ( bod is LargeSmithBOD ) - m_DeedType = BODType.Smith; + DeedType = BODType.Smith; - m_Material = bod.Material; - m_AmountMax = bod.AmountMax; + Material = bod.Material; + AmountMax = bod.AmountMax; - m_Entries = new BOBLargeSubEntry[bod.Entries.Length]; + Entries = new BOBLargeSubEntry[bod.Entries.Length]; - for ( int i = 0; i < m_Entries.Length; ++i ) - m_Entries[i] = new BOBLargeSubEntry( bod.Entries[i] ); + for ( int i = 0; i < Entries.Length; ++i ) + Entries[i] = new BOBLargeSubEntry( bod.Entries[i] ); } public BOBLargeEntry( GenericReader reader ) @@ -72,18 +68,18 @@ namespace Server.Engines.BulkOrders { case 0: { - m_RequireExceptional = reader.ReadBool(); + RequireExceptional = reader.ReadBool(); - m_DeedType = (BODType)reader.ReadEncodedInt(); + DeedType = (BODType)reader.ReadEncodedInt(); - m_Material = (BulkMaterialType)reader.ReadEncodedInt(); - m_AmountMax = reader.ReadEncodedInt(); - m_Price = reader.ReadEncodedInt(); + Material = (BulkMaterialType)reader.ReadEncodedInt(); + AmountMax = reader.ReadEncodedInt(); + Price = reader.ReadEncodedInt(); - m_Entries = new BOBLargeSubEntry[reader.ReadEncodedInt()]; + Entries = new BOBLargeSubEntry[reader.ReadEncodedInt()]; - for ( int i = 0; i < m_Entries.Length; ++i ) - m_Entries[i] = new BOBLargeSubEntry( reader ); + for ( int i = 0; i < Entries.Length; ++i ) + Entries[i] = new BOBLargeSubEntry( reader ); break; } @@ -94,17 +90,17 @@ namespace Server.Engines.BulkOrders { writer.WriteEncodedInt( 0 ); // version - writer.Write( (bool) m_RequireExceptional ); + writer.Write( (bool) RequireExceptional ); - writer.WriteEncodedInt( (int) m_DeedType ); - writer.WriteEncodedInt( (int) m_Material ); - writer.WriteEncodedInt( (int) m_AmountMax ); - writer.WriteEncodedInt( (int) m_Price ); + writer.WriteEncodedInt( (int) DeedType ); + writer.WriteEncodedInt( (int) Material ); + writer.WriteEncodedInt( (int) AmountMax ); + writer.WriteEncodedInt( (int) Price ); - writer.WriteEncodedInt( (int) m_Entries.Length ); + writer.WriteEncodedInt( (int) Entries.Length ); - for ( int i = 0; i < m_Entries.Length; ++i ) - m_Entries[i].Serialize( writer ); + for ( int i = 0; i < Entries.Length; ++i ) + Entries[i].Serialize( writer ); } } } \ No newline at end of file diff --git a/Scripts/Engines/BulkOrders/Books/BOBLargeSubEntry.cs b/Scripts/Engines/BulkOrders/Books/BOBLargeSubEntry.cs index f6e19c1ad..b3e2bcf69 100644 --- a/Scripts/Engines/BulkOrders/Books/BOBLargeSubEntry.cs +++ b/Scripts/Engines/BulkOrders/Books/BOBLargeSubEntry.cs @@ -4,22 +4,20 @@ namespace Server.Engines.BulkOrders { public class BOBLargeSubEntry { - private Type m_ItemType; - private int m_AmountCur; - private int m_Number; - private int m_Graphic; + public Type ItemType { get; } - public Type ItemType => m_ItemType; - public int AmountCur => m_AmountCur; - public int Number => m_Number; - public int Graphic => m_Graphic; + public int AmountCur { get; } + + public int Number { get; } + + public int Graphic { get; } public BOBLargeSubEntry( LargeBulkEntry lbe ) { - m_ItemType = lbe.Details.Type; - m_AmountCur = lbe.Amount; - m_Number = lbe.Details.Number; - m_Graphic = lbe.Details.Graphic; + ItemType = lbe.Details.Type; + AmountCur = lbe.Amount; + Number = lbe.Details.Number; + Graphic = lbe.Details.Graphic; } public BOBLargeSubEntry( GenericReader reader ) @@ -33,11 +31,11 @@ namespace Server.Engines.BulkOrders string type = reader.ReadString(); if ( type != null ) - m_ItemType = ScriptCompiler.FindTypeByFullName( type ); + ItemType = ScriptCompiler.FindTypeByFullName( type ); - m_AmountCur = reader.ReadEncodedInt(); - m_Number = reader.ReadEncodedInt(); - m_Graphic = reader.ReadEncodedInt(); + AmountCur = reader.ReadEncodedInt(); + Number = reader.ReadEncodedInt(); + Graphic = reader.ReadEncodedInt(); break; } @@ -48,11 +46,11 @@ namespace Server.Engines.BulkOrders { writer.WriteEncodedInt( 0 ); // version - writer.Write( m_ItemType == null ? null : m_ItemType.FullName ); + writer.Write( ItemType == null ? null : ItemType.FullName ); - writer.WriteEncodedInt( (int) m_AmountCur ); - writer.WriteEncodedInt( (int) m_Number ); - writer.WriteEncodedInt( (int) m_Graphic ); + writer.WriteEncodedInt( (int) AmountCur ); + writer.WriteEncodedInt( (int) Number ); + writer.WriteEncodedInt( (int) Graphic ); } } } \ No newline at end of file diff --git a/Scripts/Engines/BulkOrders/Books/BOBSmallEntry.cs b/Scripts/Engines/BulkOrders/Books/BOBSmallEntry.cs index 7e67a4393..67af7315a 100644 --- a/Scripts/Engines/BulkOrders/Books/BOBSmallEntry.cs +++ b/Scripts/Engines/BulkOrders/Books/BOBSmallEntry.cs @@ -4,54 +4,51 @@ namespace Server.Engines.BulkOrders { public class BOBSmallEntry { - private Type m_ItemType; - private bool m_RequireExceptional; - private BODType m_DeedType; - private BulkMaterialType m_Material; - private int m_AmountCur, m_AmountMax; - private int m_Number; - private int m_Graphic; - private int m_Price; + public Type ItemType { get; } - public Type ItemType => m_ItemType; - public bool RequireExceptional => m_RequireExceptional; - public BODType DeedType => m_DeedType; - public BulkMaterialType Material => m_Material; - public int AmountCur => m_AmountCur; - public int AmountMax => m_AmountMax; - public int Number => m_Number; - public int Graphic => m_Graphic; - public int Price{ get => m_Price; - set => m_Price = value; - } + public bool RequireExceptional { get; } + + public BODType DeedType { get; } + + public BulkMaterialType Material { get; } + + public int AmountCur { get; } + + public int AmountMax { get; } + + public int Number { get; } + + public int Graphic { get; } + + public int Price { get; set; } public Item Reconstruct() { SmallBOD bod = null; - if ( m_DeedType == BODType.Smith ) - bod = new SmallSmithBOD( m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material ); - else if ( m_DeedType == BODType.Tailor ) - bod = new SmallTailorBOD( m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material ); + if ( DeedType == BODType.Smith ) + bod = new SmallSmithBOD( AmountCur, AmountMax, ItemType, Number, Graphic, RequireExceptional, Material ); + else if ( DeedType == BODType.Tailor ) + bod = new SmallTailorBOD( AmountCur, AmountMax, ItemType, Number, Graphic, RequireExceptional, Material ); return bod; } public BOBSmallEntry( SmallBOD bod ) { - m_ItemType = bod.Type; - m_RequireExceptional = bod.RequireExceptional; + ItemType = bod.Type; + RequireExceptional = bod.RequireExceptional; if ( bod is SmallTailorBOD ) - m_DeedType = BODType.Tailor; + DeedType = BODType.Tailor; else if ( bod is SmallSmithBOD ) - m_DeedType = BODType.Smith; + DeedType = BODType.Smith; - m_Material = bod.Material; - m_AmountCur = bod.AmountCur; - m_AmountMax = bod.AmountMax; - m_Number = bod.Number; - m_Graphic = bod.Graphic; + Material = bod.Material; + AmountCur = bod.AmountCur; + AmountMax = bod.AmountMax; + Number = bod.Number; + Graphic = bod.Graphic; } public BOBSmallEntry( GenericReader reader ) @@ -65,18 +62,18 @@ namespace Server.Engines.BulkOrders string type = reader.ReadString(); if ( type != null ) - m_ItemType = ScriptCompiler.FindTypeByFullName( type ); + ItemType = ScriptCompiler.FindTypeByFullName( type ); - m_RequireExceptional = reader.ReadBool(); + RequireExceptional = reader.ReadBool(); - m_DeedType = (BODType)reader.ReadEncodedInt(); + DeedType = (BODType)reader.ReadEncodedInt(); - m_Material = (BulkMaterialType)reader.ReadEncodedInt(); - m_AmountCur = reader.ReadEncodedInt(); - m_AmountMax = reader.ReadEncodedInt(); - m_Number = reader.ReadEncodedInt(); - m_Graphic = reader.ReadEncodedInt(); - m_Price = reader.ReadEncodedInt(); + Material = (BulkMaterialType)reader.ReadEncodedInt(); + AmountCur = reader.ReadEncodedInt(); + AmountMax = reader.ReadEncodedInt(); + Number = reader.ReadEncodedInt(); + Graphic = reader.ReadEncodedInt(); + Price = reader.ReadEncodedInt(); break; } @@ -87,17 +84,17 @@ namespace Server.Engines.BulkOrders { writer.WriteEncodedInt( 0 ); // version - writer.Write( m_ItemType == null ? null : m_ItemType.FullName ); + writer.Write( ItemType == null ? null : ItemType.FullName ); - writer.Write( (bool) m_RequireExceptional ); + writer.Write( (bool) RequireExceptional ); - writer.WriteEncodedInt( (int) m_DeedType ); - writer.WriteEncodedInt( (int) m_Material ); - writer.WriteEncodedInt( (int) m_AmountCur ); - writer.WriteEncodedInt( (int) m_AmountMax ); - writer.WriteEncodedInt( (int) m_Number ); - writer.WriteEncodedInt( (int) m_Graphic ); - writer.WriteEncodedInt( (int) m_Price ); + writer.WriteEncodedInt( (int) DeedType ); + writer.WriteEncodedInt( (int) Material ); + writer.WriteEncodedInt( (int) AmountCur ); + writer.WriteEncodedInt( (int) AmountMax ); + writer.WriteEncodedInt( (int) Number ); + writer.WriteEncodedInt( (int) Graphic ); + writer.WriteEncodedInt( (int) Price ); } } } \ No newline at end of file diff --git a/Scripts/Engines/BulkOrders/Books/BulkOrderBook.cs b/Scripts/Engines/BulkOrders/Books/BulkOrderBook.cs index 2c414a580..0a4c3b5ea 100644 --- a/Scripts/Engines/BulkOrders/Books/BulkOrderBook.cs +++ b/Scripts/Engines/BulkOrders/Books/BulkOrderBook.cs @@ -12,11 +12,7 @@ namespace Server.Engines.BulkOrders { public class BulkOrderBook : Item, ISecurable { - private ArrayList m_Entries; - private BOBFilter m_Filter; private string m_BookName; - private SecureLevel m_Level; - private int m_ItemCount; [CommandProperty( AccessLevel.GameMaster )] public string BookName @@ -26,21 +22,13 @@ namespace Server.Engines.BulkOrders } [CommandProperty( AccessLevel.GameMaster )] - public SecureLevel Level - { - get => m_Level; - set => m_Level = value; - } + public SecureLevel Level { get; set; } - public ArrayList Entries => m_Entries; + public ArrayList Entries { get; private set; } - public BOBFilter Filter => m_Filter; + public BOBFilter Filter { get; private set; } - public int ItemCount - { - get => m_ItemCount; - set => m_ItemCount = value; - } + public int ItemCount { get; set; } [Constructible] public BulkOrderBook() : base( 0x2259 ) @@ -48,17 +36,17 @@ namespace Server.Engines.BulkOrders Weight = 1.0; LootType = LootType.Blessed; - m_Entries = new ArrayList(); - m_Filter = new BOBFilter(); + Entries = new ArrayList(); + Filter = new BOBFilter(); - m_Level = SecureLevel.CoOwners; + Level = SecureLevel.CoOwners; } public override void OnDoubleClick( Mobile from ) { if ( !from.InRange( GetWorldLocation(), 2 ) ) from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. - else if ( m_Entries.Count == 0 ) + else if ( Entries.Count == 0 ) from.SendLocalizedMessage( 1062381 ); // The book is empty. else if ( from is PlayerMobile mobile ) mobile.SendGump( new BOBGump( mobile, this ) ); @@ -70,7 +58,7 @@ namespace Server.Engines.BulkOrders { from.SendLocalizedMessage( 500446 ); // That is too far away. } - else if ( m_Entries.Count == 0 ) + else if ( Entries.Count == 0 ) { from.SendLocalizedMessage( 1062381 ); // The book is empty. } @@ -103,18 +91,18 @@ namespace Server.Engines.BulkOrders } if ( !from.Backpack.CheckHold( from, dropped, true, true ) ) return false; - if ( m_Entries.Count < 500 ) + if ( Entries.Count < 500 ) { if ( dropped is LargeBOD bod ) - m_Entries.Add( new BOBLargeEntry( bod ) ); + Entries.Add( new BOBLargeEntry( bod ) ); else - m_Entries.Add( new BOBSmallEntry( (SmallBOD)dropped ) ); + Entries.Add( new BOBSmallEntry( (SmallBOD)dropped ) ); InvalidateProperties(); - if ( m_Entries.Count / 5 > m_ItemCount ) + if ( Entries.Count / 5 > ItemCount ) { - m_ItemCount++; + ItemCount++; InvalidateItems(); } @@ -142,7 +130,7 @@ namespace Server.Engines.BulkOrders int total = base.GetTotal( type ); if ( type == TotalType.Items ) - total = m_ItemCount; + total = ItemCount; return total; } @@ -175,19 +163,19 @@ namespace Server.Engines.BulkOrders writer.Write( (int) 2 ); // version - writer.Write( (int) m_ItemCount ); + writer.Write( (int) ItemCount ); - writer.Write( (int) m_Level ); + writer.Write( (int) Level ); writer.Write( m_BookName ); - m_Filter.Serialize( writer ); + Filter.Serialize( writer ); - writer.WriteEncodedInt( (int) m_Entries.Count ); + writer.WriteEncodedInt( (int) Entries.Count ); - for ( int i = 0; i < m_Entries.Count; ++i ) + for ( int i = 0; i < Entries.Count; ++i ) { - object obj = m_Entries[i]; + object obj = Entries[i]; if ( obj is BOBLargeEntry entry ) { @@ -212,23 +200,23 @@ namespace Server.Engines.BulkOrders { case 2: { - m_ItemCount = reader.ReadInt(); + ItemCount = reader.ReadInt(); goto case 1; } case 1: { - m_Level = (SecureLevel)reader.ReadInt(); + Level = (SecureLevel)reader.ReadInt(); goto case 0; } case 0: { m_BookName = reader.ReadString(); - m_Filter = new BOBFilter( reader ); + Filter = new BOBFilter( reader ); int count = reader.ReadEncodedInt(); - m_Entries = new ArrayList( count ); + Entries = new ArrayList( count ); for ( int i = 0; i < count; ++i ) { @@ -236,8 +224,8 @@ namespace Server.Engines.BulkOrders switch ( v ) { - case 0: m_Entries.Add( new BOBLargeEntry( reader ) ); break; - case 1: m_Entries.Add( new BOBSmallEntry( reader ) ); break; + case 0: Entries.Add( new BOBLargeEntry( reader ) ); break; + case 1: Entries.Add( new BOBSmallEntry( reader ) ); break; } } @@ -250,7 +238,7 @@ namespace Server.Engines.BulkOrders { base.GetProperties( list ); - list.Add( 1062344, m_Entries.Count.ToString() ); // Deeds in book: ~1_val~ + list.Add( 1062344, Entries.Count.ToString() ); // Deeds in book: ~1_val~ if ( m_BookName != null && m_BookName.Length > 0 ) list.Add( 1062481, m_BookName ); // Book Name: ~1_val~ @@ -260,7 +248,7 @@ namespace Server.Engines.BulkOrders { base.OnSingleClick(from); - LabelTo(from, 1062344, m_Entries.Count.ToString()); // Deeds in book: ~1_val~ + LabelTo(from, 1062344, Entries.Count.ToString()); // Deeds in book: ~1_val~ if (!string.IsNullOrEmpty(m_BookName)) LabelTo(from, 1062481, m_BookName); diff --git a/Scripts/Engines/BulkOrders/LargeBulkEntry.cs b/Scripts/Engines/BulkOrders/LargeBulkEntry.cs index ebc8f970e..04788746a 100644 --- a/Scripts/Engines/BulkOrders/LargeBulkEntry.cs +++ b/Scripts/Engines/BulkOrders/LargeBulkEntry.cs @@ -5,18 +5,15 @@ namespace Server.Engines.BulkOrders { public class LargeBulkEntry { - private LargeBOD m_Owner; private int m_Amount; - private SmallBulkEntry m_Details; - public LargeBOD Owner{ get => m_Owner; - set => m_Owner = value; - } + public LargeBOD Owner { get; set; } + public int Amount{ get => m_Amount; set{ m_Amount = value; - m_Owner?.InvalidateProperties(); + Owner?.InvalidateProperties(); } } - public SmallBulkEntry Details => m_Details; + public SmallBulkEntry Details { get; } public static SmallBulkEntry[] LargeRing => GetEntries( "Blacksmith", "largering" ); @@ -92,13 +89,13 @@ namespace Server.Engines.BulkOrders public LargeBulkEntry( LargeBOD owner, SmallBulkEntry details ) { - m_Owner = owner; - m_Details = details; + Owner = owner; + Details = details; } public LargeBulkEntry( LargeBOD owner, GenericReader reader ) { - m_Owner = owner; + Owner = owner; m_Amount = reader.ReadInt(); Type realType = null; @@ -108,15 +105,15 @@ namespace Server.Engines.BulkOrders if ( type != null ) realType = ScriptCompiler.FindTypeByFullName( type ); - m_Details = new SmallBulkEntry( realType, reader.ReadInt(), reader.ReadInt() ); + Details = new SmallBulkEntry( realType, reader.ReadInt(), reader.ReadInt() ); } public void Serialize( GenericWriter writer ) { writer.Write( m_Amount ); - writer.Write( m_Details.Type == null ? null : m_Details.Type.FullName ); - writer.Write( m_Details.Number ); - writer.Write( m_Details.Graphic ); + writer.Write( Details.Type == null ? null : Details.Type.FullName ); + writer.Write( Details.Number ); + writer.Write( Details.Graphic ); } } } diff --git a/Scripts/Engines/BulkOrders/Rewards.cs b/Scripts/Engines/BulkOrders/Rewards.cs index 75ebef626..2ee3bb7e4 100644 --- a/Scripts/Engines/BulkOrders/Rewards.cs +++ b/Scripts/Engines/BulkOrders/Rewards.cs @@ -7,23 +7,21 @@ namespace Server.Engines.BulkOrders public sealed class RewardType { - private int m_Points; - private Type[] m_Types; + public int Points { get; } - public int Points => m_Points; - public Type[] Types => m_Types; + public Type[] Types { get; } public RewardType( int points, params Type[] types ) { - m_Points = points; - m_Types = types; + Points = points; + Types = types; } public bool Contains( Type type ) { - for ( int i = 0; i < m_Types.Length; ++i ) + for ( int i = 0; i < Types.Length; ++i ) { - if ( m_Types[i] == type ) + if ( Types[i] == type ) return true; } @@ -33,13 +31,11 @@ namespace Server.Engines.BulkOrders public sealed class RewardItem { - private int m_Weight; - private ConstructCallback m_Constructor; - private int m_Type; + public int Weight { get; } - public int Weight => m_Weight; - public ConstructCallback Constructor => m_Constructor; - public int Type => m_Type; + public ConstructCallback Constructor { get; } + + public int Type { get; } public RewardItem( int weight, ConstructCallback constructor ) : this( weight, constructor, 0 ) { @@ -47,49 +43,47 @@ namespace Server.Engines.BulkOrders public RewardItem( int weight, ConstructCallback constructor, int type ) { - m_Weight = weight; - m_Constructor = constructor; - m_Type = type; + Weight = weight; + Constructor = constructor; + Type = type; } public Item Construct() { - try{ return m_Constructor( m_Type ); } + try{ return Constructor( Type ); } catch{ return null; } } } public sealed class RewardGroup { - private int m_Points; - private RewardItem[] m_Items; + public int Points { get; } - public int Points => m_Points; - public RewardItem[] Items => m_Items; + public RewardItem[] Items { get; } public RewardGroup( int points, params RewardItem[] items ) { - m_Points = points; - m_Items = items; + Points = points; + Items = items; } public RewardItem AcquireItem() { - if ( m_Items.Length == 0 ) + if ( Items.Length == 0 ) return null; - if ( m_Items.Length == 1 ) - return m_Items[0]; + if ( Items.Length == 1 ) + return Items[0]; int totalWeight = 0; - for ( int i = 0; i < m_Items.Length; ++i ) - totalWeight += m_Items[i].Weight; + for ( int i = 0; i < Items.Length; ++i ) + totalWeight += Items[i].Weight; int randomWeight = Utility.Random( totalWeight ); - for ( int i = 0; i < m_Items.Length; ++i ) + for ( int i = 0; i < Items.Length; ++i ) { - RewardItem item = m_Items[i]; + RewardItem item = Items[i]; if ( randomWeight < item.Weight ) return item; @@ -103,11 +97,7 @@ namespace Server.Engines.BulkOrders public abstract class RewardCalculator { - private RewardGroup[] m_Groups; - - public RewardGroup[] Groups{ get => m_Groups; - set => m_Groups = value; - } + public RewardGroup[] Groups { get; set; } public abstract int ComputePoints( int quantity, bool exceptional, BulkMaterialType material, int itemCount, Type type ); public abstract int ComputeGold( int quantity, bool exceptional, BulkMaterialType material, int itemCount, Type type ); @@ -148,15 +138,15 @@ namespace Server.Engines.BulkOrders public virtual RewardGroup LookupRewards( int points ) { - for ( int i = m_Groups.Length - 1; i >= 1; --i ) + for ( int i = Groups.Length - 1; i >= 1; --i ) { - RewardGroup group = m_Groups[i]; + RewardGroup group = Groups[i]; if ( points >= group.Points ) return group; } - return m_Groups[0]; + return Groups[0]; } public virtual int LookupTypePoints( RewardType[] types, Type type ) diff --git a/Scripts/Engines/BulkOrders/SmallBOD.cs b/Scripts/Engines/BulkOrders/SmallBOD.cs index c5cd4af36..550d84dcb 100644 --- a/Scripts/Engines/BulkOrders/SmallBOD.cs +++ b/Scripts/Engines/BulkOrders/SmallBOD.cs @@ -9,9 +9,7 @@ namespace Server.Engines.BulkOrders public abstract class SmallBOD : Item { private int m_AmountCur, m_AmountMax; - private Type m_Type; private int m_Number; - private int m_Graphic; private bool m_RequireExceptional; private BulkMaterialType m_Material; @@ -24,18 +22,14 @@ namespace Server.Engines.BulkOrders set{ m_AmountMax = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] - public Type Type{ get => m_Type; - set => m_Type = value; - } + public Type Type { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int Number{ get => m_Number; set{ m_Number = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] - public int Graphic{ get => m_Graphic; - set => m_Graphic = value; - } + public int Graphic { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool RequireExceptional{ get => m_RequireExceptional; @@ -58,9 +52,9 @@ namespace Server.Engines.BulkOrders LootType = LootType.Blessed; m_AmountMax = amountMax; - m_Type = type; + Type = type; m_Number = number; - m_Graphic = graphic; + Graphic = graphic; m_RequireExceptional = requireExeptional; m_Material = material; } @@ -182,7 +176,7 @@ namespace Server.Engines.BulkOrders { from.SendLocalizedMessage( 1045166 ); // The maximum amount of requested items have already been combined to this deed. } - else if ( m_Type == null || (objectType != m_Type && !objectType.IsSubclassOf( m_Type )) || (!(item is BaseWeapon) && !(item is BaseArmor) && !(item is BaseClothing)) ) + else if ( Type == null || (objectType != Type && !objectType.IsSubclassOf( Type )) || (!(item is BaseWeapon) && !(item is BaseArmor) && !(item is BaseClothing)) ) { from.SendLocalizedMessage( 1045169 ); // The item is not in the request. } @@ -249,9 +243,9 @@ namespace Server.Engines.BulkOrders writer.Write( m_AmountCur ); writer.Write( m_AmountMax ); - writer.Write( m_Type == null ? null : m_Type.FullName ); + writer.Write( Type == null ? null : Type.FullName ); writer.Write( m_Number ); - writer.Write( m_Graphic ); + writer.Write( Graphic ); writer.Write( m_RequireExceptional ); writer.Write( (int) m_Material ); } @@ -272,10 +266,10 @@ namespace Server.Engines.BulkOrders string type = reader.ReadString(); if ( type != null ) - m_Type = ScriptCompiler.FindTypeByFullName( type ); + Type = ScriptCompiler.FindTypeByFullName( type ); m_Number = reader.ReadInt(); - m_Graphic = reader.ReadInt(); + Graphic = reader.ReadInt(); m_RequireExceptional = reader.ReadBool(); m_Material = (BulkMaterialType)reader.ReadInt(); diff --git a/Scripts/Engines/BulkOrders/SmallBulkEntry.cs b/Scripts/Engines/BulkOrders/SmallBulkEntry.cs index 58614c409..b2a98920a 100644 --- a/Scripts/Engines/BulkOrders/SmallBulkEntry.cs +++ b/Scripts/Engines/BulkOrders/SmallBulkEntry.cs @@ -6,19 +6,17 @@ namespace Server.Engines.BulkOrders { public class SmallBulkEntry { - private Type m_Type; - private int m_Number; - private int m_Graphic; + public Type Type { get; } - public Type Type => m_Type; - public int Number => m_Number; - public int Graphic => m_Graphic; + public int Number { get; } + + public int Graphic { get; } public SmallBulkEntry( Type type, int number, int graphic ) { - m_Type = type; - m_Number = number; - m_Graphic = graphic; + Type = type; + Number = number; + Graphic = graphic; } public static SmallBulkEntry[] BlacksmithWeapons => GetEntries( "Blacksmith", "weapons" ); diff --git a/Scripts/Engines/CannedEvil/ChampionSkullBrazier.cs b/Scripts/Engines/CannedEvil/ChampionSkullBrazier.cs index 974a29577..2a98690c5 100644 --- a/Scripts/Engines/CannedEvil/ChampionSkullBrazier.cs +++ b/Scripts/Engines/CannedEvil/ChampionSkullBrazier.cs @@ -6,12 +6,11 @@ namespace Server.Engines.CannedEvil { public class ChampionSkullBrazier : AddonComponent { - private ChampionSkullPlatform m_Platform; private ChampionSkullType m_Type; private Item m_Skull; [CommandProperty( AccessLevel.GameMaster )] - public ChampionSkullPlatform Platform => m_Platform; + public ChampionSkullPlatform Platform { get; private set; } [CommandProperty( AccessLevel.GameMaster )] public ChampionSkullType Type{ get => m_Type; @@ -20,7 +19,7 @@ namespace Server.Engines.CannedEvil [CommandProperty( AccessLevel.GameMaster )] public Item Skull{ get => m_Skull; set{ m_Skull = value; - m_Platform?.Validate(); + Platform?.Validate(); } } public override int LabelNumber => 1049489 + (int)m_Type; @@ -30,7 +29,7 @@ namespace Server.Engines.CannedEvil Hue = 0x455; Light = LightType.Circle300; - m_Platform = platform; + Platform = platform; m_Type = type; } @@ -40,7 +39,7 @@ namespace Server.Engines.CannedEvil public override void OnDoubleClick( Mobile from ) { - m_Platform?.Validate(); + Platform?.Validate(); BeginSacrifice( from ); } @@ -138,7 +137,7 @@ namespace Server.Engines.CannedEvil writer.Write( (int) 0 ); // version writer.Write( (int) m_Type ); - writer.Write( m_Platform ); + writer.Write( Platform ); writer.Write( m_Skull ); } @@ -153,10 +152,10 @@ namespace Server.Engines.CannedEvil case 0: { m_Type = (ChampionSkullType)reader.ReadInt(); - m_Platform = reader.ReadItem() as ChampionSkullPlatform; + Platform = reader.ReadItem() as ChampionSkullPlatform; m_Skull = reader.ReadItem(); - if ( m_Platform == null ) + if ( Platform == null ) Delete(); break; diff --git a/Scripts/Engines/CannedEvil/ChampionSpawn.cs b/Scripts/Engines/CannedEvil/ChampionSpawn.cs index d06326b01..1bace0251 100644 --- a/Scripts/Engines/CannedEvil/ChampionSpawn.cs +++ b/Scripts/Engines/CannedEvil/ChampionSpawn.cs @@ -18,7 +18,6 @@ namespace Server.Engines.CannedEvil private int m_SPawnSzMod; private bool m_Active; - private bool m_RandomizeType; private ChampionSpawnType m_Type; private List m_Creatures; private List m_RedSkulls; @@ -26,40 +25,22 @@ namespace Server.Engines.CannedEvil private ChampionPlatform m_Platform; private ChampionAltar m_Altar; private int m_Kills; - private Mobile m_Champion; //private int m_SpawnRange; private Rectangle2D m_SpawnArea; private ChampionSpawnRegion m_Region; - private TimeSpan m_ExpireDelay; - private DateTime m_ExpireTime; - - private TimeSpan m_RestartDelay; - private DateTime m_RestartTime; - private Timer m_Timer, m_RestartTimer; private IdolOfTheChampion m_Idol; - private bool m_HasBeenAdvanced; - private bool m_ConfinedRoaming; - private Dictionary m_DamageEntries; [CommandProperty( AccessLevel.GameMaster )] - public bool ConfinedRoaming - { - get => m_ConfinedRoaming; - set => m_ConfinedRoaming = value; - } + public bool ConfinedRoaming { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool HasBeenAdvanced - { - get => m_HasBeenAdvanced; - set => m_HasBeenAdvanced = value; - } + public bool HasBeenAdvanced { get; set; } [Constructible] public ChampionSpawn() : base( 0xBD2 ) @@ -75,8 +56,8 @@ namespace Server.Engines.CannedEvil m_Altar = new ChampionAltar( this ); m_Idol = new IdolOfTheChampion( this ); - m_ExpireDelay = TimeSpan.FromMinutes( 10.0 ); - m_RestartDelay = TimeSpan.FromMinutes( 10.0 ); + ExpireDelay = TimeSpan.FromMinutes( 10.0 ); + RestartDelay = TimeSpan.FromMinutes( 10.0 ); m_DamageEntries = new Dictionary(); @@ -114,11 +95,7 @@ namespace Server.Engines.CannedEvil } [CommandProperty( AccessLevel.GameMaster )] - public bool RandomizeType - { - get => m_RandomizeType; - set => m_RandomizeType = value; - } + public bool RandomizeType { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int Kills @@ -144,28 +121,16 @@ namespace Server.Engines.CannedEvil } [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan RestartDelay - { - get => m_RestartDelay; - set => m_RestartDelay = value; - } + public TimeSpan RestartDelay { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime RestartTime => m_RestartTime; + public DateTime RestartTime { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan ExpireDelay - { - get => m_ExpireDelay; - set => m_ExpireDelay = value; - } + public TimeSpan ExpireDelay { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime ExpireTime - { - get => m_ExpireTime; - set => m_ExpireTime = value; - } + public DateTime ExpireTime { get; set; } [CommandProperty( AccessLevel.GameMaster )] public ChampionSpawnType Type @@ -194,11 +159,7 @@ namespace Server.Engines.CannedEvil } [CommandProperty( AccessLevel.GameMaster )] - public Mobile Champion - { - get => m_Champion; - set => m_Champion = value; - } + public Mobile Champion { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int Level @@ -266,7 +227,7 @@ namespace Server.Engines.CannedEvil return; m_Active = true; - m_HasBeenAdvanced = false; + HasBeenAdvanced = false; m_Timer?.Stop(); @@ -279,7 +240,7 @@ namespace Server.Engines.CannedEvil if ( m_Altar != null ) { - if ( m_Champion != null ) + if ( Champion != null ) m_Altar.Hue = 0x26; else m_Altar.Hue = 0; @@ -295,7 +256,7 @@ namespace Server.Engines.CannedEvil return; m_Active = false; - m_HasBeenAdvanced = false; + HasBeenAdvanced = false; m_Timer?.Stop(); @@ -316,7 +277,7 @@ namespace Server.Engines.CannedEvil { m_RestartTimer?.Stop(); - m_RestartTime = DateTime.UtcNow + ts; + RestartTime = DateTime.UtcNow + ts; m_RestartTimer = new RestartTimer( this, ts ); m_RestartTimer.Start(); @@ -336,7 +297,7 @@ namespace Server.Engines.CannedEvil } } - m_HasBeenAdvanced = false; + HasBeenAdvanced = false; Start(); } @@ -414,13 +375,13 @@ namespace Server.Engines.CannedEvil if ( !m_Active || Deleted ) return; - if ( m_Champion != null ) + if ( Champion != null ) { - if ( m_Champion.Deleted ) + if ( Champion.Deleted ) { - RegisterDamageTo( m_Champion ); + RegisterDamageTo( Champion ); - if ( m_Champion is BaseChampion champion ) + if ( Champion is BaseChampion champion ) AwardArtifact( champion.GetArtifact() ); m_DamageEntries.Clear(); @@ -438,10 +399,10 @@ namespace Server.Engines.CannedEvil } } - m_Champion = null; + Champion = null; Stop(); - BeginRestart( m_RestartDelay ); + BeginRestart( RestartDelay ); } } else @@ -543,7 +504,7 @@ namespace Server.Engines.CannedEvil else if ( p > 0 ) SetWhiteSkullCount( p / 20 ); - if ( DateTime.UtcNow >= m_ExpireTime ) + if ( DateTime.UtcNow >= ExpireTime ) Expire(); Respawn(); @@ -552,7 +513,7 @@ namespace Server.Engines.CannedEvil public void AdvanceLevel() { - m_ExpireTime = DateTime.UtcNow + m_ExpireDelay; + ExpireTime = DateTime.UtcNow + ExpireDelay; if ( Level < 16 ) { @@ -588,16 +549,16 @@ namespace Server.Engines.CannedEvil try { - m_Champion = Activator.CreateInstance( ChampionSpawnInfo.GetInfo( m_Type ).Champion ) as Mobile; + Champion = Activator.CreateInstance( ChampionSpawnInfo.GetInfo( m_Type ).Champion ) as Mobile; } catch { } - m_Champion?.MoveToWorld( new Point3D( X, Y, Z - 15 ), Map ); + Champion?.MoveToWorld( new Point3D( X, Y, Z - 15 ), Map ); } public void Respawn() { - if ( !m_Active || Deleted || m_Champion != null ) + if ( !m_Active || Deleted || Champion != null ) return; while( m_Creatures.Count < ( ( m_SPawnSzMod * ( 200 / 12 ) ) ) - ( GetSubLevel() * ( m_SPawnSzMod * ( 40 / 12 ) ) ) ) @@ -619,7 +580,7 @@ namespace Server.Engines.CannedEvil { bc.Tamable = false; - if ( !m_ConfinedRoaming ) + if ( !ConfinedRoaming ) { bc.Home = Location; bc.RangeHome = (int)(Math.Sqrt( m_SpawnArea.Width * m_SpawnArea.Width + m_SpawnArea.Height * m_SpawnArea.Height )/2); @@ -752,7 +713,7 @@ namespace Server.Engines.CannedEvil SetWhiteSkullCount( 0 ); } - m_ExpireTime = DateTime.UtcNow + m_ExpireDelay; + ExpireTime = DateTime.UtcNow + ExpireDelay; } public Point3D GetRedSkullLocation( int index ) @@ -935,8 +896,8 @@ namespace Server.Engines.CannedEvil m_Creatures.Clear(); } - if ( m_Champion != null && !m_Champion.Player ) - m_Champion.Delete(); + if ( Champion != null && !Champion.Player ) + Champion.Delete(); Stop(); @@ -1047,12 +1008,12 @@ namespace Server.Engines.CannedEvil writer.Write( kvp.Value ); } - writer.Write( m_ConfinedRoaming ); + writer.Write( ConfinedRoaming ); writer.WriteItem( m_Idol ); - writer.Write( m_HasBeenAdvanced ); + writer.Write( HasBeenAdvanced ); writer.Write( m_SpawnArea ); - writer.Write( m_RandomizeType ); + writer.Write( RandomizeType ); // writer.Write( m_SpawnRange ); writer.Write( m_Kills ); @@ -1064,15 +1025,15 @@ namespace Server.Engines.CannedEvil writer.Write( m_WhiteSkulls, true ); writer.WriteItem( m_Platform ); writer.WriteItem( m_Altar ); - writer.Write( m_ExpireDelay ); - writer.WriteDeltaTime( m_ExpireTime ); - writer.Write( m_Champion ); - writer.Write( m_RestartDelay ); + writer.Write( ExpireDelay ); + writer.WriteDeltaTime( ExpireTime ); + writer.Write( Champion ); + writer.Write( RestartDelay ); writer.Write( m_RestartTimer != null ); if ( m_RestartTimer != null ) - writer.WriteDeltaTime( m_RestartTime ); + writer.WriteDeltaTime( RestartTime ); } public override void Deserialize( GenericReader reader ) @@ -1110,9 +1071,9 @@ namespace Server.Engines.CannedEvil } case 4: { - m_ConfinedRoaming = reader.ReadBool(); + ConfinedRoaming = reader.ReadBool(); m_Idol = reader.ReadItem(); - m_HasBeenAdvanced = reader.ReadBool(); + HasBeenAdvanced = reader.ReadBool(); goto case 3; } @@ -1124,7 +1085,7 @@ namespace Server.Engines.CannedEvil } case 2: { - m_RandomizeType = reader.ReadBool(); + RandomizeType = reader.ReadBool(); goto case 1; } @@ -1153,15 +1114,15 @@ namespace Server.Engines.CannedEvil m_WhiteSkulls = reader.ReadStrongItemList(); m_Platform = reader.ReadItem(); m_Altar = reader.ReadItem(); - m_ExpireDelay = reader.ReadTimeSpan(); - m_ExpireTime = reader.ReadDeltaTime(); - m_Champion = reader.ReadMobile(); - m_RestartDelay = reader.ReadTimeSpan(); + ExpireDelay = reader.ReadTimeSpan(); + ExpireTime = reader.ReadDeltaTime(); + Champion = reader.ReadMobile(); + RestartDelay = reader.ReadTimeSpan(); if ( reader.ReadBool() ) { - m_RestartTime = reader.ReadDeltaTime(); - BeginRestart( m_RestartTime - DateTime.UtcNow ); + RestartTime = reader.ReadDeltaTime(); + BeginRestart( RestartTime - DateTime.UtcNow ); } if ( version < 4 ) @@ -1187,13 +1148,11 @@ namespace Server.Engines.CannedEvil { public override bool YoungProtected => false; - private ChampionSpawn m_Spawn; - - public ChampionSpawn ChampionSpawn => m_Spawn; + public ChampionSpawn ChampionSpawn { get; } public ChampionSpawnRegion( ChampionSpawn spawn ) : base( null, spawn.Map, Find( spawn.Location, spawn.Map ), spawn.SpawnArea ) { - m_Spawn = spawn; + ChampionSpawn = spawn; } public override bool AllowHousing( Mobile from, Point3D p ) @@ -1204,22 +1163,20 @@ namespace Server.Engines.CannedEvil public override void AlterLightLevel( Mobile m, ref int global, ref int personal ) { base.AlterLightLevel( m, ref global, ref personal ); - global = Math.Max( global, 1 + m_Spawn.Level ); //This is a guesstimate. TODO: Verify & get exact values // OSI testing: at 2 red skulls, light = 0x3 ; 1 red = 0x3.; 3 = 8; 9 = 0xD 8 = 0xD 12 = 0x12 10 = 0xD + global = Math.Max( global, 1 + ChampionSpawn.Level ); //This is a guesstimate. TODO: Verify & get exact values // OSI testing: at 2 red skulls, light = 0x3 ; 1 red = 0x3.; 3 = 8; 9 = 0xD 8 = 0xD 12 = 0x12 10 = 0xD } } public class IdolOfTheChampion : Item { - private ChampionSpawn m_Spawn; - - public ChampionSpawn Spawn => m_Spawn; + public ChampionSpawn Spawn { get; private set; } public override string DefaultName => "Idol of the Champion"; public IdolOfTheChampion( ChampionSpawn spawn ): base( 0x1F18 ) { - m_Spawn = spawn; + Spawn = spawn; Movable = false; } @@ -1227,7 +1184,7 @@ namespace Server.Engines.CannedEvil { base.OnAfterDelete(); - m_Spawn?.Delete(); + Spawn?.Delete(); } public IdolOfTheChampion( Serial serial ) : base( serial ) @@ -1240,7 +1197,7 @@ namespace Server.Engines.CannedEvil writer.Write( (int) 0 ); // version - writer.Write( m_Spawn ); + writer.Write( Spawn ); } public override void Deserialize( GenericReader reader ) @@ -1253,9 +1210,9 @@ namespace Server.Engines.CannedEvil { case 0: { - m_Spawn = reader.ReadItem() as ChampionSpawn; + Spawn = reader.ReadItem() as ChampionSpawn; - if ( m_Spawn == null ) + if ( Spawn == null ) Delete(); break; diff --git a/Scripts/Engines/CannedEvil/ChampionSpawnType.cs b/Scripts/Engines/CannedEvil/ChampionSpawnType.cs index df862956d..51206039d 100644 --- a/Scripts/Engines/CannedEvil/ChampionSpawnType.cs +++ b/Scripts/Engines/CannedEvil/ChampionSpawnType.cs @@ -18,103 +18,100 @@ namespace Server.Engines.CannedEvil public class ChampionSpawnInfo { - private string m_Name; - private Type m_Champion; - private Type[][] m_SpawnTypes; - private string[] m_LevelNames; + public string Name { get; } - public string Name => m_Name; - public Type Champion => m_Champion; - public Type[][] SpawnTypes => m_SpawnTypes; - public string[] LevelNames => m_LevelNames; + public Type Champion { get; } + + public Type[][] SpawnTypes { get; } + + public string[] LevelNames { get; } public ChampionSpawnInfo( string name, Type champion, string[] levelNames, Type[][] spawnTypes ) { - m_Name = name; - m_Champion = champion; - m_LevelNames = levelNames; - m_SpawnTypes = spawnTypes; + Name = name; + Champion = champion; + LevelNames = levelNames; + SpawnTypes = spawnTypes; } - public static ChampionSpawnInfo[] Table => m_Table; - - private static readonly ChampionSpawnInfo[] m_Table = { - new ChampionSpawnInfo( "Abyss", typeof( Semidar ), new[]{ "Foe", "Assassin", "Conqueror" }, new[] // Abyss - { // Abyss - new[]{ typeof( GreaterMongbat ), typeof( Imp ) }, // Level 1 - new[]{ typeof( Gargoyle ), typeof( Harpy ) }, // Level 2 - new[]{ typeof( FireGargoyle ), typeof( StoneGargoyle ) }, // Level 3 - new[]{ typeof( Daemon ), typeof( Succubus ) } // Level 4 - } ), - new ChampionSpawnInfo( "Arachnid", typeof( Mephitis ), new[]{ "Bane", "Killer", "Vanquisher" }, new[] // Arachnid - { // Arachnid - new[]{ typeof( Scorpion ), typeof( GiantSpider ) }, // Level 1 - new[]{ typeof( TerathanDrone ), typeof( TerathanWarrior ) }, // Level 2 - new[]{ typeof( DreadSpider ), typeof( TerathanMatriarch ) }, // Level 3 - new[]{ typeof( PoisonElemental ), typeof( TerathanAvenger ) } // Level 4 - } ), - new ChampionSpawnInfo( "Cold Blood", typeof( Rikktor ), new[]{ "Blight", "Slayer", "Destroyer" }, new[] // Cold Blood - { // Cold Blood - new[]{ typeof( Lizardman ), typeof( Snake ) }, // Level 1 - new[]{ typeof( LavaLizard ), typeof( OphidianWarrior ) }, // Level 2 - new[]{ typeof( Drake ), typeof( OphidianArchmage ) }, // Level 3 - new[]{ typeof( Dragon ), typeof( OphidianKnight ) } // Level 4 - } ), - new ChampionSpawnInfo( "Forest Lord", typeof( LordOaks ), new[]{ "Enemy", "Curse", "Slaughterer" }, new[] // Forest Lord - { // Forest Lord - new[]{ typeof( Pixie ), typeof( ShadowWisp ) }, // Level 1 - new[]{ typeof( Kirin ), typeof( Wisp ) }, // Level 2 - new[]{ typeof( Centaur ), typeof( Unicorn ) }, // Level 3 - new[]{ typeof( EtherealWarrior ), typeof( SerpentineDragon ) } // Level 4 - } ), - new ChampionSpawnInfo( "Vermin Horde", typeof( Barracoon ), new[]{ "Adversary", "Subjugator", "Eradicator" }, new[] // Vermin Horde - { // Vermin Horde - new[]{ typeof( GiantRat ), typeof( Slime ) }, // Level 1 - new[]{ typeof( DireWolf ), typeof( Ratman ) }, // Level 2 - new[]{ typeof( HellHound ), typeof( RatmanMage ) }, // Level 3 - new[]{ typeof( RatmanArcher ), typeof( SilverSerpent ) } // Level 4 - } ), - new ChampionSpawnInfo( "Unholy Terror", typeof( Neira ), new[]{ "Scourge", "Punisher", "Nemesis" }, new[] // Unholy Terror - { // Unholy Terror - (Core.AOS ? + public static ChampionSpawnInfo[] Table { get; } = + { + new ChampionSpawnInfo( "Abyss", typeof( Semidar ), new[]{ "Foe", "Assassin", "Conqueror" }, new[] // Abyss + { // Abyss + new[]{ typeof( GreaterMongbat ), typeof( Imp ) }, // Level 1 + new[]{ typeof( Gargoyle ), typeof( Harpy ) }, // Level 2 + new[]{ typeof( FireGargoyle ), typeof( StoneGargoyle ) }, // Level 3 + new[]{ typeof( Daemon ), typeof( Succubus ) } // Level 4 + } ), + new ChampionSpawnInfo( "Arachnid", typeof( Mephitis ), new[]{ "Bane", "Killer", "Vanquisher" }, new[] // Arachnid + { // Arachnid + new[]{ typeof( Scorpion ), typeof( GiantSpider ) }, // Level 1 + new[]{ typeof( TerathanDrone ), typeof( TerathanWarrior ) }, // Level 2 + new[]{ typeof( DreadSpider ), typeof( TerathanMatriarch ) }, // Level 3 + new[]{ typeof( PoisonElemental ), typeof( TerathanAvenger ) } // Level 4 + } ), + new ChampionSpawnInfo( "Cold Blood", typeof( Rikktor ), new[]{ "Blight", "Slayer", "Destroyer" }, new[] // Cold Blood + { // Cold Blood + new[]{ typeof( Lizardman ), typeof( Snake ) }, // Level 1 + new[]{ typeof( LavaLizard ), typeof( OphidianWarrior ) }, // Level 2 + new[]{ typeof( Drake ), typeof( OphidianArchmage ) }, // Level 3 + new[]{ typeof( Dragon ), typeof( OphidianKnight ) } // Level 4 + } ), + new ChampionSpawnInfo( "Forest Lord", typeof( LordOaks ), new[]{ "Enemy", "Curse", "Slaughterer" }, new[] // Forest Lord + { // Forest Lord + new[]{ typeof( Pixie ), typeof( ShadowWisp ) }, // Level 1 + new[]{ typeof( Kirin ), typeof( Wisp ) }, // Level 2 + new[]{ typeof( Centaur ), typeof( Unicorn ) }, // Level 3 + new[]{ typeof( EtherealWarrior ), typeof( SerpentineDragon ) } // Level 4 + } ), + new ChampionSpawnInfo( "Vermin Horde", typeof( Barracoon ), new[]{ "Adversary", "Subjugator", "Eradicator" }, new[] // Vermin Horde + { // Vermin Horde + new[]{ typeof( GiantRat ), typeof( Slime ) }, // Level 1 + new[]{ typeof( DireWolf ), typeof( Ratman ) }, // Level 2 + new[]{ typeof( HellHound ), typeof( RatmanMage ) }, // Level 3 + new[]{ typeof( RatmanArcher ), typeof( SilverSerpent ) } // Level 4 + } ), + new ChampionSpawnInfo( "Unholy Terror", typeof( Neira ), new[]{ "Scourge", "Punisher", "Nemesis" }, new[] // Unholy Terror + { // Unholy Terror + (Core.AOS ? new[]{ typeof( Bogle ), typeof( Ghoul ), typeof( Shade ), typeof( Spectre ), typeof( Wraith ) } // Level 1 (Pre-AoS) : new[]{ typeof( Ghoul ), typeof( Shade ), typeof( Spectre ), typeof( Wraith ) } ), // Level 1 - new[]{ typeof( BoneMagi ), typeof( Mummy ), typeof( SkeletalMage ) }, // Level 2 - new[]{ typeof( BoneKnight ), typeof( Lich ), typeof( SkeletalKnight ) }, // Level 3 - new[]{ typeof( LichLord ), typeof( RottingCorpse ) } // Level 4 - } ), - new ChampionSpawnInfo( "Sleeping Dragon", typeof( Serado ), new[]{ "Rival", "Challenger", "Antagonist" } , new[] - { // Unholy Terror - new[]{ typeof( DeathwatchBeetleHatchling ), typeof( Lizardman ) }, - new[]{ typeof( DeathwatchBeetle ), typeof( Kappa ) }, - new[]{ typeof( LesserHiryu ), typeof( RevenantLion ) }, - new[]{ typeof( Hiryu ), typeof( Oni ) } - } ), - new ChampionSpawnInfo( "Glade", typeof( Twaulo ), new[]{ "Banisher", "Enforcer", "Eradicator" } , new[] - { // Glade - new[]{ typeof( Pixie ), typeof( ShadowWisp ) }, - new[]{ typeof( Centaur ), typeof( MLDryad ) }, - new[]{ typeof( Satyr ), typeof( CuSidhe ) }, - new[]{ typeof( FeralTreefellow ), typeof( RagingGrizzlyBear ) } - } ), - new ChampionSpawnInfo( "The Corrupt", typeof( Ilhenir ), new[]{ "Cleanser", "Expunger", "Depurator" } , new[] - { // Unholy Terror - new[]{ typeof( PlagueSpawn ), typeof( Bogling ) }, - new[]{ typeof( PlagueBeast ), typeof( BogThing ) }, - new[]{ typeof( PlagueBeastLord ), typeof( InterredGrizzle ) }, - new[]{ typeof( FetidEssence ), typeof( PestilentBandage ) } - } ) - }; + new[]{ typeof( BoneMagi ), typeof( Mummy ), typeof( SkeletalMage ) }, // Level 2 + new[]{ typeof( BoneKnight ), typeof( Lich ), typeof( SkeletalKnight ) }, // Level 3 + new[]{ typeof( LichLord ), typeof( RottingCorpse ) } // Level 4 + } ), + new ChampionSpawnInfo( "Sleeping Dragon", typeof( Serado ), new[]{ "Rival", "Challenger", "Antagonist" } , new[] + { // Unholy Terror + new[]{ typeof( DeathwatchBeetleHatchling ), typeof( Lizardman ) }, + new[]{ typeof( DeathwatchBeetle ), typeof( Kappa ) }, + new[]{ typeof( LesserHiryu ), typeof( RevenantLion ) }, + new[]{ typeof( Hiryu ), typeof( Oni ) } + } ), + new ChampionSpawnInfo( "Glade", typeof( Twaulo ), new[]{ "Banisher", "Enforcer", "Eradicator" } , new[] + { // Glade + new[]{ typeof( Pixie ), typeof( ShadowWisp ) }, + new[]{ typeof( Centaur ), typeof( MLDryad ) }, + new[]{ typeof( Satyr ), typeof( CuSidhe ) }, + new[]{ typeof( FeralTreefellow ), typeof( RagingGrizzlyBear ) } + } ), + new ChampionSpawnInfo( "The Corrupt", typeof( Ilhenir ), new[]{ "Cleanser", "Expunger", "Depurator" } , new[] + { // Unholy Terror + new[]{ typeof( PlagueSpawn ), typeof( Bogling ) }, + new[]{ typeof( PlagueBeast ), typeof( BogThing ) }, + new[]{ typeof( PlagueBeastLord ), typeof( InterredGrizzle ) }, + new[]{ typeof( FetidEssence ), typeof( PestilentBandage ) } + } ) + }; public static ChampionSpawnInfo GetInfo( ChampionSpawnType type ) { int v = (int)type; - if ( v < 0 || v >= m_Table.Length ) + if ( v < 0 || v >= Table.Length ) v = 0; - return m_Table[v]; + return Table[v]; } } } diff --git a/Scripts/Engines/Chat/Channel.cs b/Scripts/Engines/Chat/Channel.cs index 210819a1d..874bd3fdd 100644 --- a/Scripts/Engines/Chat/Channel.cs +++ b/Scripts/Engines/Chat/Channel.cs @@ -9,7 +9,6 @@ namespace Server.Engines.Chat private string m_Password; private List m_Users, m_Banned, m_Moderators, m_Voices; private bool m_VoiceRestricted; - private bool m_AlwaysAvailable; public Channel( string name ) { @@ -141,7 +140,7 @@ namespace Server.Engines.Chat m_Users.Add( user ); user.CurrentChannel = this; - if ( user.Mobile.AccessLevel >= AccessLevel.GameMaster || (!m_AlwaysAvailable && m_Users.Count == 1) ) + if ( user.Mobile.AccessLevel >= AccessLevel.GameMaster || (!AlwaysAvailable && m_Users.Count == 1) ) AddModerator( user ); SendUsersTo( user ); @@ -165,7 +164,7 @@ namespace Server.Engines.Chat SendCommand( ChatCommand.RemoveUserFromChannel, user, user.Username ); ChatSystem.SendCommandTo( user.Mobile, ChatCommand.LeaveChannel ); - if ( m_Users.Count == 0 && !m_AlwaysAvailable ) + if ( m_Users.Count == 0 && !AlwaysAvailable ) RemoveChannel( this ); } } @@ -241,11 +240,7 @@ namespace Server.Engines.Chat } } - public bool AlwaysAvailable - { - get => m_AlwaysAvailable; - set => m_AlwaysAvailable = value; - } + public bool AlwaysAvailable { get; set; } public void AddVoiced( ChatUser user ) { @@ -441,15 +436,13 @@ namespace Server.Engines.Chat } } - private static List m_Channels = new List(); - - public static List Channels => m_Channels; + public static List Channels { get; } = new List(); public static void SendChannelsTo( ChatUser user ) { - for ( int i = 0; i < m_Channels.Count; ++i ) + for ( int i = 0; i < Channels.Count; ++i ) { - Channel channel = m_Channels[i]; + Channel channel = Channels[i]; if ( !channel.IsBanned( user ) ) ChatSystem.SendCommandTo( user.Mobile, ChatCommand.AddChannel, channel.Name, "0" ); @@ -468,7 +461,7 @@ namespace Server.Engines.Chat if ( channel == null ) { channel = new Channel( name, password ); - m_Channels.Add( channel ); + Channels.Add( channel ); } ChatUser.GlobalSendCommand( ChatCommand.AddChannel, name, "0" ) ; @@ -486,22 +479,22 @@ namespace Server.Engines.Chat if ( channel == null ) return; - if ( m_Channels.Contains( channel ) && channel.m_Users.Count == 0 ) + if ( Channels.Contains( channel ) && channel.m_Users.Count == 0 ) { ChatUser.GlobalSendCommand( ChatCommand.RemoveChannel, channel.Name ) ; channel.m_Moderators.Clear(); channel.m_Voices.Clear(); - m_Channels.Remove( channel ); + Channels.Remove( channel ); } } public static Channel FindChannelByName( string name ) { - for ( int i = 0; i < m_Channels.Count; ++i ) + for ( int i = 0; i < Channels.Count; ++i ) { - Channel channel = m_Channels[i]; + Channel channel = Channels[i]; if ( channel.m_Name == name ) return channel; diff --git a/Scripts/Engines/Chat/Chat.cs b/Scripts/Engines/Chat/Chat.cs index 58aa5b3f5..ad3e5ad49 100644 --- a/Scripts/Engines/Chat/Chat.cs +++ b/Scripts/Engines/Chat/Chat.cs @@ -7,13 +7,7 @@ namespace Server.Engines.Chat { public class ChatSystem { - private static bool m_Enabled = true; - - public static bool Enabled - { - get => m_Enabled; - set => m_Enabled = value; - } + public static bool Enabled { get; set; } = true; public static void Initialize() { @@ -40,7 +34,7 @@ namespace Server.Engines.Chat { Mobile from = state.Mobile; - if ( !m_Enabled ) + if ( !Enabled ) { from.SendMessage( "The chat system has been disabled." ); return; @@ -120,7 +114,7 @@ namespace Server.Engines.Chat public static void ChatAction( NetState state, PacketReader pvSrc ) { - if ( !m_Enabled ) + if ( !Enabled ) return; try diff --git a/Scripts/Engines/Chat/ChatActionHandler.cs b/Scripts/Engines/Chat/ChatActionHandler.cs index dbaa19f91..7115cd5d0 100644 --- a/Scripts/Engines/Chat/ChatActionHandler.cs +++ b/Scripts/Engines/Chat/ChatActionHandler.cs @@ -4,19 +4,17 @@ namespace Server.Engines.Chat public class ChatActionHandler { - private bool m_RequireModerator; - private bool m_RequireConference; - private OnChatAction m_Callback; + public bool RequireModerator { get; } - public bool RequireModerator => m_RequireModerator; - public bool RequireConference => m_RequireConference; - public OnChatAction Callback => m_Callback; + public bool RequireConference { get; } + + public OnChatAction Callback { get; } public ChatActionHandler( bool requireModerator, bool requireConference, OnChatAction callback ) { - m_RequireModerator = requireModerator; - m_RequireConference = requireConference; - m_Callback = callback; + RequireModerator = requireModerator; + RequireConference = requireConference; + Callback = callback; } } } \ No newline at end of file diff --git a/Scripts/Engines/Chat/ChatUser.cs b/Scripts/Engines/Chat/ChatUser.cs index 5dabc181a..874129b1e 100644 --- a/Scripts/Engines/Chat/ChatUser.cs +++ b/Scripts/Engines/Chat/ChatUser.cs @@ -5,60 +5,42 @@ namespace Server.Engines.Chat { public class ChatUser { - private Mobile m_Mobile; - private Channel m_Channel; - private bool m_Anonymous; - private bool m_IgnorePrivateMessage; - private List m_Ignored, m_Ignoring; - public ChatUser( Mobile m ) { - m_Mobile = m; - m_Ignored = new List(); - m_Ignoring = new List(); + Mobile = m; + Ignored = new List(); + Ignoring = new List(); } - public Mobile Mobile => m_Mobile; + public Mobile Mobile { get; } - public List Ignored => m_Ignored; + public List Ignored { get; } - public List Ignoring => m_Ignoring; + public List Ignoring { get; } public string Username { get { - if ( m_Mobile.Account is Account acct ) + if ( Mobile.Account is Account acct ) return acct.GetTag( "ChatName" ); return null; } set { - if ( m_Mobile.Account is Account acct ) + if ( Mobile.Account is Account acct ) acct.SetTag( "ChatName", value ); } } - public Channel CurrentChannel - { - get => m_Channel; - set => m_Channel = value; - } + public Channel CurrentChannel { get; set; } - public bool IsOnline => ( m_Mobile.NetState != null ); + public bool IsOnline => ( Mobile.NetState != null ); - public bool Anonymous - { - get => m_Anonymous; - set => m_Anonymous = value; - } + public bool Anonymous { get; set; } - public bool IgnorePrivateMessage - { - get => m_IgnorePrivateMessage; - set => m_IgnorePrivateMessage = value; - } + public bool IgnorePrivateMessage { get; set; } public const char NormalColorCharacter = '0'; public const char ModeratorColorCharacter = '1'; @@ -66,10 +48,10 @@ namespace Server.Engines.Chat public char GetColorCharacter() { - if ( m_Channel != null && m_Channel.IsModerator( this ) ) + if ( CurrentChannel != null && CurrentChannel.IsModerator( this ) ) return ModeratorColorCharacter; - if ( m_Channel != null && m_Channel.IsVoiced( this ) ) + if ( CurrentChannel != null && CurrentChannel.IsVoiced( this ) ) return VoicedColorCharacter; return NormalColorCharacter; @@ -96,22 +78,22 @@ namespace Server.Engines.Chat public void SendMessage( int number, string param1, string param2 ) { - if ( m_Mobile.NetState != null ) - m_Mobile.Send( new ChatMessagePacket( m_Mobile, number, param1, param2 ) ); + if ( Mobile.NetState != null ) + Mobile.Send( new ChatMessagePacket( Mobile, number, param1, param2 ) ); } public void SendMessage( int number, Mobile from, string param1, string param2 ) { - if ( m_Mobile.NetState != null ) - m_Mobile.Send( new ChatMessagePacket( from, number, param1, param2 ) ); + if ( Mobile.NetState != null ) + Mobile.Send( new ChatMessagePacket( from, number, param1, param2 ) ); } public bool IsIgnored( ChatUser check ) { - return m_Ignored.Contains( check ); + return Ignored.Contains( check ); } - public bool IsModerator => ( m_Channel != null && m_Channel.IsModerator( this ) ); + public bool IsModerator => ( CurrentChannel != null && CurrentChannel.IsModerator( this ) ); public void AddIgnored( ChatUser user ) { @@ -121,8 +103,8 @@ namespace Server.Engines.Chat } else { - m_Ignored.Add( user ); - user.m_Ignoring.Add( this ); + Ignored.Add( user ); + user.Ignoring.Add( this ); SendMessage( 23, user.Username ); // You are now ignoring %1. } @@ -132,12 +114,12 @@ namespace Server.Engines.Chat { if ( IsIgnored( user ) ) { - m_Ignored.Remove( user ); - user.m_Ignoring.Remove( this ); + Ignored.Remove( user ); + user.Ignoring.Remove( this ); SendMessage( 24, user.Username ); // You are no longer ignoring %1. - if ( m_Ignored.Count == 0 ) + if ( Ignored.Count == 0 ) SendMessage( 26 ); // You are no longer ignoring anyone. } else @@ -183,17 +165,17 @@ namespace Server.Engines.Chat if ( user == null ) return; - for ( int i = 0; i < user.m_Ignoring.Count; ++i ) - user.m_Ignoring[i].RemoveIgnored( user ); + for ( int i = 0; i < user.Ignoring.Count; ++i ) + user.Ignoring[i].RemoveIgnored( user ); if ( m_Users.Contains( user ) ) { ChatSystem.SendCommandTo( user.Mobile, ChatCommand.CloseChatWindow ); - user.m_Channel?.RemoveUser( user ); + user.CurrentChannel?.RemoveUser( user ); m_Users.Remove( user ); - m_Table.Remove( user.m_Mobile ); + m_Table.Remove( user.Mobile ); } } @@ -258,7 +240,7 @@ namespace Server.Engines.Chat continue; if ( user.CheckOnline() ) - ChatSystem.SendCommandTo( user.m_Mobile, command, param1, param2 ); + ChatSystem.SendCommandTo( user.Mobile, command, param1, param2 ); } } } diff --git a/Scripts/Engines/ConPVP/Arena.cs b/Scripts/Engines/ConPVP/Arena.cs index 741fb587e..a0dedecf6 100644 --- a/Scripts/Engines/ConPVP/Arena.cs +++ b/Scripts/Engines/ConPVP/Arena.cs @@ -7,16 +7,13 @@ namespace Server.Engines.ConPVP public class ArenaController : Item { private Arena m_Arena; - private bool m_IsPrivate; [CommandProperty( AccessLevel.GameMaster )] public Arena Arena{ get => m_Arena; set{} } [CommandProperty( AccessLevel.GameMaster )] - public bool IsPrivate{ get => m_IsPrivate; - set => m_IsPrivate = value; - } + public bool IsPrivate { get; set; } public override string DefaultName => "arena controller"; @@ -28,14 +25,14 @@ namespace Server.Engines.ConPVP m_Arena = new Arena(); - m_Instances.Add( this ); + Instances.Add( this ); } public override void OnDelete() { base.OnDelete(); - m_Instances.Remove( this ); + Instances.Remove( this ); m_Arena.Delete(); } @@ -55,7 +52,7 @@ namespace Server.Engines.ConPVP writer.Write( (int) 1 ); - writer.Write( (bool) m_IsPrivate ); + writer.Write( (bool) IsPrivate ); m_Arena.Serialize( writer ); } @@ -70,7 +67,7 @@ namespace Server.Engines.ConPVP { case 1: { - m_IsPrivate = reader.ReadBool(); + IsPrivate = reader.ReadBool(); goto case 0; } @@ -81,61 +78,55 @@ namespace Server.Engines.ConPVP } } - m_Instances.Add( this ); + Instances.Add( this ); } - private static List m_Instances = new List(); - - public static List Instances{ get => m_Instances; - set => m_Instances = value; - } + public static List Instances { get; set; } = new List(); } [PropertyObject] public class ArenaStartPoints { - private Point3D[] m_Points; - - public Point3D[] Points => m_Points; + public Point3D[] Points { get; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D EdgeWest{ get => m_Points[0]; - set => m_Points[0] = value; + public Point3D EdgeWest{ get => Points[0]; + set => Points[0] = value; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D EdgeEast{ get => m_Points[1]; - set => m_Points[1] = value; + public Point3D EdgeEast{ get => Points[1]; + set => Points[1] = value; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D EdgeNorth{ get => m_Points[2]; - set => m_Points[2] = value; + public Point3D EdgeNorth{ get => Points[2]; + set => Points[2] = value; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D EdgeSouth{ get => m_Points[3]; - set => m_Points[3] = value; + public Point3D EdgeSouth{ get => Points[3]; + set => Points[3] = value; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D CornerNW{ get => m_Points[4]; - set => m_Points[4] = value; + public Point3D CornerNW{ get => Points[4]; + set => Points[4] = value; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D CornerSE{ get => m_Points[5]; - set => m_Points[5] = value; + public Point3D CornerSE{ get => Points[5]; + set => Points[5] = value; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D CornerSW{ get => m_Points[6]; - set => m_Points[6] = value; + public Point3D CornerSW{ get => Points[6]; + set => Points[6] = value; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D CornerNE{ get => m_Points[7]; - set => m_Points[7] = value; + public Point3D CornerNE{ get => Points[7]; + set => Points[7] = value; } public override string ToString() @@ -149,23 +140,23 @@ namespace Server.Engines.ConPVP public ArenaStartPoints( Point3D[] points ) { - m_Points = points; + Points = points; } public ArenaStartPoints( GenericReader reader ) { - m_Points = new Point3D[reader.ReadEncodedInt()]; + Points = new Point3D[reader.ReadEncodedInt()]; - for ( int i = 0; i < m_Points.Length; ++i ) - m_Points[i] = reader.ReadPoint3D(); + for ( int i = 0; i < Points.Length; ++i ) + Points[i] = reader.ReadPoint3D(); } public void Serialize( GenericWriter writer ) { - writer.WriteEncodedInt( (int) m_Points.Length ); + writer.WriteEncodedInt( (int) Points.Length ); - for ( int i = 0; i < m_Points.Length; ++i ) - writer.Write( (Point3D) m_Points[i] ); + for ( int i = 0; i < Points.Length; ++i ) + writer.Write( (Point3D) Points[i] ); } } @@ -175,9 +166,6 @@ namespace Server.Engines.ConPVP private Map m_Facet; private Rectangle2D m_Bounds; private Rectangle2D m_Zone; - private Point3D m_Outside; - private Point3D m_Wall; - private Point3D m_GateIn; private Point3D m_GateOut; private ArenaStartPoints m_Points; private bool m_Active; @@ -185,21 +173,10 @@ namespace Server.Engines.ConPVP private bool m_IsGuarded; - private Item m_Teleporter; - - private List m_Players; - private TournamentController m_Tournament; - private Mobile m_Announcer; - - private LadderController m_Ladder; [CommandProperty( AccessLevel.GameMaster )] - public LadderController Ladder - { - get => m_Ladder; - set => m_Ladder = value; - } + public LadderController Ladder { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool IsGuarded @@ -216,8 +193,8 @@ namespace Server.Engines.ConPVP public Ladder AcquireLadder() { - if ( m_Ladder != null ) - return m_Ladder.Ladder; + if ( Ladder != null ) + return Ladder.Ladder; return Server.Engines.ConPVP.Ladder.Instance; } @@ -237,17 +214,13 @@ namespace Server.Engines.ConPVP } [CommandProperty( AccessLevel.GameMaster )] - public Mobile Announcer - { - get => m_Announcer; - set => m_Announcer = value; - } + public Mobile Announcer { get; set; } [CommandProperty( AccessLevel.GameMaster )] public string Name { get => m_Name; - set{ m_Name = value; if ( m_Active ) m_Arenas.Sort(); } + set{ m_Name = value; if ( m_Active ) Arenas.Sort(); } } [CommandProperty( AccessLevel.GameMaster )] @@ -258,13 +231,13 @@ namespace Server.Engines.ConPVP { m_Facet = value; - if ( m_Teleporter != null ) - m_Teleporter.Map = value; + if ( Teleporter != null ) + Teleporter.Map = value; m_Region?.Unregister(); if ( m_Zone.Start != Point2D.Zero && m_Zone.End != Point2D.Zero && m_Facet != null ) - m_Region = new SafeZone( m_Zone, m_Outside, m_Facet, m_IsGuarded ); + m_Region = new SafeZone( m_Zone, Outside, m_Facet, m_IsGuarded ); else m_Region = null; } @@ -284,7 +257,7 @@ namespace Server.Engines.ConPVP if ( m_Region == null ) return 0; - int specs = m_Region.GetPlayerCount() - m_Players.Count; + int specs = m_Region.GetPlayerCount() - Players.Count; if ( specs < 0 ) specs = 0; @@ -305,7 +278,7 @@ namespace Server.Engines.ConPVP { m_Region?.Unregister(); - m_Region = new SafeZone( m_Zone, m_Outside, m_Facet, m_IsGuarded ); + m_Region = new SafeZone( m_Zone, Outside, m_Facet, m_IsGuarded ); } else { @@ -317,36 +290,28 @@ namespace Server.Engines.ConPVP } [CommandProperty( AccessLevel.GameMaster )] - public Point3D Outside{ get => m_Outside; - set => m_Outside = value; - } + public Point3D Outside { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D GateIn{ get => m_GateIn; - set => m_GateIn = value; - } + public Point3D GateIn { get; set; } [CommandProperty( AccessLevel.GameMaster )] public Point3D GateOut{ get => m_GateOut; - set{ m_GateOut = value; if ( m_Teleporter != null ) m_Teleporter.Location = m_GateOut; } } + set{ m_GateOut = value; if ( Teleporter != null ) Teleporter.Location = m_GateOut; } } [CommandProperty( AccessLevel.GameMaster )] - public Point3D Wall{ get => m_Wall; - set => m_Wall = value; - } + public Point3D Wall { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool IsOccupied => ( m_Players.Count > 0 ); + public bool IsOccupied => ( Players.Count > 0 ); [CommandProperty( AccessLevel.GameMaster )] public ArenaStartPoints Points{ get => m_Points; set{} } - public Item Teleporter{ get => m_Teleporter; - set => m_Teleporter = value; - } + public Item Teleporter { get; set; } - public List Players => m_Players; + public List Players { get; } [CommandProperty( AccessLevel.GameMaster )] public bool Active @@ -361,12 +326,12 @@ namespace Server.Engines.ConPVP if ( m_Active ) { - m_Arenas.Add( this ); - m_Arenas.Sort(); + Arenas.Add( this ); + Arenas.Sort(); } else { - m_Arenas.Remove( this ); + Arenas.Remove( this ); } } } @@ -482,16 +447,16 @@ namespace Server.Engines.ConPVP p.Y = (p.X * matrix[1, 0]) + (p.Y * matrix[1, 1]); mob.MoveToWorld( new Point3D( start.X + p.X, start.Y + p.Y, start.Z ), m_Facet ); - mob.Direction = mob.GetDirectionTo( m_Wall ); + mob.Direction = mob.GetDirectionTo( Wall ); - m_Players.Add( mob ); + Players.Add( mob ); } } public Arena() { m_Points = new ArenaStartPoints(); - m_Players = new List(); + Players = new List(); } public Arena( GenericReader reader ) @@ -508,14 +473,14 @@ namespace Server.Engines.ConPVP } case 6: { - m_Ladder = reader.ReadItem() as LadderController; + Ladder = reader.ReadItem() as LadderController; goto case 5; } case 5: { m_Tournament = reader.ReadItem() as TournamentController; - m_Announcer = reader.ReadMobile(); + Announcer = reader.ReadMobile(); goto case 4; } @@ -533,15 +498,15 @@ namespace Server.Engines.ConPVP } case 2: { - m_GateIn = reader.ReadPoint3D(); + GateIn = reader.ReadPoint3D(); m_GateOut = reader.ReadPoint3D(); - m_Teleporter = reader.ReadItem(); + Teleporter = reader.ReadItem(); goto case 1; } case 1: { - m_Players = reader.ReadStrongMobileList(); + Players = reader.ReadStrongMobileList(); goto case 0; } @@ -549,13 +514,13 @@ namespace Server.Engines.ConPVP { m_Facet = reader.ReadMap(); m_Bounds = reader.ReadRect2D(); - m_Outside = reader.ReadPoint3D(); - m_Wall = reader.ReadPoint3D(); + Outside = reader.ReadPoint3D(); + Wall = reader.ReadPoint3D(); if ( version == 0 ) { reader.ReadBool(); - m_Players = new List(); + Players = new List(); } m_Active = reader.ReadBool(); @@ -563,8 +528,8 @@ namespace Server.Engines.ConPVP if ( m_Active ) { - m_Arenas.Add( this ); - m_Arenas.Sort(); + Arenas.Add( this ); + Arenas.Sort(); } break; @@ -572,7 +537,7 @@ namespace Server.Engines.ConPVP } if ( m_Zone.Start != Point2D.Zero && m_Zone.End != Point2D.Zero && m_Facet != null ) - m_Region = new SafeZone( m_Zone, m_Outside, m_Facet, m_IsGuarded ); + m_Region = new SafeZone( m_Zone, Outside, m_Facet, m_IsGuarded ); if ( IsOccupied ) Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), Evict ); @@ -602,15 +567,15 @@ namespace Server.Engines.ConPVP } else { - loc = m_Outside; + loc = Outside; facet = m_Facet; } bool hasBounds = ( m_Bounds.Start != Point2D.Zero && m_Bounds.End != Point2D.Zero ); - for ( int i = 0; i < m_Players.Count; ++i ) + for ( int i = 0; i < Players.Count; ++i ) { - Mobile mob = m_Players[i]; + Mobile mob = Players[i]; if ( mob == null ) continue; @@ -635,7 +600,7 @@ namespace Server.Engines.ConPVP List pets = new List(); foreach ( Mobile mob in facet.GetMobilesInBounds( m_Bounds ) ) { - if ( mob is BaseCreature pet && pet.Controlled && pet.ControlMaster != null && m_Players.Contains( pet.ControlMaster ) ) { + if ( mob is BaseCreature pet && pet.Controlled && pet.ControlMaster != null && Players.Contains( pet.ControlMaster ) ) { pets.Add( pet ); } } @@ -648,7 +613,7 @@ namespace Server.Engines.ConPVP } } - m_Players.Clear(); + Players.Clear(); } public void Serialize( GenericWriter writer ) @@ -657,33 +622,31 @@ namespace Server.Engines.ConPVP writer.Write( (bool) m_IsGuarded ); - writer.Write( (Item) m_Ladder ); + writer.Write( (Item) Ladder ); writer.Write( (Item) m_Tournament ); - writer.Write( (Mobile) m_Announcer ); + writer.Write( (Mobile) Announcer ); writer.Write( (string) m_Name ); writer.Write( (Rectangle2D) m_Zone ); - writer.Write( (Point3D) m_GateIn ); + writer.Write( (Point3D) GateIn ); writer.Write( (Point3D) m_GateOut ); - writer.Write( (Item) m_Teleporter ); + writer.Write( (Item) Teleporter ); - writer.Write( m_Players ); + writer.Write( Players ); writer.Write( (Map) m_Facet ); writer.Write( (Rectangle2D) m_Bounds ); - writer.Write( (Point3D) m_Outside ); - writer.Write( (Point3D) m_Wall ); + writer.Write( (Point3D) Outside ); + writer.Write( (Point3D) Wall ); writer.Write( (bool) m_Active ); m_Points.Serialize( writer ); } - private static List m_Arenas = new List(); - - public static List Arenas => m_Arenas; + public static List Arenas { get; } = new List(); public static Arena FindArena( List players ) { @@ -692,7 +655,7 @@ namespace Server.Engines.ConPVP if ( prefs == null ) return FindArena(); - if ( m_Arenas.Count == 0 ) + if ( Arenas.Count == 0 ) return null; if ( players.Count > 0 ) @@ -735,16 +698,16 @@ namespace Server.Engines.ConPVP List arenas = new List(); - for ( int i = 0; i < m_Arenas.Count; ++i ) + for ( int i = 0; i < Arenas.Count; ++i ) { - Arena arena = m_Arenas[i]; + Arena arena = Arenas[i]; if ( !arena.IsOccupied ) arenas.Add( new ArenaEntry( arena ) ); } if ( arenas.Count == 0 ) - return m_Arenas[0]; + return Arenas[0]; int tc = 0; @@ -796,20 +759,20 @@ namespace Server.Engines.ConPVP public static Arena FindArena() { - if ( m_Arenas.Count == 0 ) + if ( Arenas.Count == 0 ) return null; - int offset = Utility.Random( m_Arenas.Count ); + int offset = Utility.Random( Arenas.Count ); - for ( int i = 0; i < m_Arenas.Count; ++i ) + for ( int i = 0; i < Arenas.Count; ++i ) { - Arena arena = m_Arenas[(i + offset) % m_Arenas.Count]; + Arena arena = Arenas[(i + offset) % Arenas.Count]; if ( !arena.IsOccupied ) return arena; } - return m_Arenas[offset]; + return Arenas[offset]; } public int CompareTo(object obj) diff --git a/Scripts/Engines/ConPVP/DuelContext.cs b/Scripts/Engines/ConPVP/DuelContext.cs index a44bfa83c..152ab0a9d 100644 --- a/Scripts/Engines/ConPVP/DuelContext.cs +++ b/Scripts/Engines/ConPVP/DuelContext.cs @@ -22,31 +22,25 @@ namespace Server.Engines.ConPVP public class DuelContext { - private Mobile m_Initiator; - private ArrayList m_Participants; - private Ruleset m_Ruleset; - private Arena m_Arena; - private bool m_Registered = true; - private bool m_Finished, m_Started; + public bool Rematch { get; private set; } - private bool m_ReadyWait; - private int m_ReadyCount; + public bool ReadyWait { get; private set; } - private bool m_Rematch; + public int ReadyCount { get; private set; } - public bool Rematch => m_Rematch; + public bool Registered { get; private set; } = true; - public bool ReadyWait => m_ReadyWait; - public int ReadyCount => m_ReadyCount; + public bool Finished { get; private set; } - public bool Registered => m_Registered; - public bool Finished => m_Finished; - public bool Started => m_Started; + public bool Started { get; private set; } - public Mobile Initiator => m_Initiator; - public ArrayList Participants => m_Participants; - public Ruleset Ruleset => m_Ruleset; - public Arena Arena => m_Arena; + public Mobile Initiator { get; } + + public ArrayList Participants { get; } + + public Ruleset Ruleset { get; private set; } + + public Arena Arena { get; private set; } private bool CantDoAnything( Mobile mob ) { @@ -83,7 +77,7 @@ namespace Server.Engines.ConPVP public bool InstAllowSpecialMove( Mobile from, string name, SpecialMove move ) { - if ( !m_StartedBeginCountdown ) + if ( !StartedBeginCountdown ) return true; DuelPlayer pl = Find( from ); @@ -102,7 +96,7 @@ namespace Server.Engines.ConPVP title = "Ninjitsu"; - if ( title == null || name == null || m_Ruleset.GetOption( title, name ) ) + if ( title == null || name == null || Ruleset.GetOption( title, name ) ) return true; from.SendMessage( "The dueling ruleset prevents you from using this move." ); @@ -111,7 +105,7 @@ namespace Server.Engines.ConPVP public bool AllowSpellCast( Mobile from, Spell spell ) { - if ( !m_StartedBeginCountdown ) + if ( !StartedBeginCountdown ) return true; DuelPlayer pl = Find( from ); @@ -174,7 +168,7 @@ namespace Server.Engines.ConPVP option = spell.Name; } - if ( title == null || option == null || m_Ruleset.GetOption( title, option ) ) + if ( title == null || option == null || Ruleset.GetOption( title, option ) ) return true; from.SendMessage( "The dueling ruleset prevents you from casting this spell." ); @@ -183,7 +177,7 @@ namespace Server.Engines.ConPVP public bool AllowItemEquip( Mobile from, Item item ) { - if ( !m_StartedBeginCountdown ) + if ( !StartedBeginCountdown ) return true; DuelPlayer pl = Find( from ); @@ -211,7 +205,7 @@ namespace Server.Engines.ConPVP public bool InstAllowSpecialAbility( Mobile from, string name, bool message ) { - if ( !m_StartedBeginCountdown ) + if ( !StartedBeginCountdown ) return true; DuelPlayer pl = Find( from ); @@ -222,7 +216,7 @@ namespace Server.Engines.ConPVP if ( CantDoAnything( from ) ) return false; - if ( m_Ruleset.GetOption( "Combat Abilities", name ) ) + if ( Ruleset.GetOption( "Combat Abilities", name ) ) return true; if ( message ) @@ -235,38 +229,38 @@ namespace Server.Engines.ConPVP { if ( item is Fists ) { - if ( !m_Ruleset.GetOption( "Weapons", "Wrestling" ) ) + if ( !Ruleset.GetOption( "Weapons", "Wrestling" ) ) return false; } else if ( item is BaseArmor armor ) { - if ( armor.ProtectionLevel > ArmorProtectionLevel.Regular && !m_Ruleset.GetOption( "Armor", "Magical" ) ) + if ( armor.ProtectionLevel > ArmorProtectionLevel.Regular && !Ruleset.GetOption( "Armor", "Magical" ) ) return false; - if ( !Core.AOS && armor.Resource != armor.DefaultResource && !m_Ruleset.GetOption( "Armor", "Colored" ) ) + if ( !Core.AOS && armor.Resource != armor.DefaultResource && !Ruleset.GetOption( "Armor", "Colored" ) ) return false; - if ( armor is BaseShield && !m_Ruleset.GetOption( "Armor", "Shields" ) ) + if ( armor is BaseShield && !Ruleset.GetOption( "Armor", "Shields" ) ) return false; } else if ( item is BaseWeapon weapon ) { - if ( (weapon.DamageLevel > WeaponDamageLevel.Regular || weapon.AccuracyLevel > WeaponAccuracyLevel.Regular) && !m_Ruleset.GetOption( "Weapons", "Magical" ) ) + if ( (weapon.DamageLevel > WeaponDamageLevel.Regular || weapon.AccuracyLevel > WeaponAccuracyLevel.Regular) && !Ruleset.GetOption( "Weapons", "Magical" ) ) return false; - if ( !Core.AOS && weapon.Resource != CraftResource.Iron && weapon.Resource != CraftResource.None && !m_Ruleset.GetOption( "Weapons", "Runics" ) ) + if ( !Core.AOS && weapon.Resource != CraftResource.Iron && weapon.Resource != CraftResource.None && !Ruleset.GetOption( "Weapons", "Runics" ) ) return false; - if ( weapon is BaseRanged && !m_Ruleset.GetOption( "Weapons", "Ranged" ) ) + if ( weapon is BaseRanged && !Ruleset.GetOption( "Weapons", "Ranged" ) ) return false; - if ( !(weapon is BaseRanged) && !m_Ruleset.GetOption( "Weapons", "Melee" ) ) + if ( !(weapon is BaseRanged) && !Ruleset.GetOption( "Weapons", "Melee" ) ) return false; - if ( weapon.PoisonCharges > 0 && weapon.Poison != null && !m_Ruleset.GetOption( "Weapons", "Poisoned" ) ) + if ( weapon.PoisonCharges > 0 && weapon.Poison != null && !Ruleset.GetOption( "Weapons", "Poisoned" ) ) return false; - if ( weapon is BaseWand && !m_Ruleset.GetOption( "Items", "Wands" ) ) + if ( weapon is BaseWand && !Ruleset.GetOption( "Items", "Wands" ) ) return false; } @@ -275,7 +269,7 @@ namespace Server.Engines.ConPVP public bool AllowSkillUse( Mobile from, SkillName skill ) { - if ( !m_StartedBeginCountdown ) + if ( !StartedBeginCountdown ) return true; DuelPlayer pl = Find( from ); @@ -290,7 +284,7 @@ namespace Server.Engines.ConPVP if ( id >= 0 && id < SkillInfo.Table.Length ) { - if ( m_Ruleset.GetOption( "Skills", SkillInfo.Table[id].Name ) ) + if ( Ruleset.GetOption( "Skills", SkillInfo.Table[id].Name ) ) return true; } @@ -300,7 +294,7 @@ namespace Server.Engines.ConPVP public bool AllowItemUse( Mobile from, Item item ) { - if ( !m_StartedBeginCountdown ) + if ( !StartedBeginCountdown ) return true; DuelPlayer pl = Find( from ); @@ -386,7 +380,7 @@ namespace Server.Engines.ConPVP option = "Wands"; } - if ( title != null && option != null && m_StartedBeginCountdown && !m_Started ) + if ( title != null && option != null && StartedBeginCountdown && !Started ) { from.SendMessage( "You may not use this item before the duel begins." ); return false; @@ -402,7 +396,7 @@ namespace Server.Engines.ConPVP return false; } - if ( title == null || option == null || m_Ruleset.GetOption( title, option ) ) + if ( title == null || option == null || Ruleset.GetOption( title, option ) ) return true; from.SendMessage( "The dueling ruleset prevents you from using this item." ); @@ -430,10 +424,10 @@ namespace Server.Engines.ConPVP public void OnLocationChanged( Mobile mob ) { - if ( !m_Registered || !m_StartedBeginCountdown || m_Finished ) + if ( !Registered || !StartedBeginCountdown || Finished ) return; - Arena arena = m_Arena; + Arena arena = Arena; if ( arena == null ) return; @@ -472,7 +466,7 @@ namespace Server.Engines.ConPVP public void OnDeath( Mobile mob, Container corpse ) { - if ( !m_Registered || !m_Started ) + if ( !Registered || !Started ) return; DuelPlayer pl = Find( mob ); @@ -506,9 +500,9 @@ namespace Server.Engines.ConPVP public bool CheckFull() { - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; if ( p.HasOpenSlot ) return false; @@ -596,11 +590,11 @@ namespace Server.Engines.ConPVP public void SendOutside( Mobile mob ) { - if ( m_Arena == null ) + if ( Arena == null ) return; mob.Combatant = null; - mob.MoveToWorld( m_Arena.Outside, m_Arena.Facet ); + mob.MoveToWorld( Arena.Outside, Arena.Facet ); } private Point3D m_GatePoint; @@ -608,13 +602,13 @@ namespace Server.Engines.ConPVP public void Finish( Participant winner ) { - if ( m_Finished ) + if ( Finished ) return; EndAutoTie(); StopSDTimers(); - m_Finished = true; + Finished = true; for ( int i = 0; i < winner.Players.Length; ++i ) { @@ -630,12 +624,12 @@ namespace Server.Engines.ConPVP { m_Match.Winner = winner.TournyPart; winner.TournyPart.WonMatch( m_Match ); - m_Tournament.HandleWon( m_Arena, m_Match, winner.TournyPart ); + m_Tournament.HandleWon( Arena, m_Match, winner.TournyPart ); } - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant loser = (Participant)m_Participants[i]; + Participant loser = (Participant)Participants[i]; if ( loser != winner ) { @@ -661,8 +655,8 @@ namespace Server.Engines.ConPVP if ( IsOneVsOne ) { - DuelPlayer dp1 = ((Participant)m_Participants[0]).Players[0]; - DuelPlayer dp2 = ((Participant)m_Participants[1]).Players[0]; + DuelPlayer dp1 = ((Participant)Participants[0]).Players[0]; + DuelPlayer dp2 = ((Participant)Participants[1]).Players[0]; if ( dp1 != null && dp2 != null ) { @@ -678,7 +672,7 @@ namespace Server.Engines.ConPVP public void Award( Mobile us, Mobile them, bool won ) { - Ladder ladder = ( m_Arena == null ? Ladder.Instance : m_Arena.AcquireLadder() ); + Ladder ladder = ( Arena == null ? Ladder.Instance : Arena.AcquireLadder() ); if ( ladder == null ) return; @@ -733,20 +727,20 @@ namespace Server.Engines.ConPVP { DestroyWall(); - if ( !m_Registered ) + if ( !Registered ) return; - m_Registered = false; + Registered = false; - m_Arena?.Evict(); + Arena?.Evict(); StopSDTimers(); Type[] types = { typeof( BeginGump ), typeof( DuelContextGump ), typeof( ParticipantGump ), typeof( PickRulesetGump ), typeof( ReadyGump ), typeof( ReadyUpGump ), typeof( RulesetGump ) }; - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -769,16 +763,16 @@ namespace Server.Engines.ConPVP public void QueryRematch() { - DuelContext dc = new DuelContext( m_Initiator, m_Ruleset.Layout, false ); + DuelContext dc = new DuelContext( Initiator, Ruleset.Layout, false ); - dc.m_Ruleset = m_Ruleset; - dc.m_Rematch = true; + dc.Ruleset = Ruleset; + dc.Rematch = true; - dc.m_Participants.Clear(); + dc.Participants.Clear(); - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant oldPart = (Participant)m_Participants[i]; + Participant oldPart = (Participant)Participants[i]; Participant newPart = new Participant( dc, oldPart.Players.Length ); for ( int j = 0; j < oldPart.Players.Length; ++j ) @@ -789,7 +783,7 @@ namespace Server.Engines.ConPVP newPart.Players[j] = new DuelPlayer( oldPlayer.Mobile, newPart ); } - dc.m_Participants.Add( newPart ); + dc.Participants.Add( newPart ); } dc.CloseAllGumps(); @@ -806,9 +800,9 @@ namespace Server.Engines.ConPVP return null; } - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; DuelPlayer pl = p.Find( mob ); if ( pl != null ) @@ -833,15 +827,15 @@ namespace Server.Engines.ConPVP bool hasWinner = false; int eliminated = 0; - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; if ( p.Eliminated ) { ++eliminated; - if ( eliminated == (m_Participants.Count - 1) ) + if ( eliminated == (Participants.Count - 1) ) hasWinner = true; } else @@ -851,7 +845,7 @@ namespace Server.Engines.ConPVP } if ( hasWinner ) - return winner ?? (Participant) m_Participants[0]; + return winner ?? (Participant) Participants[0]; return null; } @@ -891,15 +885,10 @@ namespace Server.Engines.ConPVP } private Timer m_AutoTieTimer; - private bool m_Tied; - public bool Tied => m_Tied; + public bool Tied { get; private set; } - private bool m_IsSuddenDeath; - - public bool IsSuddenDeath{ get => m_IsSuddenDeath; - set => m_IsSuddenDeath = value; - } + public bool IsSuddenDeath { get; set; } private Timer m_SDWarnTimer, m_SDActivateTimer; @@ -927,9 +916,9 @@ namespace Server.Engines.ConPVP public void WarnSuddenDeath() { - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -944,7 +933,7 @@ namespace Server.Engines.ConPVP } } - m_Tournament?.Alert( m_Arena, "Sudden death will be active soon!" ); + m_Tournament?.Alert( Arena, "Sudden death will be active soon!" ); m_SDWarnTimer?.Stop(); @@ -958,9 +947,9 @@ namespace Server.Engines.ConPVP public void ActivateSuddenDeath() { - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -975,9 +964,9 @@ namespace Server.Engines.ConPVP } } - m_Tournament?.Alert( m_Arena, "Sudden death has been activated!" ); + m_Tournament?.Alert( Arena, "Sudden death has been activated!" ); - m_IsSuddenDeath = true; + IsSuddenDeath = true; m_SDActivateTimer?.Stop(); @@ -1006,19 +995,19 @@ namespace Server.Engines.ConPVP { m_AutoTieTimer = null; - if ( !m_Started || m_Finished ) + if ( !Started || Finished ) return; - m_Tied = true; - m_Finished = true; + Tied = true; + Finished = true; StopSDTimers(); ArrayList remaining = new ArrayList(); - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; if ( p.Eliminated ) { @@ -1052,7 +1041,7 @@ namespace Server.Engines.ConPVP } } - m_Tournament?.HandleTie( m_Arena, m_Match, remaining ); + m_Tournament?.HandleTie( Arena, m_Match, remaining ); Timer.DelayCall( TimeSpan.FromSeconds( 10.0 ), Unregister ); } @@ -1061,13 +1050,13 @@ namespace Server.Engines.ConPVP { get { - if ( m_Participants.Count != 2 ) + if ( Participants.Count != 2 ) return false; - if ( ((Participant)m_Participants[0]).Players.Length != 1 ) + if ( ((Participant)Participants[0]).Players.Length != 1 ) return false; - if ( ((Participant)m_Participants[1]).Players.Length != 1 ) + if ( ((Participant)Participants[1]).Players.Length != 1 ) return false; return true; @@ -1140,7 +1129,7 @@ namespace Server.Engines.ConPVP if ( dc.ReadyWait && pm.DuelPlayer.Ready && !dc.Started && !dc.StartedBeginCountdown && !dc.Finished ) { if ( dc.m_Tournament == null ) - pm.SendGump( new ReadyGump( pm, dc, dc.m_ReadyCount ) ); + pm.SendGump( new ReadyGump( pm, dc, dc.ReadyCount ) ); } else if ( dc.ReadyWait && !dc.StartedBeginCountdown && !dc.Started && !dc.Finished ) { @@ -1362,7 +1351,7 @@ namespace Server.Engines.ConPVP { dc.Unregister(); } - else if ( dc.m_Registered ) + else if ( dc.Registered ) { p.Nullify( pl ); pm.DuelPlayer=null; @@ -1400,7 +1389,7 @@ namespace Server.Engines.ConPVP pm.DuelContext.m_Countdown?.Stop(); pm.DuelContext.m_Countdown = null; - pm.DuelContext.m_StartedReadyCountdown=false; + pm.DuelContext.StartedReadyCountdown=false; p.Broadcast( 0x22, null, "{0} has yielded.", "You have yielded." ); dc.m_Yielding=true; @@ -1411,7 +1400,7 @@ namespace Server.Engines.ConPVP { dc.Unregister(); } - else if ( dc.m_Registered ) + else if ( dc.Registered ) { p.Nullify( pl ); pm.DuelPlayer=null; @@ -1500,17 +1489,17 @@ namespace Server.Engines.ConPVP public DuelContext( Mobile initiator, RulesetLayout layout, bool addNew ) { - m_Initiator = initiator; - m_Participants = new ArrayList(); - m_Ruleset = new Ruleset( layout ); - m_Ruleset.ApplyDefault( layout.Defaults[0] ); + Initiator = initiator; + Participants = new ArrayList(); + Ruleset = new Ruleset( layout ); + Ruleset.ApplyDefault( layout.Defaults[0] ); if ( addNew ) { - m_Participants.Add( new Participant( this, 1 ) ); - m_Participants.Add( new Participant( this, 1 ) ); + Participants.Add( new Participant( this, 1 ) ); + Participants.Add( new Participant( this, 1 ) ); - ((Participant)m_Participants[0]).Add( initiator ); + ((Participant)Participants[0]).Add( initiator ); } } @@ -1519,9 +1508,9 @@ namespace Server.Engines.ConPVP Type[] types = { typeof( DuelContextGump ), typeof( ParticipantGump ), typeof( RulesetGump ) }; int[] defs = { -1, -1, -1 }; - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -1541,15 +1530,15 @@ namespace Server.Engines.ConPVP public void RejectReady( Mobile rejector, string page ) { - if ( m_StartedReadyCountdown ) + if ( StartedReadyCountdown ) return; // sanity Type[] types = { typeof( DuelContextGump ), typeof( ReadyUpGump ), typeof( ReadyGump ) }; int[] defs = { -1, -1, -1 }; - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -1570,9 +1559,9 @@ namespace Server.Engines.ConPVP else { if ( mob == rejector ) - mob.SendMessage( 0x22, "You have rejected the {0}.", m_Rematch ? "rematch" : page ); + mob.SendMessage( 0x22, "You have rejected the {0}.", Rematch ? "rematch" : page ); else - mob.SendMessage( 0x22, "{0} has rejected the {1}.", rejector.Name, m_Rematch ? "rematch" : page ); + mob.SendMessage( 0x22, "{0} has rejected the {1}.", rejector.Name, Rematch ? "rematch" : page ); } for ( int k = 0; k < types.Length; ++k ) @@ -1581,13 +1570,13 @@ namespace Server.Engines.ConPVP } } - if ( m_Rematch ) + if ( Rematch ) Unregister(); else if ( !m_Yielding ) - m_Initiator.SendGump( new DuelContextGump( m_Initiator, this ) ); + Initiator.SendGump( new DuelContextGump( Initiator, this ) ); - m_ReadyWait = false; - m_ReadyCount = 0; + ReadyWait = false; + ReadyCount = 0; } public void SendReadyGump() @@ -1651,11 +1640,9 @@ namespace Server.Engines.ConPVP Targeting.Target.Cancel( mob ); } - private bool m_StartedBeginCountdown; - private bool m_StartedReadyCountdown; + public bool StartedBeginCountdown { get; private set; } - public bool StartedBeginCountdown => m_StartedBeginCountdown; - public bool StartedReadyCountdown => m_StartedReadyCountdown; + public bool StartedReadyCountdown { get; private set; } private class InternalWall : Item { @@ -1704,11 +1691,11 @@ namespace Server.Engines.ConPVP public void CreateWall() { - if ( m_Arena == null ) + if ( Arena == null ) return; - Point3D start = m_Arena.Points.EdgeWest; - Point3D wall = m_Arena.Wall; + Point3D start = Arena.Points.EdgeWest; + Point3D wall = Arena.Wall; int dx = start.X - wall.X; int dy = start.Y - wall.Y; @@ -1726,7 +1713,7 @@ namespace Server.Engines.ConPVP else eastToWest = false; - Effects.PlaySound( wall, m_Arena.Facet, 0x1F6 ); + Effects.PlaySound( wall, Arena.Facet, 0x1F6 ); for ( int i = -1; i <= 1; ++i ) { @@ -1734,7 +1721,7 @@ namespace Server.Engines.ConPVP InternalWall created = new InternalWall(); - created.Appear( loc, m_Arena.Facet ); + created.Appear( loc, Arena.Facet ); m_Walls.Add( created ); } @@ -1742,9 +1729,9 @@ namespace Server.Engines.ConPVP public void BuildParties() { - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; if ( p.Players.Length > 1 ) { @@ -1810,9 +1797,9 @@ namespace Server.Engines.ConPVP public void ClearIllegalItems() { - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -1877,11 +1864,11 @@ namespace Server.Engines.ConPVP } private void MessageRuleset( Mobile mob ) { - if ( m_Ruleset == null ) { + if ( Ruleset == null ) { return; } - Ruleset ruleset = m_Ruleset; + Ruleset ruleset = Ruleset; Ruleset basedef = ruleset.Base; mob.SendMessage( "Ruleset: {0}", basedef.Title ); @@ -1928,7 +1915,7 @@ namespace Server.Engines.ConPVP public void SendBeginGump( int count ) { - if ( !m_Registered || m_Finished ) + if ( !Registered || Finished ) return; if ( count == 10 ) @@ -1942,19 +1929,19 @@ namespace Server.Engines.ConPVP DestroyWall(); } - m_StartedBeginCountdown = true; + StartedBeginCountdown = true; if ( count == 0 ) { - m_Started = true; + Started = true; BeginAutoTie(); } Type[] types = { typeof( ReadyGump ), typeof( ReadyUpGump ), typeof( BeginGump ) }; - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -1985,44 +1972,43 @@ namespace Server.Engines.ConPVP private class ReturnEntry { - private Mobile m_Mobile; - private Point3D m_Location; - private Map m_Facet; private DateTime m_Expire; - public Mobile Mobile => m_Mobile; - public Point3D Location => m_Location; - public Map Facet => m_Facet; + public Mobile Mobile { get; } + + public Point3D Location { get; private set; } + + public Map Facet { get; private set; } public void Return() { - if ( m_Facet == Map.Internal || m_Facet == null ) + if ( Facet == Map.Internal || Facet == null ) return; - if ( m_Mobile.Map == Map.Internal ) + if ( Mobile.Map == Map.Internal ) { - m_Mobile.LogoutLocation = m_Location; - m_Mobile.LogoutMap = m_Facet; + Mobile.LogoutLocation = Location; + Mobile.LogoutMap = Facet; } else { - m_Mobile.Location = m_Location; - m_Mobile.Map = m_Facet; + Mobile.Location = Location; + Mobile.Map = Facet; } } public ReturnEntry( Mobile mob ) { - m_Mobile = mob; + Mobile = mob; Update(); } public ReturnEntry( Mobile mob, Point3D loc, Map facet ) { - m_Mobile = mob; - m_Location = loc; - m_Facet = facet; + Mobile = mob; + Location = loc; + Facet = facet; m_Expire = DateTime.UtcNow + TimeSpan.FromMinutes( 30.0 ); } @@ -2032,15 +2018,15 @@ namespace Server.Engines.ConPVP { m_Expire = DateTime.UtcNow + TimeSpan.FromMinutes( 30.0 ); - if ( m_Mobile.Map == Map.Internal ) + if ( Mobile.Map == Map.Internal ) { - m_Facet = m_Mobile.LogoutMap; - m_Location = m_Mobile.LogoutLocation; + Facet = Mobile.LogoutMap; + Location = Mobile.LogoutLocation; } else { - m_Facet = m_Mobile.Map; - m_Location = m_Mobile.Location; + Facet = Mobile.Map; + Location = Mobile.Location; } } } @@ -2243,9 +2229,9 @@ namespace Server.Engines.ConPVP public void RemoveAggressions( Mobile mob ) { - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -2264,17 +2250,17 @@ namespace Server.Engines.ConPVP public void SendReadyUpGump() { - if ( !m_Registered ) + if ( !Registered ) return; - m_ReadyWait = true; - m_ReadyCount = -1; + ReadyWait = true; + ReadyCount = -1; Type[] types = { typeof( ReadyUpGump ) }; - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -2296,9 +2282,9 @@ namespace Server.Engines.ConPVP if ( m_Tournament == null && TournamentController.IsActive ) return "a tournament is active"; - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -2347,13 +2333,13 @@ namespace Server.Engines.ConPVP public void SendReadyGump( int count ) { - if ( !m_Registered ) + if ( !Registered ) return; if ( count != -1 ) - m_StartedReadyCountdown = true; + StartedReadyCountdown = true; - m_ReadyCount = count; + ReadyCount = count; if ( count == 0 ) { @@ -2361,9 +2347,9 @@ namespace Server.Engines.ConPVP if ( error != null ) { - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -2378,13 +2364,13 @@ namespace Server.Engines.ConPVP return; } - m_ReadyWait = false; + ReadyWait = false; List players = new List(); - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -2402,9 +2388,9 @@ namespace Server.Engines.ConPVP if ( arena == null ) { - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -2420,17 +2406,17 @@ namespace Server.Engines.ConPVP if ( !arena.IsOccupied ) { - m_Arena = arena; + Arena = arena; - if ( m_Initiator.Map == Map.Internal ) + if ( Initiator.Map == Map.Internal ) { - m_GatePoint = m_Initiator.LogoutLocation; - m_GateFacet = m_Initiator.LogoutMap; + m_GatePoint = Initiator.LogoutLocation; + m_GateFacet = Initiator.LogoutMap; } else { - m_GatePoint = m_Initiator.Location; - m_GateFacet = m_Initiator.Map; + m_GatePoint = Initiator.Location; + m_GateFacet = Initiator.Map; } if ( !(arena.Teleporter is ExitTeleporter tp) ) @@ -2441,11 +2427,11 @@ namespace Server.Engines.ConPVP ArenaMoongate mg = new ArenaMoongate( arena.GateIn == Point3D.Zero ? arena.Outside : arena.GateIn, arena.Facet, tp ); - m_StartedBeginCountdown = true; + StartedBeginCountdown = true; - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -2476,9 +2462,9 @@ namespace Server.Engines.ConPVP } else { - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { @@ -2494,15 +2480,15 @@ namespace Server.Engines.ConPVP return; } - m_ReadyWait = true; + ReadyWait = true; bool isAllReady = true; Type[] types = { typeof( ReadyGump ) }; - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - Participant p = (Participant)m_Participants[i]; + Participant p = (Participant)Participants[i]; for ( int j = 0; j < p.Players.Length; ++j ) { diff --git a/Scripts/Engines/ConPVP/DuelContextGump.cs b/Scripts/Engines/ConPVP/DuelContextGump.cs index cdc747a4b..f6cb72431 100644 --- a/Scripts/Engines/ConPVP/DuelContextGump.cs +++ b/Scripts/Engines/ConPVP/DuelContextGump.cs @@ -6,11 +6,9 @@ namespace Server.Engines.ConPVP { public class DuelContextGump : Gump { - private Mobile m_From; - private DuelContext m_Context; + public Mobile From { get; } - public Mobile From => m_From; - public DuelContext Context => m_Context; + public DuelContext Context { get; } public string Center( string text ) { @@ -31,8 +29,8 @@ namespace Server.Engines.ConPVP public DuelContextGump( Mobile from, DuelContext context ) : base( 50, 50 ) { - m_From = from; - m_Context = context; + From = from; + Context = context; from.CloseGump( typeof( RulesetGump ) ); from.CloseGump( typeof( DuelContextGump ) ); @@ -71,7 +69,7 @@ namespace Server.Engines.ConPVP public override void OnResponse( NetState sender, RelayInfo info ) { - if ( !m_Context.Registered ) + if ( !Context.Registered ) return; int index = info.ButtonID; @@ -84,39 +82,39 @@ namespace Server.Engines.ConPVP } case 0: // closed { - m_Context.Unregister(); + Context.Unregister(); break; } case 1: // Rules { //m_From.SendGump( new RulesetGump( m_From, m_Context.Ruleset, m_Context.Ruleset.Layout, m_Context ) ); - m_From.SendGump( new PickRulesetGump( m_From, m_Context, m_Context.Ruleset ) ); + From.SendGump( new PickRulesetGump( From, Context, Context.Ruleset ) ); break; } case 2: // Start { - if ( m_Context.CheckFull() ) + if ( Context.CheckFull() ) { - m_Context.CloseAllGumps(); - m_Context.SendReadyUpGump(); + Context.CloseAllGumps(); + Context.SendReadyUpGump(); //m_Context.SendReadyGump(); } else { - m_From.SendMessage( "You cannot start the duel before all participating players have been assigned." ); - m_From.SendGump( new DuelContextGump( m_From, m_Context ) ); + From.SendMessage( "You cannot start the duel before all participating players have been assigned." ); + From.SendGump( new DuelContextGump( From, Context ) ); } break; } case 3: // New Participant { - if ( m_Context.Participants.Count < 10 ) - m_Context.Participants.Add( new Participant( m_Context, 1 ) ); + if ( Context.Participants.Count < 10 ) + Context.Participants.Add( new Participant( Context, 1 ) ); else - m_From.SendMessage( "The number of participating parties may not be increased further." ); + From.SendMessage( "The number of participating parties may not be increased further." ); - m_From.SendGump( new DuelContextGump( m_From, m_Context ) ); + From.SendGump( new DuelContextGump( From, Context ) ); break; } @@ -124,8 +122,8 @@ namespace Server.Engines.ConPVP { index -= 4; - if ( index >= 0 && index < m_Context.Participants.Count ) - m_From.SendGump( new ParticipantGump( m_From, m_Context, (Participant)m_Context.Participants[index] ) ); + if ( index >= 0 && index < Context.Participants.Count ) + From.SendGump( new ParticipantGump( From, Context, (Participant)Context.Participants[index] ) ); break; } diff --git a/Scripts/Engines/ConPVP/Games/BombingRun.cs b/Scripts/Engines/ConPVP/Games/BombingRun.cs index 68a098903..7b58342ae 100644 --- a/Scripts/Engines/ConPVP/Games/BombingRun.cs +++ b/Scripts/Engines/ConPVP/Games/BombingRun.cs @@ -15,7 +15,6 @@ namespace Server.Engines.ConPVP public override string DefaultName => "da bomb"; private BRGame m_Game; - private Mobile m_Thrower; private EffectTimer m_Timer; private bool m_Flying; @@ -287,7 +286,7 @@ namespace Server.Engines.ConPVP m_Flying = true; Visible = false; - m_Thrower = from; + Thrower = from; MoveToWorld( GetWorldLocation(), from.Map ); BeginFlight( pt ); @@ -348,7 +347,7 @@ namespace Server.Engines.ConPVP string verb = "caught"; - if ( m_Thrower != null && m_Game.GetTeamInfo( m_Thrower ) != useTeam ) + if ( Thrower != null && m_Game.GetTeamInfo( Thrower ) != useTeam ) verb = "intercepted"; if ( !TakeBomb( m, useTeam, verb ) ) @@ -607,7 +606,7 @@ namespace Server.Engines.ConPVP if ( i is BRGoal goal ) { Point3D oldLoc = new Point3D( GetWorldLocation() ); - if ( CheckScore( goal, m_Thrower, 3 ) ) + if ( CheckScore( goal, Thrower, 3 ) ) DoAnim( oldLoc, point, Map ); else HitObject( point, loc.Z, height ); @@ -626,7 +625,7 @@ namespace Server.Engines.ConPVP { Mobile m = ns.Mobile; - if ( m == null || m == m_Thrower ) + if ( m == null || m == Thrower ) continue; Point3D point; @@ -705,7 +704,7 @@ namespace Server.Engines.ConPVP } } - public Mobile Thrower => m_Thrower; + public Mobile Thrower { get; private set; } public bool CheckScore( BRGoal goal, Mobile m, int points ) { @@ -1165,14 +1164,12 @@ namespace Server.Engines.ConPVP { private BRTeamInfo m_TeamInfo; - private Mobile m_Player; - private int m_Kills; private int m_Captures; private int m_Score; - public Mobile Player => m_Player; + public Mobile Player { get; } public int CompareTo( object obj ) { @@ -1188,7 +1185,7 @@ namespace Server.Engines.ConPVP return res; } - public string Name => m_Player.Name; + public string Name => Player.Name; public int Kills { @@ -1226,29 +1223,15 @@ namespace Server.Engines.ConPVP public BRPlayerInfo( BRTeamInfo teamInfo, Mobile player ) { m_TeamInfo = teamInfo; - m_Player = player; + Player = player; } } [PropertyObject] public sealed class BRTeamInfo : IRankedCTF, IComparable { - private BRGame m_Game; - private int m_TeamID; - - private int m_Color; - private string m_Name; - - private BRBoard m_Board; private BRGoal m_Goal; - private int m_Kills; - private int m_Captures; - - private int m_Score; - - private Hashtable m_Players; - public int CompareTo( object obj ) { BRTeamInfo ti = (BRTeamInfo)obj; @@ -1263,40 +1246,24 @@ namespace Server.Engines.ConPVP return res; } - public string Name => $"{m_Name} Team"; + public string Name => $"{TeamName} Team"; - public BRGame Game { get => m_Game; - set => m_Game = value; - } - public int TeamID => m_TeamID; + public BRGame Game { get; set; } - public int Kills { get => m_Kills; - set => m_Kills = value; - } - public int Captures { get => m_Captures; - set => m_Captures = value; - } + public int TeamID { get; } - public int Score { get => m_Score; - set => m_Score = value; - } + public int Kills { get; set; } - private BRPlayerInfo m_Leader; + public int Captures { get; set; } - public BRPlayerInfo Leader - { - get => m_Leader; - set => m_Leader = value; - } + public int Score { get; set; } + + public BRPlayerInfo Leader { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public BRBoard Board - { - get => m_Board; - set => m_Board = value; - } + public BRBoard Board { get; set; } - public Hashtable Players => m_Players; + public Hashtable Players { get; } public BRPlayerInfo this[Mobile mob] { @@ -1305,26 +1272,18 @@ namespace Server.Engines.ConPVP if ( mob == null ) return null; - if ( !(m_Players[mob] is BRPlayerInfo val) ) - m_Players[mob] = val = new BRPlayerInfo( this, mob ); + if ( !(Players[mob] is BRPlayerInfo val) ) + Players[mob] = val = new BRPlayerInfo( this, mob ); return val; } } [CommandProperty( AccessLevel.GameMaster )] - public int Color - { - get => m_Color; - set => m_Color = value; - } + public int Color { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public string TeamName - { - get => m_Name; - set => m_Name = value; - } + public string TeamName { get; set; } [CommandProperty( AccessLevel.GameMaster )] public BRGoal Goal @@ -1340,30 +1299,30 @@ namespace Server.Engines.ConPVP public BRTeamInfo( int teamID ) { - m_TeamID = teamID; - m_Players = new Hashtable(); + TeamID = teamID; + Players = new Hashtable(); } public void Reset() { - m_Kills = 0; - m_Captures = 0; - m_Score = 0; + Kills = 0; + Captures = 0; + Score = 0; - m_Leader = null; + Leader = null; - m_Players.Clear(); + Players.Clear(); - if ( m_Board != null ) - m_Board.m_TeamInfo = this; + if ( Board != null ) + Board.m_TeamInfo = this; if ( m_Goal != null ) m_Goal.Team = this; } public BRTeamInfo( int teamID, GenericReader ip ) { - m_TeamID = teamID; - m_Players = new Hashtable(); + TeamID = teamID; + Players = new Hashtable(); int version = ip.ReadEncodedInt(); @@ -1371,9 +1330,9 @@ namespace Server.Engines.ConPVP { case 0: { - m_Board = ip.ReadItem() as BRBoard; - m_Name = ip.ReadString(); - m_Color = ip.ReadEncodedInt(); + Board = ip.ReadItem() as BRBoard; + TeamName = ip.ReadString(); + Color = ip.ReadEncodedInt(); m_Goal = ip.ReadItem() as BRGoal; break; } @@ -1384,18 +1343,18 @@ namespace Server.Engines.ConPVP { op.WriteEncodedInt( 0 ); // version - op.Write( m_Board ); + op.Write( Board ); - op.Write( m_Name ); + op.Write( TeamName ); - op.WriteEncodedInt( m_Color ); + op.WriteEncodedInt( Color ); op.Write( m_Goal ); } public override string ToString() { - if ( m_Name != null ) + if ( TeamName != null ) return $"({Name}) ..."; return "..."; } @@ -1403,48 +1362,36 @@ namespace Server.Engines.ConPVP public sealed class BRController : EventController { - private BRTeamInfo[] m_TeamInfo; - private TimeSpan m_Duration; - private Point3D m_BombHome; - - public BRTeamInfo[] TeamInfo => m_TeamInfo; + public BRTeamInfo[] TeamInfo { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public BRTeamInfo Team1 { get => m_TeamInfo[0]; + public BRTeamInfo Team1 { get => TeamInfo[0]; set { } } [CommandProperty( AccessLevel.GameMaster )] - public BRTeamInfo Team2 { get => m_TeamInfo[1]; + public BRTeamInfo Team2 { get => TeamInfo[1]; set { } } [CommandProperty( AccessLevel.GameMaster )] - public BRTeamInfo Team3 { get => m_TeamInfo[2]; + public BRTeamInfo Team3 { get => TeamInfo[2]; set { } } [CommandProperty( AccessLevel.GameMaster )] - public BRTeamInfo Team4 { get => m_TeamInfo[3]; + public BRTeamInfo Team4 { get => TeamInfo[3]; set { } } [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan Duration - { - get => m_Duration; - set => m_Duration = value; - } + public TimeSpan Duration { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D BombHome - { - get => m_BombHome; - set => m_BombHome = value; - } + public Point3D BombHome { get; set; } public override string Title => "Bombing Run"; public override string DefaultName => "Bombing Run Controller"; public override string GetTeamName( int teamID ) { - return m_TeamInfo[teamID % m_TeamInfo.Length].Name; + return TeamInfo[teamID % TeamInfo.Length].Name; } public override EventGame Construct( DuelContext context ) @@ -1458,14 +1405,14 @@ namespace Server.Engines.ConPVP Visible = false; Movable = false; - m_Duration = TimeSpan.FromMinutes( 30.0 ); + Duration = TimeSpan.FromMinutes( 30.0 ); - m_BombHome = Point3D.Zero; + BombHome = Point3D.Zero; - m_TeamInfo = new BRTeamInfo[4]; + TeamInfo = new BRTeamInfo[4]; - for ( int i = 0; i < m_TeamInfo.Length; ++i ) - m_TeamInfo[i] = new BRTeamInfo( i ); + for ( int i = 0; i < TeamInfo.Length; ++i ) + TeamInfo[i] = new BRTeamInfo( i ); } public BRController( Serial serial ) @@ -1479,14 +1426,14 @@ namespace Server.Engines.ConPVP writer.Write( (int) 0 ); - writer.Write( m_BombHome ); + writer.Write( BombHome ); - writer.Write( m_Duration ); + writer.Write( Duration ); - writer.WriteEncodedInt( m_TeamInfo.Length ); + writer.WriteEncodedInt( TeamInfo.Length ); - for ( int i = 0; i < m_TeamInfo.Length; ++i ) - m_TeamInfo[i].Serialize( writer ); + for ( int i = 0; i < TeamInfo.Length; ++i ) + TeamInfo[i].Serialize( writer ); } public override void Deserialize( GenericReader reader ) @@ -1499,14 +1446,14 @@ namespace Server.Engines.ConPVP { case 0: { - m_BombHome = reader.ReadPoint3D(); + BombHome = reader.ReadPoint3D(); - m_Duration = reader.ReadTimeSpan(); + Duration = reader.ReadTimeSpan(); - m_TeamInfo = new BRTeamInfo[reader.ReadEncodedInt()]; + TeamInfo = new BRTeamInfo[reader.ReadEncodedInt()]; - for ( int i = 0; i < m_TeamInfo.Length; ++i ) - m_TeamInfo[i] = new BRTeamInfo( i, reader ); + for ( int i = 0; i < TeamInfo.Length; ++i ) + TeamInfo[i] = new BRTeamInfo( i, reader ); break; } @@ -1535,12 +1482,12 @@ namespace Server.Engines.ConPVP public void ReturnBomb() { - if ( m_Bomb != null && m_Controller != null ) + if ( m_Bomb != null && Controller != null ) { if ( m_UnhideCallback == null ) m_UnhideCallback = UnhideBomb; m_Bomb.Visible = false; - m_Bomb.MoveToWorld( m_Controller.BombHome, m_Controller.Map ); + m_Bomb.MoveToWorld( Controller.BombHome, Controller.Map ); Timer.DelayCall( TimeSpan.FromSeconds( Utility.RandomMinMax( 5, 15 ) ), m_UnhideCallback ); } } @@ -1554,9 +1501,7 @@ namespace Server.Engines.ConPVP } } - private BRController m_Controller; - - public BRController Controller => m_Controller; + public BRController Controller { get; } public void Alert( string text ) { @@ -1581,7 +1526,7 @@ namespace Server.Engines.ConPVP public BRGame( BRController controller, DuelContext context ) : base( context ) { - m_Controller = controller; + Controller = controller; } public Map Facet @@ -1591,7 +1536,7 @@ namespace Server.Engines.ConPVP if ( m_Context.Arena != null ) return m_Context.Arena.Facet; - return m_Controller.Map; + return Controller.Map; } } @@ -1600,7 +1545,7 @@ namespace Server.Engines.ConPVP int teamID = GetTeamID( mob ); if ( teamID >= 0 ) - return m_Controller.TeamInfo[teamID % m_Controller.TeamInfo.Length]; + return Controller.TeamInfo[teamID % Controller.TeamInfo.Length]; return null; } @@ -1718,23 +1663,23 @@ namespace Server.Engines.ConPVP public override void OnStart() { - for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i ) + for ( int i = 0; i < Controller.TeamInfo.Length; ++i ) { - BRTeamInfo teamInfo = m_Controller.TeamInfo[i]; + BRTeamInfo teamInfo = Controller.TeamInfo[i]; teamInfo.Game = this; teamInfo.Reset(); } for ( int i = 0; i < m_Context.Participants.Count; ++i ) - ApplyHues( m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length].Color ); + ApplyHues( m_Context.Participants[i] as Participant, Controller.TeamInfo[i % Controller.TeamInfo.Length].Color ); m_FinishTimer?.Stop(); m_Bomb = new BRBomb( this ); ReturnBomb(); - m_FinishTimer = Timer.DelayCall( m_Controller.Duration, Finish_Callback ); + m_FinishTimer = Timer.DelayCall( Controller.Duration, Finish_Callback ); } private void Finish_Callback() @@ -1743,7 +1688,7 @@ namespace Server.Engines.ConPVP for ( int i = 0; i < m_Context.Participants.Count; ++i ) { - BRTeamInfo teamInfo = m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length]; + BRTeamInfo teamInfo = Controller.TeamInfo[i % Controller.TeamInfo.Length]; if ( teamInfo == null ) continue; @@ -1787,8 +1732,8 @@ namespace Server.Engines.ConPVP } } - if ( m_Controller != null ) - sb.Append( ' ' ).Append( m_Controller.Title ); + if ( Controller != null ) + sb.Append( ' ' ).Append( Controller.Title ); string title = sb.ToString(); @@ -1899,9 +1844,9 @@ namespace Server.Engines.ConPVP public override void OnStop() { - for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i ) + for ( int i = 0; i < Controller.TeamInfo.Length; ++i ) { - BRTeamInfo teamInfo = m_Controller.TeamInfo[i]; + BRTeamInfo teamInfo = Controller.TeamInfo[i]; if ( teamInfo.Board != null ) teamInfo.Board.m_TeamInfo = null; diff --git a/Scripts/Engines/ConPVP/Games/CTF.cs b/Scripts/Engines/ConPVP/Games/CTF.cs index 881ee7b4b..46c588925 100644 --- a/Scripts/Engines/ConPVP/Games/CTF.cs +++ b/Scripts/Engines/ConPVP/Games/CTF.cs @@ -528,16 +528,14 @@ namespace Server.Engines.ConPVP { private CTFTeamInfo m_TeamInfo; - private Mobile m_Player; - private int m_Kills; private int m_Captures; private int m_Score; - public Mobile Player => m_Player; + public Mobile Player { get; } - string IRankedCTF.Name => m_Player.Name; + string IRankedCTF.Name => Player.Name; public int Kills { @@ -575,65 +573,31 @@ namespace Server.Engines.ConPVP public CTFPlayerInfo( CTFTeamInfo teamInfo, Mobile player ) { m_TeamInfo = teamInfo; - m_Player = player; + Player = player; } } [PropertyObject] public sealed class CTFTeamInfo : IRankedCTF { - private CTFGame m_Game; - private int m_TeamID; + string IRankedCTF.Name => $"{Name} Team"; - private int m_Color; - private string m_Name; + public CTFGame Game { get; set; } - private CTFBoard m_Board; + public int TeamID { get; } - private CTFFlag m_Flag; - private Point3D m_Origin; + public int Kills { get; set; } - private int m_Kills; - private int m_Captures; + public int Captures { get; set; } - private int m_Score; + public int Score { get; set; } - private Dictionary m_Players; - - string IRankedCTF.Name => $"{m_Name} Team"; - - public CTFGame Game { get => m_Game; - set => m_Game = value; - } - public int TeamID => m_TeamID; - - public int Kills { get => m_Kills; - set => m_Kills = value; - } - public int Captures { get => m_Captures; - set => m_Captures = value; - } - - public int Score { get => m_Score; - set => m_Score = value; - } - - private CTFPlayerInfo m_Leader; - - public CTFPlayerInfo Leader - { - get => m_Leader; - set => m_Leader = value; - } + public CTFPlayerInfo Leader { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public CTFBoard Board - { - get => m_Board; - set => m_Board = value; - } + public CTFBoard Board { get; set; } - public Dictionary Players => m_Players; + public Dictionary Players { get; } public CTFPlayerInfo this[Mobile mob] { @@ -642,73 +606,57 @@ namespace Server.Engines.ConPVP if ( mob == null ) return null; - if (!m_Players.TryGetValue( mob, out CTFPlayerInfo val )) - m_Players[mob] = val = new CTFPlayerInfo( this, mob ); + if (!Players.TryGetValue( mob, out CTFPlayerInfo val )) + Players[mob] = val = new CTFPlayerInfo( this, mob ); return val; } } [CommandProperty( AccessLevel.GameMaster )] - public int Color - { - get => m_Color; - set => m_Color = value; - } + public int Color { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public string Name - { - get => m_Name; - set => m_Name = value; - } + public string Name { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public CTFFlag Flag - { - get => m_Flag; - set => m_Flag = value; - } + public CTFFlag Flag { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D Origin - { - get => m_Origin; - set => m_Origin = value; - } + public Point3D Origin { get; set; } public CTFTeamInfo( int teamID ) { - m_TeamID = teamID; - m_Players = new Dictionary(); + TeamID = teamID; + Players = new Dictionary(); } public void Reset() { - m_Kills = 0; - m_Captures = 0; + Kills = 0; + Captures = 0; - m_Score = 0; + Score = 0; - m_Leader = null; + Leader = null; - m_Players.Clear(); + Players.Clear(); - if ( m_Flag != null ) + if ( Flag != null ) { - m_Flag.m_TeamInfo = this; - m_Flag.Hue = m_Color; - m_Flag.SendHome(); + Flag.m_TeamInfo = this; + Flag.Hue = Color; + Flag.SendHome(); } - if ( m_Board != null ) - m_Board.m_TeamInfo = this; + if ( Board != null ) + Board.m_TeamInfo = this; } public CTFTeamInfo( int teamID, GenericReader ip ) { - m_TeamID = teamID; - m_Players = new Dictionary(); + TeamID = teamID; + Players = new Dictionary(); int version = ip.ReadEncodedInt(); @@ -716,22 +664,22 @@ namespace Server.Engines.ConPVP { case 2: { - m_Board = ip.ReadItem() as CTFBoard; + Board = ip.ReadItem() as CTFBoard; goto case 1; } case 1: { - m_Name = ip.ReadString(); + Name = ip.ReadString(); goto case 0; } case 0: { - m_Color = ip.ReadEncodedInt(); + Color = ip.ReadEncodedInt(); - m_Flag = ip.ReadItem() as CTFFlag; - m_Origin = ip.ReadPoint3D(); + Flag = ip.ReadItem() as CTFFlag; + Origin = ip.ReadPoint3D(); break; } } @@ -741,14 +689,14 @@ namespace Server.Engines.ConPVP { op.WriteEncodedInt( 2 ); // version - op.Write( m_Board ); + op.Write( Board ); - op.Write( m_Name ); + op.Write( Name ); - op.WriteEncodedInt( m_Color ); + op.WriteEncodedInt( Color ); - op.Write( m_Flag ); - op.Write( m_Origin ); + op.Write( Flag ); + op.Write( Origin ); } public override string ToString() @@ -759,56 +707,48 @@ namespace Server.Engines.ConPVP public sealed class CTFController : EventController { - private CTFTeamInfo[] m_TeamInfo; - - private TimeSpan m_Duration; - - public CTFTeamInfo[] TeamInfo => m_TeamInfo; + public CTFTeamInfo[] TeamInfo { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public CTFTeamInfo Team1 { get => m_TeamInfo[0]; + public CTFTeamInfo Team1 { get => TeamInfo[0]; set { } } [CommandProperty( AccessLevel.GameMaster )] - public CTFTeamInfo Team2 { get => m_TeamInfo[1]; + public CTFTeamInfo Team2 { get => TeamInfo[1]; set { } } [CommandProperty( AccessLevel.GameMaster )] - public CTFTeamInfo Team3 { get => m_TeamInfo[2]; + public CTFTeamInfo Team3 { get => TeamInfo[2]; set { } } [CommandProperty( AccessLevel.GameMaster )] - public CTFTeamInfo Team4 { get => m_TeamInfo[3]; + public CTFTeamInfo Team4 { get => TeamInfo[3]; set { } } [CommandProperty( AccessLevel.GameMaster )] - public CTFTeamInfo Team5 { get => m_TeamInfo[4]; + public CTFTeamInfo Team5 { get => TeamInfo[4]; set { } } [CommandProperty( AccessLevel.GameMaster )] - public CTFTeamInfo Team6 { get => m_TeamInfo[5]; + public CTFTeamInfo Team6 { get => TeamInfo[5]; set { } } [CommandProperty( AccessLevel.GameMaster )] - public CTFTeamInfo Team7 { get => m_TeamInfo[6]; + public CTFTeamInfo Team7 { get => TeamInfo[6]; set { } } [CommandProperty( AccessLevel.GameMaster )] - public CTFTeamInfo Team8 { get => m_TeamInfo[7]; + public CTFTeamInfo Team8 { get => TeamInfo[7]; set { } } [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan Duration - { - get => m_Duration; - set => m_Duration = value; - } + public TimeSpan Duration { get; set; } public override string Title => "CTF"; public override string GetTeamName( int teamID ) { - return m_TeamInfo[teamID % m_TeamInfo.Length].Name; + return TeamInfo[teamID % TeamInfo.Length].Name; } public override EventGame Construct( DuelContext context ) @@ -822,12 +762,12 @@ namespace Server.Engines.ConPVP Visible = false; Movable = false; - m_Duration = TimeSpan.FromMinutes( 30.0 ); + Duration = TimeSpan.FromMinutes( 30.0 ); - m_TeamInfo = new CTFTeamInfo[8]; + TeamInfo = new CTFTeamInfo[8]; - for ( int i = 0; i < m_TeamInfo.Length; ++i ) - m_TeamInfo[i] = new CTFTeamInfo( i ); + for ( int i = 0; i < TeamInfo.Length; ++i ) + TeamInfo[i] = new CTFTeamInfo( i ); } public CTFController( Serial serial ) @@ -841,12 +781,12 @@ namespace Server.Engines.ConPVP writer.Write( (int) 2 ); - writer.Write( m_Duration ); + writer.Write( Duration ); - writer.WriteEncodedInt( m_TeamInfo.Length ); + writer.WriteEncodedInt( TeamInfo.Length ); - for ( int i = 0; i < m_TeamInfo.Length; ++i ) - m_TeamInfo[i].Serialize( writer ); + for ( int i = 0; i < TeamInfo.Length; ++i ) + TeamInfo[i].Serialize( writer ); } public override void Deserialize( GenericReader reader ) @@ -859,32 +799,32 @@ namespace Server.Engines.ConPVP { case 2: { - m_Duration = reader.ReadTimeSpan(); + Duration = reader.ReadTimeSpan(); goto case 1; } case 1: { - m_TeamInfo = new CTFTeamInfo[reader.ReadEncodedInt()]; + TeamInfo = new CTFTeamInfo[reader.ReadEncodedInt()]; - for ( int i = 0; i < m_TeamInfo.Length; ++i ) - m_TeamInfo[i] = new CTFTeamInfo( i, reader ); + for ( int i = 0; i < TeamInfo.Length; ++i ) + TeamInfo[i] = new CTFTeamInfo( i, reader ); break; } case 0: { - m_TeamInfo = new CTFTeamInfo[8]; + TeamInfo = new CTFTeamInfo[8]; - for ( int i = 0; i < m_TeamInfo.Length; ++i ) - m_TeamInfo[i] = new CTFTeamInfo( i ); + for ( int i = 0; i < TeamInfo.Length; ++i ) + TeamInfo[i] = new CTFTeamInfo( i ); break; } } if ( version < 2 ) - m_Duration = TimeSpan.FromMinutes( 30.0 ); + Duration = TimeSpan.FromMinutes( 30.0 ); } } @@ -896,9 +836,7 @@ namespace Server.Engines.ConPVP TileData.ItemTable[i].Flags |= TileFlag.NoShoot; } - private CTFController m_Controller; - - public CTFController Controller => m_Controller; + public CTFController Controller { get; } public void Alert( string text ) { @@ -923,7 +861,7 @@ namespace Server.Engines.ConPVP public CTFGame( CTFController controller, DuelContext context ) : base( context ) { - m_Controller = controller; + Controller = controller; } public Map Facet @@ -933,7 +871,7 @@ namespace Server.Engines.ConPVP if ( m_Context.Arena != null ) return m_Context.Arena.Facet; - return m_Controller.Map; + return Controller.Map; } } @@ -942,7 +880,7 @@ namespace Server.Engines.ConPVP int teamID = GetTeamID( mob ); if ( teamID >= 0 ) - return m_Controller.TeamInfo[teamID % m_Controller.TeamInfo.Length]; + return Controller.TeamInfo[teamID % Controller.TeamInfo.Length]; return null; } @@ -1052,15 +990,15 @@ namespace Server.Engines.ConPVP if ( mob.InRange( teamInfo.Origin, 24 ) && mob.Map == Facet ) playerInfo.Score += 1; // fragged in base -- guarding - for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i ) + for ( int i = 0; i < Controller.TeamInfo.Length; ++i ) { - if ( m_Controller.TeamInfo[i] == teamInfo ) + if ( Controller.TeamInfo[i] == teamInfo ) continue; Mobile ourFlagCarrier = null; - if ( m_Controller.TeamInfo[i].Flag != null ) - ourFlagCarrier = m_Controller.TeamInfo[i].Flag.RootParent as Mobile; + if ( Controller.TeamInfo[i].Flag != null ) + ourFlagCarrier = Controller.TeamInfo[i].Flag.RootParent as Mobile; if ( ourFlagCarrier != null && GetTeamInfo( ourFlagCarrier ) == teamInfo ) { @@ -1094,20 +1032,20 @@ namespace Server.Engines.ConPVP public override void OnStart() { - for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i ) + for ( int i = 0; i < Controller.TeamInfo.Length; ++i ) { - CTFTeamInfo teamInfo = m_Controller.TeamInfo[i]; + CTFTeamInfo teamInfo = Controller.TeamInfo[i]; teamInfo.Game = this; teamInfo.Reset(); } for ( int i = 0; i < m_Context.Participants.Count; ++i ) - ApplyHues( m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % 8].Color ); + ApplyHues( m_Context.Participants[i] as Participant, Controller.TeamInfo[i % 8].Color ); m_FinishTimer?.Stop(); - m_FinishTimer = Timer.DelayCall( m_Controller.Duration, Finish_Callback ); + m_FinishTimer = Timer.DelayCall( Controller.Duration, Finish_Callback ); } private void Finish_Callback() @@ -1116,7 +1054,7 @@ namespace Server.Engines.ConPVP for ( int i = 0; i < m_Context.Participants.Count; ++i ) { - CTFTeamInfo teamInfo = m_Controller.TeamInfo[i % 8]; + CTFTeamInfo teamInfo = Controller.TeamInfo[i % 8]; if ( teamInfo?.Flag == null ) continue; @@ -1163,8 +1101,8 @@ namespace Server.Engines.ConPVP } } - if ( m_Controller != null ) - sb.Append( ' ' ).Append( m_Controller.Title ); + if ( Controller != null ) + sb.Append( ' ' ).Append( Controller.Title ); string title = sb.ToString(); @@ -1277,9 +1215,9 @@ namespace Server.Engines.ConPVP public override void OnStop() { - for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i ) + for ( int i = 0; i < Controller.TeamInfo.Length; ++i ) { - CTFTeamInfo teamInfo = m_Controller.TeamInfo[i]; + CTFTeamInfo teamInfo = Controller.TeamInfo[i]; if ( teamInfo.Flag != null ) { diff --git a/Scripts/Engines/ConPVP/Games/DoubleDom.cs b/Scripts/Engines/ConPVP/Games/DoubleDom.cs index 74be68c90..cac4af78d 100644 --- a/Scripts/Engines/ConPVP/Games/DoubleDom.cs +++ b/Scripts/Engines/ConPVP/Games/DoubleDom.cs @@ -223,16 +223,14 @@ namespace Server.Engines.ConPVP { private DDTeamInfo m_TeamInfo; - private Mobile m_Player; - private int m_Kills; private int m_Captures; private int m_Score; - public Mobile Player => m_Player; + public Mobile Player { get; } - public string Name => m_Player.Name; + public string Name => Player.Name; public int Kills { @@ -270,64 +268,31 @@ namespace Server.Engines.ConPVP public DDPlayerInfo( DDTeamInfo teamInfo, Mobile player ) { m_TeamInfo = teamInfo; - m_Player = player; + Player = player; } } [PropertyObject] public sealed class DDTeamInfo : IRankedCTF { - private DDGame m_Game; - private int m_TeamID; + public string Name => $"{TeamName} Team"; - private int m_Color; - private string m_Name; + public DDGame Game { get; set; } - private DDBoard m_Board; + public int TeamID { get; } - private Point3D m_Origin; + public int Kills { get; set; } - private int m_Kills; - private int m_Captures; + public int Captures { get; set; } - private int m_Score; + public int Score { get; set; } - private Dictionary m_Players; - - public string Name => $"{m_Name} Team"; - - public DDGame Game { get => m_Game; - set => m_Game = value; - } - public int TeamID => m_TeamID; - - public int Kills { get => m_Kills; - set => m_Kills = value; - } - public int Captures { get => m_Captures; - set => m_Captures = value; - } - - public int Score { get => m_Score; - set => m_Score = value; - } - - private DDPlayerInfo m_Leader; - - public DDPlayerInfo Leader - { - get => m_Leader; - set => m_Leader = value; - } + public DDPlayerInfo Leader { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DDBoard Board - { - get => m_Board; - set => m_Board = value; - } + public DDBoard Board { get; set; } - public Dictionary Players => m_Players; + public Dictionary Players { get; } public DDPlayerInfo this[Mobile mob] { @@ -336,59 +301,47 @@ namespace Server.Engines.ConPVP if ( mob == null ) return null; - if (!m_Players.TryGetValue( mob, out DDPlayerInfo val )) - m_Players[mob] = val = new DDPlayerInfo( this, mob ); + if (!Players.TryGetValue( mob, out DDPlayerInfo val )) + Players[mob] = val = new DDPlayerInfo( this, mob ); return val; } } [CommandProperty( AccessLevel.GameMaster )] - public int Color - { - get => m_Color; - set => m_Color = value; - } + public int Color { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public string TeamName - { - get => m_Name; - set => m_Name = value; - } + public string TeamName { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D Origin - { - get => m_Origin; - set => m_Origin = value; - } + public Point3D Origin { get; set; } public DDTeamInfo( int teamID ) { - m_TeamID = teamID; - m_Players = new Dictionary(); + TeamID = teamID; + Players = new Dictionary(); } public void Reset() { - m_Kills = 0; - m_Captures = 0; + Kills = 0; + Captures = 0; - m_Score = 0; + Score = 0; - m_Leader = null; + Leader = null; - m_Players.Clear(); + Players.Clear(); - if ( m_Board != null ) - m_Board.m_TeamInfo = this; + if ( Board != null ) + Board.m_TeamInfo = this; } public DDTeamInfo( int teamID, GenericReader ip ) { - m_TeamID = teamID; - m_Players = new Dictionary(); + TeamID = teamID; + Players = new Dictionary(); int version = ip.ReadEncodedInt(); @@ -396,10 +349,10 @@ namespace Server.Engines.ConPVP { case 0: { - m_Board = ip.ReadItem() as DDBoard; - m_Name = ip.ReadString(); - m_Color = ip.ReadEncodedInt(); - m_Origin = ip.ReadPoint3D(); + Board = ip.ReadItem() as DDBoard; + TeamName = ip.ReadString(); + Color = ip.ReadEncodedInt(); + Origin = ip.ReadPoint3D(); break; } } @@ -409,10 +362,10 @@ namespace Server.Engines.ConPVP { op.WriteEncodedInt( 0 ); // version - op.Write( m_Board ); - op.Write( m_Name ); - op.WriteEncodedInt( m_Color ); - op.Write( m_Origin ); + op.Write( Board ); + op.Write( TeamName ); + op.WriteEncodedInt( Color ); + op.Write( Origin ); } public override string ToString() @@ -423,44 +376,30 @@ namespace Server.Engines.ConPVP public sealed class DDController : EventController { - private DDTeamInfo[] m_TeamInfo; - - private TimeSpan m_Duration; - - public DDTeamInfo[] TeamInfo => m_TeamInfo; + public DDTeamInfo[] TeamInfo { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public DDTeamInfo Team1 { get => m_TeamInfo[0]; + public DDTeamInfo Team1 { get => TeamInfo[0]; set { } } [CommandProperty( AccessLevel.GameMaster )] - public DDTeamInfo Team2 { get => m_TeamInfo[1]; + public DDTeamInfo Team2 { get => TeamInfo[1]; set { } } [CommandProperty( AccessLevel.GameMaster )] - public DDWayPoint PointA { get => m_PointA; - set => m_PointA = value; - } + public DDWayPoint PointA { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DDWayPoint PointB { get => m_PointB; - set => m_PointB = value; - } - - private DDWayPoint m_PointA, m_PointB; + public DDWayPoint PointB { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan Duration - { - get => m_Duration; - set => m_Duration = value; - } + public TimeSpan Duration { get; set; } public override string Title => "DoubleDom"; public override string GetTeamName( int teamID ) { - return m_TeamInfo[teamID % m_TeamInfo.Length].Name; + return TeamInfo[teamID % TeamInfo.Length].Name; } public override EventGame Construct( DuelContext context ) @@ -476,12 +415,12 @@ namespace Server.Engines.ConPVP Visible = false; Movable = false; - m_Duration = TimeSpan.FromMinutes( 30.0 ); + Duration = TimeSpan.FromMinutes( 30.0 ); - m_TeamInfo = new DDTeamInfo[2]; + TeamInfo = new DDTeamInfo[2]; - for ( int i = 0; i < m_TeamInfo.Length; ++i ) - m_TeamInfo[i] = new DDTeamInfo( i ); + for ( int i = 0; i < TeamInfo.Length; ++i ) + TeamInfo[i] = new DDTeamInfo( i ); } public DDController( Serial serial ) @@ -495,15 +434,15 @@ namespace Server.Engines.ConPVP writer.Write( (int)0 ); - writer.Write( m_Duration ); + writer.Write( Duration ); - writer.WriteEncodedInt( m_TeamInfo.Length ); + writer.WriteEncodedInt( TeamInfo.Length ); - for ( int i = 0; i < m_TeamInfo.Length; ++i ) - m_TeamInfo[i].Serialize( writer ); + for ( int i = 0; i < TeamInfo.Length; ++i ) + TeamInfo[i].Serialize( writer ); - writer.Write( m_PointA ); - writer.Write( m_PointB ); + writer.Write( PointA ); + writer.Write( PointB ); } public override void Deserialize( GenericReader reader ) @@ -516,14 +455,14 @@ namespace Server.Engines.ConPVP { case 0: { - m_Duration = reader.ReadTimeSpan(); - m_TeamInfo = new DDTeamInfo[reader.ReadEncodedInt()]; + Duration = reader.ReadTimeSpan(); + TeamInfo = new DDTeamInfo[reader.ReadEncodedInt()]; - for ( int i = 0; i < m_TeamInfo.Length; ++i ) - m_TeamInfo[i] = new DDTeamInfo( i, reader ); + for ( int i = 0; i < TeamInfo.Length; ++i ) + TeamInfo[i] = new DDTeamInfo( i, reader ); - m_PointA = reader.ReadItem() as DDWayPoint; - m_PointB = reader.ReadItem() as DDWayPoint; + PointA = reader.ReadItem() as DDWayPoint; + PointB = reader.ReadItem() as DDWayPoint; break; } @@ -533,9 +472,7 @@ namespace Server.Engines.ConPVP public sealed class DDGame : EventGame { - private DDController m_Controller; - - public DDController Controller => m_Controller; + public DDController Controller { get; } public void Alert( string text ) { @@ -560,7 +497,7 @@ namespace Server.Engines.ConPVP public DDGame( DDController controller, DuelContext context ) : base( context ) { - m_Controller = controller; + Controller = controller; } public Map Facet @@ -570,7 +507,7 @@ namespace Server.Engines.ConPVP if ( m_Context.Arena != null ) return m_Context.Arena.Facet; - return m_Controller.Map; + return Controller.Map; } } @@ -579,7 +516,7 @@ namespace Server.Engines.ConPVP int teamID = GetTeamID( mob ); if ( teamID >= 0 ) - return m_Controller.TeamInfo[teamID % m_Controller.TeamInfo.Length]; + return Controller.TeamInfo[teamID % Controller.TeamInfo.Length]; return null; } @@ -706,25 +643,25 @@ namespace Server.Engines.ConPVP m_UncaptureTimer = null; } - for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i ) + for ( int i = 0; i < Controller.TeamInfo.Length; ++i ) { - DDTeamInfo teamInfo = m_Controller.TeamInfo[i]; + DDTeamInfo teamInfo = Controller.TeamInfo[i]; teamInfo.Game = this; teamInfo.Reset(); } - if ( m_Controller.PointA != null ) - m_Controller.PointA.Game = this; + if ( Controller.PointA != null ) + Controller.PointA.Game = this; - if ( m_Controller.PointB != null ) - m_Controller.PointB.Game = this; + if ( Controller.PointB != null ) + Controller.PointB.Game = this; for ( int i = 0; i < m_Context.Participants.Count; ++i ) - ApplyHues( m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length].Color ); + ApplyHues( m_Context.Participants[i] as Participant, Controller.TeamInfo[i % Controller.TeamInfo.Length].Color ); m_FinishTimer?.Stop(); - m_FinishTimer = Timer.DelayCall( m_Controller.Duration, Finish_Callback ); + m_FinishTimer = Timer.DelayCall( Controller.Duration, Finish_Callback ); } private void Finish_Callback() @@ -733,7 +670,7 @@ namespace Server.Engines.ConPVP for ( int i = 0; i < m_Context.Participants.Count; ++i ) { - DDTeamInfo teamInfo = m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length]; + DDTeamInfo teamInfo = Controller.TeamInfo[i % Controller.TeamInfo.Length]; if ( teamInfo != null ) teams.Add( teamInfo ); @@ -775,8 +712,8 @@ namespace Server.Engines.ConPVP } } - if ( m_Controller != null ) - sb.Append( ' ' ).Append( m_Controller.Title ); + if ( Controller != null ) + sb.Append( ' ' ).Append( Controller.Title ); string title = sb.ToString(); @@ -889,9 +826,9 @@ namespace Server.Engines.ConPVP public override void OnStop() { - for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i ) + for ( int i = 0; i < Controller.TeamInfo.Length; ++i ) { - DDTeamInfo teamInfo = m_Controller.TeamInfo[i]; + DDTeamInfo teamInfo = Controller.TeamInfo[i]; if ( teamInfo.Board != null ) teamInfo.Board.m_TeamInfo = null; @@ -899,11 +836,11 @@ namespace Server.Engines.ConPVP teamInfo.Game = null; } - if ( m_Controller.PointA != null ) - m_Controller.PointA.Game = null; + if ( Controller.PointA != null ) + Controller.PointA.Game = null; - if ( m_Controller.PointB != null ) - m_Controller.PointB.Game = null; + if ( Controller.PointB != null ) + Controller.PointB.Game = null; m_Capturable = false; @@ -936,21 +873,21 @@ namespace Server.Engines.ConPVP if ( point == null || from == null || team == null || !m_Capturable ) return; - bool wasDom = ( m_Controller.PointA != null && m_Controller.PointB != null && - m_Controller.PointA.TeamOwner == m_Controller.PointB.TeamOwner && m_Controller.PointA.TeamOwner != null ); + bool wasDom = ( Controller.PointA != null && Controller.PointB != null && + Controller.PointA.TeamOwner == Controller.PointB.TeamOwner && Controller.PointA.TeamOwner != null ); point.TeamOwner = team; Alert( "{0} has captured {1}!", team.Name, point.Name ); - bool isDom = ( m_Controller.PointA != null && m_Controller.PointB != null && - m_Controller.PointA.TeamOwner == m_Controller.PointB.TeamOwner && m_Controller.PointA.TeamOwner != null ); + bool isDom = ( Controller.PointA != null && Controller.PointB != null && + Controller.PointA.TeamOwner == Controller.PointB.TeamOwner && Controller.PointA.TeamOwner != null ); if ( wasDom && !isDom ) { Alert( "Domination averted!" ); - m_Controller.PointA?.SetNonCaptureHue(); - m_Controller.PointB?.SetNonCaptureHue(); + Controller.PointA?.SetNonCaptureHue(); + Controller.PointB?.SetNonCaptureHue(); m_CaptureTimer?.Stop(); m_CaptureTimer = null; } @@ -967,10 +904,10 @@ namespace Server.Engines.ConPVP { DDTeamInfo team = null; - if ( m_Controller.PointA?.TeamOwner != null ) - team = m_Controller.PointA.TeamOwner; - else if ( m_Controller.PointB?.TeamOwner != null ) - team = m_Controller.PointB.TeamOwner; + if ( Controller.PointA?.TeamOwner != null ) + team = Controller.PointA.TeamOwner; + else if ( Controller.PointB?.TeamOwner != null ) + team = Controller.PointB.TeamOwner; if ( team == null ) { @@ -984,8 +921,8 @@ namespace Server.Engines.ConPVP { Alert( "{0} is dominating... {1}", team.Name, 10 - m_CapStage ); - m_Controller.PointA?.SetCaptureHue( m_CapStage ); - m_Controller.PointB?.SetCaptureHue( m_CapStage ); + Controller.PointA?.SetCaptureHue( m_CapStage ); + Controller.PointB?.SetCaptureHue( m_CapStage ); } else { @@ -999,16 +936,16 @@ namespace Server.Engines.ConPVP m_CaptureTimer.Stop(); m_CaptureTimer = null; - if ( m_Controller.PointA != null ) + if ( Controller.PointA != null ) { - m_Controller.PointA.TeamOwner = null; - m_Controller.PointA.SetUncapturableHue(); + Controller.PointA.TeamOwner = null; + Controller.PointA.SetUncapturableHue(); } - if ( m_Controller.PointB != null ) + if ( Controller.PointB != null ) { - m_Controller.PointB.TeamOwner = null; - m_Controller.PointB.SetUncapturableHue(); + Controller.PointB.TeamOwner = null; + Controller.PointB.SetUncapturableHue(); } m_UncaptureTimer = Timer.DelayCall( TimeSpan.FromSeconds( 30.0 ), UncaptureTick ); @@ -1032,16 +969,16 @@ namespace Server.Engines.ConPVP m_UncaptureTimer = null; } - if ( m_Controller.PointA != null ) + if ( Controller.PointA != null ) { - m_Controller.PointA.TeamOwner = null; - m_Controller.PointA.SetNonCaptureHue(); + Controller.PointA.TeamOwner = null; + Controller.PointA.SetNonCaptureHue(); } - if ( m_Controller.PointB != null ) + if ( Controller.PointB != null ) { - m_Controller.PointB.TeamOwner = null; - m_Controller.PointB.SetNonCaptureHue(); + Controller.PointB.TeamOwner = null; + Controller.PointB.SetNonCaptureHue(); } } } diff --git a/Scripts/Engines/ConPVP/Games/KingOfTheHill.cs b/Scripts/Engines/ConPVP/Games/KingOfTheHill.cs index f1c02eb28..2466769d5 100644 --- a/Scripts/Engines/ConPVP/Games/KingOfTheHill.cs +++ b/Scripts/Engines/ConPVP/Games/KingOfTheHill.cs @@ -11,18 +11,16 @@ namespace Server.Engines.ConPVP { public class HillOfTheKing : Item { - private int m_ScoreInterval; - private KHGame m_Game; - private Mobile m_King; - private KingTimer m_KingTimer; + private KHGame m_Game; + private KingTimer m_KingTimer; [Constructible] public HillOfTheKing() : base(0x520) { - m_ScoreInterval = 10; + ScoreInterval = 10; m_Game = null; - m_King = null; + King = null; Movable = false; Name = "the hill"; @@ -43,7 +41,7 @@ namespace Server.Engines.ConPVP { case 0: { - m_ScoreInterval = reader.ReadEncodedInt(); + ScoreInterval = reader.ReadEncodedInt(); break; } } @@ -55,10 +53,10 @@ namespace Server.Engines.ConPVP writer.Write((int)0); // version - writer.WriteEncodedInt(m_ScoreInterval); + writer.WriteEncodedInt(ScoreInterval); } - public Mobile King => m_King; + public Mobile King { get; private set; } public KHGame Game { @@ -69,17 +67,15 @@ namespace Server.Engines.ConPVP { m_KingTimer?.Stop(); m_Game = value; - m_King = null; + King = null; } } } [CommandProperty(AccessLevel.GameMaster)] - public int ScoreInterval { get => m_ScoreInterval; - set => m_ScoreInterval = value; - } + public int ScoreInterval { get; set; } - public int CapturesSoFar + public int CapturesSoFar { get { @@ -100,7 +96,7 @@ namespace Server.Engines.ConPVP return false; // Not current king (or they are the current king) - if (m_King != null && m_King != m) + if (King != null && King != m) return false; // They are on a team @@ -137,7 +133,7 @@ namespace Server.Engines.ConPVP { if (base.OnMoveOff(m)) { - if (m_King == m) + if (King == m) DeKingify(); return true; @@ -169,7 +165,7 @@ namespace Server.Engines.ConPVP m_KingTimer?.Stop(); - m_King = null; + King = null; } private void ReKingify(Mobile m) @@ -182,30 +178,29 @@ namespace Server.Engines.ConPVP if (ti == null) return; - m_King = m; + King = m; if (m_KingTimer == null) m_KingTimer = new KingTimer(this); m_KingTimer.Stop(); m_KingTimer.StartHillTicker(); - if (m_King.Name != null) - PublicOverheadMessage(MessageType.Regular, 0x0481, false, $"Taken by {m_King.Name}!"); + if (King.Name != null) + PublicOverheadMessage(MessageType.Regular, 0x0481, false, $"Taken by {King.Name}!"); } private class KingTimer : Timer { private HillOfTheKing m_Hill; - private int m_Total; - private int m_Counter; + private int m_Counter; - public int Captures => m_Total; + public int Captures { get; private set; } - public KingTimer(HillOfTheKing hill) + public KingTimer(HillOfTheKing hill) : base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0)) { m_Hill = hill; - m_Total = 0; + Captures = 0; m_Counter = 0; Priority = TimerPriority.FiftyMS; @@ -213,7 +208,7 @@ namespace Server.Engines.ConPVP public void StartHillTicker() { - m_Total = 0; + Captures = 0; m_Counter = 0; Start(); @@ -268,7 +263,7 @@ namespace Server.Engines.ConPVP m_Hill.PublicOverheadMessage(MessageType.Regular, 0x0481, false, "Capture!"); pi.Captures++; - m_Total++; + Captures++; pi.Score += m_Counter; @@ -512,21 +507,19 @@ namespace Server.Engines.ConPVP { private KHTeamInfo m_TeamInfo; - private Mobile m_Player; - - private int m_Kills; + private int m_Kills; private int m_Captures; private int m_Score; public KHPlayerInfo(KHTeamInfo teamInfo, Mobile player) { m_TeamInfo = teamInfo; - m_Player = player; + Player = player; } - public Mobile Player => m_Player; + public Mobile Player { get; } - public int CompareTo(object obj) + public int CompareTo(object obj) { KHPlayerInfo pi = (KHPlayerInfo)obj; int res = pi.Score.CompareTo(Score); @@ -544,9 +537,9 @@ namespace Server.Engines.ConPVP { get { - if (m_Player?.Name == null) + if (Player?.Name == null) return ""; - return m_Player.Name; + return Player.Name; } } @@ -587,20 +580,7 @@ namespace Server.Engines.ConPVP [PropertyObject] public sealed class KHTeamInfo : IRankedCTF, IComparable { - private KHGame m_Game; - private int m_TeamID; - - private int m_Color; - private string m_Name; - - private int m_Kills; - private int m_Captures; - - private int m_Score; - - private Hashtable m_Players; - - public int CompareTo(object obj) + public int CompareTo(object obj) { KHTeamInfo ti = (KHTeamInfo)obj; int res = ti.Score.CompareTo(Score); @@ -618,36 +598,25 @@ namespace Server.Engines.ConPVP { get { - if (m_Name == null) + if (TeamName == null) return "(null) Team"; - return $"{m_Name} Team"; + return $"{TeamName} Team"; } } - public KHGame Game { get => m_Game; - set => m_Game = value; - } - public int TeamID => m_TeamID; + public KHGame Game { get; set; } - public int Kills { get => m_Kills; - set => m_Kills = value; - } - public int Captures { get => m_Captures; - set => m_Captures = value; - } - public int Score { get => m_Score; - set => m_Score = value; - } + public int TeamID { get; } - private KHPlayerInfo m_Leader; + public int Kills { get; set; } - public KHPlayerInfo Leader - { - get => m_Leader; - set => m_Leader = value; - } + public int Captures { get; set; } - public Hashtable Players => m_Players; + public int Score { get; set; } + + public KHPlayerInfo Leader { get; set; } + + public Hashtable Players { get; } public KHPlayerInfo this[Mobile mob] { @@ -656,48 +625,40 @@ namespace Server.Engines.ConPVP if (mob == null) return null; - if (!(m_Players[mob] is KHPlayerInfo val)) - m_Players[mob] = val = new KHPlayerInfo(this, mob); + if (!(Players[mob] is KHPlayerInfo val)) + Players[mob] = val = new KHPlayerInfo(this, mob); return val; } } [CommandProperty(AccessLevel.GameMaster)] - public int Color - { - get => m_Color; - set => m_Color = value; - } + public int Color { get; set; } - [CommandProperty(AccessLevel.GameMaster)] - public string TeamName - { - get => m_Name; - set => m_Name = value; - } + [CommandProperty(AccessLevel.GameMaster)] + public string TeamName { get; set; } - public KHTeamInfo(int teamID) + public KHTeamInfo(int teamID) { - m_TeamID = teamID; - m_Players = new Hashtable(); + TeamID = teamID; + Players = new Hashtable(); } public void Reset() { - m_Kills = 0; - m_Captures = 0; - m_Score = 0; + Kills = 0; + Captures = 0; + Score = 0; - m_Leader = null; + Leader = null; - m_Players.Clear(); + Players.Clear(); } public KHTeamInfo(int teamID, GenericReader ip) { - m_TeamID = teamID; - m_Players = new Hashtable(); + TeamID = teamID; + Players = new Hashtable(); int version = ip.ReadEncodedInt(); @@ -705,8 +666,8 @@ namespace Server.Engines.ConPVP { case 0: { - m_Name = ip.ReadString(); - m_Color = ip.ReadEncodedInt(); + TeamName = ip.ReadString(); + Color = ip.ReadEncodedInt(); break; } } @@ -716,13 +677,13 @@ namespace Server.Engines.ConPVP { op.WriteEncodedInt(0); // version - op.Write(m_Name); - op.WriteEncodedInt(m_Color); + op.Write(TeamName); + op.WriteEncodedInt(Color); } public override string ToString() { - if (m_Name != null) + if (TeamName != null) return $"({Name}) ..."; return "..."; } @@ -730,82 +691,74 @@ namespace Server.Engines.ConPVP public sealed class KHController : EventController { - private KHTeamInfo[] m_TeamInfo; - private HillOfTheKing[] m_Hills; - private ArrayList m_Boards; - private TimeSpan m_Duration; - private int m_ScoreInterval; + private int m_ScoreInterval; - public KHTeamInfo[] TeamInfo => m_TeamInfo; + public KHTeamInfo[] TeamInfo { get; private set; } - [CommandProperty(AccessLevel.GameMaster)] - public KHTeamInfo Team1_W { get => m_TeamInfo[0]; + [CommandProperty(AccessLevel.GameMaster)] + public KHTeamInfo Team1_W { get => TeamInfo[0]; set { } } [CommandProperty(AccessLevel.GameMaster)] - public KHTeamInfo Team2_E { get => m_TeamInfo[1]; + public KHTeamInfo Team2_E { get => TeamInfo[1]; set { } } [CommandProperty(AccessLevel.GameMaster)] - public KHTeamInfo Team3_N { get => m_TeamInfo[2]; + public KHTeamInfo Team3_N { get => TeamInfo[2]; set { } } [CommandProperty(AccessLevel.GameMaster)] - public KHTeamInfo Team4_S { get => m_TeamInfo[3]; + public KHTeamInfo Team4_S { get => TeamInfo[3]; set { } } [CommandProperty(AccessLevel.GameMaster)] - public KHTeamInfo Team5_NW { get => m_TeamInfo[4]; + public KHTeamInfo Team5_NW { get => TeamInfo[4]; set { } } [CommandProperty(AccessLevel.GameMaster)] - public KHTeamInfo Team6_SE { get => m_TeamInfo[5]; + public KHTeamInfo Team6_SE { get => TeamInfo[5]; set { } } [CommandProperty(AccessLevel.GameMaster)] - public KHTeamInfo Team7_SW { get => m_TeamInfo[6]; + public KHTeamInfo Team7_SW { get => TeamInfo[6]; set { } } [CommandProperty(AccessLevel.GameMaster)] - public KHTeamInfo Team8_NE { get => m_TeamInfo[7]; + public KHTeamInfo Team8_NE { get => TeamInfo[7]; set { } } - public HillOfTheKing[] Hills => m_Hills; + public HillOfTheKing[] Hills { get; private set; } - [CommandProperty(AccessLevel.GameMaster)] - public HillOfTheKing Hill1 { get => m_Hills[0]; - set => m_Hills[0] = value; + [CommandProperty(AccessLevel.GameMaster)] + public HillOfTheKing Hill1 { get => Hills[0]; + set => Hills[0] = value; } [CommandProperty(AccessLevel.GameMaster)] - public HillOfTheKing Hill2 { get => m_Hills[1]; - set => m_Hills[1] = value; + public HillOfTheKing Hill2 { get => Hills[1]; + set => Hills[1] = value; } [CommandProperty(AccessLevel.GameMaster)] - public HillOfTheKing Hill3 { get => m_Hills[2]; - set => m_Hills[2] = value; + public HillOfTheKing Hill3 { get => Hills[2]; + set => Hills[2] = value; } [CommandProperty(AccessLevel.GameMaster)] - public HillOfTheKing Hill4 { get => m_Hills[3]; - set => m_Hills[3] = value; + public HillOfTheKing Hill4 { get => Hills[3]; + set => Hills[3] = value; } - public ArrayList Boards => m_Boards; + public ArrayList Boards { get; private set; } - [CommandProperty(AccessLevel.GameMaster)] - public TimeSpan Duration - { - get => m_Duration; - set => m_Duration = value; - } + [CommandProperty(AccessLevel.GameMaster)] + public TimeSpan Duration { get; set; } - public override string Title => "King of the Hill"; + public override string Title => "King of the Hill"; public override string GetTeamName(int teamID) { - return m_TeamInfo[teamID % m_TeamInfo.Length].Name; + return TeamInfo[teamID % TeamInfo.Length].Name; } public override EventGame Construct(DuelContext context) @@ -817,7 +770,7 @@ namespace Server.Engines.ConPVP { if (b != null) { - m_Boards.Remove(b); + Boards.Remove(b); b.m_Game = null; } } @@ -825,7 +778,7 @@ namespace Server.Engines.ConPVP public void AddBoard(KHBoard b) { if (b != null) - m_Boards.Add(b); + Boards.Add(b); } [Constructible] @@ -836,13 +789,13 @@ namespace Server.Engines.ConPVP Name = "King of the Hill Controller"; - m_Duration = TimeSpan.FromMinutes(30.0); - m_Boards = new ArrayList(); - m_Hills = new HillOfTheKing[4]; - m_TeamInfo = new KHTeamInfo[8]; + Duration = TimeSpan.FromMinutes(30.0); + Boards = new ArrayList(); + Hills = new HillOfTheKing[4]; + TeamInfo = new KHTeamInfo[8]; - for (int i = 0; i < m_TeamInfo.Length; ++i) - m_TeamInfo[i] = new KHTeamInfo(i); + for (int i = 0; i < TeamInfo.Length; ++i) + TeamInfo[i] = new KHTeamInfo(i); } public KHController(Serial serial) @@ -857,17 +810,17 @@ namespace Server.Engines.ConPVP writer.Write((int)0); writer.WriteEncodedInt(m_ScoreInterval); - writer.Write(m_Duration); + writer.Write(Duration); - writer.WriteItemList(m_Boards, true); + writer.WriteItemList(Boards, true); - writer.WriteEncodedInt(m_Hills.Length); - for (int i = 0; i < m_Hills.Length; ++i) - writer.Write(m_Hills[i]); + writer.WriteEncodedInt(Hills.Length); + for (int i = 0; i < Hills.Length; ++i) + writer.Write(Hills[i]); - writer.WriteEncodedInt(m_TeamInfo.Length); - for (int i = 0; i < m_TeamInfo.Length; ++i) - m_TeamInfo[i].Serialize(writer); + writer.WriteEncodedInt(TeamInfo.Length); + for (int i = 0; i < TeamInfo.Length; ++i) + TeamInfo[i].Serialize(writer); } public override void Deserialize(GenericReader reader) @@ -882,17 +835,17 @@ namespace Server.Engines.ConPVP { m_ScoreInterval = reader.ReadEncodedInt(); - m_Duration = reader.ReadTimeSpan(); + Duration = reader.ReadTimeSpan(); - m_Boards = reader.ReadItemList(); + Boards = reader.ReadItemList(); - m_Hills = new HillOfTheKing[reader.ReadEncodedInt()]; - for (int i = 0; i < m_Hills.Length; ++i) - m_Hills[i] = reader.ReadItem() as HillOfTheKing; + Hills = new HillOfTheKing[reader.ReadEncodedInt()]; + for (int i = 0; i < Hills.Length; ++i) + Hills[i] = reader.ReadItem() as HillOfTheKing; - m_TeamInfo = new KHTeamInfo[reader.ReadEncodedInt()]; - for (int i = 0; i < m_TeamInfo.Length; ++i) - m_TeamInfo[i] = new KHTeamInfo(i, reader); + TeamInfo = new KHTeamInfo[reader.ReadEncodedInt()]; + for (int i = 0; i < TeamInfo.Length; ++i) + TeamInfo[i] = new KHTeamInfo(i, reader); break; } @@ -902,17 +855,15 @@ namespace Server.Engines.ConPVP public sealed class KHGame : EventGame { - private KHController m_Controller; + public KHController Controller { get; } - public KHController Controller => m_Controller; - - public override bool CantDoAnything(Mobile mob) + public override bool CantDoAnything(Mobile mob) { - if (mob != null && GetTeamInfo(mob) != null && m_Controller != null) + if (mob != null && GetTeamInfo(mob) != null && Controller != null) { - for (int i = 0; i < m_Controller.Hills.Length; i++) + for (int i = 0; i < Controller.Hills.Length; i++) { - if (m_Controller.Hills[i] != null && m_Controller.Hills[i].King == mob) + if (Controller.Hills[i] != null && Controller.Hills[i].King == mob) return true; } } @@ -944,7 +895,7 @@ namespace Server.Engines.ConPVP public KHGame(KHController controller, DuelContext context) : base(context) { - m_Controller = controller; + Controller = controller; } public Map Facet @@ -954,7 +905,7 @@ namespace Server.Engines.ConPVP if (m_Context?.Arena != null) return m_Context.Arena.Facet; - return m_Controller.Map; + return Controller.Map; } } @@ -963,7 +914,7 @@ namespace Server.Engines.ConPVP int teamID = GetTeamID(mob); if (teamID >= 0) - return m_Controller.TeamInfo[teamID % m_Controller.TeamInfo.Length]; + return Controller.TeamInfo[teamID % Controller.TeamInfo.Length]; return null; } @@ -1038,18 +989,18 @@ namespace Server.Engines.ConPVP if (killer != null && killer.Player) teamInfo = GetTeamInfo(killer); - for (int i = 0; i < m_Controller.Hills.Length; i++) + for (int i = 0; i < Controller.Hills.Length; i++) { - if (m_Controller.Hills[i] == null) + if (Controller.Hills[i] == null) continue; - if (m_Controller.Hills[i].King == mob) + if (Controller.Hills[i].King == mob) { - bonus += m_Controller.Hills[i].CapturesSoFar; - m_Controller.Hills[i].OnKingDied(mob, victInfo, killer, teamInfo); + bonus += Controller.Hills[i].CapturesSoFar; + Controller.Hills[i].OnKingDied(mob, victInfo, killer, teamInfo); } - if (m_Controller.Hills[i].King == killer) + if (Controller.Hills[i].King == killer) bonus += 2; } @@ -1077,32 +1028,32 @@ namespace Server.Engines.ConPVP public override void OnStart() { - for (int i = 0; i < m_Controller.TeamInfo.Length; ++i) + for (int i = 0; i < Controller.TeamInfo.Length; ++i) { - KHTeamInfo teamInfo = m_Controller.TeamInfo[i]; + KHTeamInfo teamInfo = Controller.TeamInfo[i]; teamInfo.Game = this; teamInfo.Reset(); } for (int i = 0; i < m_Context.Participants.Count; ++i) - ApplyHues(m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length].Color); + ApplyHues(m_Context.Participants[i] as Participant, Controller.TeamInfo[i % Controller.TeamInfo.Length].Color); m_FinishTimer?.Stop(); - for (int i = 0; i < m_Controller.Hills.Length; i++) + for (int i = 0; i < Controller.Hills.Length; i++) { - if (m_Controller.Hills[i] != null) - m_Controller.Hills[i].Game = this; + if (Controller.Hills[i] != null) + Controller.Hills[i].Game = this; } - foreach (KHBoard board in m_Controller.Boards) + foreach (KHBoard board in Controller.Boards) { if (board != null && !board.Deleted) board.m_Game = this; } - m_FinishTimer = Timer.DelayCall(m_Controller.Duration, Finish_Callback); + m_FinishTimer = Timer.DelayCall(Controller.Duration, Finish_Callback); } private void Finish_Callback() @@ -1111,7 +1062,7 @@ namespace Server.Engines.ConPVP for (int i = 0; i < m_Context.Participants.Count; ++i) { - KHTeamInfo teamInfo = m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length]; + KHTeamInfo teamInfo = Controller.TeamInfo[i % Controller.TeamInfo.Length]; if (teamInfo == null) continue; @@ -1150,8 +1101,8 @@ namespace Server.Engines.ConPVP } } - if (m_Controller != null) - sb.Append(' ').Append(m_Controller.Title); + if (Controller != null) + sb.Append(' ').Append(Controller.Title); string title = sb.ToString(); @@ -1263,16 +1214,16 @@ namespace Server.Engines.ConPVP public override void OnStop() { - for (int i = 0; i < m_Controller.TeamInfo.Length; ++i) - m_Controller.TeamInfo[i].Game = null; + for (int i = 0; i < Controller.TeamInfo.Length; ++i) + Controller.TeamInfo[i].Game = null; - for (int i = 0; i < m_Controller.Hills.Length; ++i) + for (int i = 0; i < Controller.Hills.Length; ++i) { - if (m_Controller.Hills[i] != null) - m_Controller.Hills[i].Game = null; + if (Controller.Hills[i] != null) + Controller.Hills[i].Game = null; } - foreach (KHBoard board in m_Controller.Boards) + foreach (KHBoard board in Controller.Boards) { if (board != null) board.m_Game = null; diff --git a/Scripts/Engines/ConPVP/Ladder.cs b/Scripts/Engines/ConPVP/Ladder.cs index 8fb7ec3aa..0ca7e76c0 100644 --- a/Scripts/Engines/ConPVP/Ladder.cs +++ b/Scripts/Engines/ConPVP/Ladder.cs @@ -243,11 +243,7 @@ namespace Server.Engines.ConPVP return m_Table[mob] as LadderEntry; } - private static Ladder m_Instance; - - public static Ladder Instance{ get => m_Instance; - set => m_Instance = value; - } + public static Ladder Instance { get; set; } public Ladder() { @@ -311,40 +307,30 @@ namespace Server.Engines.ConPVP public class LadderEntry : IComparable { - private Mobile m_Mobile; private int m_Experience; - private int m_Wins; - private int m_Losses; - private int m_Index; private Ladder m_Ladder; - public Mobile Mobile => m_Mobile; + public Mobile Mobile { get; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] public int Experience{ get => m_Experience; set{ m_Experience = value; m_Ladder.UpdateEntry(this); } } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] - public int Wins{ get => m_Wins; - set => m_Wins = value; - } + public int Wins { get; set; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] - public int Losses{ get => m_Losses; - set => m_Losses = value; - } + public int Losses { get; set; } - public int Index{ get => m_Index; - set => m_Index = value; - } + public int Index { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int Rank => m_Index; + public int Rank => Index; public LadderEntry( Mobile mob, Ladder ladder ) { m_Ladder = ladder; - m_Mobile = mob; + Mobile = mob; } public LadderEntry( GenericReader reader, Ladder ladder, int version ) @@ -356,10 +342,10 @@ namespace Server.Engines.ConPVP case 1: case 0: { - m_Mobile = reader.ReadMobile(); + Mobile = reader.ReadMobile(); m_Experience = reader.ReadEncodedInt(); - m_Wins = reader.ReadEncodedInt(); - m_Losses = reader.ReadEncodedInt(); + Wins = reader.ReadEncodedInt(); + Losses = reader.ReadEncodedInt(); break; } @@ -368,10 +354,10 @@ namespace Server.Engines.ConPVP public void Serialize( GenericWriter writer ) { - writer.Write( (Mobile) m_Mobile ); + writer.Write( (Mobile) Mobile ); writer.WriteEncodedInt( (int) m_Experience ); - writer.WriteEncodedInt( (int) m_Wins ); - writer.WriteEncodedInt( (int) m_Losses ); + writer.WriteEncodedInt( (int) Wins ); + writer.WriteEncodedInt( (int) Losses ); } public int CompareTo( object obj ) diff --git a/Scripts/Engines/ConPVP/LadderGump.cs b/Scripts/Engines/ConPVP/LadderGump.cs index 82d4b1062..277d858e6 100644 --- a/Scripts/Engines/ConPVP/LadderGump.cs +++ b/Scripts/Engines/ConPVP/LadderGump.cs @@ -7,14 +7,8 @@ namespace Server.Engines.ConPVP { public class LadderItem : Item { - private LadderController m_Ladder; - [CommandProperty( AccessLevel.GameMaster )] - public LadderController Ladder - { - get => m_Ladder; - set => m_Ladder = value; - } + public LadderController Ladder { get; set; } public override string DefaultName => "1v1 leaderboard"; @@ -34,7 +28,7 @@ namespace Server.Engines.ConPVP writer.Write( (int) 1 ); - writer.Write( (Item) m_Ladder ); + writer.Write( (Item) Ladder ); } public override void Deserialize( GenericReader reader ) @@ -47,7 +41,7 @@ namespace Server.Engines.ConPVP { case 1: { - m_Ladder = reader.ReadItem() as LadderController; + Ladder = reader.ReadItem() as LadderController; break; } } @@ -59,8 +53,8 @@ namespace Server.Engines.ConPVP { Ladder ladder = Server.Engines.ConPVP.Ladder.Instance; - if ( m_Ladder != null ) - ladder = m_Ladder.Ladder; + if ( Ladder != null ) + ladder = Ladder.Ladder; if ( ladder != null ) { diff --git a/Scripts/Engines/ConPVP/Participant.cs b/Scripts/Engines/ConPVP/Participant.cs index e149f4cf6..a5416510c 100644 --- a/Scripts/Engines/ConPVP/Participant.cs +++ b/Scripts/Engines/ConPVP/Participant.cs @@ -6,31 +6,27 @@ namespace Server.Engines.ConPVP { public class Participant { - private DuelContext m_Context; - private DuelPlayer[] m_Players; - private TournyParticipant m_TournyPart; + public int Count => Players.Length; + public DuelPlayer[] Players { get; private set; } - public int Count => m_Players.Length; - public DuelPlayer[] Players => m_Players; - public DuelContext Context => m_Context; - public TournyParticipant TournyPart{ get => m_TournyPart; - set => m_TournyPart = value; - } + public DuelContext Context { get; } + + public TournyParticipant TournyPart { get; set; } public DuelPlayer Find( Mobile mob ) { if ( mob is PlayerMobile pm ) { - if ( pm.DuelContext == m_Context && pm.DuelPlayer.Participant == this ) + if ( pm.DuelContext == Context && pm.DuelPlayer.Participant == this ) return pm.DuelPlayer; return null; } - for ( int i = 0; i < m_Players.Length; ++i ) + for ( int i = 0; i < Players.Length; ++i ) { - if ( m_Players[i] != null && m_Players[i].Mobile == mob ) - return m_Players[i]; + if ( Players[i] != null && Players[i].Mobile == mob ) + return Players[i]; } return null; @@ -43,18 +39,18 @@ namespace Server.Engines.ConPVP public void Broadcast( int hue, string message, string nonLocalOverhead, string localOverhead ) { - for ( int i = 0; i < m_Players.Length; ++i ) + for ( int i = 0; i < Players.Length; ++i ) { - if ( m_Players[i] != null ) + if ( Players[i] != null ) { if ( message != null ) - m_Players[i].Mobile.SendMessage( hue, message ); + Players[i].Mobile.SendMessage( hue, message ); if ( nonLocalOverhead != null ) - m_Players[i].Mobile.NonlocalOverheadMessage( Network.MessageType.Regular, hue, false, string.Format( nonLocalOverhead, m_Players[i].Mobile.Name, m_Players[i].Mobile.Female ? "her" : "his" ) ); + Players[i].Mobile.NonlocalOverheadMessage( Network.MessageType.Regular, hue, false, string.Format( nonLocalOverhead, Players[i].Mobile.Name, Players[i].Mobile.Female ? "her" : "his" ) ); if ( localOverhead != null ) - m_Players[i].Mobile.LocalOverheadMessage( Network.MessageType.Regular, hue, false, localOverhead ); + Players[i].Mobile.LocalOverheadMessage( Network.MessageType.Regular, hue, false, localOverhead ); } } } @@ -65,9 +61,9 @@ namespace Server.Engines.ConPVP { int count = 0; - for ( int i = 0; i < m_Players.Length; ++i ) + for ( int i = 0; i < Players.Length; ++i ) { - if ( m_Players[i] != null ) + if ( Players[i] != null ) ++count; } @@ -79,9 +75,9 @@ namespace Server.Engines.ConPVP { get { - for ( int i = 0; i < m_Players.Length; ++i ) + for ( int i = 0; i < Players.Length; ++i ) { - if ( m_Players[i] == null ) + if ( Players[i] == null ) return true; } @@ -93,9 +89,9 @@ namespace Server.Engines.ConPVP { get { - for ( int i = 0; i < m_Players.Length; ++i ) + for ( int i = 0; i < Players.Length; ++i ) { - if ( m_Players[i] != null && !m_Players[i].Eliminated ) + if ( Players[i] != null && !Players[i].Eliminated ) return false; } @@ -109,12 +105,12 @@ namespace Server.Engines.ConPVP { StringBuilder sb = new StringBuilder(); - for ( int i = 0; i < m_Players.Length; ++i ) + for ( int i = 0; i < Players.Length; ++i ) { - if ( m_Players[i] == null ) + if ( Players[i] == null ) continue; - Mobile mob = m_Players[i].Mobile; + Mobile mob = Players[i].Mobile; if ( sb.Length > 0 ) sb.Append( ", " ); @@ -134,12 +130,12 @@ namespace Server.Engines.ConPVP if ( player == null ) return; - int index = Array.IndexOf( m_Players, player ); + int index = Array.IndexOf( Players, player ); if ( index == -1 ) return; - m_Players[index] = null; + Players[index] = null; } public void Remove( DuelPlayer player ) @@ -147,19 +143,19 @@ namespace Server.Engines.ConPVP if ( player == null ) return; - int index = Array.IndexOf( m_Players, player ); + int index = Array.IndexOf( Players, player ); if ( index == -1 ) return; - DuelPlayer[] old = m_Players; - m_Players = new DuelPlayer[old.Length - 1]; + DuelPlayer[] old = Players; + Players = new DuelPlayer[old.Length - 1]; for ( int i = 0; i < index; ++i ) - m_Players[i] = old[i]; + Players[i] = old[i]; for ( int i = index + 1; i < old.Length; ++i ) - m_Players[i - 1] = old[i]; + Players[i - 1] = old[i]; } public void Remove( Mobile player ) @@ -172,23 +168,23 @@ namespace Server.Engines.ConPVP if ( Contains( player ) ) return; - for ( int i = 0; i < m_Players.Length; ++i ) + for ( int i = 0; i < Players.Length; ++i ) { - if ( m_Players[i] == null ) + if ( Players[i] == null ) { - m_Players[i] = new DuelPlayer( player, this ); + Players[i] = new DuelPlayer( player, this ); return; } } - Resize( m_Players.Length + 1 ); - m_Players[m_Players.Length - 1] = new DuelPlayer( player, this ); + Resize( Players.Length + 1 ); + Players[Players.Length - 1] = new DuelPlayer( player, this ); } public void Resize( int count ) { - DuelPlayer[] old = m_Players; - m_Players = new DuelPlayer[count]; + DuelPlayer[] old = Players; + Players = new DuelPlayer[count]; if ( old != null ) { @@ -197,14 +193,14 @@ namespace Server.Engines.ConPVP for ( int i = 0; i < old.Length; ++i ) { if ( old[i] != null && ct < count ) - m_Players[ct++] = old[i]; + Players[ct++] = old[i]; } } } public Participant( DuelContext context, int count ) { - m_Context = context; + Context = context; //m_Stakes = new StakesContainer( context, this ); Resize( count ); } @@ -212,25 +208,20 @@ namespace Server.Engines.ConPVP public class DuelPlayer { - private Mobile m_Mobile; private bool m_Eliminated; - private bool m_Ready; - private Participant m_Participant; - public Mobile Mobile => m_Mobile; - public bool Ready{ get => m_Ready; - set => m_Ready = value; - } + public Mobile Mobile { get; } + + public bool Ready { get; set; } + public bool Eliminated{ get => m_Eliminated; - set{ m_Eliminated = value; if ( m_Participant.Context.m_Tournament != null && m_Eliminated ){ m_Participant.Context.m_Tournament.OnEliminated( this ); m_Mobile.SendEverything(); } } } - public Participant Participant{ get => m_Participant; - set => m_Participant = value; - } + set{ m_Eliminated = value; if ( Participant.Context.m_Tournament != null && m_Eliminated ){ Participant.Context.m_Tournament.OnEliminated( this ); Mobile.SendEverything(); } } } + public Participant Participant { get; set; } public DuelPlayer( Mobile mob, Participant p ) { - m_Mobile = mob; - m_Participant = p; + Mobile = mob; + Participant = p; if ( mob is PlayerMobile mobile ) mobile.DuelPlayer = this; diff --git a/Scripts/Engines/ConPVP/ParticipantGump.cs b/Scripts/Engines/ConPVP/ParticipantGump.cs index 26672460d..401965f03 100644 --- a/Scripts/Engines/ConPVP/ParticipantGump.cs +++ b/Scripts/Engines/ConPVP/ParticipantGump.cs @@ -8,13 +8,11 @@ namespace Server.Engines.ConPVP { public class ParticipantGump : Gump { - private Mobile m_From; - private DuelContext m_Context; - private Participant m_Participant; + public Mobile From { get; } - public Mobile From => m_From; - public DuelContext Context => m_Context; - public Participant Participant => m_Participant; + public DuelContext Context { get; } + + public Participant Participant { get; } public string Center( string text ) { @@ -35,9 +33,9 @@ namespace Server.Engines.ConPVP public ParticipantGump( Mobile from, DuelContext context, Participant p ) : base( 50, 50 ) { - m_From = from; - m_Context = context; - m_Participant = p; + From = from; + Context = context; + Participant = p; from.CloseGump( typeof( RulesetGump ) ); from.CloseGump( typeof( DuelContextGump ) ); @@ -81,54 +79,54 @@ namespace Server.Engines.ConPVP public override void OnResponse( NetState sender, RelayInfo info ) { - if ( !m_Context.Registered ) + if ( !Context.Registered ) return; int bid = info.ButtonID; if ( bid == 0 ) { - m_From.SendGump( new DuelContextGump( m_From, m_Context ) ); + From.SendGump( new DuelContextGump( From, Context ) ); } else if ( bid == 1 ) { - if ( m_Participant.Count < 8 ) - m_Participant.Resize( m_Participant.Count + 1 ); + if ( Participant.Count < 8 ) + Participant.Resize( Participant.Count + 1 ); else - m_From.SendMessage( "You may not raise the team size any further." ); + From.SendMessage( "You may not raise the team size any further." ); - m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) ); + From.SendGump( new ParticipantGump( From, Context, Participant ) ); } else if ( bid == 2 ) { - if ( m_Participant.Count > 1 && m_Participant.Count > m_Participant.FilledSlots ) - m_Participant.Resize( m_Participant.Count - 1 ); + if ( Participant.Count > 1 && Participant.Count > Participant.FilledSlots ) + Participant.Resize( Participant.Count - 1 ); else - m_From.SendMessage( "You may not lower the team size any further." ); + From.SendMessage( "You may not lower the team size any further." ); - m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) ); + From.SendGump( new ParticipantGump( From, Context, Participant ) ); } else if ( bid == 3 ) { - if ( m_Participant.FilledSlots > 0 ) + if ( Participant.FilledSlots > 0 ) { - m_From.SendMessage( "There is at least one currently active player. You must remove them first." ); - m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) ); + From.SendMessage( "There is at least one currently active player. You must remove them first." ); + From.SendGump( new ParticipantGump( From, Context, Participant ) ); } - else if ( m_Context.Participants.Count > 2 ) + else if ( Context.Participants.Count > 2 ) { /*Container cont = m_Participant.Stakes; if ( cont != null ) cont.Delete();*/ - m_Context.Participants.Remove( m_Participant ); - m_From.SendGump( new DuelContextGump( m_From, m_Context ) ); + Context.Participants.Remove( Participant ); + From.SendGump( new DuelContextGump( From, Context ) ); } else { - m_From.SendMessage( "Duels must have at least two participating parties." ); - m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) ); + From.SendMessage( "Duels must have at least two participating parties." ); + From.SendGump( new ParticipantGump( From, Context, Participant ) ); } } /*else if ( bid == 4 ) @@ -155,23 +153,23 @@ namespace Server.Engines.ConPVP { bid -= 5; - if ( bid >= 0 && bid < m_Participant.Players.Length ) + if ( bid >= 0 && bid < Participant.Players.Length ) { - if ( m_Participant.Players[bid] == null ) + if ( Participant.Players[bid] == null ) { - m_From.Target = new ParticipantTarget( m_Context, m_Participant, bid ); - m_From.SendMessage( "Target a player." ); + From.Target = new ParticipantTarget( Context, Participant, bid ); + From.SendMessage( "Target a player." ); } else { - m_Participant.Players[bid].Mobile.SendMessage( "You have been removed from the duel." ); + Participant.Players[bid].Mobile.SendMessage( "You have been removed from the duel." ); - if ( m_Participant.Players[bid].Mobile is PlayerMobile ) - ((PlayerMobile)(m_Participant.Players[bid].Mobile)).DuelPlayer = null; + if ( Participant.Players[bid].Mobile is PlayerMobile ) + ((PlayerMobile)(Participant.Players[bid].Mobile)).DuelPlayer = null; - m_Participant.Players[bid] = null; - m_From.SendMessage( "They have been removed from the duel." ); - m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) ); + Participant.Players[bid] = null; + From.SendMessage( "They have been removed from the duel." ); + From.SendGump( new ParticipantGump( From, Context, Participant ) ); } } } diff --git a/Scripts/Engines/ConPVP/Preferences.cs b/Scripts/Engines/ConPVP/Preferences.cs index aa5dc2c81..458c95a2a 100644 --- a/Scripts/Engines/ConPVP/Preferences.cs +++ b/Scripts/Engines/ConPVP/Preferences.cs @@ -69,10 +69,9 @@ namespace Server.Engines.ConPVP public class Preferences { - private ArrayList m_Entries; private Hashtable m_Table; - public ArrayList Entries => m_Entries; + public ArrayList Entries { get; } public PreferencesEntry Find( Mobile mob ) { @@ -81,22 +80,18 @@ namespace Server.Engines.ConPVP if ( entry == null ) { m_Table[mob] = entry = new PreferencesEntry( mob, this ); - m_Entries.Add( entry ); + Entries.Add( entry ); } return entry; } - private static Preferences m_Instance; - - public static Preferences Instance{ get => m_Instance; - set => m_Instance = value; - } + public static Preferences Instance { get; set; } public Preferences() { m_Table = new Hashtable(); - m_Entries = new ArrayList(); + Entries = new ArrayList(); } public Preferences( GenericReader reader ) @@ -110,7 +105,7 @@ namespace Server.Engines.ConPVP int count = reader.ReadEncodedInt(); m_Table = new Hashtable( count ); - m_Entries = new ArrayList( count ); + Entries = new ArrayList( count ); for ( int i = 0; i < count; ++i ) { @@ -119,7 +114,7 @@ namespace Server.Engines.ConPVP if ( entry.Mobile != null ) { m_Table[entry.Mobile] = entry; - m_Entries.Add( entry ); + Entries.Add( entry ); } } @@ -132,27 +127,26 @@ namespace Server.Engines.ConPVP { writer.WriteEncodedInt( (int) 0 ); // version; - writer.WriteEncodedInt( (int) m_Entries.Count ); + writer.WriteEncodedInt( (int) Entries.Count ); - for ( int i = 0; i < m_Entries.Count; ++i ) - ((PreferencesEntry)m_Entries[i]).Serialize( writer ); + for ( int i = 0; i < Entries.Count; ++i ) + ((PreferencesEntry)Entries[i]).Serialize( writer ); } } public class PreferencesEntry { - private Mobile m_Mobile; - private ArrayList m_Disliked; private Preferences m_Preferences; - public Mobile Mobile => m_Mobile; - public ArrayList Disliked => m_Disliked; + public Mobile Mobile { get; } + + public ArrayList Disliked { get; } public PreferencesEntry( Mobile mob, Preferences prefs ) { m_Preferences = prefs; - m_Mobile = mob; - m_Disliked = new ArrayList(); + Mobile = mob; + Disliked = new ArrayList(); } public PreferencesEntry( GenericReader reader, Preferences prefs, int version ) @@ -163,14 +157,14 @@ namespace Server.Engines.ConPVP { case 0: { - m_Mobile = reader.ReadMobile(); + Mobile = reader.ReadMobile(); int count = reader.ReadEncodedInt(); - m_Disliked = new ArrayList( count ); + Disliked = new ArrayList( count ); for ( int i = 0; i < count; ++i ) - m_Disliked.Add( reader.ReadString() ); + Disliked.Add( reader.ReadString() ); break; } @@ -179,12 +173,12 @@ namespace Server.Engines.ConPVP public void Serialize( GenericWriter writer ) { - writer.Write( (Mobile) m_Mobile ); + writer.Write( (Mobile) Mobile ); - writer.WriteEncodedInt( (int) m_Disliked.Count ); + writer.WriteEncodedInt( (int) Disliked.Count ); - for ( int i = 0; i < m_Disliked.Count; ++i ) - writer.Write( (string) m_Disliked[i] ); + for ( int i = 0; i < Disliked.Count; ++i ) + writer.Write( (string) Disliked[i] ); } } diff --git a/Scripts/Engines/ConPVP/Ruleset.cs b/Scripts/Engines/ConPVP/Ruleset.cs index 53e50e033..a7241d06d 100644 --- a/Scripts/Engines/ConPVP/Ruleset.cs +++ b/Scripts/Engines/ConPVP/Ruleset.cs @@ -4,106 +4,98 @@ namespace Server.Engines.ConPVP { public class Ruleset { - private RulesetLayout m_Layout; - private BitArray m_Options; - private string m_Title; + public RulesetLayout Layout { get; } - private Ruleset m_Base; - private ArrayList m_Flavors = new ArrayList(); - private bool m_Changed; + public BitArray Options { get; private set; } - public RulesetLayout Layout => m_Layout; - public BitArray Options => m_Options; - public string Title{ get => m_Title; - set => m_Title = value; - } + public string Title { get; set; } - public Ruleset Base => m_Base; - public ArrayList Flavors => m_Flavors; - public bool Changed{ get => m_Changed; - set => m_Changed = value; - } + public Ruleset Base { get; private set; } + + public ArrayList Flavors { get; } = new ArrayList(); + + public bool Changed { get; set; } public void ApplyDefault( Ruleset newDefault ) { - m_Base = newDefault; - m_Changed = false; + Base = newDefault; + Changed = false; - m_Options = new BitArray( newDefault.m_Options ); + Options = new BitArray( newDefault.Options ); ApplyFlavorsTo( this ); } public void ApplyFlavorsTo( Ruleset ruleset ) { - for ( int i = 0; i < m_Flavors.Count; ++i ) + for ( int i = 0; i < Flavors.Count; ++i ) { - Ruleset flavor = (Ruleset)m_Flavors[i]; + Ruleset flavor = (Ruleset)Flavors[i]; - m_Options.Or( flavor.m_Options ); + Options.Or( flavor.Options ); } } public void AddFlavor( Ruleset flavor ) { - if ( m_Flavors.Contains( flavor ) ) + if ( Flavors.Contains( flavor ) ) return; - m_Flavors.Add( flavor ); - m_Options.Or( flavor.m_Options ); + Flavors.Add( flavor ); + Options.Or( flavor.Options ); } public void RemoveFlavor( Ruleset flavor ) { - if ( !m_Flavors.Contains( flavor ) ) + if ( !Flavors.Contains( flavor ) ) return; - m_Flavors.Remove( flavor ); - m_Options.And( flavor.m_Options.Not() ); - flavor.m_Options.Not(); + Flavors.Remove( flavor ); + Options.And( flavor.Options.Not() ); + flavor.Options.Not(); } public void SetOptionRange( string title, bool value ) { - RulesetLayout layout = m_Layout.FindByTitle( title ); + RulesetLayout layout = Layout.FindByTitle( title ); if ( layout == null ) return; for ( int i = 0; i < layout.TotalLength; ++i ) - m_Options[i + layout.Offset] = value; + Options[i + layout.Offset] = value; - m_Changed = true; + Changed = true; } public bool GetOption( string title, string option ) { int index = 0; - RulesetLayout layout = m_Layout.FindByOption( title, option, ref index ); + RulesetLayout layout = Layout.FindByOption( title, option, ref index ); if ( layout == null ) return true; - return m_Options[layout.Offset + index]; + return Options[layout.Offset + index]; } public void SetOption( string title, string option, bool value ) { int index = 0; - RulesetLayout layout = m_Layout.FindByOption( title, option, ref index ); + RulesetLayout layout = Layout.FindByOption( title, option, ref index ); if ( layout == null ) return; - m_Options[layout.Offset + index] = value; + Options[layout.Offset + index] = value; - m_Changed = true; + Changed = true; } public Ruleset( RulesetLayout layout ) { - m_Layout = layout; - m_Options = new BitArray( layout.TotalLength ); + Layout = layout; + Options = new BitArray( layout.TotalLength ); } } } \ No newline at end of file diff --git a/Scripts/Engines/ConPVP/RulesetLayout.cs b/Scripts/Engines/ConPVP/RulesetLayout.cs index 3d6063504..9c894d48f 100644 --- a/Scripts/Engines/ConPVP/RulesetLayout.cs +++ b/Scripts/Engines/ConPVP/RulesetLayout.cs @@ -649,42 +649,32 @@ namespace Server.Engines.ConPVP } } - private string m_Title, m_Description; - private string[] m_Options; + public string Title { get; } - private int m_Offset, m_TotalLength; + public string Description { get; } - private Ruleset[] m_Defaults; - private Ruleset[] m_Flavors; + public string[] Options { get; } - private RulesetLayout m_Parent; - private RulesetLayout[] m_Children; + public int Offset { get; private set; } - public string Title => m_Title; - public string Description => m_Description; - public string[] Options => m_Options; + public int TotalLength { get; private set; } - public int Offset => m_Offset; - public int TotalLength => m_TotalLength; + public RulesetLayout Parent { get; private set; } - public RulesetLayout Parent => m_Parent; - public RulesetLayout[] Children => m_Children; + public RulesetLayout[] Children { get; } - public Ruleset[] Defaults{ get => m_Defaults; - set => m_Defaults = value; - } - public Ruleset[] Flavors{ get => m_Flavors; - set => m_Flavors = value; - } + public Ruleset[] Defaults { get; set; } + + public Ruleset[] Flavors { get; set; } public RulesetLayout FindByTitle( string title ) { - if ( m_Title == title ) + if ( Title == title ) return this; - for ( int i = 0; i < m_Children.Length; ++i ) + for ( int i = 0; i < Children.Length; ++i ) { - RulesetLayout layout = m_Children[i].FindByTitle( title ); + RulesetLayout layout = Children[i].FindByTitle( title ); if ( layout != null ) return layout; @@ -695,12 +685,12 @@ namespace Server.Engines.ConPVP public string FindByIndex( int index ) { - if ( index >= m_Offset && index < (m_Offset + m_Options.Length) ) - return m_Description + ": " + m_Options[index - m_Offset]; + if ( index >= Offset && index < (Offset + Options.Length) ) + return Description + ": " + Options[index - Offset]; - for ( int i = 0; i < m_Children.Length; ++i ) + for ( int i = 0; i < Children.Length; ++i ) { - string opt = m_Children[i].FindByIndex( index ); + string opt = Children[i].FindByIndex( index ); if ( opt != null ) return opt; @@ -711,7 +701,7 @@ namespace Server.Engines.ConPVP public RulesetLayout FindByOption( string title, string option, ref int index ) { - if ( title == null || m_Title == title ) + if ( title == null || Title == title ) { index = GetOptionIndex( option ); @@ -721,9 +711,9 @@ namespace Server.Engines.ConPVP title = null; } - for ( int i = 0; i < m_Children.Length; ++i ) + for ( int i = 0; i < Children.Length; ++i ) { - RulesetLayout layout = m_Children[i].FindByOption( title, option, ref index ); + RulesetLayout layout = Children[i].FindByOption( title, option, ref index ); if ( layout != null ) return layout; @@ -734,7 +724,7 @@ namespace Server.Engines.ConPVP public int GetOptionIndex( string option ) { - return Array.IndexOf( m_Options, option ); + return Array.IndexOf( Options, option ); } public void ComputeOffsets() @@ -746,15 +736,15 @@ namespace Server.Engines.ConPVP private int RecurseComputeOffsets( ref int offset ) { - m_Offset = offset; + Offset = offset; - offset += m_Options.Length; - m_TotalLength += m_Options.Length; + offset += Options.Length; + TotalLength += Options.Length; - for ( int i = 0; i < m_Children.Length; ++i ) - m_TotalLength += m_Children[i].RecurseComputeOffsets( ref offset ); + for ( int i = 0; i < Children.Length; ++i ) + TotalLength += Children[i].RecurseComputeOffsets( ref offset ); - return m_TotalLength; + return TotalLength; } public RulesetLayout( string title, string[] options ) : this( title, title, new RulesetLayout[0], options ) @@ -779,13 +769,13 @@ namespace Server.Engines.ConPVP public RulesetLayout( string title, string description, RulesetLayout[] children, string[] options ) { - m_Title = title; - m_Description = description; - m_Children = children; - m_Options = options; + Title = title; + Description = description; + Children = children; + Options = options; for ( int i = 0; i < children.Length; ++i ) - children[i].m_Parent = this; + children[i].Parent = this; } } } diff --git a/Scripts/Engines/ConPVP/Tournament.cs b/Scripts/Engines/ConPVP/Tournament.cs index 23318f175..fcb024636 100644 --- a/Scripts/Engines/ConPVP/Tournament.cs +++ b/Scripts/Engines/ConPVP/Tournament.cs @@ -38,12 +38,8 @@ namespace Server.Engines.ConPVP public class TournamentRegistrar : Banker { - private TournamentController m_Tournament; - [CommandProperty( AccessLevel.GameMaster )] - public TournamentController Tournament{ get => m_Tournament; - set => m_Tournament = value; - } + public TournamentController Tournament { get; set; } [Constructible] public TournamentRegistrar() @@ -55,8 +51,8 @@ namespace Server.Engines.ConPVP { Tournament tourny = null; - if ( m_Tournament != null ) - tourny = m_Tournament.Tournament; + if ( Tournament != null ) + tourny = Tournament.Tournament; if ( tourny != null && tourny.Stage == TournamentStage.Signup ) PublicOverheadMessage( MessageType.Regular, 0x35, false, "Come one, come all! Do you aspire to be a fighter of great renown? Join this tournament and show the world your abilities." ); @@ -68,8 +64,8 @@ namespace Server.Engines.ConPVP Tournament tourny = null; - if ( m_Tournament != null ) - tourny = m_Tournament.Tournament; + if ( Tournament != null ) + tourny = Tournament.Tournament; if ( InRange( m, 4 ) && !InRange( oldLocation, 4 ) && tourny != null && tourny.Stage == TournamentStage.Signup && m.CanBeginAction( this ) ) { @@ -110,7 +106,7 @@ namespace Server.Engines.ConPVP writer.Write( (int) 0 ); - writer.Write( (Item) m_Tournament ); + writer.Write( (Item) Tournament ); } public override void Deserialize( GenericReader reader ) @@ -123,7 +119,7 @@ namespace Server.Engines.ConPVP { case 0: { - m_Tournament = reader.ReadItem() as TournamentController; + Tournament = reader.ReadItem() as TournamentController; break; } } @@ -134,18 +130,11 @@ namespace Server.Engines.ConPVP public class TournamentSignupItem : Item { - private TournamentController m_Tournament; - private Mobile m_Registrar; + [CommandProperty( AccessLevel.GameMaster )] + public TournamentController Tournament { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TournamentController Tournament{ get => m_Tournament; - set => m_Tournament = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public Mobile Registrar{ get => m_Registrar; - set => m_Registrar = value; - } + public Mobile Registrar { get; set; } public override string DefaultName => "tournament signup book"; @@ -163,27 +152,27 @@ namespace Server.Engines.ConPVP } else { - Tournament tourny = m_Tournament?.Tournament; + Tournament tourny = Tournament?.Tournament; if ( tourny != null ) { - if ( m_Registrar != null ) - m_Registrar.Direction = m_Registrar.GetDirectionTo( this ); + if ( Registrar != null ) + Registrar.Direction = Registrar.GetDirectionTo( this ); switch ( tourny.Stage ) { case TournamentStage.Fighting: { - if ( m_Registrar != null ) + if ( Registrar != null ) { if ( tourny.HasParticipant( from ) ) { - m_Registrar.PrivateOverheadMessage( MessageType.Regular, + Registrar.PrivateOverheadMessage( MessageType.Regular, 0x35, false, "Excuse me? You are already signed up.", from.NetState ); } else { - m_Registrar.PrivateOverheadMessage( MessageType.Regular, + Registrar.PrivateOverheadMessage( MessageType.Regular, 0x22, false, "The tournament has already begun. You are too late to signup now.", from.NetState ); } } @@ -192,7 +181,7 @@ namespace Server.Engines.ConPVP } case TournamentStage.Inactive: { - m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + Registrar?.PrivateOverheadMessage( MessageType.Regular, 0x35, false, "The tournament is closed.", from.NetState ); break; @@ -204,7 +193,7 @@ namespace Server.Engines.ConPVP if ( entry != null && Ladder.GetLevel( entry.Experience ) < tourny.LevelRequirement ) { - m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + Registrar?.PrivateOverheadMessage( MessageType.Regular, 0x35, false, "You have not yet proven yourself a worthy dueler.", from.NetState ); break; @@ -212,7 +201,7 @@ namespace Server.Engines.ConPVP if ( tourny.IsFactionRestricted && Faction.Find( from ) == null ) { - m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + Registrar?.PrivateOverheadMessage( MessageType.Regular, 0x35, false, "Only those who have declared their faction allegiance may participate.", from.NetState ); break; @@ -220,17 +209,17 @@ namespace Server.Engines.ConPVP if ( from.HasGump( typeof( AcceptTeamGump ) ) ) { - m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + Registrar?.PrivateOverheadMessage( MessageType.Regular, 0x22, false, "You must first respond to the offer I've given you.", from.NetState ); } else if ( from.HasGump( typeof( AcceptDuelGump ) ) ) { - m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + Registrar?.PrivateOverheadMessage( MessageType.Regular, 0x22, false, "You must first cancel your duel offer.", from.NetState ); } else if ( from is PlayerMobile mobile && mobile.DuelContext != null ) { - m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + Registrar?.PrivateOverheadMessage( MessageType.Regular, 0x22, false, "You are already participating in a duel.", mobile.NetState ); } else if ( !tourny.HasParticipant( from ) ) @@ -238,11 +227,11 @@ namespace Server.Engines.ConPVP ArrayList players = new ArrayList(); players.Add(from); from.CloseGump( typeof( ConfirmSignupGump ) ); - from.SendGump( new ConfirmSignupGump( from, m_Registrar, tourny, players ) ); + from.SendGump( new ConfirmSignupGump( from, Registrar, tourny, players ) ); } else { - m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + Registrar?.PrivateOverheadMessage( MessageType.Regular, 0x35, false, "You have already entered this tournament.", from.NetState ); } @@ -263,8 +252,8 @@ namespace Server.Engines.ConPVP writer.Write( (int) 0 ); - writer.Write( (Item) m_Tournament ); - writer.Write( (Mobile) m_Registrar ); + writer.Write( (Item) Tournament ); + writer.Write( (Mobile) Registrar ); } public override void Deserialize( GenericReader reader ) @@ -277,8 +266,8 @@ namespace Server.Engines.ConPVP { case 0: { - m_Tournament = reader.ReadItem() as TournamentController; - m_Registrar = reader.ReadMobile(); + Tournament = reader.ReadItem() as TournamentController; + Registrar = reader.ReadMobile(); break; } } @@ -1331,81 +1320,28 @@ namespace Server.Engines.ConPVP { private int m_ParticipantsPerMatch; private int m_PlayersPerParticipant; - private int m_LevelRequirement; - private bool m_FactionRestricted; - - private TournyPyramid m_Pyramid; - private Ruleset m_Ruleset; - - private ArrayList m_Arenas; - private ArrayList m_Participants; - private ArrayList m_Undefeated; - - private TimeSpan m_SignupPeriod; - private DateTime m_SignupStart; - - private TournamentStage m_Stage; - - private GroupingType m_GroupType; - private TieType m_TieType; - private TimeSpan m_SuddenDeath; - - private TournyType m_TournyType; - - private int m_SuddenDeathRounds; - - private EventController m_EventController; - - public bool IsNotoRestricted => ( m_TournyType != TournyType.Standard ); + public bool IsNotoRestricted => ( TournyType != TournyType.Standard ); [CommandProperty( AccessLevel.GameMaster )] - public EventController EventController - { - get => m_EventController; - set => m_EventController = value; - } + public EventController EventController { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int SuddenDeathRounds - { - get => m_SuddenDeathRounds; - set => m_SuddenDeathRounds = value; - } + public int SuddenDeathRounds { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TournyType TournyType - { - get => m_TournyType; - set => m_TournyType = value; - } + public TournyType TournyType { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public GroupingType GroupType - { - get => m_GroupType; - set => m_GroupType = value; - } + public GroupingType GroupType { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TieType TieType - { - get => m_TieType; - set => m_TieType = value; - } + public TieType TieType { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan SuddenDeath - { - get => m_SuddenDeath; - set => m_SuddenDeath = value; - } + public TimeSpan SuddenDeath { get; set; } - public Ruleset Ruleset - { - get => m_Ruleset; - set => m_Ruleset = value; - } + public Ruleset Ruleset { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int ParticipantsPerMatch @@ -1422,73 +1358,41 @@ namespace Server.Engines.ConPVP } [CommandProperty( AccessLevel.GameMaster )] - public int LevelRequirement - { - get => m_LevelRequirement; - set => m_LevelRequirement = value; - } + public int LevelRequirement { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool FactionRestricted - { - get => m_FactionRestricted; - set => m_FactionRestricted = value; - } + public bool FactionRestricted { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan SignupPeriod - { - get => m_SignupPeriod; - set => m_SignupPeriod = value; - } + public TimeSpan SignupPeriod { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime SignupStart - { - get => m_SignupStart; - set => m_SignupStart = value; - } + public DateTime SignupStart { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TournamentStage CurrentStage => m_Stage; + public TournamentStage CurrentStage { get; private set; } public TournamentStage Stage { - get => m_Stage; - set => m_Stage = value; + get => CurrentStage; + set => CurrentStage = value; } - public TournyPyramid Pyramid - { - get => m_Pyramid; - set => m_Pyramid = value; - } + public TournyPyramid Pyramid { get; set; } - public ArrayList Arenas - { - get => m_Arenas; - set => m_Arenas = value; - } + public ArrayList Arenas { get; set; } - public ArrayList Participants - { - get => m_Participants; - set => m_Participants = value; - } + public ArrayList Participants { get; set; } - public ArrayList Undefeated - { - get => m_Undefeated; - set => m_Undefeated = value; - } + public ArrayList Undefeated { get; set; } - public bool IsFactionRestricted => ( m_FactionRestricted || m_TournyType == TournyType.Faction ); + public bool IsFactionRestricted => ( FactionRestricted || TournyType == TournyType.Faction ); public bool HasParticipant( Mobile mob ) { - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - TournyParticipant part = (TournyParticipant)m_Participants[i]; + TournyParticipant part = (TournyParticipant)Participants[i]; if ( part.Players.Contains( mob ) ) return true; @@ -1501,21 +1405,21 @@ namespace Server.Engines.ConPVP { writer.WriteEncodedInt( (int) 5 ); // version - writer.Write( (bool) m_FactionRestricted ); + writer.Write( (bool) FactionRestricted ); - writer.Write( (Item) m_EventController ); + writer.Write( (Item) EventController ); - writer.WriteEncodedInt( (int) m_SuddenDeathRounds ); + writer.WriteEncodedInt( (int) SuddenDeathRounds ); - writer.WriteEncodedInt( (int) m_TournyType ); + writer.WriteEncodedInt( (int) TournyType ); - writer.WriteEncodedInt( (int) m_GroupType ); - writer.WriteEncodedInt( (int) m_TieType ); - writer.Write( (TimeSpan) m_SuddenDeath ); + writer.WriteEncodedInt( (int) GroupType ); + writer.WriteEncodedInt( (int) TieType ); + writer.Write( (TimeSpan) SuddenDeath ); writer.WriteEncodedInt( (int) m_ParticipantsPerMatch ); writer.WriteEncodedInt( (int) m_PlayersPerParticipant ); - writer.Write( (TimeSpan) m_SignupPeriod ); + writer.Write( (TimeSpan) SignupPeriod ); } public Tournament( GenericReader reader ) @@ -1525,51 +1429,51 @@ namespace Server.Engines.ConPVP switch ( version ) { case 5: { - m_FactionRestricted = reader.ReadBool(); + FactionRestricted = reader.ReadBool(); goto case 4; } case 4: { - m_EventController = reader.ReadItem() as EventController; + EventController = reader.ReadItem() as EventController; goto case 3; } case 3: { - m_SuddenDeathRounds = reader.ReadEncodedInt(); + SuddenDeathRounds = reader.ReadEncodedInt(); goto case 2; } case 2: { - m_TournyType = (TournyType)reader.ReadEncodedInt(); + TournyType = (TournyType)reader.ReadEncodedInt(); goto case 1; } case 1: { - m_GroupType = (GroupingType)reader.ReadEncodedInt(); - m_TieType = (TieType)reader.ReadEncodedInt(); - m_SignupPeriod = reader.ReadTimeSpan(); + GroupType = (GroupingType)reader.ReadEncodedInt(); + TieType = (TieType)reader.ReadEncodedInt(); + SignupPeriod = reader.ReadTimeSpan(); goto case 0; } case 0: { if ( version < 3 ) - m_SuddenDeathRounds = 3; + SuddenDeathRounds = 3; m_ParticipantsPerMatch = reader.ReadEncodedInt(); m_PlayersPerParticipant = reader.ReadEncodedInt(); - m_SignupPeriod = reader.ReadTimeSpan(); - m_Stage = TournamentStage.Inactive; - m_Pyramid = new TournyPyramid(); - m_Ruleset = new Ruleset( RulesetLayout.Root ); - m_Ruleset.ApplyDefault( m_Ruleset.Layout.Defaults[0] ); - m_Participants = new ArrayList(); - m_Undefeated = new ArrayList(); - m_Arenas = new ArrayList(); + SignupPeriod = reader.ReadTimeSpan(); + CurrentStage = TournamentStage.Inactive; + Pyramid = new TournyPyramid(); + Ruleset = new Ruleset( RulesetLayout.Root ); + Ruleset.ApplyDefault( Ruleset.Layout.Defaults[0] ); + Participants = new ArrayList(); + Undefeated = new ArrayList(); + Arenas = new ArrayList(); break; } @@ -1582,13 +1486,13 @@ namespace Server.Engines.ConPVP { m_ParticipantsPerMatch = 2; m_PlayersPerParticipant = 1; - m_Pyramid = new TournyPyramid(); - m_Ruleset = new Ruleset( RulesetLayout.Root ); - m_Ruleset.ApplyDefault( m_Ruleset.Layout.Defaults[0] ); - m_Participants = new ArrayList(); - m_Undefeated = new ArrayList(); - m_Arenas = new ArrayList(); - m_SignupPeriod = TimeSpan.FromMinutes( 10.0 ); + Pyramid = new TournyPyramid(); + Ruleset = new Ruleset( RulesetLayout.Root ); + Ruleset.ApplyDefault( Ruleset.Layout.Defaults[0] ); + Participants = new ArrayList(); + Undefeated = new ArrayList(); + Arenas = new ArrayList(); + SignupPeriod = TimeSpan.FromMinutes( 10.0 ); Timer.DelayCall( SliceInterval, SliceInterval, Slice ); } @@ -1633,7 +1537,7 @@ namespace Server.Engines.ConPVP } else { - m_Undefeated.Remove( part ); + Undefeated.Remove( part ); } } @@ -1641,12 +1545,12 @@ namespace Server.Engines.ConPVP string whole = ( remaining.Count == 2 ? "both" : "all" ); - TieType tieType = m_TieType; + TieType tieType = TieType; - if ( tieType == TieType.FullElimination && remaining.Count >= m_Undefeated.Count ) + if ( tieType == TieType.FullElimination && remaining.Count >= Undefeated.Count ) tieType = TieType.FullAdvancement; - switch ( m_TieType ) + switch ( TieType ) { case TieType.FullAdvancement: { @@ -1656,7 +1560,7 @@ namespace Server.Engines.ConPVP case TieType.FullElimination: { for ( int j = 0; j < remaining.Count; ++j ) - m_Undefeated.Remove( remaining[j] ); + Undefeated.Remove( remaining[j] ); sb.AppendFormat( "In accordance with the rules, {0} parties are eliminated.", whole ); break; @@ -1668,7 +1572,7 @@ namespace Server.Engines.ConPVP for ( int i = 0; i < remaining.Count; ++i ) { if ( remaining[i] != advanced ) - m_Undefeated.Remove( remaining[i] ); + Undefeated.Remove( remaining[i] ); } if ( advanced != null ) @@ -1691,7 +1595,7 @@ namespace Server.Engines.ConPVP for ( int i = 0; i < remaining.Count; ++i ) { if ( remaining[i] != advanced ) - m_Undefeated.Remove( remaining[i] ); + Undefeated.Remove( remaining[i] ); } if ( advanced != null ) @@ -1714,7 +1618,7 @@ namespace Server.Engines.ConPVP for ( int i = 0; i < remaining.Count; ++i ) { if ( remaining[i] != advanced ) - m_Undefeated.Remove( remaining[i] ); + Undefeated.Remove( remaining[i] ); } if ( advanced != null ) @@ -1734,7 +1638,7 @@ namespace Server.Engines.ConPVP if ( !part.Eliminated ) return; - if ( m_TournyType == TournyType.FreeForAll ) + if ( TournyType == TournyType.FreeForAll ) { int rem = 0; @@ -1782,7 +1686,7 @@ namespace Server.Engines.ConPVP if ( part == winner ) continue; - m_Undefeated.Remove( part ); + Undefeated.Remove( part ); if ( hasAppended ) sb.Append( ", " ); @@ -1793,7 +1697,7 @@ namespace Server.Engines.ConPVP sb.Append( "." ); - if ( m_TournyType == TournyType.Standard ) + if ( TournyType == TournyType.Standard ) Alert( arena, sb.ToString() ); } @@ -1801,19 +1705,19 @@ namespace Server.Engines.ConPVP private int ComputeCashAward() { - return m_Participants.Count * m_PlayersPerParticipant * 2500; + return Participants.Count * m_PlayersPerParticipant * 2500; } private void GiveAwards() { - switch ( m_TournyType ) + switch ( TournyType ) { case TournyType.FreeForAll: { - if ( m_Pyramid.Levels.Count < 1 ) + if ( Pyramid.Levels.Count < 1 ) break; - PyramidLevel top = m_Pyramid.Levels[m_Pyramid.Levels.Count - 1] as PyramidLevel; + PyramidLevel top = Pyramid.Levels[Pyramid.Levels.Count - 1] as PyramidLevel; if ( top.FreeAdvance != null || top.Matches.Count != 1 ) break; @@ -1828,10 +1732,10 @@ namespace Server.Engines.ConPVP } case TournyType.Standard: { - if ( m_Pyramid.Levels.Count < 2 ) + if ( Pyramid.Levels.Count < 2 ) break; - PyramidLevel top = m_Pyramid.Levels[m_Pyramid.Levels.Count - 1] as PyramidLevel; + PyramidLevel top = Pyramid.Levels[Pyramid.Levels.Count - 1] as PyramidLevel; if ( top.FreeAdvance != null || top.Matches.Count != 1 ) break; @@ -1851,7 +1755,7 @@ namespace Server.Engines.ConPVP GiveAwards( part.Players, TrophyRank.Silver, cash / 2 ); } - PyramidLevel next = m_Pyramid.Levels[m_Pyramid.Levels.Count - 2] as PyramidLevel; + PyramidLevel next = Pyramid.Levels[Pyramid.Levels.Count - 2] as PyramidLevel; if ( next.Matches.Count > 2 ) break; @@ -1889,22 +1793,22 @@ namespace Server.Engines.ConPVP StringBuilder sb = new StringBuilder(); - if ( m_TournyType == TournyType.FreeForAll ) + if ( TournyType == TournyType.FreeForAll ) { - sb.Append( m_Participants.Count * m_PlayersPerParticipant ); + sb.Append( Participants.Count * m_PlayersPerParticipant ); sb.Append( "-man FFA" ); } - else if ( m_TournyType == TournyType.RandomTeam ) + else if ( TournyType == TournyType.RandomTeam ) { sb.Append( m_ParticipantsPerMatch ); sb.Append( "-Team" ); } - else if ( m_TournyType == TournyType.Faction ) + else if ( TournyType == TournyType.Faction ) { sb.Append( m_ParticipantsPerMatch ); sb.Append( "-Team Faction" ); } - else if ( m_TournyType == TournyType.RedVsBlue ) + else if ( TournyType == TournyType.RedVsBlue ) { sb.Append( "Red v Blue" ); } @@ -1919,8 +1823,8 @@ namespace Server.Engines.ConPVP } } - if ( m_EventController != null ) - sb.Append( ' ' ).Append( m_EventController.Title ); + if ( EventController != null ) + sb.Append( ' ' ).Append( EventController.Title ); sb.Append( " Champion" ); @@ -1956,15 +1860,15 @@ namespace Server.Engines.ConPVP public void Slice() { - if ( m_Stage == TournamentStage.Signup ) + if ( CurrentStage == TournamentStage.Signup ) { - TimeSpan until = ( m_SignupStart + m_SignupPeriod ) - DateTime.UtcNow; + TimeSpan until = ( SignupStart + SignupPeriod ) - DateTime.UtcNow; if ( until <= TimeSpan.Zero ) { - for ( int i = m_Participants.Count - 1; i >= 0; --i ) + for ( int i = Participants.Count - 1; i >= 0; --i ) { - TournyParticipant part = (TournyParticipant)m_Participants[i]; + TournyParticipant part = (TournyParticipant)Participants[i]; bool bad = false; for ( int j = 0; j < part.Players.Count; ++j ) @@ -1983,29 +1887,29 @@ namespace Server.Engines.ConPVP for ( int j = 0; j < part.Players.Count; ++j ) ((Mobile)part.Players[j]).SendMessage( "You have been disqualified from the tournament." ); - m_Participants.RemoveAt( i ); + Participants.RemoveAt( i ); } } - if ( m_Participants.Count >= 2 ) + if ( Participants.Count >= 2 ) { - m_Stage = TournamentStage.Fighting; + CurrentStage = TournamentStage.Fighting; - m_Undefeated.Clear(); + Undefeated.Clear(); - m_Pyramid.Levels.Clear(); - m_Pyramid.AddLevel( m_ParticipantsPerMatch, m_Participants, m_GroupType, m_TournyType ); + Pyramid.Levels.Clear(); + Pyramid.AddLevel( m_ParticipantsPerMatch, Participants, GroupType, TournyType ); - PyramidLevel level = (PyramidLevel)m_Pyramid.Levels[0]; + PyramidLevel level = (PyramidLevel)Pyramid.Levels[0]; if ( level.FreeAdvance != null ) - m_Undefeated.Add( level.FreeAdvance ); + Undefeated.Add( level.FreeAdvance ); for ( int i = 0; i < level.Matches.Count; ++i ) { TournyMatch match = (TournyMatch)level.Matches[i]; - m_Undefeated.AddRange( match.Participants ); + Undefeated.AddRange( match.Participants ); } Alert( "Hear ye! Hear ye!", "The tournament will begin shortly." ); @@ -2016,7 +1920,7 @@ namespace Server.Engines.ConPVP m_SignupStart = DateTime.UtcNow;*/ Alert("Is this all?", "Pitiful. Tournament cancelled."); - m_Stage = TournamentStage.Inactive; + CurrentStage = TournamentStage.Inactive; } } else if ( Math.Abs( until.TotalSeconds - TimeSpan.FromMinutes( 1.0 ).TotalSeconds ) < (SliceInterval.TotalSeconds/2) ) @@ -2028,26 +1932,26 @@ namespace Server.Engines.ConPVP Alert( "The tournament will begin in 5 minutes.", "Sign up now before it's too late." ); } } - else if ( m_Stage == TournamentStage.Fighting ) + else if ( CurrentStage == TournamentStage.Fighting ) { - if ( m_Undefeated.Count == 1 ) + if ( Undefeated.Count == 1 ) { - TournyParticipant winner = (TournyParticipant)m_Undefeated[0]; + TournyParticipant winner = (TournyParticipant)Undefeated[0]; try { - if ( m_EventController != null ) + if ( EventController != null ) Alert( "The tournament has completed!", - $"Team {m_EventController.GetTeamName(((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner))} has won!"); - else if ( m_TournyType == TournyType.RandomTeam ) + $"Team {EventController.GetTeamName(((TournyMatch) ((PyramidLevel) Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner))} has won!"); + else if ( TournyType == TournyType.RandomTeam ) Alert( "The tournament has completed!", - $"Team {((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) + 1} has won!"); - else if ( m_TournyType == TournyType.Faction ) { + $"Team {((TournyMatch) ((PyramidLevel) Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) + 1} has won!"); + else if ( TournyType == TournyType.Faction ) { if ( m_ParticipantsPerMatch == 4 ) { string name = "(null)"; - switch ( ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) ) + switch ( ((TournyMatch)((PyramidLevel)Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) ) { case 0: { name = "Minax"; @@ -2072,17 +1976,17 @@ namespace Server.Engines.ConPVP else if ( m_ParticipantsPerMatch == 2 ) { Alert( "The tournament has completed!", - $"The {(((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) == 0 ? "Evil" : "Hero")} team has won!"); + $"The {(((TournyMatch) ((PyramidLevel) Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) == 0 ? "Evil" : "Hero")} team has won!"); } else { Alert( "The tournament has completed!", - $"Team {((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) + 1} has won!"); + $"Team {((TournyMatch) ((PyramidLevel) Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) + 1} has won!"); } } - else if ( m_TournyType == TournyType.RedVsBlue ) + else if ( TournyType == TournyType.RedVsBlue ) Alert( "The tournament has completed!", - $"Team {(((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) == 0 ? "Red" : "Blue")} has won!"); + $"Team {(((TournyMatch) ((PyramidLevel) Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) == 0 ? "Red" : "Blue")} has won!"); else Alert( "The tournament has completed!", $"{winner.NameList} {(winner.Players.Count > 1 ? "are" : "is")} the champion{(winner.Players.Count == 1 ? "" : "s")}."); @@ -2093,12 +1997,12 @@ namespace Server.Engines.ConPVP GiveAwards(); - m_Stage = TournamentStage.Inactive; - m_Undefeated.Clear(); + CurrentStage = TournamentStage.Inactive; + Undefeated.Clear(); } - else if ( m_Pyramid.Levels.Count > 0 ) + else if ( Pyramid.Levels.Count > 0 ) { - PyramidLevel activeLevel = (PyramidLevel)m_Pyramid.Levels[m_Pyramid.Levels.Count - 1]; + PyramidLevel activeLevel = (PyramidLevel)Pyramid.Levels[Pyramid.Levels.Count - 1]; bool stillGoing = false; for ( int i = 0; i < activeLevel.Matches.Count; ++i ) @@ -2111,9 +2015,9 @@ namespace Server.Engines.ConPVP if ( !match.InProgress ) { - for ( int j = 0; j < m_Arenas.Count; ++j ) + for ( int j = 0; j < Arenas.Count; ++j ) { - Arena arena = (Arena)m_Arenas[j]; + Arena arena = (Arena)Arenas[j]; if ( !arena.IsOccupied ) { @@ -2127,9 +2031,9 @@ namespace Server.Engines.ConPVP if ( !stillGoing ) { - for ( int i = m_Undefeated.Count - 1; i >= 0; --i ) + for ( int i = Undefeated.Count - 1; i >= 0; --i ) { - TournyParticipant part = (TournyParticipant)m_Undefeated[i]; + TournyParticipant part = (TournyParticipant)Undefeated[i]; bool bad = false; for ( int j = 0; j < part.Players.Count; ++j ) @@ -2148,26 +2052,26 @@ namespace Server.Engines.ConPVP for ( int j = 0; j < part.Players.Count; ++j ) ((Mobile)part.Players[j]).SendMessage( "You have been disqualified from the tournament." ); - m_Undefeated.RemoveAt( i ); + Undefeated.RemoveAt( i ); - if ( m_Undefeated.Count == 1 ) + if ( Undefeated.Count == 1 ) { - TournyParticipant winner = (TournyParticipant)m_Undefeated[0]; + TournyParticipant winner = (TournyParticipant)Undefeated[0]; try { - if ( m_EventController != null ) + if ( EventController != null ) Alert( "The tournament has completed!", - $"Team {m_EventController.GetTeamName(((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner))} has won"); - else if ( m_TournyType == TournyType.RandomTeam ) + $"Team {EventController.GetTeamName(((TournyMatch) ((PyramidLevel) Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner))} has won"); + else if ( TournyType == TournyType.RandomTeam ) Alert( "The tournament has completed!", - $"Team {((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) + 1} has won!"); - else if ( m_TournyType == TournyType.Faction ) { + $"Team {((TournyMatch) ((PyramidLevel) Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) + 1} has won!"); + else if ( TournyType == TournyType.Faction ) { if ( m_ParticipantsPerMatch == 4 ) { string name = "(null)"; - switch ( ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) ) + switch ( ((TournyMatch)((PyramidLevel)Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) ) { case 0: { name = "Minax"; @@ -2192,17 +2096,17 @@ namespace Server.Engines.ConPVP else if ( m_ParticipantsPerMatch == 2 ) { Alert( "The tournament has completed!", - $"The {(((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) == 0 ? "Evil" : "Hero")} team has won!"); + $"The {(((TournyMatch) ((PyramidLevel) Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) == 0 ? "Evil" : "Hero")} team has won!"); } else { Alert( "The tournament has completed!", - $"Team {((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) + 1} has won!"); + $"Team {((TournyMatch) ((PyramidLevel) Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) + 1} has won!"); } } - else if ( m_TournyType == TournyType.RedVsBlue ) + else if ( TournyType == TournyType.RedVsBlue ) Alert( "The tournament has completed!", - $"Team {(((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) == 0 ? "Red" : "Blue")} has won!"); + $"Team {(((TournyMatch) ((PyramidLevel) Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) == 0 ? "Red" : "Blue")} has won!"); else Alert( "The tournament has completed!", $"{winner.NameList} {(winner.Players.Count > 1 ? "are" : "is")} the champion{(winner.Players.Count == 1 ? "" : "s")}."); @@ -2213,15 +2117,15 @@ namespace Server.Engines.ConPVP GiveAwards(); - m_Stage = TournamentStage.Inactive; - m_Undefeated.Clear(); + CurrentStage = TournamentStage.Inactive; + Undefeated.Clear(); break; } } } - if ( m_Undefeated.Count > 1 ) - m_Pyramid.AddLevel( m_ParticipantsPerMatch, m_Undefeated, m_GroupType, m_TournyType ); + if ( Undefeated.Count > 1 ) + Pyramid.AddLevel( m_ParticipantsPerMatch, Undefeated, GroupType, TournyType ); } } } @@ -2229,8 +2133,8 @@ namespace Server.Engines.ConPVP public void Alert( params string[] alerts ) { - for ( int i = 0; i < m_Arenas.Count; ++i ) - Alert( (Arena) m_Arenas[i], alerts ); + for ( int i = 0; i < Arenas.Count; ++i ) + Alert( (Arena) Arenas[i], alerts ); } public void Alert( Arena arena, params string[] alerts ) @@ -2252,17 +2156,11 @@ namespace Server.Engines.ConPVP public class TournyPyramid { - private ArrayList m_Levels; - - public ArrayList Levels - { - get => m_Levels; - set => m_Levels = value; - } + public ArrayList Levels { get; set; } public TournyPyramid() { - m_Levels = new ArrayList(); + Levels = new ArrayList(); } public void AddLevel( int partsPerMatch, ArrayList participants, GroupingType groupType, TournyType tournyType ) @@ -2433,70 +2331,43 @@ namespace Server.Engines.ConPVP } } - m_Levels.Add( level ); + Levels.Add( level ); } } public class PyramidLevel { - private ArrayList m_Matches; - private TournyParticipant m_FreeAdvance; + public ArrayList Matches { get; set; } - public ArrayList Matches - { - get => m_Matches; - set => m_Matches = value; - } - - public TournyParticipant FreeAdvance - { - get => m_FreeAdvance; - set => m_FreeAdvance = value; - } + public TournyParticipant FreeAdvance { get; set; } public PyramidLevel() { - m_Matches = new ArrayList(); + Matches = new ArrayList(); } } public class TournyMatch { - private ArrayList m_Participants; - private TournyParticipant m_Winner; - private DuelContext m_Context; + public ArrayList Participants { get; set; } - public ArrayList Participants - { - get => m_Participants; - set => m_Participants = value; - } + public TournyParticipant Winner { get; set; } - public TournyParticipant Winner - { - get => m_Winner; - set => m_Winner = value; - } + public DuelContext Context { get; set; } - public DuelContext Context - { - get => m_Context; - set => m_Context = value; - } - - public bool InProgress => ( m_Context != null && m_Context.Registered ); + public bool InProgress => ( Context != null && Context.Registered ); public void Start( Arena arena, Tournament tourny ) { - TournyParticipant first = (TournyParticipant)m_Participants[0]; + TournyParticipant first = (TournyParticipant)Participants[0]; DuelContext dc = new DuelContext( (Mobile)first.Players[0], tourny.Ruleset.Layout, false ); dc.Ruleset.Options.SetAll(false); dc.Ruleset.Options.Or(tourny.Ruleset.Options); - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - TournyParticipant tournyPart = (TournyParticipant)m_Participants[i]; + TournyParticipant tournyPart = (TournyParticipant)Participants[i]; Participant duelPart = new Participant( dc, tournyPart.Players.Count ); duelPart.TournyPart = tournyPart; @@ -2528,11 +2399,11 @@ namespace Server.Engines.ConPVP if ( dc.StartedBeginCountdown ) { - m_Context = dc; + Context = dc; - for ( int i = 0; i < m_Participants.Count; ++i ) + for ( int i = 0; i < Participants.Count; ++i ) { - TournyParticipant p = (TournyParticipant)m_Participants[i]; + TournyParticipant p = (TournyParticipant)Participants[i]; for ( int j = 0; j < p.Players.Count; ++j ) { @@ -2557,7 +2428,7 @@ namespace Server.Engines.ConPVP public TournyMatch( ArrayList participants ) { - m_Participants = participants; + Participants = participants; for ( int i = 0; i < participants.Count; ++i ) { @@ -2593,27 +2464,11 @@ namespace Server.Engines.ConPVP public class TournyParticipant : IComparable { - private ArrayList m_Players; - private ArrayList m_Log; - private int m_FreeAdvances; + public ArrayList Players { get; set; } - public ArrayList Players - { - get => m_Players; - set => m_Players = value; - } + public ArrayList Log { get; set; } - public ArrayList Log - { - get => m_Log; - set => m_Log = value; - } - - public int FreeAdvances - { - get => m_FreeAdvances; - set => m_FreeAdvances = value; - } + public int FreeAdvances { get; set; } public int TotalLadderXP { @@ -2626,9 +2481,9 @@ namespace Server.Engines.ConPVP int total = 0; - for ( int i = 0; i < m_Players.Count; ++i ) + for ( int i = 0; i < Players.Count; ++i ) { - Mobile mob = (Mobile)m_Players[i]; + Mobile mob = (Mobile)Players[i]; LadderEntry entry = ladder.Find( mob ); if ( entry != null ) @@ -2645,18 +2500,18 @@ namespace Server.Engines.ConPVP { StringBuilder sb = new StringBuilder(); - for ( int i = 0; i < m_Players.Count; ++i ) + for ( int i = 0; i < Players.Count; ++i ) { - if ( m_Players[i] == null ) + if ( Players[i] == null ) continue; - Mobile mob = (Mobile) m_Players[i]; + Mobile mob = (Mobile) Players[i]; if ( sb.Length > 0 ) { - if ( m_Players.Count == 2 ) + if ( Players.Count == 2 ) sb.Append( " and " ); - else if ( (i+1) < m_Players.Count ) + else if ( (i+1) < Players.Count ) sb.Append( ", " ); else sb.Append( ", and " ); @@ -2674,7 +2529,7 @@ namespace Server.Engines.ConPVP public void AddLog( string text ) { - m_Log.Add( text ); + Log.Add( text ); } public void AddLog( string format, params object[] args ) @@ -2694,15 +2549,15 @@ namespace Server.Engines.ConPVP public TournyParticipant( Mobile owner ) { - m_Log = new ArrayList(); - m_Players = new ArrayList(); - m_Players.Add( owner ); + Log = new ArrayList(); + Players = new ArrayList(); + Players.Add( owner ); } public TournyParticipant( ArrayList players ) { - m_Log = new ArrayList(); - m_Players = players; + Log = new ArrayList(); + Players = players; } public int CompareTo( object obj ) @@ -3526,12 +3381,8 @@ namespace Server.Engines.ConPVP public class TournamentBracketItem : Item { - private TournamentController m_Tournament; - [CommandProperty( AccessLevel.GameMaster )] - public TournamentController Tournament{ get => m_Tournament; - set => m_Tournament = value; - } + public TournamentController Tournament { get; set; } public override string DefaultName => "tournament bracket"; @@ -3549,7 +3400,7 @@ namespace Server.Engines.ConPVP } else { - Tournament tourny = m_Tournament?.Tournament; + Tournament tourny = Tournament?.Tournament; if ( tourny != null ) { @@ -3574,7 +3425,7 @@ namespace Server.Engines.ConPVP writer.Write( (int) 0 ); - writer.Write( (Item) m_Tournament ); + writer.Write( (Item) Tournament ); } public override void Deserialize( GenericReader reader ) @@ -3587,7 +3438,7 @@ namespace Server.Engines.ConPVP { case 0: { - m_Tournament = reader.ReadItem() as TournamentController; + Tournament = reader.ReadItem() as TournamentController; break; } } diff --git a/Scripts/Engines/ConPVP/Trophy.cs b/Scripts/Engines/ConPVP/Trophy.cs index 49c2b1ff6..c65d5d858 100644 --- a/Scripts/Engines/ConPVP/Trophy.cs +++ b/Scripts/Engines/ConPVP/Trophy.cs @@ -12,34 +12,27 @@ namespace Server.Items [Flippable( 5020, 4647 )] public class Trophy : Item { - private string m_Title; private TrophyRank m_Rank; - private Mobile m_Owner; - private DateTime m_Date; [CommandProperty( AccessLevel.GameMaster )] - public string Title{ get => m_Title; - set => m_Title = value; - } + public string Title { get; set; } [CommandProperty( AccessLevel.GameMaster )] public TrophyRank Rank{ get => m_Rank; set{ m_Rank = value; UpdateStyle(); } } [CommandProperty( AccessLevel.GameMaster )] - public Mobile Owner{ get => m_Owner; - set => m_Owner = value; - } + public Mobile Owner { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime Date => m_Date; + public DateTime Date { get; private set; } [Constructible] public Trophy( string title, TrophyRank rank ) : base( 5020 ) { - m_Title = title; + Title = title; m_Rank = rank; - m_Date = DateTime.UtcNow; + Date = DateTime.UtcNow; LootType = LootType.Blessed; @@ -56,10 +49,10 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (string) m_Title ); + writer.Write( (string) Title ); writer.Write( (int) m_Rank ); - writer.Write( (Mobile) m_Owner ); - writer.Write( (DateTime) m_Date ); + writer.Write( (Mobile) Owner ); + writer.Write( (DateTime) Date ); } public override void Deserialize( GenericReader reader ) @@ -68,10 +61,10 @@ namespace Server.Items int version = reader.ReadInt(); - m_Title = reader.ReadString(); + Title = reader.ReadString(); m_Rank = (TrophyRank) reader.ReadInt(); - m_Owner = reader.ReadMobile(); - m_Date = reader.ReadDateTime(); + Owner = reader.ReadMobile(); + Date = reader.ReadDateTime(); if ( version == 0 ) LootType = LootType.Blessed; @@ -81,21 +74,21 @@ namespace Server.Items { base.OnAdded( parent ); - if ( m_Owner == null ) - m_Owner = RootParent as Mobile; + if ( Owner == null ) + Owner = RootParent as Mobile; } public override void OnSingleClick( Mobile from ) { base.OnSingleClick( from ); - if ( m_Owner != null ) - LabelTo( from, "{0} -- {1}", m_Title, m_Owner.RawName ); - else if ( m_Title != null ) - LabelTo( from, m_Title ); + if ( Owner != null ) + LabelTo( from, "{0} -- {1}", Title, Owner.RawName ); + else if ( Title != null ) + LabelTo( from, Title ); - if ( m_Date != DateTime.MinValue ) - LabelTo( from, m_Date.ToString( "d" ) ); + if ( Date != DateTime.MinValue ) + LabelTo( from, Date.ToString( "d" ) ); } public void UpdateStyle() diff --git a/Scripts/Engines/Craft/Core/CraftContext.cs b/Scripts/Engines/Craft/Core/CraftContext.cs index 2310016dd..60c8c5c1b 100644 --- a/Scripts/Engines/Craft/Core/CraftContext.cs +++ b/Scripts/Engines/Craft/Core/CraftContext.cs @@ -11,44 +11,32 @@ namespace Server.Engines.Craft public class CraftContext { - private List m_Items; - private int m_LastResourceIndex; - private int m_LastResourceIndex2; - private int m_LastGroupIndex; - private bool m_DoNotColor; - private CraftMarkOption m_MarkOption; + public List Items { get; } - public List Items => m_Items; - public int LastResourceIndex{ get => m_LastResourceIndex; - set => m_LastResourceIndex = value; - } - public int LastResourceIndex2{ get => m_LastResourceIndex2; - set => m_LastResourceIndex2 = value; - } - public int LastGroupIndex{ get => m_LastGroupIndex; - set => m_LastGroupIndex = value; - } - public bool DoNotColor{ get => m_DoNotColor; - set => m_DoNotColor = value; - } - public CraftMarkOption MarkOption{ get => m_MarkOption; - set => m_MarkOption = value; - } + public int LastResourceIndex { get; set; } + + public int LastResourceIndex2 { get; set; } + + public int LastGroupIndex { get; set; } + + public bool DoNotColor { get; set; } + + public CraftMarkOption MarkOption { get; set; } public CraftContext() { - m_Items = new List(); - m_LastResourceIndex = -1; - m_LastResourceIndex2 = -1; - m_LastGroupIndex = -1; + Items = new List(); + LastResourceIndex = -1; + LastResourceIndex2 = -1; + LastGroupIndex = -1; } public CraftItem LastMade { get { - if ( m_Items.Count > 0 ) - return m_Items[0]; + if ( Items.Count > 0 ) + return Items[0]; return null; } @@ -56,12 +44,12 @@ namespace Server.Engines.Craft public void OnMade( CraftItem item ) { - m_Items.Remove( item ); + Items.Remove( item ); - if ( m_Items.Count == 10 ) - m_Items.RemoveAt( 9 ); + if ( Items.Count == 10 ) + Items.RemoveAt( 9 ); - m_Items.Insert( 0, item ); + Items.Insert( 0, item ); } } } diff --git a/Scripts/Engines/Craft/Core/CraftGroup.cs b/Scripts/Engines/Craft/Core/CraftGroup.cs index c79398817..72755ff5b 100644 --- a/Scripts/Engines/Craft/Core/CraftGroup.cs +++ b/Scripts/Engines/Craft/Core/CraftGroup.cs @@ -2,27 +2,22 @@ namespace Server.Engines.Craft { public class CraftGroup { - private CraftItemCol m_arCraftItem; - - private string m_NameString; - private int m_NameNumber; - public CraftGroup( TextDefinition groupName ) { - m_NameNumber = groupName; - m_NameString = groupName; - m_arCraftItem = new CraftItemCol(); + NameNumber = groupName; + NameString = groupName; + CraftItems = new CraftItemCol(); } public void AddCraftItem( CraftItem craftItem ) { - m_arCraftItem.Add( craftItem ); + CraftItems.Add( craftItem ); } - public CraftItemCol CraftItems => m_arCraftItem; + public CraftItemCol CraftItems { get; } - public string NameString => m_NameString; + public string NameString { get; } - public int NameNumber => m_NameNumber; + public int NameNumber { get; } } } \ No newline at end of file diff --git a/Scripts/Engines/Craft/Core/CraftItem.cs b/Scripts/Engines/Craft/Core/CraftItem.cs index 37faa0272..37b31965e 100644 --- a/Scripts/Engines/Craft/Core/CraftItem.cs +++ b/Scripts/Engines/Craft/Core/CraftItem.cs @@ -19,61 +19,21 @@ namespace Server.Engines.Craft public class CraftItem { - private CraftResCol m_arCraftRes; - private CraftSkillCol m_arCraftSkill; - private Type m_Type; + public bool ForceNonExceptional { get; set; } - private string m_GroupNameString; - private int m_GroupNameNumber; + public Expansion RequiredExpansion { get; set; } - private string m_NameString; - private int m_NameNumber; - - private int m_ItemHue; - - private int m_Mana; - private int m_Hits; - private int m_Stam; - - private BeverageType m_RequiredBeverage; - - private bool m_UseAllRes; - - private bool m_NeedHeat; - private bool m_NeedOven; - private bool m_NeedMill; - - private bool m_UseSubRes2; - - private bool m_ForceNonExceptional; - - public bool ForceNonExceptional - { - get => m_ForceNonExceptional; - set => m_ForceNonExceptional = value; - } - - private Expansion m_RequiredExpansion; - - public Expansion RequiredExpansion - { - get => m_RequiredExpansion; - set => m_RequiredExpansion = value; - } - - private Recipe m_Recipe; - - public Recipe Recipe => m_Recipe; + public Recipe Recipe { get; private set; } public void AddRecipe( int id, CraftSystem system ) { - if ( m_Recipe != null ) + if ( Recipe != null ) { - Console.WriteLine( "Warning: Attempted add of recipe #{0} to the crafting of {1} in CraftSystem {2}.", id, m_Type.Name, system ); + Console.WriteLine( "Warning: Attempted add of recipe #{0} to the crafting of {1} in CraftSystem {2}.", id, ItemType.Name, system ); return; } - m_Recipe = new Recipe( id, system, this ); + Recipe = new Recipe( id, system, this ); } public static int LabelNumber( Type type ) { @@ -129,25 +89,21 @@ namespace Server.Engines.Craft public CraftItem( Type type, TextDefinition groupName, TextDefinition name ) { - m_arCraftRes = new CraftResCol(); - m_arCraftSkill = new CraftSkillCol(); + Resources = new CraftResCol(); + Skills = new CraftSkillCol(); - m_Type = type; + ItemType = type; - m_GroupNameString = groupName; - m_NameString = name; + GroupNameString = groupName; + NameString = name; - m_GroupNameNumber = groupName; - m_NameNumber = name; + GroupNameNumber = groupName; + NameNumber = name; - m_RequiredBeverage = BeverageType.Water; + RequiredBeverage = BeverageType.Water; } - public BeverageType RequiredBeverage - { - get => m_RequiredBeverage; - set => m_RequiredBeverage = value; - } + public BeverageType RequiredBeverage { get; set; } public void AddRes( Type type, TextDefinition name, int amount ) { @@ -157,83 +113,47 @@ namespace Server.Engines.Craft public void AddRes( Type type, TextDefinition name, int amount, TextDefinition message ) { CraftRes craftRes = new CraftRes( type, name, amount, message ); - m_arCraftRes.Add( craftRes ); + Resources.Add( craftRes ); } public void AddSkill( SkillName skillToMake, double minSkill, double maxSkill ) { CraftSkill craftSkill = new CraftSkill( skillToMake, minSkill, maxSkill ); - m_arCraftSkill.Add( craftSkill ); + Skills.Add( craftSkill ); } - public int Mana - { - get => m_Mana; - set => m_Mana = value; - } + public int Mana { get; set; } - public int Hits - { - get => m_Hits; - set => m_Hits = value; - } + public int Hits { get; set; } - public int Stam - { - get => m_Stam; - set => m_Stam = value; - } + public int Stam { get; set; } - public bool UseSubRes2 - { - get => m_UseSubRes2; - set => m_UseSubRes2 = value; - } + public bool UseSubRes2 { get; set; } - public bool UseAllRes - { - get => m_UseAllRes; - set => m_UseAllRes = value; - } + public bool UseAllRes { get; set; } - public bool NeedHeat - { - get => m_NeedHeat; - set => m_NeedHeat = value; - } + public bool NeedHeat { get; set; } - public bool NeedOven - { - get => m_NeedOven; - set => m_NeedOven = value; - } + public bool NeedOven { get; set; } - public bool NeedMill - { - get => m_NeedMill; - set => m_NeedMill = value; - } + public bool NeedMill { get; set; } - public Type ItemType => m_Type; + public Type ItemType { get; } - public int ItemHue - { - get => m_ItemHue; - set => m_ItemHue = value; - } + public int ItemHue { get; set; } - public string GroupNameString => m_GroupNameString; + public string GroupNameString { get; } - public int GroupNameNumber => m_GroupNameNumber; + public int GroupNameNumber { get; } - public string NameString => m_NameString; + public string NameString { get; } - public int NameNumber => m_NameNumber; + public int NameNumber { get; } - public CraftResCol Resources => m_arCraftRes; + public CraftResCol Resources { get; } - public CraftSkillCol Skills => m_arCraftSkill; + public CraftSkillCol Skills { get; } public bool ConsumeAttributes( Mobile from, ref object message, bool consume ) { @@ -355,7 +275,7 @@ namespace Server.Engines.Craft public bool IsMarkable( Type type ) { - if ( m_ForceNonExceptional ) //Don't even display the stuff for marking if it can't ever be exceptional. + if ( ForceNonExceptional ) //Don't even display the stuff for marking if it can't ever be exceptional. return false; for ( int i = 0; i < m_MarkableTable.Length; ++i ) @@ -390,7 +310,7 @@ namespace Server.Engines.Craft if ( system.RetainsColorFrom( this, type ) ) return true; - bool inItemTable = RetainsColor( m_Type ); + bool inItemTable = RetainsColor( ItemType ); if ( !inItemTable ) return false; @@ -492,7 +412,7 @@ namespace Server.Engines.Craft } else { - if ( hq is BaseBeverage beverage && beverage.Content != m_RequiredBeverage ) + if ( hq is BaseBeverage beverage && beverage.Content != RequiredBeverage ) continue; totals[i] += hq.Quantity; @@ -528,7 +448,7 @@ namespace Server.Engines.Craft } else { - if ( hq is BaseBeverage beverage && beverage.Content != m_RequiredBeverage ) + if ( hq is BaseBeverage beverage && beverage.Content != RequiredBeverage ) continue; int theirAmount = hq.Quantity; @@ -564,7 +484,7 @@ namespace Server.Engines.Craft } else { - if ( hq is BaseBeverage beverage && beverage.Content != m_RequiredBeverage ) + if ( hq is BaseBeverage beverage && beverage.Content != RequiredBeverage ) continue; amount += hq.Quantity; @@ -586,34 +506,34 @@ namespace Server.Engines.Craft if ( ourPack == null ) return false; - if ( m_NeedHeat && !Find( from, m_HeatSources ) ) + if ( NeedHeat && !Find( from, m_HeatSources ) ) { message = 1044487; // You must be near a fire source to cook. return false; } - if ( m_NeedOven && !Find( from, m_Ovens ) ) + if ( NeedOven && !Find( from, m_Ovens ) ) { message = 1044493; // You must be near an oven to bake that. return false; } - if ( m_NeedMill && !Find( from, m_Mills ) ) + if ( NeedMill && !Find( from, m_Mills ) ) { message = 1044491; // You must be near a flour mill to do that. return false; } - Type[][] types = new Type[m_arCraftRes.Count][]; - int[] amounts = new int[m_arCraftRes.Count]; + Type[][] types = new Type[Resources.Count][]; + int[] amounts = new int[Resources.Count]; maxAmount = int.MaxValue; - CraftSubResCol resCol = ( m_UseSubRes2 ? craftSystem.CraftSubRes2 : craftSystem.CraftSubRes ); + CraftSubResCol resCol = ( UseSubRes2 ? craftSystem.CraftSubRes2 : craftSystem.CraftSubRes ); for ( int i = 0; i < types.Length; ++i ) { - CraftRes craftRes = m_arCraftRes.GetAt( i ); + CraftRes craftRes = Resources.GetAt( i ); Type baseType = craftRes.ItemType; // Resource Mutation @@ -653,7 +573,7 @@ namespace Server.Engines.Craft if ( maxAmount == 0 ) { - CraftRes res = m_arCraftRes.GetAt( i ); + CraftRes res = Resources.GetAt( i ); if ( res.MessageNumber > 0 ) message = res.MessageNumber; @@ -683,7 +603,7 @@ namespace Server.Engines.Craft Item consumeExtra = null; - if ( m_NameNumber == 1041267 ) + if ( NameNumber == 1041267 ) { // Runebooks are a special case, they need a blank recall rune @@ -782,7 +702,7 @@ namespace Server.Engines.Craft } { - CraftRes res = m_arCraftRes.GetAt( index ); + CraftRes res = Resources.GetAt( index ); if ( res.MessageNumber > 0 ) message = res.MessageNumber; @@ -818,7 +738,7 @@ namespace Server.Engines.Craft public double GetExceptionalChance( CraftSystem system, double chance, Mobile from ) { - if ( m_ForceNonExceptional ) + if ( ForceNonExceptional ) return 0.0; double bonus = 0.0; @@ -876,9 +796,9 @@ namespace Server.Engines.Craft allRequiredSkills = true; - for ( int i = 0; i < m_arCraftSkill.Count; i++) + for ( int i = 0; i < Skills.Count; i++) { - CraftSkill craftSkill = m_arCraftSkill.GetAt(i); + CraftSkill craftSkill = Skills.GetAt(i); double minSkill = craftSkill.MinSkill; double maxSkill = craftSkill.MaxSkill; @@ -927,7 +847,7 @@ namespace Server.Engines.Craft { if ( Recipe == null || !(from is PlayerMobile) || ((PlayerMobile)from).HasRecipe( Recipe ) ) { - int badCraft = craftSystem.CanCraft( from, tool, m_Type ); + int badCraft = craftSystem.CanCraft( from, tool, ItemType ); if ( badCraft <= 0 ) { @@ -1009,7 +929,7 @@ namespace Server.Engines.Craft public void CompleteCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft ) { - int badCraft = craftSystem.CanCraft( from, tool, m_Type ); + int badCraft = craftSystem.CanCraft( from, tool, ItemType ); if ( badCraft > 0 ) { @@ -1251,7 +1171,7 @@ namespace Server.Engines.Craft { m_From.EndAction( typeof( CraftSystem ) ); - int badCraft = m_CraftSystem.CanCraft( m_From, m_Tool, m_CraftItem.m_Type ); + int badCraft = m_CraftSystem.CanCraft( m_From, m_Tool, m_CraftItem.ItemType ); if ( badCraft > 0 ) { diff --git a/Scripts/Engines/Craft/Core/CraftItemIDAttribute.cs b/Scripts/Engines/Craft/Core/CraftItemIDAttribute.cs index 1d7498678..7e8cc0d18 100644 --- a/Scripts/Engines/Craft/Core/CraftItemIDAttribute.cs +++ b/Scripts/Engines/Craft/Core/CraftItemIDAttribute.cs @@ -5,13 +5,11 @@ namespace Server.Engines.Craft [AttributeUsage( AttributeTargets.Class )] public class CraftItemIDAttribute : Attribute { - private int m_ItemID; - - public int ItemID => m_ItemID; + public int ItemID { get; } public CraftItemIDAttribute( int itemID ) { - m_ItemID = itemID; + ItemID = itemID; } } } \ No newline at end of file diff --git a/Scripts/Engines/Craft/Core/CraftRes.cs b/Scripts/Engines/Craft/Core/CraftRes.cs index 28c6d195e..f6588d846 100644 --- a/Scripts/Engines/Craft/Core/CraftRes.cs +++ b/Scripts/Engines/Craft/Core/CraftRes.cs @@ -4,50 +4,41 @@ namespace Server.Engines.Craft { public class CraftRes { - private Type m_Type; - private int m_Amount; - - private string m_MessageString; - private int m_MessageNumber; - - private string m_NameString; - private int m_NameNumber; - public CraftRes( Type type, int amount ) { - m_Type = type; - m_Amount = amount; + ItemType = type; + Amount = amount; } public CraftRes( Type type, TextDefinition name, int amount, TextDefinition message ): this ( type, amount ) { - m_NameNumber = name; - m_MessageNumber = message; + NameNumber = name; + MessageNumber = message; - m_NameString = name; - m_MessageString = message; + NameString = name; + MessageString = message; } public void SendMessage( Mobile from ) { - if ( m_MessageNumber > 0 ) - from.SendLocalizedMessage( m_MessageNumber ); - else if ( !string.IsNullOrEmpty( m_MessageString ) ) - from.SendMessage( m_MessageString ); + if ( MessageNumber > 0 ) + from.SendLocalizedMessage( MessageNumber ); + else if ( !string.IsNullOrEmpty( MessageString ) ) + from.SendMessage( MessageString ); else from.SendLocalizedMessage( 502925 ); // You don't have the resources required to make that item. } - public Type ItemType => m_Type; + public Type ItemType { get; } - public string MessageString => m_MessageString; + public string MessageString { get; } - public int MessageNumber => m_MessageNumber; + public int MessageNumber { get; } - public string NameString => m_NameString; + public string NameString { get; } - public int NameNumber => m_NameNumber; + public int NameNumber { get; } - public int Amount => m_Amount; + public int Amount { get; } } } diff --git a/Scripts/Engines/Craft/Core/CraftSkill.cs b/Scripts/Engines/Craft/Core/CraftSkill.cs index c256bf796..54b0e0a71 100644 --- a/Scripts/Engines/Craft/Core/CraftSkill.cs +++ b/Scripts/Engines/Craft/Core/CraftSkill.cs @@ -2,21 +2,17 @@ namespace Server.Engines.Craft { public class CraftSkill { - private SkillName m_SkillToMake; - private double m_MinSkill; - private double m_MaxSkill; - public CraftSkill( SkillName skillToMake, double minSkill, double maxSkill ) { - m_SkillToMake = skillToMake; - m_MinSkill = minSkill; - m_MaxSkill = maxSkill; + SkillToMake = skillToMake; + MinSkill = minSkill; + MaxSkill = maxSkill; } - public SkillName SkillToMake => m_SkillToMake; + public SkillName SkillToMake { get; } - public double MinSkill => m_MinSkill; + public double MinSkill { get; } - public double MaxSkill => m_MaxSkill; + public double MaxSkill { get; } } } \ No newline at end of file diff --git a/Scripts/Engines/Craft/Core/CraftSubRes.cs b/Scripts/Engines/Craft/Core/CraftSubRes.cs index e6c0d2f1e..4519b8ac3 100644 --- a/Scripts/Engines/Craft/Core/CraftSubRes.cs +++ b/Scripts/Engines/Craft/Core/CraftSubRes.cs @@ -4,37 +4,30 @@ namespace Server.Engines.Craft { public class CraftSubRes { - private Type m_Type; - private double m_ReqSkill; - private string m_NameString; - private int m_NameNumber; - private int m_GenericNameNumber; - private object m_Message; - public CraftSubRes( Type type, TextDefinition name, double reqSkill, object message ) : this( type, name, reqSkill, 0, message ) { } public CraftSubRes( Type type, TextDefinition name, double reqSkill, int genericNameNumber, object message ) { - m_Type = type; - m_NameNumber = name; - m_NameString = name; - m_ReqSkill = reqSkill; - m_GenericNameNumber = genericNameNumber; - m_Message = message; + ItemType = type; + NameNumber = name; + NameString = name; + RequiredSkill = reqSkill; + GenericNameNumber = genericNameNumber; + Message = message; } - public Type ItemType => m_Type; + public Type ItemType { get; } - public string NameString => m_NameString; + public string NameString { get; } - public int NameNumber => m_NameNumber; + public int NameNumber { get; } - public int GenericNameNumber => m_GenericNameNumber; + public int GenericNameNumber { get; } - public object Message => m_Message; + public object Message { get; } - public double RequiredSkill => m_ReqSkill; + public double RequiredSkill { get; } } } \ No newline at end of file diff --git a/Scripts/Engines/Craft/Core/CraftSubResCol.cs b/Scripts/Engines/Craft/Core/CraftSubResCol.cs index d70350c18..579e38f6b 100644 --- a/Scripts/Engines/Craft/Core/CraftSubResCol.cs +++ b/Scripts/Engines/Craft/Core/CraftSubResCol.cs @@ -4,38 +4,17 @@ namespace Server.Engines.Craft { public class CraftSubResCol : System.Collections.CollectionBase { - private Type m_Type; - private string m_NameString; - private int m_NameNumber; - private bool m_Init; + public bool Init { get; set; } - public bool Init - { - get => m_Init; - set => m_Init = value; - } - - public Type ResType - { - get => m_Type; - set => m_Type = value; - } + public Type ResType { get; set; } - public string NameString - { - get => m_NameString; - set => m_NameString = value; - } + public string NameString { get; set; } - public int NameNumber - { - get => m_NameNumber; - set => m_NameNumber = value; - } + public int NameNumber { get; set; } public CraftSubResCol() { - m_Init = false; + Init = false; } public void Add( CraftSubRes craftSubRes ) diff --git a/Scripts/Engines/Craft/Core/CraftSystem.cs b/Scripts/Engines/Craft/Core/CraftSystem.cs index 6984677b1..6929c45bc 100644 --- a/Scripts/Engines/Craft/Core/CraftSystem.cs +++ b/Scripts/Engines/Craft/Core/CraftSystem.cs @@ -13,30 +13,22 @@ namespace Server.Engines.Craft public abstract class CraftSystem { - private int m_MinCraftEffect; - private int m_MaxCraftEffect; - private double m_Delay; - private bool m_Resmelt; - private bool m_Repair; - private bool m_MarkOption; - private bool m_CanEnhance; - - private CraftItemCol m_CraftItems; - private CraftGroupCol m_CraftGroups; - private CraftSubResCol m_CraftSubRes; - private CraftSubResCol m_CraftSubRes2; - private List m_Recipes; private List m_RareRecipes; - public int MinCraftEffect => m_MinCraftEffect; - public int MaxCraftEffect => m_MaxCraftEffect; - public double Delay => m_Delay; + public int MinCraftEffect { get; } - public CraftItemCol CraftItems => m_CraftItems; - public CraftGroupCol CraftGroups => m_CraftGroups; - public CraftSubResCol CraftSubRes => m_CraftSubRes; - public CraftSubResCol CraftSubRes2 => m_CraftSubRes2; + public int MaxCraftEffect { get; } + + public double Delay { get; } + + public CraftItemCol CraftItems { get; } + + public CraftGroupCol CraftGroups { get; } + + public CraftSubResCol CraftSubRes { get; } + + public CraftSubResCol CraftSubRes2 { get; } public abstract SkillName MainSkill{ get; } @@ -80,40 +72,24 @@ namespace Server.Engines.Craft c?.OnMade( item ); } - public bool Resmelt - { - get => m_Resmelt; - set => m_Resmelt = value; - } + public bool Resmelt { get; set; } - public bool Repair - { - get => m_Repair; - set => m_Repair = value; - } + public bool Repair { get; set; } - public bool MarkOption - { - get => m_MarkOption; - set => m_MarkOption = value; - } + public bool MarkOption { get; set; } - public bool CanEnhance - { - get => m_CanEnhance; - set => m_CanEnhance = value; - } + public bool CanEnhance { get; set; } public CraftSystem( int minCraftEffect, int maxCraftEffect, double delay ) { - m_MinCraftEffect = minCraftEffect; - m_MaxCraftEffect = maxCraftEffect; - m_Delay = delay; + MinCraftEffect = minCraftEffect; + MaxCraftEffect = maxCraftEffect; + Delay = delay; - m_CraftItems = new CraftItemCol(); - m_CraftGroups = new CraftGroupCol(); - m_CraftSubRes = new CraftSubResCol(); - m_CraftSubRes2 = new CraftSubResCol(); + CraftItems = new CraftItemCol(); + CraftGroups = new CraftGroupCol(); + CraftSubRes = new CraftSubResCol(); + CraftSubRes2 = new CraftSubResCol(); m_Recipes = new List(); m_RareRecipes = new List(); @@ -129,7 +105,7 @@ namespace Server.Engines.Craft public void CreateItem( Mobile from, Type type, Type typeRes, BaseTool tool, CraftItem realCraftItem ) { // Verify if the type is in the list of the craftable item - CraftItem craftItem = m_CraftItems.SearchFor( type ); + CraftItem craftItem = CraftItems.SearchFor( type ); if ( craftItem != null ) { // The item is in the list, try to create it @@ -178,84 +154,84 @@ namespace Server.Engines.Craft craftItem.AddSkill( skillToMake, minSkill, maxSkill ); DoGroup( group, craftItem ); - return m_CraftItems.Add( craftItem ); + return CraftItems.Add( craftItem ); } private void DoGroup( TextDefinition groupName, CraftItem craftItem ) { - int index = m_CraftGroups.SearchFor( groupName ); + int index = CraftGroups.SearchFor( groupName ); if ( index == -1) { CraftGroup craftGroup = new CraftGroup( groupName ); craftGroup.AddCraftItem( craftItem ); - m_CraftGroups.Add( craftGroup ); + CraftGroups.Add( craftGroup ); } else { - m_CraftGroups.GetAt( index ).AddCraftItem( craftItem ); + CraftGroups.GetAt( index ).AddCraftItem( craftItem ); } } public void SetItemHue( int index, int hue ) { - CraftItem craftItem = m_CraftItems.GetAt( index ); + CraftItem craftItem = CraftItems.GetAt( index ); craftItem.ItemHue = hue; } public void SetManaReq( int index, int mana ) { - CraftItem craftItem = m_CraftItems.GetAt( index ); + CraftItem craftItem = CraftItems.GetAt( index ); craftItem.Mana = mana; } public void SetStamReq( int index, int stam ) { - CraftItem craftItem = m_CraftItems.GetAt( index ); + CraftItem craftItem = CraftItems.GetAt( index ); craftItem.Stam = stam; } public void SetHitsReq( int index, int hits ) { - CraftItem craftItem = m_CraftItems.GetAt( index ); + CraftItem craftItem = CraftItems.GetAt( index ); craftItem.Hits = hits; } public void SetUseAllRes( int index, bool useAll ) { - CraftItem craftItem = m_CraftItems.GetAt( index ); + CraftItem craftItem = CraftItems.GetAt( index ); craftItem.UseAllRes = useAll; } public void SetNeedHeat( int index, bool needHeat ) { - CraftItem craftItem = m_CraftItems.GetAt( index ); + CraftItem craftItem = CraftItems.GetAt( index ); craftItem.NeedHeat = needHeat; } public void SetNeedOven( int index, bool needOven ) { - CraftItem craftItem = m_CraftItems.GetAt( index ); + CraftItem craftItem = CraftItems.GetAt( index ); craftItem.NeedOven = needOven; } public void SetBeverageType( int index, BeverageType requiredBeverage ) { - CraftItem craftItem = m_CraftItems.GetAt( index ); + CraftItem craftItem = CraftItems.GetAt( index ); craftItem.RequiredBeverage = requiredBeverage; } public void SetNeedMill( int index, bool needMill ) { - CraftItem craftItem = m_CraftItems.GetAt( index ); + CraftItem craftItem = CraftItems.GetAt( index ); craftItem.NeedMill = needMill; } public void SetNeededExpansion( int index, Expansion expansion ) { - CraftItem craftItem = m_CraftItems.GetAt( index ); + CraftItem craftItem = CraftItems.GetAt( index ); craftItem.RequiredExpansion = expansion; } @@ -266,25 +242,25 @@ namespace Server.Engines.Craft public void AddRes( int index, Type type, TextDefinition name, int amount, TextDefinition message ) { - CraftItem craftItem = m_CraftItems.GetAt( index ); + CraftItem craftItem = CraftItems.GetAt( index ); craftItem.AddRes( type, name, amount, message ); } public void AddSkill( int index, SkillName skillToMake, double minSkill, double maxSkill ) { - CraftItem craftItem = m_CraftItems.GetAt(index); + CraftItem craftItem = CraftItems.GetAt(index); craftItem.AddSkill(skillToMake, minSkill, maxSkill); } public void SetUseSubRes2( int index, bool val ) { - CraftItem craftItem = m_CraftItems.GetAt(index); + CraftItem craftItem = CraftItems.GetAt(index); craftItem.UseSubRes2 = val; } private void AddRecipeBase( int index, int id ) { - CraftItem craftItem = m_CraftItems.GetAt( index ); + CraftItem craftItem = CraftItems.GetAt( index ); craftItem.AddRecipe( id, this ); } @@ -307,74 +283,74 @@ namespace Server.Engines.Craft public void ForceNonExceptional( int index ) { - CraftItem craftItem = m_CraftItems.GetAt( index ); + CraftItem craftItem = CraftItems.GetAt( index ); craftItem.ForceNonExceptional = true; } public void SetSubRes( Type type, string name ) { - m_CraftSubRes.ResType = type; - m_CraftSubRes.NameString = name; - m_CraftSubRes.Init = true; + CraftSubRes.ResType = type; + CraftSubRes.NameString = name; + CraftSubRes.Init = true; } public void SetSubRes( Type type, int name ) { - m_CraftSubRes.ResType = type; - m_CraftSubRes.NameNumber = name; - m_CraftSubRes.Init = true; + CraftSubRes.ResType = type; + CraftSubRes.NameNumber = name; + CraftSubRes.Init = true; } public void AddSubRes( Type type, int name, double reqSkill, object message ) { CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, message ); - m_CraftSubRes.Add( craftSubRes ); + CraftSubRes.Add( craftSubRes ); } public void AddSubRes( Type type, int name, double reqSkill, int genericName, object message ) { CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, genericName, message ); - m_CraftSubRes.Add( craftSubRes ); + CraftSubRes.Add( craftSubRes ); } public void AddSubRes( Type type, string name, double reqSkill, object message ) { CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, message ); - m_CraftSubRes.Add( craftSubRes ); + CraftSubRes.Add( craftSubRes ); } public void SetSubRes2( Type type, string name ) { - m_CraftSubRes2.ResType = type; - m_CraftSubRes2.NameString = name; - m_CraftSubRes2.Init = true; + CraftSubRes2.ResType = type; + CraftSubRes2.NameString = name; + CraftSubRes2.Init = true; } public void SetSubRes2( Type type, int name ) { - m_CraftSubRes2.ResType = type; - m_CraftSubRes2.NameNumber = name; - m_CraftSubRes2.Init = true; + CraftSubRes2.ResType = type; + CraftSubRes2.NameNumber = name; + CraftSubRes2.Init = true; } public void AddSubRes2( Type type, int name, double reqSkill, object message ) { CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, message ); - m_CraftSubRes2.Add( craftSubRes ); + CraftSubRes2.Add( craftSubRes ); } public void AddSubRes2( Type type, int name, double reqSkill, int genericName, object message ) { CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, genericName, message ); - m_CraftSubRes2.Add( craftSubRes ); + CraftSubRes2.Add( craftSubRes ); } public void AddSubRes2( Type type, string name, double reqSkill, object message ) { CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, message ); - m_CraftSubRes2.Add( craftSubRes ); + CraftSubRes2.Add( craftSubRes ); } public abstract void InitCraftList(); diff --git a/Scripts/Engines/Craft/Core/CustomCraft.cs b/Scripts/Engines/Craft/Core/CustomCraft.cs index 8fd585816..a4892f2c8 100644 --- a/Scripts/Engines/Craft/Core/CustomCraft.cs +++ b/Scripts/Engines/Craft/Core/CustomCraft.cs @@ -5,28 +5,26 @@ namespace Server.Engines.Craft { public abstract class CustomCraft { - private Mobile m_From; - private CraftItem m_CraftItem; - private CraftSystem m_CraftSystem; - private Type m_TypeRes; - private BaseTool m_Tool; - private int m_Quality; + public Mobile From { get; } - public Mobile From => m_From; - public CraftItem CraftItem => m_CraftItem; - public CraftSystem CraftSystem => m_CraftSystem; - public Type TypeRes => m_TypeRes; - public BaseTool Tool => m_Tool; - public int Quality => m_Quality; + public CraftItem CraftItem { get; } + + public CraftSystem CraftSystem { get; } + + public Type TypeRes { get; } + + public BaseTool Tool { get; } + + public int Quality { get; } public CustomCraft( Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, int quality ) { - m_From = from; - m_CraftItem = craftItem; - m_CraftSystem = craftSystem; - m_TypeRes = typeRes; - m_Tool = tool; - m_Quality = quality; + From = from; + CraftItem = craftItem; + CraftSystem = craftSystem; + TypeRes = typeRes; + Tool = tool; + Quality = quality; } public abstract void EndCraftAction(); diff --git a/Scripts/Engines/Craft/Core/Recipes.cs b/Scripts/Engines/Craft/Core/Recipes.cs index da0498155..3d287b4c4 100644 --- a/Scripts/Engines/Craft/Core/Recipes.cs +++ b/Scripts/Engines/Craft/Core/Recipes.cs @@ -24,7 +24,7 @@ namespace Server.Engines.Craft { if ( targeted is PlayerMobile mobile ) { - foreach( KeyValuePair kvp in m_Recipes ) + foreach( KeyValuePair kvp in Recipes ) mobile.AcquireRecipe( kvp.Key ); m.SendMessage( "You teach them all of the recipies." ); @@ -59,32 +59,15 @@ namespace Server.Engines.Craft } - private static Dictionary m_Recipes = new Dictionary(); + public static Dictionary Recipes { get; } = new Dictionary(); - public static Dictionary Recipes => m_Recipes; + public static int LargestRecipeID { get; private set; } - private static int m_LargestRecipeID; - public static int LargestRecipeID => m_LargestRecipeID; + public CraftSystem CraftSystem { get; set; } - private CraftSystem m_System; + public CraftItem CraftItem { get; set; } - public CraftSystem CraftSystem - { - get => m_System; - set => m_System = value; - } - - private CraftItem m_CraftItem; - - public CraftItem CraftItem - { - get => m_CraftItem; - set => m_CraftItem = value; - } - - private int m_ID; - - public int ID => m_ID; + public int ID { get; } private TextDefinition m_TD; public TextDefinition TextDefinition @@ -92,7 +75,7 @@ namespace Server.Engines.Craft get { if ( m_TD == null ) - m_TD = new TextDefinition( m_CraftItem.NameNumber, m_CraftItem.NameString ); + m_TD = new TextDefinition( CraftItem.NameNumber, CraftItem.NameString ); return m_TD; } @@ -100,15 +83,15 @@ namespace Server.Engines.Craft public Recipe( int id, CraftSystem system, CraftItem item ) { - m_ID = id; - m_System = system; - m_CraftItem = item; + ID = id; + CraftSystem = system; + CraftItem = item; - if ( m_Recipes.ContainsKey( id ) ) + if ( Recipes.ContainsKey( id ) ) throw new Exception( "Attempting to create recipe with preexisting ID." ); - m_Recipes.Add( id, this ); - m_LargestRecipeID = Math.Max( id, m_LargestRecipeID ); + Recipes.Add( id, this ); + LargestRecipeID = Math.Max( id, LargestRecipeID ); } } } diff --git a/Scripts/Engines/Craft/DefTinkering.cs b/Scripts/Engines/Craft/DefTinkering.cs index 711f6503d..5304f00cb 100644 --- a/Scripts/Engines/Craft/DefTinkering.cs +++ b/Scripts/Engines/Craft/DefTinkering.cs @@ -375,9 +375,7 @@ namespace Server.Engines.Craft public abstract class TrapCraft : CustomCraft { - private LockableContainer m_Container; - - public LockableContainer Container => m_Container; + public LockableContainer Container { get; private set; } public abstract TrapType TrapType{ get; } @@ -414,7 +412,7 @@ namespace Server.Engines.Craft return false; } - m_Container = container; + Container = container; return true; } diff --git a/Scripts/Engines/Doom/GauntletSpawner.cs b/Scripts/Engines/Doom/GauntletSpawner.cs index 9690171b7..75bfb2e0c 100644 --- a/Scripts/Engines/Doom/GauntletSpawner.cs +++ b/Scripts/Engines/Doom/GauntletSpawner.cs @@ -24,56 +24,29 @@ namespace Server.Engines.Doom private GauntletSpawnerState m_State; - private string m_TypeName; - private BaseDoor m_Door; - private BaseAddon m_Addon; - private GauntletSpawner m_Sequence; - private List m_Creatures; - - private Rectangle2D m_RegionBounds; - private List m_Traps; - - private Region m_Region; + [CommandProperty( AccessLevel.GameMaster )] + public string TypeName { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public string TypeName - { - get => m_TypeName; - set => m_TypeName = value; - } + public BaseDoor Door { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public BaseDoor Door - { - get => m_Door; - set => m_Door = value; - } + public BaseAddon Addon { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public BaseAddon Addon - { - get => m_Addon; - set => m_Addon = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public GauntletSpawner Sequence - { - get => m_Sequence; - set => m_Sequence = value; - } + public GauntletSpawner Sequence { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool HasCompleted { get { - if ( m_Creatures.Count == 0 ) + if ( Creatures.Count == 0 ) return false; - for ( int i = 0; i < m_Creatures.Count; ++i ) + for ( int i = 0; i < Creatures.Count; ++i ) { - Mobile mob = m_Creatures[i]; + Mobile mob = Creatures[i]; if ( !mob.Deleted ) return false; @@ -84,11 +57,7 @@ namespace Server.Engines.Doom } [CommandProperty( AccessLevel.GameMaster )] - public Rectangle2D RegionBounds - { - get => m_RegionBounds; - set => m_RegionBounds = value; - } + public Rectangle2D RegionBounds { get; set; } [CommandProperty( AccessLevel.GameMaster )] public GauntletSpawnerState State @@ -111,32 +80,32 @@ namespace Server.Engines.Doom case GauntletSpawnerState.Completed: hue = CompletedItemHue; break; } - if ( m_Door != null ) + if ( Door != null ) { - m_Door.Hue = hue; - m_Door.Locked = lockDoors; + Door.Hue = hue; + Door.Locked = lockDoors; if ( lockDoors ) { - m_Door.KeyValue = Key.RandomValue(); - m_Door.Open = false; + Door.KeyValue = Key.RandomValue(); + Door.Open = false; } - if ( m_Door.Link != null ) + if ( Door.Link != null ) { - m_Door.Link.Hue = hue; - m_Door.Link.Locked = lockDoors; + Door.Link.Hue = hue; + Door.Link.Locked = lockDoors; if ( lockDoors ) { - m_Door.Link.KeyValue = Key.RandomValue(); - m_Door.Open = false; + Door.Link.KeyValue = Key.RandomValue(); + Door.Open = false; } } } - if ( m_Addon != null ) - m_Addon.Hue = hue; + if ( Addon != null ) + Addon.Hue = hue; if ( m_State == GauntletSpawnerState.InProgress ) { @@ -160,27 +129,15 @@ namespace Server.Engines.Doom private Timer m_Timer; - public List Creatures - { - get => m_Creatures; - set => m_Creatures = value; - } + public List Creatures { get; set; } - public List Traps - { - get => m_Traps; - set => m_Traps = value; - } + public List Traps { get; set; } - public Region Region - { - get => m_Region; - set => m_Region = value; - } + public Region Region { get; set; } public virtual void CreateRegion() { - if ( m_Region != null ) + if ( Region != null ) return; Map map = Map; @@ -188,29 +145,29 @@ namespace Server.Engines.Doom if ( map == null || map == Map.Internal ) return; - m_Region = new GauntletRegion( this, map ); + Region = new GauntletRegion( this, map ); } public virtual void DestroyRegion() { - m_Region?.Unregister(); + Region?.Unregister(); - m_Region = null; + Region = null; } public virtual int ComputeTrapCount() { - int area = m_RegionBounds.Width * m_RegionBounds.Height; + int area = RegionBounds.Width * RegionBounds.Height; return area / 100; } public virtual void ClearTraps() { - for ( int i = 0; i < m_Traps.Count; ++i ) - m_Traps[i].Delete(); + for ( int i = 0; i < Traps.Count; ++i ) + Traps[i].Delete(); - m_Traps.Clear(); + Traps.Clear(); } public virtual void SpawnTrap() @@ -244,8 +201,8 @@ namespace Server.Engines.Doom // try 10 times to find a valid location for ( int i = 0; i < 10; ++i ) { - int x = Utility.Random( m_RegionBounds.X, m_RegionBounds.Width ); - int y = Utility.Random( m_RegionBounds.Y, m_RegionBounds.Height ); + int x = Utility.Random( RegionBounds.X, RegionBounds.Width ); + int y = Utility.Random( RegionBounds.Y, RegionBounds.Height ); int z = Z; if ( !map.CanFit( x, y, z, 16, false, false ) ) @@ -255,7 +212,7 @@ namespace Server.Engines.Doom continue; trap.MoveToWorld( new Point3D( x, y, z ), map ); - m_Traps.Add( trap ); + Traps.Add( trap ); return; } @@ -279,8 +236,8 @@ namespace Server.Engines.Doom playerCount = reg.GetPlayerCount(); } - if ( playerCount == 0 && m_Region != null ) - playerCount = m_Region.GetPlayerCount(); + if ( playerCount == 0 && Region != null ) + playerCount = Region.GetPlayerCount(); int count = (playerCount + PlayersPerSpawn - 1) / PlayersPerSpawn; @@ -292,10 +249,10 @@ namespace Server.Engines.Doom public virtual void ClearCreatures() { - for ( int i = 0; i < m_Creatures.Count; ++i ) - m_Creatures[i].Delete(); + for ( int i = 0; i < Creatures.Count; ++i ) + Creatures[i].Delete(); - m_Creatures.Clear(); + Creatures.Clear(); } public virtual void FullSpawn() @@ -319,10 +276,10 @@ namespace Server.Engines.Doom { try { - if ( m_TypeName == null ) + if ( TypeName == null ) return; - Type type = ScriptCompiler.FindTypeByName( m_TypeName, true ); + Type type = ScriptCompiler.FindTypeByName( TypeName, true ); if ( type == null ) return; @@ -335,7 +292,7 @@ namespace Server.Engines.Doom { mob.MoveToWorld( GetWorldLocation(), Map ); - m_Creatures.Add( mob ); + Creatures.Add( mob ); } } catch @@ -349,8 +306,8 @@ namespace Server.Engines.Doom { State = GauntletSpawnerState.InSequence; - if ( m_Sequence != null && !m_Sequence.Deleted ) - m_Sequence.RecurseReset(); + if ( Sequence != null && !Sequence.Deleted ) + Sequence.RecurseReset(); } } @@ -361,19 +318,19 @@ namespace Server.Engines.Doom int count = ComputeSpawnCount(); - for ( int i = m_Creatures.Count; i < count; ++i ) + for ( int i = Creatures.Count; i < count; ++i ) Spawn(); if ( HasCompleted ) { State = GauntletSpawnerState.Completed; - if ( m_Sequence != null && !m_Sequence.Deleted ) + if ( Sequence != null && !Sequence.Deleted ) { - if ( m_Sequence.State == GauntletSpawnerState.Completed ) + if ( Sequence.State == GauntletSpawnerState.Completed ) RecurseReset(); - m_Sequence.State = GauntletSpawnerState.InProgress; + Sequence.State = GauntletSpawnerState.InProgress; } } } @@ -391,9 +348,9 @@ namespace Server.Engines.Doom Visible = false; Movable = false; - m_TypeName = typeName; - m_Creatures = new List(); - m_Traps = new List(); + TypeName = typeName; + Creatures = new List(); + Traps = new List(); } public GauntletSpawner( Serial serial ) : base( serial ) @@ -406,16 +363,16 @@ namespace Server.Engines.Doom writer.Write( (int) 1 ); // version - writer.Write( m_RegionBounds ); + writer.Write( RegionBounds ); - writer.WriteItemList( m_Traps, false ); + writer.WriteItemList( Traps, false ); - writer.Write( m_Creatures, false ); + writer.Write( Creatures, false ); - writer.Write( m_TypeName ); - writer.WriteItem( m_Door ); - writer.WriteItem( m_Addon ); - writer.WriteItem( m_Sequence ); + writer.Write( TypeName ); + writer.WriteItem( Door ); + writer.WriteItem( Addon ); + writer.WriteItem( Sequence ); writer.Write( (int) m_State ); } @@ -430,8 +387,8 @@ namespace Server.Engines.Doom { case 1: { - m_RegionBounds = reader.ReadRect2D(); - m_Traps = reader.ReadStrongItemList(); + RegionBounds = reader.ReadRect2D(); + Traps = reader.ReadStrongItemList(); goto case 0; } @@ -439,16 +396,16 @@ namespace Server.Engines.Doom { if ( version < 1 ) { - m_Traps = new List(); - m_RegionBounds = new Rectangle2D( X - 40, Y - 40, 80, 80 ); + Traps = new List(); + RegionBounds = new Rectangle2D( X - 40, Y - 40, 80, 80 ); } - m_Creatures = reader.ReadStrongMobileList(); + Creatures = reader.ReadStrongMobileList(); - m_TypeName = reader.ReadString(); - m_Door = reader.ReadItem(); ; - m_Addon = reader.ReadItem(); ; - m_Sequence = reader.ReadItem(); + TypeName = reader.ReadString(); + Door = reader.ReadItem(); ; + Addon = reader.ReadItem(); ; + Sequence = reader.ReadItem(); State = (GauntletSpawnerState)reader.ReadInt(); diff --git a/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleController.cs b/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleController.cs index 04dd663ff..5fec79208 100644 --- a/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleController.cs +++ b/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleController.cs @@ -14,17 +14,12 @@ namespace Server.Engines.Doom { public class LeverPuzzleController : Item { - private bool m_Enabled; private static bool installed; - private ushort m_MyKey; - private ushort m_TheirKey; - private List m_Levers; private List m_Teles; private List m_Statues; private List m_Tiles; - private Mobile m_Successful; private LampRoomBox m_Box; private Region m_LampRoom; @@ -58,21 +53,15 @@ namespace Server.Engines.Doom } [CommandProperty( AccessLevel.GameMaster )] - public ushort MyKey { get => m_MyKey; - set => m_MyKey = value; - } + public ushort MyKey { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public ushort TheirKey { get => m_TheirKey; - set => m_TheirKey = value; - } + public ushort TheirKey { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool Enabled { get => m_Enabled; - set => m_Enabled = value; - } + public bool Enabled { get; set; } - public Mobile Successful => m_Successful; + public Mobile Successful { get; private set; } public bool CircleComplete { @@ -253,7 +242,7 @@ namespace Server.Engines.Doom public virtual void RemoveSuccessful() { - m_Successful=null; + Successful=null; } public virtual void LeverPulled( ushort code ) @@ -280,7 +269,7 @@ namespace Server.Engines.Doom if ( TheirKey == MyKey ) { GenKey(); - if (( m_Successful = ( m_Player=GetOccupant( 0 ))) != null ) + if (( Successful = ( m_Player=GetOccupant( 0 ))) != null ) { SendLocationEffect( lp_Center, 0x1153, 0, 60, 1 ); PlaySounds( lp_Center, cs1 ); @@ -290,7 +279,7 @@ namespace Server.Engines.Doom m_Timer = new LampRoomTimer( this ); m_Timer.Start(); - m_Enabled = false; + Enabled = false; } } else @@ -715,9 +704,9 @@ namespace Server.Engines.Doom m_Tiles.Add( new LeverPuzzleRegion( this, TA[i] )); m_LampRoom = new LampRoomRegion( this ); - m_Enabled = true; - m_TheirKey = 0; - m_MyKey = 0; + Enabled = true; + TheirKey = 0; + MyKey = 0; GenKey(); } } diff --git a/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleItems.cs b/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleItems.cs index 25434590e..d4d5c00d4 100644 --- a/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleItems.cs +++ b/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleItems.cs @@ -95,16 +95,15 @@ namespace Server.Engines.Doom public class LeverPuzzleLever : Item { - private ushort m_Code; private LeverPuzzleController m_Controller; [CommandProperty( AccessLevel.GameMaster )] - public ushort Code => m_Code; + public ushort Code { get; private set; } public LeverPuzzleLever( ushort code, LeverPuzzleController controller ) : base( 0x108E ) { m_Controller=controller; - m_Code = code; + Code = code; Hue = 0x66D; Movable = false; } @@ -115,7 +114,7 @@ namespace Server.Engines.Doom { ItemID^=2; Effects.PlaySound( Location, Map, 0x3E8 ); - m_Controller.LeverPulled( m_Code ); + m_Controller.LeverPulled( Code ); } else { @@ -136,14 +135,14 @@ namespace Server.Engines.Doom { base.Serialize( writer ); writer.Write( (int) 0 ); // version - writer.Write( (ushort) m_Code ); + writer.Write( (ushort) Code ); writer.Write( m_Controller ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); - m_Code = reader.ReadUShort(); + Code = reader.ReadUShort(); m_Controller = reader.ReadItem() as LeverPuzzleController; } } diff --git a/Scripts/Engines/Ethics/Core/Persistance.cs b/Scripts/Engines/Ethics/Core/Persistance.cs index c0844b029..e7b687d16 100644 --- a/Scripts/Engines/Ethics/Core/Persistance.cs +++ b/Scripts/Engines/Ethics/Core/Persistance.cs @@ -2,9 +2,7 @@ namespace Server.Ethics { public class EthicsPersistance : Item { - private static EthicsPersistance m_Instance; - - public static EthicsPersistance Instance => m_Instance; + public static EthicsPersistance Instance { get; private set; } public override string DefaultName => "Ethics Persistance - Internal"; @@ -14,8 +12,8 @@ namespace Server.Ethics { Movable = false; - if ( m_Instance == null || m_Instance.Deleted ) - m_Instance = this; + if ( Instance == null || Instance.Deleted ) + Instance = this; else base.Delete(); } @@ -23,7 +21,7 @@ namespace Server.Ethics public EthicsPersistance( Serial serial ) : base( serial ) { - m_Instance = this; + Instance = this; } public override void Serialize( GenericWriter writer ) diff --git a/Scripts/Engines/Ethics/Core/Player.cs b/Scripts/Engines/Ethics/Core/Player.cs index 34de7aa72..36ecd1292 100644 --- a/Scripts/Engines/Ethics/Core/Player.cs +++ b/Scripts/Engines/Ethics/Core/Player.cs @@ -41,39 +41,23 @@ namespace Server.Ethics return pl; } - private Ethic m_Ethic; - private Mobile m_Mobile; - - private int m_Power; - private int m_History; - - private Mobile m_Steed; - private Mobile m_Familiar; - private DateTime m_Shield; - public Ethic Ethic => m_Ethic; - public Mobile Mobile => m_Mobile; + public Ethic Ethic { get; } + + public Mobile Mobile { get; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] - public int Power { get => m_Power; - set => m_Power = value; - } + public int Power { get; set; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] - public int History { get => m_History; - set => m_History = value; - } + public int History { get; set; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] - public Mobile Steed { get => m_Steed; - set => m_Steed = value; - } + public Mobile Steed { get; set; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] - public Mobile Familiar { get => m_Familiar; - set => m_Familiar = value; - } + public Mobile Familiar { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool IsShielded @@ -103,38 +87,38 @@ namespace Server.Ethics public Player( Ethic ethic, Mobile mobile ) { - m_Ethic = ethic; - m_Mobile = mobile; + Ethic = ethic; + Mobile = mobile; - m_Power = 5; - m_History = 5; + Power = 5; + History = 5; } public void CheckAttach() { - if ( m_Ethic.IsEligible( m_Mobile ) ) + if ( Ethic.IsEligible( Mobile ) ) Attach(); } public void Attach() { - if ( m_Mobile is PlayerMobile mobile ) + if ( Mobile is PlayerMobile mobile ) mobile.EthicPlayer = this; - m_Ethic.Players.Add( this ); + Ethic.Players.Add( this ); } public void Detach() { - if ( m_Mobile is PlayerMobile mobile ) + if ( Mobile is PlayerMobile mobile ) mobile.EthicPlayer = null; - m_Ethic.Players.Remove( this ); + Ethic.Players.Remove( this ); } public Player( Ethic ethic, GenericReader reader ) { - m_Ethic = ethic; + Ethic = ethic; int version = reader.ReadEncodedInt(); @@ -142,13 +126,13 @@ namespace Server.Ethics { case 0: { - m_Mobile = reader.ReadMobile(); + Mobile = reader.ReadMobile(); - m_Power = reader.ReadEncodedInt(); - m_History = reader.ReadEncodedInt(); + Power = reader.ReadEncodedInt(); + History = reader.ReadEncodedInt(); - m_Steed = reader.ReadMobile(); - m_Familiar = reader.ReadMobile(); + Steed = reader.ReadMobile(); + Familiar = reader.ReadMobile(); m_Shield = reader.ReadDeltaTime(); @@ -161,13 +145,13 @@ namespace Server.Ethics { writer.WriteEncodedInt( 0 ); // version - writer.Write( m_Mobile ); + writer.Write( Mobile ); - writer.WriteEncodedInt( m_Power ); - writer.WriteEncodedInt( m_History ); + writer.WriteEncodedInt( Power ); + writer.WriteEncodedInt( History ); - writer.Write( m_Steed ); - writer.Write( m_Familiar ); + writer.Write( Steed ); + writer.Write( Familiar ); writer.WriteDeltaTime( m_Shield ); } diff --git a/Scripts/Engines/Ethics/Definitions/EthicDefinition.cs b/Scripts/Engines/Ethics/Definitions/EthicDefinition.cs index d099b4b6c..4b5fbde92 100644 --- a/Scripts/Engines/Ethics/Definitions/EthicDefinition.cs +++ b/Scripts/Engines/Ethics/Definitions/EthicDefinition.cs @@ -2,34 +2,26 @@ namespace Server.Ethics { public class EthicDefinition { - private int m_PrimaryHue; + public int PrimaryHue { get; } - private TextDefinition m_Title; - private TextDefinition m_Adjunct; + public TextDefinition Title { get; } - private TextDefinition m_JoinPhrase; + public TextDefinition Adjunct { get; } - private Power[] m_Powers; + public TextDefinition JoinPhrase { get; } - public int PrimaryHue => m_PrimaryHue; - - public TextDefinition Title => m_Title; - public TextDefinition Adjunct => m_Adjunct; - - public TextDefinition JoinPhrase => m_JoinPhrase; - - public Power[] Powers => m_Powers; + public Power[] Powers { get; } public EthicDefinition( int primaryHue, TextDefinition title, TextDefinition adjunct, TextDefinition joinPhrase, Power[] powers ) { - m_PrimaryHue = primaryHue; + PrimaryHue = primaryHue; - m_Title = title; - m_Adjunct = adjunct; + Title = title; + Adjunct = adjunct; - m_JoinPhrase = joinPhrase; + JoinPhrase = joinPhrase; - m_Powers = powers; + Powers = powers; } } } diff --git a/Scripts/Engines/Ethics/Definitions/PowerDefinition.cs b/Scripts/Engines/Ethics/Definitions/PowerDefinition.cs index a67a013a7..0c927bd8c 100644 --- a/Scripts/Engines/Ethics/Definitions/PowerDefinition.cs +++ b/Scripts/Engines/Ethics/Definitions/PowerDefinition.cs @@ -2,25 +2,21 @@ namespace Server.Ethics { public class PowerDefinition { - private int m_Power; + public int Power { get; } - private TextDefinition m_Name; - private TextDefinition m_Phrase; - private TextDefinition m_Description; + public TextDefinition Name { get; } - public int Power => m_Power; + public TextDefinition Phrase { get; } - public TextDefinition Name => m_Name; - public TextDefinition Phrase => m_Phrase; - public TextDefinition Description => m_Description; + public TextDefinition Description { get; } public PowerDefinition( int power, TextDefinition name, TextDefinition phrase, TextDefinition description ) { - m_Power = power; + Power = power; - m_Name = name; - m_Phrase = phrase; - m_Description = description; + Name = name; + Phrase = phrase; + Description = description; } } } diff --git a/Scripts/Engines/Factions/Core/Election.cs b/Scripts/Engines/Factions/Core/Election.cs index 968d48c8d..a99e98ef2 100644 --- a/Scripts/Engines/Factions/Core/Election.cs +++ b/Scripts/Engines/Factions/Core/Election.cs @@ -14,22 +14,16 @@ namespace Server.Factions public const int MaxCandidates = 10; public const int CandidateRank = 5; - private Faction m_Faction; - private List m_Candidates; + public Faction Faction { get; } - private ElectionState m_State; - private DateTime m_LastStateTime; + public List Candidates { get; } - public Faction Faction => m_Faction; - - public List Candidates => m_Candidates; - - public ElectionState State{ get => m_State; - set{ m_State = value; m_LastStateTime = DateTime.UtcNow; } } - public DateTime LastStateTime => m_LastStateTime; + public ElectionState State{ get => CurrentState; + set{ CurrentState = value; LastStateTime = DateTime.UtcNow; } } + public DateTime LastStateTime { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public ElectionState CurrentState => m_State; + public ElectionState CurrentState { get; private set; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] public TimeSpan NextStateTime @@ -38,7 +32,7 @@ namespace Server.Factions { TimeSpan period; - switch ( m_State ) + switch ( CurrentState ) { default: case ElectionState.Pending: period = PendingPeriod; break; @@ -46,7 +40,7 @@ namespace Server.Factions case ElectionState.Campaign: period = CampaignPeriod; break; } - TimeSpan until = (m_LastStateTime + period) - DateTime.UtcNow; + TimeSpan until = (LastStateTime + period) - DateTime.UtcNow; if ( until < TimeSpan.Zero ) until = TimeSpan.Zero; @@ -57,7 +51,7 @@ namespace Server.Factions { TimeSpan period; - switch ( m_State ) + switch ( CurrentState ) { default: case ElectionState.Pending: period = PendingPeriod; break; @@ -65,7 +59,7 @@ namespace Server.Factions case ElectionState.Campaign: period = CampaignPeriod; break; } - m_LastStateTime = DateTime.UtcNow - period + value; + LastStateTime = DateTime.UtcNow - period + value; } } @@ -78,8 +72,8 @@ namespace Server.Factions public Election( Faction faction ) { - m_Faction = faction; - m_Candidates = new List(); + Faction = faction; + Candidates = new List(); StartTimer(); } @@ -92,12 +86,12 @@ namespace Server.Factions { case 0: { - m_Faction = Faction.ReadReference( reader ); + Faction = Faction.ReadReference( reader ); - m_LastStateTime = reader.ReadDateTime(); - m_State = (ElectionState)reader.ReadEncodedInt(); + LastStateTime = reader.ReadDateTime(); + CurrentState = (ElectionState)reader.ReadEncodedInt(); - m_Candidates = new List(); + Candidates = new List(); int count = reader.ReadEncodedInt(); @@ -106,7 +100,7 @@ namespace Server.Factions Candidate cd = new Candidate( reader ); if ( cd.Mobile != null ) - m_Candidates.Add( cd ); + Candidates.Add( cd ); } break; @@ -120,15 +114,15 @@ namespace Server.Factions { writer.WriteEncodedInt( (int) 0 ); // version - Faction.WriteReference( writer, m_Faction ); + Faction.WriteReference( writer, Faction ); - writer.Write( (DateTime) m_LastStateTime ); - writer.WriteEncodedInt( (int) m_State ); + writer.Write( (DateTime) LastStateTime ); + writer.WriteEncodedInt( (int) CurrentState ); - writer.WriteEncodedInt( m_Candidates.Count ); + writer.WriteEncodedInt( Candidates.Count ); - for ( int i = 0; i < m_Candidates.Count; ++i ) - m_Candidates[i].Serialize( writer ); + for ( int i = 0; i < Candidates.Count; ++i ) + Candidates[i].Serialize( writer ); } public void AddCandidate( Mobile mob ) @@ -136,17 +130,17 @@ namespace Server.Factions if ( IsCandidate( mob ) ) return; - m_Candidates.Add( new Candidate( mob ) ); + Candidates.Add( new Candidate( mob ) ); mob.SendLocalizedMessage( 1010117 ); // You are now running for office. } public void RemoveVoter( Mobile mob ) { - if ( m_State == ElectionState.Election ) + if ( CurrentState == ElectionState.Election ) { - for ( int i = 0; i < m_Candidates.Count; ++i ) + for ( int i = 0; i < Candidates.Count; ++i ) { - List voters = m_Candidates[i].Voters; + List voters = Candidates[i].Voters; for ( int j = 0; j < voters.Count; ++j ) { @@ -166,38 +160,38 @@ namespace Server.Factions if ( cd == null ) return; - m_Candidates.Remove( cd ); + Candidates.Remove( cd ); mob.SendLocalizedMessage( 1038031 ); - if ( m_State == ElectionState.Election ) + if ( CurrentState == ElectionState.Election ) { - if ( m_Candidates.Count == 1 ) + if ( Candidates.Count == 1 ) { - m_Faction.Broadcast( 1038031 ); // There are no longer any valid candidates in the Faction Commander election. + Faction.Broadcast( 1038031 ); // There are no longer any valid candidates in the Faction Commander election. - Candidate winner = m_Candidates[0]; + Candidate winner = Candidates[0]; Mobile winMob = winner.Mobile; PlayerState pl = PlayerState.Find( winMob ); - if ( pl == null || pl.Faction != m_Faction || winMob == m_Faction.Commander ) + if ( pl == null || pl.Faction != Faction || winMob == Faction.Commander ) { - m_Faction.Broadcast( 1038026 ); // Faction leadership has not changed. + Faction.Broadcast( 1038026 ); // Faction leadership has not changed. } else { - m_Faction.Broadcast( 1038028 ); // The faction has a new commander. - m_Faction.Commander = winMob; + Faction.Broadcast( 1038028 ); // The faction has a new commander. + Faction.Commander = winMob; } - m_Candidates.Clear(); + Candidates.Clear(); State = ElectionState.Pending; } - else if ( m_Candidates.Count == 0 ) // well, I guess this'll never happen + else if ( Candidates.Count == 0 ) // well, I guess this'll never happen { - m_Faction.Broadcast( 1038031 ); // There are no longer any valid candidates in the Faction Commander election. + Faction.Broadcast( 1038031 ); // There are no longer any valid candidates in the Faction Commander election. - m_Candidates.Clear(); + Candidates.Clear(); State = ElectionState.Pending; } } @@ -210,7 +204,7 @@ namespace Server.Factions public bool CanVote( Mobile mob ) { - return ( m_State == ElectionState.Election && !HasVoted( mob ) ); + return ( CurrentState == ElectionState.Election && !HasVoted( mob ) ); } public bool HasVoted( Mobile mob ) @@ -220,10 +214,10 @@ namespace Server.Factions public Candidate FindCandidate( Mobile mob ) { - for ( int i = 0; i < m_Candidates.Count; ++i ) + for ( int i = 0; i < Candidates.Count; ++i ) { - if ( m_Candidates[i].Mobile == mob ) - return m_Candidates[i]; + if ( Candidates[i].Mobile == mob ) + return Candidates[i]; } return null; @@ -231,16 +225,16 @@ namespace Server.Factions public Candidate FindVoter( Mobile mob ) { - for ( int i = 0; i < m_Candidates.Count; ++i ) + for ( int i = 0; i < Candidates.Count; ++i ) { - List voters = m_Candidates[i].Voters; + List voters = Candidates[i].Voters; for ( int j = 0; j < voters.Count; ++j ) { Voter voter = voters[j]; if ( voter.From == mob ) - return m_Candidates[i]; + return Candidates[i]; } } @@ -252,20 +246,20 @@ namespace Server.Factions if ( IsCandidate( mob ) ) return false; - if ( m_Candidates.Count >= MaxCandidates ) + if ( Candidates.Count >= MaxCandidates ) return false; - if ( m_State != ElectionState.Campaign ) + if ( CurrentState != ElectionState.Campaign ) return false; // sanity.. PlayerState pl = PlayerState.Find( mob ); - return ( pl != null && pl.Faction == m_Faction && pl.Rank.Rank >= CandidateRank ); + return ( pl != null && pl.Faction == Faction && pl.Rank.Rank >= CandidateRank ); } public void Slice() { - if ( m_Faction.Election != this ) + if ( Faction.Election != this ) { m_Timer?.Stop(); @@ -274,55 +268,55 @@ namespace Server.Factions return; } - switch ( m_State ) + switch ( CurrentState ) { case ElectionState.Pending: { - if ( (m_LastStateTime + PendingPeriod) > DateTime.UtcNow ) + if ( (LastStateTime + PendingPeriod) > DateTime.UtcNow ) break; - m_Faction.Broadcast( 1038023 ); // Campaigning for the Faction Commander election has begun. + Faction.Broadcast( 1038023 ); // Campaigning for the Faction Commander election has begun. - m_Candidates.Clear(); + Candidates.Clear(); State = ElectionState.Campaign; break; } case ElectionState.Campaign: { - if ( (m_LastStateTime + CampaignPeriod) > DateTime.UtcNow ) + if ( (LastStateTime + CampaignPeriod) > DateTime.UtcNow ) break; - if ( m_Candidates.Count == 0 ) + if ( Candidates.Count == 0 ) { - m_Faction.Broadcast( 1038025 ); // Nobody ran for office. + Faction.Broadcast( 1038025 ); // Nobody ran for office. State = ElectionState.Pending; } - else if ( m_Candidates.Count == 1 ) + else if ( Candidates.Count == 1 ) { - m_Faction.Broadcast( 1038029 ); // Only one member ran for office. + Faction.Broadcast( 1038029 ); // Only one member ran for office. - Candidate winner = m_Candidates[0]; + Candidate winner = Candidates[0]; Mobile mob = winner.Mobile; PlayerState pl = PlayerState.Find( mob ); - if ( pl == null || pl.Faction != m_Faction || mob == m_Faction.Commander ) + if ( pl == null || pl.Faction != Faction || mob == Faction.Commander ) { - m_Faction.Broadcast( 1038026 ); // Faction leadership has not changed. + Faction.Broadcast( 1038026 ); // Faction leadership has not changed. } else { - m_Faction.Broadcast( 1038028 ); // The faction has a new commander. - m_Faction.Commander = mob; + Faction.Broadcast( 1038028 ); // The faction has a new commander. + Faction.Commander = mob; } - m_Candidates.Clear(); + Candidates.Clear(); State = ElectionState.Pending; } else { - m_Faction.Broadcast( 1038030 ); + Faction.Broadcast( 1038030 ); State = ElectionState.Election; } @@ -330,20 +324,20 @@ namespace Server.Factions } case ElectionState.Election: { - if ( (m_LastStateTime + VotingPeriod) > DateTime.UtcNow ) + if ( (LastStateTime + VotingPeriod) > DateTime.UtcNow ) break; - m_Faction.Broadcast( 1038024 ); // The results for the Faction Commander election are in + Faction.Broadcast( 1038024 ); // The results for the Faction Commander election are in Candidate winner = null; - for ( int i = 0; i < m_Candidates.Count; ++i ) + for ( int i = 0; i < Candidates.Count; ++i ) { - Candidate cd = m_Candidates[i]; + Candidate cd = Candidates[i]; PlayerState pl = PlayerState.Find( cd.Mobile ); - if ( pl == null || pl.Faction != m_Faction ) + if ( pl == null || pl.Faction != Faction ) continue; //cd.CleanMuleVotes(); @@ -354,19 +348,19 @@ namespace Server.Factions if ( winner == null ) { - m_Faction.Broadcast( 1038026 ); // Faction leadership has not changed. + Faction.Broadcast( 1038026 ); // Faction leadership has not changed. } - else if ( winner.Mobile == m_Faction.Commander ) + else if ( winner.Mobile == Faction.Commander ) { - m_Faction.Broadcast( 1038027 ); // The incumbent won the election. + Faction.Broadcast( 1038027 ); // The incumbent won the election. } else { - m_Faction.Broadcast( 1038028 ); // The faction has a new commander. - m_Faction.Commander = winner.Mobile; + Faction.Broadcast( 1038028 ); // The faction has a new commander. + Faction.Commander = winner.Mobile; } - m_Candidates.Clear(); + Candidates.Clear(); State = ElectionState.Pending; break; @@ -377,35 +371,29 @@ namespace Server.Factions public class Voter { - private Mobile m_From; - private Mobile m_Candidate; + public Mobile From { get; } - private IPAddress m_Address; - private DateTime m_Time; + public Mobile Candidate { get; } - public Mobile From => m_From; + public IPAddress Address { get; } - public Mobile Candidate => m_Candidate; - - public IPAddress Address => m_Address; - - public DateTime Time => m_Time; + public DateTime Time { get; } public object[] AcquireFields() { TimeSpan gameTime = TimeSpan.Zero; - if ( m_From is PlayerMobile mobile ) + if ( From is PlayerMobile mobile ) gameTime = mobile.GameTime; int kp = 0; - PlayerState pl = PlayerState.Find( m_From ); + PlayerState pl = PlayerState.Find( From ); if ( pl != null ) kp = pl.KillPoints; - int sk = m_From.Skills.Total; + int sk = From.Skills.Total; int factorSkills = 50 + ( (sk * 100 ) / 10000 ); int factorKillPts = 100 + (kp*2); @@ -418,25 +406,25 @@ namespace Server.Factions else if ( totalFactor < 0 ) totalFactor = 0; - return new object[]{ m_From, m_Address, m_Time, totalFactor }; + return new object[]{ From, Address, Time, totalFactor }; } public Voter( Mobile from, Mobile candidate ) { - m_From = from; - m_Candidate = candidate; + From = from; + Candidate = candidate; - if ( m_From.NetState != null ) - m_Address = m_From.NetState.Address; + if ( From.NetState != null ) + Address = From.NetState.Address; else - m_Address = IPAddress.None; + Address = IPAddress.None; - m_Time = DateTime.UtcNow; + Time = DateTime.UtcNow; } public Voter( GenericReader reader, Mobile candidate ) { - m_Candidate = candidate; + Candidate = candidate; int version = reader.ReadEncodedInt(); @@ -444,9 +432,9 @@ namespace Server.Factions { case 0: { - m_From = reader.ReadMobile(); - m_Address = Utility.Intern( reader.ReadIPAddress() ); - m_Time = reader.ReadDateTime(); + From = reader.ReadMobile(); + Address = Utility.Intern( reader.ReadIPAddress() ); + Time = reader.ReadDateTime(); break; } @@ -457,37 +445,35 @@ namespace Server.Factions { writer.WriteEncodedInt( (int) 0 ); - writer.Write( (Mobile) m_From ); - writer.Write( (IPAddress) m_Address ); - writer.Write( (DateTime) m_Time ); + writer.Write( (Mobile) From ); + writer.Write( (IPAddress) Address ); + writer.Write( (DateTime) Time ); } } public class Candidate { - private Mobile m_Mobile; - private List m_Voters; + public Mobile Mobile { get; } - public Mobile Mobile => m_Mobile; - public List Voters => m_Voters; + public List Voters { get; } - public int Votes => m_Voters.Count; + public int Votes => Voters.Count; public void CleanMuleVotes() { - for ( int i = 0; i < m_Voters.Count; ++i ) + for ( int i = 0; i < Voters.Count; ++i ) { - Voter voter = (Voter)m_Voters[i]; + Voter voter = (Voter)Voters[i]; if ( (int)voter.AcquireFields()[3] < 90 ) - m_Voters.RemoveAt( i-- ); + Voters.RemoveAt( i-- ); } } public Candidate( Mobile mob ) { - m_Mobile = mob; - m_Voters = new List(); + Mobile = mob; + Voters = new List(); } public Candidate( GenericReader reader ) @@ -498,30 +484,30 @@ namespace Server.Factions { case 1: { - m_Mobile = reader.ReadMobile(); + Mobile = reader.ReadMobile(); int count = reader.ReadEncodedInt(); - m_Voters = new List( count ); + Voters = new List( count ); for ( int i = 0; i < count; ++i ) { - Voter voter = new Voter( reader, m_Mobile ); + Voter voter = new Voter( reader, Mobile ); if ( voter.From != null ) - m_Voters.Add( voter ); + Voters.Add( voter ); } break; } case 0: { - m_Mobile = reader.ReadMobile(); + Mobile = reader.ReadMobile(); List mobs = reader.ReadStrongMobileList(); - m_Voters = new List( mobs.Count ); + Voters = new List( mobs.Count ); for ( int i = 0; i < mobs.Count; ++i ) - m_Voters.Add( new Voter( mobs[i], m_Mobile ) ); + Voters.Add( new Voter( mobs[i], Mobile ) ); break; } @@ -532,12 +518,12 @@ namespace Server.Factions { writer.WriteEncodedInt( (int) 1 ); // version - writer.Write( (Mobile) m_Mobile ); + writer.Write( (Mobile) Mobile ); - writer.WriteEncodedInt( (int) m_Voters.Count ); + writer.WriteEncodedInt( (int) Voters.Count ); - for ( int i = 0; i < m_Voters.Count; ++i ) - ((Voter)m_Voters[i]).Serialize( writer ); + for ( int i = 0; i < Voters.Count; ++i ) + ((Voter)Voters[i]).Serialize( writer ); } } diff --git a/Scripts/Engines/Factions/Core/Faction.cs b/Scripts/Engines/Factions/Core/Faction.cs index 922a58de0..b0ddd856e 100644 --- a/Scripts/Engines/Factions/Core/Faction.cs +++ b/Scripts/Engines/Factions/Core/Faction.cs @@ -18,14 +18,8 @@ namespace Server.Factions public int ZeroRankOffset; private FactionDefinition m_Definition; - private FactionState m_State; - private StrongholdRegion m_StrongholdRegion; - public StrongholdRegion StrongholdRegion - { - get => m_StrongholdRegion; - set => m_StrongholdRegion = value; - } + public StrongholdRegion StrongholdRegion { get; set; } public FactionDefinition Definition { @@ -33,49 +27,45 @@ namespace Server.Factions set { m_Definition = value; - m_StrongholdRegion = new StrongholdRegion( this ); + StrongholdRegion = new StrongholdRegion( this ); } } - public FactionState State - { - get => m_State; - set => m_State = value; - } + public FactionState State { get; set; } public Election Election { - get => m_State.Election; - set => m_State.Election = value; + get => State.Election; + set => State.Election = value; } public Mobile Commander { - get => m_State.Commander; - set => m_State.Commander = value; + get => State.Commander; + set => State.Commander = value; } public int Tithe { - get => m_State.Tithe; - set => m_State.Tithe = value; + get => State.Tithe; + set => State.Tithe = value; } public int Silver { - get => m_State.Silver; - set => m_State.Silver = value; + get => State.Silver; + set => State.Silver = value; } public List Members { - get => m_State.Members; - set => m_State.Members = value; + get => State.Members; + set => State.Members = value; } public static readonly TimeSpan LeavePeriod = TimeSpan.FromDays( 3.0 ); - public bool FactionMessageReady => m_State.FactionMessageReady; + public bool FactionMessageReady => State.FactionMessageReady; public void Broadcast( string text ) { @@ -117,7 +107,7 @@ namespace Server.Factions public void EndBroadcast( Mobile from, string text ) { if ( from.AccessLevel == AccessLevel.Player ) - m_State.RegisterBroadcast(); + State.RegisterBroadcast(); Broadcast( Definition.HueBroadcast, "{0} [Commander] {1} : {2}", from.Name, Definition.FriendlyName, text ); } @@ -514,7 +504,7 @@ namespace Server.Factions public Faction() { - m_State = new FactionState( this ); + State = new FactionState( this ); } public override string ToString() @@ -949,8 +939,8 @@ namespace Server.Factions public List Traps { - get => m_State.Traps; - set => m_State.Traps = value; + get => State.Traps; + set => State.Traps = value; } public const int StabilityFactor = 300; // 300% greater (3 times) than smallest faction diff --git a/Scripts/Engines/Factions/Core/FactionItem.cs b/Scripts/Engines/Factions/Core/FactionItem.cs index e86115c02..9b7ddc449 100644 --- a/Scripts/Engines/Factions/Core/FactionItem.cs +++ b/Scripts/Engines/Factions/Core/FactionItem.cs @@ -11,28 +11,26 @@ namespace Server.Factions { public static readonly TimeSpan ExpirationPeriod = TimeSpan.FromDays( 21.0 ); - private Item m_Item; - private Faction m_Faction; - private DateTime m_Expiration; + public Item Item { get; } - public Item Item => m_Item; - public Faction Faction => m_Faction; - public DateTime Expiration => m_Expiration; + public Faction Faction { get; } + + public DateTime Expiration { get; private set; } public bool HasExpired { get { - if ( m_Item == null || m_Item.Deleted ) + if ( Item == null || Item.Deleted ) return true; - return ( m_Expiration != DateTime.MinValue && DateTime.UtcNow >= m_Expiration ); + return ( Expiration != DateTime.MinValue && DateTime.UtcNow >= Expiration ); } } public void StartExpiration() { - m_Expiration = DateTime.UtcNow + ExpirationPeriod; + Expiration = DateTime.UtcNow + ExpirationPeriod; } public void CheckAttach() @@ -45,25 +43,25 @@ namespace Server.Factions public void Attach() { - if ( m_Item is IFactionItem item ) + if ( Item is IFactionItem item ) item.FactionItemState = this; - m_Faction?.State.FactionItems.Add( this ); + Faction?.State.FactionItems.Add( this ); } public void Detach() { - if ( m_Item is IFactionItem item ) + if ( Item is IFactionItem item ) item.FactionItemState = null; - if ( m_Faction != null && m_Faction.State.FactionItems.Contains( this ) ) - m_Faction.State.FactionItems.Remove( this ); + if ( Faction != null && Faction.State.FactionItems.Contains( this ) ) + Faction.State.FactionItems.Remove( this ); } public FactionItem( Item item, Faction faction ) { - m_Item = item; - m_Faction = faction; + Item = item; + Faction = faction; } public FactionItem( GenericReader reader, Faction faction ) @@ -74,21 +72,21 @@ namespace Server.Factions { case 0: { - m_Item = reader.ReadItem(); - m_Expiration = reader.ReadDateTime(); + Item = reader.ReadItem(); + Expiration = reader.ReadDateTime(); break; } } - m_Faction = faction; + Faction = faction; } public void Serialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); - writer.Write( (Item) m_Item ); - writer.Write( (DateTime) m_Expiration ); + writer.Write( (Item) Item ); + writer.Write( (DateTime) Expiration ); } public static int GetMaxWearables( Mobile mob ) diff --git a/Scripts/Engines/Factions/Core/FactionState.cs b/Scripts/Engines/Factions/Core/FactionState.cs index 88fb1d8e5..7b6c84393 100644 --- a/Scripts/Engines/Factions/Core/FactionState.cs +++ b/Scripts/Engines/Factions/Core/FactionState.cs @@ -7,22 +7,13 @@ namespace Server.Factions { private Faction m_Faction; private Mobile m_Commander; - private int m_Tithe; - private int m_Silver; - private List m_Members; - private Election m_Election; - private List m_FactionItems; - private List m_FactionTraps; - private DateTime m_LastAtrophy; private const int BroadcastsPerPeriod = 2; private static readonly TimeSpan BroadcastPeriod = TimeSpan.FromHours( 1.0 ); private DateTime[] m_LastBroadcasts = new DateTime[BroadcastsPerPeriod]; - public DateTime LastAtrophy{ get => m_LastAtrophy; - set => m_LastAtrophy = value; - } + public DateTime LastAtrophy { get; set; } public bool FactionMessageReady { @@ -38,17 +29,17 @@ namespace Server.Factions } } - public bool IsAtrophyReady => DateTime.UtcNow >= (m_LastAtrophy + TimeSpan.FromHours( 47.0 )); + public bool IsAtrophyReady => DateTime.UtcNow >= (LastAtrophy + TimeSpan.FromHours( 47.0 )); public int CheckAtrophy() { - if ( DateTime.UtcNow < (m_LastAtrophy + TimeSpan.FromHours( 47.0 )) ) + if ( DateTime.UtcNow < (LastAtrophy + TimeSpan.FromHours( 47.0 )) ) return 0; int distrib = 0; - m_LastAtrophy = DateTime.UtcNow; + LastAtrophy = DateTime.UtcNow; - List members = new List( m_Members ); + List members = new List( Members ); for ( int i = 0; i < members.Count; ++i ) { @@ -83,23 +74,11 @@ namespace Server.Factions } } - public List FactionItems - { - get => m_FactionItems; - set => m_FactionItems = value; - } + public List FactionItems { get; set; } - public List Traps - { - get => m_FactionTraps; - set => m_FactionTraps = value; - } + public List Traps { get; set; } - public Election Election - { - get => m_Election; - set => m_Election = value; - } + public Election Election { get; set; } public Mobile Commander { @@ -127,32 +106,20 @@ namespace Server.Factions } } - public int Tithe - { - get => m_Tithe; - set => m_Tithe = value; - } + public int Tithe { get; set; } - public int Silver - { - get => m_Silver; - set => m_Silver = value; - } + public int Silver { get; set; } - public List Members - { - get => m_Members; - set => m_Members = value; - } + public List Members { get; set; } public FactionState( Faction faction ) { m_Faction = faction; - m_Tithe = 50; - m_Members = new List(); - m_Election = new Election( faction ); - m_FactionItems = new List(); - m_FactionTraps = new List(); + Tithe = 50; + Members = new List(); + Election = new Election( faction ); + FactionItems = new List(); + Traps = new List(); } public FactionState( GenericReader reader ) @@ -163,7 +130,7 @@ namespace Server.Factions { case 5: { - m_LastAtrophy = reader.ReadDateTime(); + LastAtrophy = reader.ReadDateTime(); goto case 4; } case 4: @@ -184,7 +151,7 @@ namespace Server.Factions case 2: case 1: { - m_Election = new Election( reader ); + Election = new Election( reader ); goto case 0; } @@ -195,7 +162,7 @@ namespace Server.Factions m_Commander = reader.ReadMobile(); if ( version < 5 ) - m_LastAtrophy = DateTime.UtcNow; + LastAtrophy = DateTime.UtcNow; if ( version < 4 ) { @@ -205,28 +172,28 @@ namespace Server.Factions m_LastBroadcasts[0] = time; } - m_Tithe = reader.ReadEncodedInt(); - m_Silver = reader.ReadEncodedInt(); + Tithe = reader.ReadEncodedInt(); + Silver = reader.ReadEncodedInt(); int memberCount = reader.ReadEncodedInt(); - m_Members = new List(); + Members = new List(); for ( int i = 0; i < memberCount; ++i ) { - PlayerState pl = new PlayerState( reader, m_Faction, m_Members ); + PlayerState pl = new PlayerState( reader, m_Faction, Members ); if ( pl.Mobile != null ) - m_Members.Add( pl ); + Members.Add( pl ); } m_Faction.State = this; - m_Faction.ZeroRankOffset = m_Members.Count; - m_Members.Sort(); + m_Faction.ZeroRankOffset = Members.Count; + Members.Sort(); - for ( int i = m_Members.Count - 1; i >= 0; i-- ) { - PlayerState player = m_Members[i]; + for ( int i = Members.Count - 1; i >= 0; i-- ) { + PlayerState player = Members[i]; if ( player.KillPoints <= 0 ) m_Faction.ZeroRankOffset = i; @@ -234,7 +201,7 @@ namespace Server.Factions player.RankIndex = i; } - m_FactionItems = new List(); + FactionItems = new List(); if ( version >= 2 ) { @@ -248,7 +215,7 @@ namespace Server.Factions } } - m_FactionTraps = new List(); + Traps = new List(); if ( version >= 3 ) { @@ -257,7 +224,7 @@ namespace Server.Factions for ( int i = 0; i < factionTrapCount; ++i ) { if ( reader.ReadItem() is BaseFactionTrap trap && !trap.CheckDecay() ) - m_FactionTraps.Add( trap ); + Traps.Add( trap ); } } @@ -266,47 +233,47 @@ namespace Server.Factions } if ( version < 1 ) - m_Election = new Election( m_Faction ); + Election = new Election( m_Faction ); } public void Serialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 5 ); // version - writer.Write( m_LastAtrophy ); + writer.Write( LastAtrophy ); writer.WriteEncodedInt( (int) m_LastBroadcasts.Length ); for ( int i = 0; i < m_LastBroadcasts.Length; ++i ) writer.Write( (DateTime) m_LastBroadcasts[i] ); - m_Election.Serialize( writer ); + Election.Serialize( writer ); Faction.WriteReference( writer, m_Faction ); writer.Write( (Mobile) m_Commander ); - writer.WriteEncodedInt( (int) m_Tithe ); - writer.WriteEncodedInt( (int) m_Silver ); + writer.WriteEncodedInt( (int) Tithe ); + writer.WriteEncodedInt( (int) Silver ); - writer.WriteEncodedInt( (int) m_Members.Count ); + writer.WriteEncodedInt( (int) Members.Count ); - for ( int i = 0; i < m_Members.Count; ++i ) + for ( int i = 0; i < Members.Count; ++i ) { - PlayerState pl = (PlayerState) m_Members[i]; + PlayerState pl = (PlayerState) Members[i]; pl.Serialize( writer ); } - writer.WriteEncodedInt( (int) m_FactionItems.Count ); + writer.WriteEncodedInt( (int) FactionItems.Count ); - for ( int i = 0; i < m_FactionItems.Count; ++i ) - m_FactionItems[i].Serialize( writer ); + for ( int i = 0; i < FactionItems.Count; ++i ) + FactionItems[i].Serialize( writer ); - writer.WriteEncodedInt( (int) m_FactionTraps.Count ); + writer.WriteEncodedInt( (int) Traps.Count ); - for ( int i = 0; i < m_FactionTraps.Count; ++i ) - writer.Write( (Item) m_FactionTraps[i] ); + for ( int i = 0; i < Traps.Count; ++i ) + writer.Write( (Item) Traps[i] ); } } } diff --git a/Scripts/Engines/Factions/Core/GuardList.cs b/Scripts/Engines/Factions/Core/GuardList.cs index caa3cd8ea..9117e21c3 100644 --- a/Scripts/Engines/Factions/Core/GuardList.cs +++ b/Scripts/Engines/Factions/Core/GuardList.cs @@ -5,22 +5,20 @@ namespace Server.Factions { public class GuardList { - private GuardDefinition m_Definition; - private List m_Guards; + public GuardDefinition Definition { get; } - public GuardDefinition Definition => m_Definition; - public List Guards => m_Guards; + public List Guards { get; } public BaseFactionGuard Construct() { - try{ return Activator.CreateInstance( m_Definition.Type ) as BaseFactionGuard; } + try{ return Activator.CreateInstance( Definition.Type ) as BaseFactionGuard; } catch{ return null; } } public GuardList( GuardDefinition definition ) { - m_Definition = definition; - m_Guards = new List(); + Definition = definition; + Guards = new List(); } } } \ No newline at end of file diff --git a/Scripts/Engines/Factions/Core/MerchantTitles.cs b/Scripts/Engines/Factions/Core/MerchantTitles.cs index 3e67e8eb5..1a0fb33a6 100644 --- a/Scripts/Engines/Factions/Core/MerchantTitles.cs +++ b/Scripts/Engines/Factions/Core/MerchantTitles.cs @@ -12,56 +12,53 @@ namespace Server.Factions public class MerchantTitleInfo { - private SkillName m_Skill; - private double m_Requirement; - private TextDefinition m_Title; - private TextDefinition m_Label; - private TextDefinition m_Assigned; + public SkillName Skill { get; } - public SkillName Skill => m_Skill; - public double Requirement => m_Requirement; - public TextDefinition Title => m_Title; - public TextDefinition Label => m_Label; - public TextDefinition Assigned => m_Assigned; + public double Requirement { get; } + + public TextDefinition Title { get; } + + public TextDefinition Label { get; } + + public TextDefinition Assigned { get; } public MerchantTitleInfo( SkillName skill, double requirement, TextDefinition title, TextDefinition label, TextDefinition assigned ) { - m_Skill = skill; - m_Requirement = requirement; - m_Title = title; - m_Label = label; - m_Assigned = assigned; + Skill = skill; + Requirement = requirement; + Title = title; + Label = label; + Assigned = assigned; } } public class MerchantTitles { - private static MerchantTitleInfo[] m_Info = { - new MerchantTitleInfo( SkillName.Inscribe, 90.0, new TextDefinition( 1060773, "Scribe" ), new TextDefinition( 1011468, "SCRIBE" ), new TextDefinition( 1010121, "You now have the faction title of scribe" ) ), - new MerchantTitleInfo( SkillName.Carpentry, 90.0, new TextDefinition( 1060774, "Carpenter" ), new TextDefinition( 1011469, "CARPENTER" ), new TextDefinition( 1010122, "You now have the faction title of carpenter" ) ), - new MerchantTitleInfo( SkillName.Tinkering, 90.0, new TextDefinition( 1022984, "Tinker" ), new TextDefinition( 1011470, "TINKER" ), new TextDefinition( 1010123, "You now have the faction title of tinker" ) ), - new MerchantTitleInfo( SkillName.Blacksmith, 90.0, new TextDefinition( 1023016, "Blacksmith" ), new TextDefinition( 1011471, "BLACKSMITH" ), new TextDefinition( 1010124, "You now have the faction title of blacksmith" ) ), - new MerchantTitleInfo( SkillName.Fletching, 90.0, new TextDefinition( 1023022, "Bowyer" ), new TextDefinition( 1011472, "BOWYER" ), new TextDefinition( 1010125, "You now have the faction title of Bowyer" ) ), - new MerchantTitleInfo( SkillName.Tailoring, 90.0, new TextDefinition( 1022982, "Tailor" ), new TextDefinition( 1018300, "TAILOR" ), new TextDefinition( 1042162, "You now have the faction title of Tailor" ) ), - }; - - public static MerchantTitleInfo[] Info => m_Info; + public static MerchantTitleInfo[] Info { get; } = + { + new MerchantTitleInfo( SkillName.Inscribe, 90.0, new TextDefinition( 1060773, "Scribe" ), new TextDefinition( 1011468, "SCRIBE" ), new TextDefinition( 1010121, "You now have the faction title of scribe" ) ), + new MerchantTitleInfo( SkillName.Carpentry, 90.0, new TextDefinition( 1060774, "Carpenter" ), new TextDefinition( 1011469, "CARPENTER" ), new TextDefinition( 1010122, "You now have the faction title of carpenter" ) ), + new MerchantTitleInfo( SkillName.Tinkering, 90.0, new TextDefinition( 1022984, "Tinker" ), new TextDefinition( 1011470, "TINKER" ), new TextDefinition( 1010123, "You now have the faction title of tinker" ) ), + new MerchantTitleInfo( SkillName.Blacksmith, 90.0, new TextDefinition( 1023016, "Blacksmith" ), new TextDefinition( 1011471, "BLACKSMITH" ), new TextDefinition( 1010124, "You now have the faction title of blacksmith" ) ), + new MerchantTitleInfo( SkillName.Fletching, 90.0, new TextDefinition( 1023022, "Bowyer" ), new TextDefinition( 1011472, "BOWYER" ), new TextDefinition( 1010125, "You now have the faction title of Bowyer" ) ), + new MerchantTitleInfo( SkillName.Tailoring, 90.0, new TextDefinition( 1022982, "Tailor" ), new TextDefinition( 1018300, "TAILOR" ), new TextDefinition( 1042162, "You now have the faction title of Tailor" ) ), + }; public static MerchantTitleInfo GetInfo( MerchantTitle title ) { int idx = (int)title - 1; - if ( idx >= 0 && idx < m_Info.Length ) - return m_Info[idx]; + if ( idx >= 0 && idx < Info.Length ) + return Info[idx]; return null; } public static bool HasMerchantQualifications( Mobile mob ) { - for ( int i = 0; i < m_Info.Length; ++i ) + for ( int i = 0; i < Info.Length; ++i ) { - if ( IsQualified( mob, m_Info[i] ) ) + if ( IsQualified( mob, Info[i] ) ) return true; } diff --git a/Scripts/Engines/Factions/Core/Persistance.cs b/Scripts/Engines/Factions/Core/Persistance.cs index 78d46ccac..3e74ebc5d 100644 --- a/Scripts/Engines/Factions/Core/Persistance.cs +++ b/Scripts/Engines/Factions/Core/Persistance.cs @@ -4,9 +4,7 @@ namespace Server.Factions { public class FactionPersistance : Item { - private static FactionPersistance m_Instance; - - public static FactionPersistance Instance => m_Instance; + public static FactionPersistance Instance { get; private set; } public override string DefaultName => "Faction Persistance - Internal"; @@ -14,8 +12,8 @@ namespace Server.Factions { Movable = false; - if ( m_Instance == null || m_Instance.Deleted ) - m_Instance = this; + if ( Instance == null || Instance.Deleted ) + Instance = this; else base.Delete(); } @@ -29,7 +27,7 @@ namespace Server.Factions public FactionPersistance( Serial serial ) : base( serial ) { - m_Instance = this; + Instance = this; } public override void Serialize( GenericWriter writer ) diff --git a/Scripts/Engines/Factions/Core/PlayerState.cs b/Scripts/Engines/Factions/Core/PlayerState.cs index a93fc6b91..c408c0d3d 100644 --- a/Scripts/Engines/Factions/Core/PlayerState.cs +++ b/Scripts/Engines/Factions/Core/PlayerState.cs @@ -6,31 +6,26 @@ namespace Server.Factions { public class PlayerState : IComparable { - private Mobile m_Mobile; - private Faction m_Faction; - private List m_Owner; private int m_KillPoints; - private DateTime m_Leaving; private MerchantTitle m_MerchantTitle; private RankDefinition m_Rank; - private List m_SilverGiven; - private bool m_IsActive; private Town m_Sheriff; private Town m_Finance; - private DateTime m_LastHonorTime; + public Mobile Mobile { get; } + + public Faction Faction { get; } + + public List Owner { get; } - public Mobile Mobile => m_Mobile; - public Faction Faction => m_Faction; - public List Owner => m_Owner; public MerchantTitle MerchantTitle{ get => m_MerchantTitle; set{ m_MerchantTitle = value; Invalidate(); } } public Town Sheriff{ get => m_Sheriff; set{ m_Sheriff = value; Invalidate(); } } public Town Finance{ get => m_Finance; set{ m_Finance = value; Invalidate(); } } - public List SilverGiven => m_SilverGiven; + public List SilverGiven { get; private set; } public int KillPoints { get => m_KillPoints; @@ -44,17 +39,17 @@ namespace Server.Factions return; } - m_Owner.Remove( this ); - m_Owner.Insert( m_Faction.ZeroRankOffset, this ); + Owner.Remove( this ); + Owner.Insert( Faction.ZeroRankOffset, this ); - m_RankIndex = m_Faction.ZeroRankOffset; - m_Faction.ZeroRankOffset++; + m_RankIndex = Faction.ZeroRankOffset; + Faction.ZeroRankOffset++; } while ( ( m_RankIndex - 1 ) >= 0 ) { - PlayerState p = m_Owner[m_RankIndex-1] as PlayerState; + PlayerState p = Owner[m_RankIndex-1] as PlayerState; if ( value > p.KillPoints ) { - m_Owner[m_RankIndex] = p; - m_Owner[m_RankIndex-1] = this; + Owner[m_RankIndex] = p; + Owner[m_RankIndex-1] = this; RankIndex--; p.RankIndex++; } @@ -70,23 +65,23 @@ namespace Server.Factions return; } - while ( ( m_RankIndex + 1 ) < m_Faction.ZeroRankOffset ) { - PlayerState p = m_Owner[m_RankIndex+1] as PlayerState; - m_Owner[m_RankIndex+1] = this; - m_Owner[m_RankIndex] = p; + while ( ( m_RankIndex + 1 ) < Faction.ZeroRankOffset ) { + PlayerState p = Owner[m_RankIndex+1] as PlayerState; + Owner[m_RankIndex+1] = this; + Owner[m_RankIndex] = p; RankIndex++; p.RankIndex--; } m_RankIndex = -1; - m_Faction.ZeroRankOffset--; + Faction.ZeroRankOffset--; } else { - while ( ( m_RankIndex + 1 ) < m_Faction.ZeroRankOffset ) { - PlayerState p = m_Owner[m_RankIndex+1] as PlayerState; + while ( ( m_RankIndex + 1 ) < Faction.ZeroRankOffset ) { + PlayerState p = Owner[m_RankIndex+1] as PlayerState; if ( value < p.KillPoints ) { - m_Owner[m_RankIndex+1] = this; - m_Owner[m_RankIndex] = p; + Owner[m_RankIndex+1] = this; + Owner[m_RankIndex] = p; RankIndex++; p.RankIndex--; } @@ -111,15 +106,15 @@ namespace Server.Factions public RankDefinition Rank { get { if ( m_InvalidateRank ) { - RankDefinition[] ranks = m_Faction.Definition.Ranks; + RankDefinition[] ranks = Faction.Definition.Ranks; int percent; - if ( m_Owner.Count == 1 ) + if ( Owner.Count == 1 ) percent = 1000; else if ( m_RankIndex == -1 ) percent = 0; else - percent = ( ( m_Faction.ZeroRankOffset - m_RankIndex ) * 1000 ) / m_Faction.ZeroRankOffset; + percent = ( ( Faction.ZeroRankOffset - m_RankIndex ) * 1000 ) / Faction.ZeroRankOffset; for ( int i = 0; i < ranks.Length; i++ ) { RankDefinition check = ranks[i]; @@ -138,29 +133,25 @@ namespace Server.Factions } } - public DateTime LastHonorTime{ get => m_LastHonorTime; - set => m_LastHonorTime = value; - } - public DateTime Leaving{ get => m_Leaving; - set => m_Leaving = value; - } - public bool IsLeaving => ( m_Leaving > DateTime.MinValue ); + public DateTime LastHonorTime { get; set; } - public bool IsActive{ get => m_IsActive; - set => m_IsActive = value; - } + public DateTime Leaving { get; set; } + + public bool IsLeaving => ( Leaving > DateTime.MinValue ); + + public bool IsActive { get; set; } public bool CanGiveSilverTo( Mobile mob ) { - if ( m_SilverGiven == null ) + if ( SilverGiven == null ) return true; - for ( int i = 0; i < m_SilverGiven.Count; ++i ) + for ( int i = 0; i < SilverGiven.Count; ++i ) { - SilverGivenEntry sge = m_SilverGiven[i]; + SilverGivenEntry sge = SilverGiven[i]; if ( sge.IsExpired ) - m_SilverGiven.RemoveAt( i-- ); + SilverGiven.RemoveAt( i-- ); else if ( sge.GivenTo == mob ) return false; } @@ -170,15 +161,15 @@ namespace Server.Factions public void OnGivenSilverTo( Mobile mob ) { - if ( m_SilverGiven == null ) - m_SilverGiven = new List(); + if ( SilverGiven == null ) + SilverGiven = new List(); - m_SilverGiven.Add( new SilverGivenEntry( mob ) ); + SilverGiven.Add( new SilverGivenEntry( mob ) ); } public void Invalidate() { - if ( m_Mobile is PlayerMobile pm ) + if ( Mobile is PlayerMobile pm ) { pm.InvalidateProperties(); pm.InvalidateMyRunUO(); @@ -187,15 +178,15 @@ namespace Server.Factions public void Attach() { - if ( m_Mobile is PlayerMobile mobile ) + if ( Mobile is PlayerMobile mobile ) mobile.FactionPlayerState = this; } public PlayerState( Mobile mob, Faction faction, List owner ) { - m_Mobile = mob; - m_Faction = faction; - m_Owner = owner; + Mobile = mob; + Faction = faction; + Owner = owner; Attach(); Invalidate(); @@ -203,8 +194,8 @@ namespace Server.Factions public PlayerState( GenericReader reader, Faction faction, List owner ) { - m_Faction = faction; - m_Owner = owner; + Faction = faction; + Owner = owner; int version = reader.ReadEncodedInt(); @@ -212,18 +203,18 @@ namespace Server.Factions { case 1: { - m_IsActive = reader.ReadBool(); - m_LastHonorTime = reader.ReadDateTime(); + IsActive = reader.ReadBool(); + LastHonorTime = reader.ReadDateTime(); goto case 0; } case 0: { - m_Mobile = reader.ReadMobile(); + Mobile = reader.ReadMobile(); m_KillPoints = reader.ReadEncodedInt(); m_MerchantTitle = (MerchantTitle)reader.ReadEncodedInt(); - m_Leaving = reader.ReadDateTime(); + Leaving = reader.ReadDateTime(); break; } @@ -236,15 +227,15 @@ namespace Server.Factions { writer.WriteEncodedInt( (int) 1 ); // version - writer.Write( m_IsActive ); - writer.Write( m_LastHonorTime ); + writer.Write( IsActive ); + writer.Write( LastHonorTime ); - writer.Write( (Mobile) m_Mobile ); + writer.Write( (Mobile) Mobile ); writer.WriteEncodedInt( (int) m_KillPoints ); writer.WriteEncodedInt( (int) m_MerchantTitle ); - writer.Write( (DateTime) m_Leaving ); + writer.Write( (DateTime) Leaving ); } public static PlayerState Find( Mobile mob ) diff --git a/Scripts/Engines/Factions/Core/SilverGivenEntry.cs b/Scripts/Engines/Factions/Core/SilverGivenEntry.cs index c6bb28296..a1a361af8 100644 --- a/Scripts/Engines/Factions/Core/SilverGivenEntry.cs +++ b/Scripts/Engines/Factions/Core/SilverGivenEntry.cs @@ -6,18 +6,16 @@ namespace Server.Factions { public static readonly TimeSpan ExpirePeriod = TimeSpan.FromHours( 3.0 ); - private Mobile m_GivenTo; - private DateTime m_TimeOfGift; + public Mobile GivenTo { get; } - public Mobile GivenTo => m_GivenTo; - public DateTime TimeOfGift => m_TimeOfGift; + public DateTime TimeOfGift { get; } - public bool IsExpired => ( m_TimeOfGift + ExpirePeriod ) < DateTime.UtcNow; + public bool IsExpired => ( TimeOfGift + ExpirePeriod ) < DateTime.UtcNow; public SilverGivenEntry( Mobile givenTo ) { - m_GivenTo = givenTo; - m_TimeOfGift = DateTime.UtcNow; + GivenTo = givenTo; + TimeOfGift = DateTime.UtcNow; } } } \ No newline at end of file diff --git a/Scripts/Engines/Factions/Core/StrongholdRegion.cs b/Scripts/Engines/Factions/Core/StrongholdRegion.cs index 53f672ffb..f7b0156ff 100644 --- a/Scripts/Engines/Factions/Core/StrongholdRegion.cs +++ b/Scripts/Engines/Factions/Core/StrongholdRegion.cs @@ -5,17 +5,11 @@ namespace Server.Factions { public class StrongholdRegion : BaseRegion { - private Faction m_Faction; - - public Faction Faction - { - get => m_Faction; - set => m_Faction = value; - } + public Faction Faction { get; set; } public StrongholdRegion( Faction faction ) : base( faction.Definition.FriendlyName, Faction.Facet, DefaultPriority, faction.Definition.Stronghold.Area ) { - m_Faction = faction; + Faction = faction; Register(); } diff --git a/Scripts/Engines/Factions/Core/Town.cs b/Scripts/Engines/Factions/Core/Town.cs index 69997479a..58d19fbb3 100644 --- a/Scripts/Engines/Factions/Core/Town.cs +++ b/Scripts/Engines/Factions/Core/Town.cs @@ -9,14 +9,9 @@ namespace Server.Factions [CustomEnum( new[]{ "Britain", "Magincia", "Minoc", "Moonglow", "Skara Brae", "Trinsic", "Vesper", "Yew" } )] public abstract class Town : IComparable { - private TownDefinition m_Definition; private TownState m_State; - public TownDefinition Definition - { - get => m_Definition; - set => m_Definition = value; - } + public TownDefinition Definition { get; set; } public TownState State { @@ -244,29 +239,18 @@ namespace Server.Factions return list; } - private List m_VendorLists; - private List m_GuardLists; + public List VendorLists { get; set; } - public List VendorLists - { - get => m_VendorLists; - set => m_VendorLists = value; - } - - public List GuardLists - { - get => m_GuardLists; - set => m_GuardLists = value; - } + public List GuardLists { get; set; } public void ConstructGuardLists() { GuardDefinition[] defs = ( Owner == null ? new GuardDefinition[0] : Owner.Definition.Guards ); - m_GuardLists = new List(); + GuardLists = new List(); for ( int i = 0; i < defs.Length; ++i ) - m_GuardLists.Add( new GuardList( defs[i] ) ); + GuardLists.Add( new GuardList( defs[i] ) ); } public GuardList FindGuardList( Type type ) @@ -288,10 +272,10 @@ namespace Server.Factions { VendorDefinition[] defs = VendorDefinition.Definitions; - m_VendorLists = new List(); + VendorLists = new List(); for ( int i = 0; i < defs.Length; ++i ) - m_VendorLists.Add( new VendorList( defs[i] ) ); + VendorLists.Add( new VendorList( defs[i] ) ); } public VendorList FindVendorList( Type type ) @@ -468,12 +452,12 @@ namespace Server.Factions public int CompareTo( object obj ) { - return m_Definition.Sort - ((Town)obj).m_Definition.Sort; + return Definition.Sort - ((Town)obj).Definition.Sort; } public override string ToString() { - return m_Definition.FriendlyName; + return Definition.FriendlyName; } public static void WriteReference( GenericWriter writer, Town town ) diff --git a/Scripts/Engines/Factions/Core/TownState.cs b/Scripts/Engines/Factions/Core/TownState.cs index 8cae343b7..12606d4ef 100644 --- a/Scripts/Engines/Factions/Core/TownState.cs +++ b/Scripts/Engines/Factions/Core/TownState.cs @@ -4,29 +4,12 @@ namespace Server.Factions { public class TownState { - private Town m_Town; - private Faction m_Owner; - private Mobile m_Sheriff; private Mobile m_Finance; - private int m_Silver; - private int m_Tax; + public Town Town { get; set; } - private DateTime m_LastTaxChange; - private DateTime m_LastIncome; - - public Town Town - { - get => m_Town; - set => m_Town = value; - } - - public Faction Owner - { - get => m_Owner; - set => m_Owner = value; - } + public Faction Owner { get; set; } public Mobile Sheriff { @@ -48,7 +31,7 @@ namespace Server.Factions PlayerState pl = PlayerState.Find( m_Sheriff ); if ( pl != null ) - pl.Sheriff = m_Town; + pl.Sheriff = Town; } } } @@ -73,38 +56,22 @@ namespace Server.Factions PlayerState pl = PlayerState.Find( m_Finance ); if ( pl != null ) - pl.Finance = m_Town; + pl.Finance = Town; } } } - public int Silver - { - get => m_Silver; - set => m_Silver = value; - } + public int Silver { get; set; } - public int Tax - { - get => m_Tax; - set => m_Tax = value; - } + public int Tax { get; set; } - public DateTime LastTaxChange - { - get => m_LastTaxChange; - set => m_LastTaxChange = value; - } + public DateTime LastTaxChange { get; set; } - public DateTime LastIncome - { - get => m_LastIncome; - set => m_LastIncome = value; - } + public DateTime LastIncome { get; set; } public TownState( Town town ) { - m_Town = town; + Town = town; } public TownState( GenericReader reader ) @@ -115,32 +82,32 @@ namespace Server.Factions { case 3: { - m_LastIncome = reader.ReadDateTime(); + LastIncome = reader.ReadDateTime(); goto case 2; } case 2: { - m_Tax = reader.ReadEncodedInt(); - m_LastTaxChange = reader.ReadDateTime(); + Tax = reader.ReadEncodedInt(); + LastTaxChange = reader.ReadDateTime(); goto case 1; } case 1: { - m_Silver = reader.ReadEncodedInt(); + Silver = reader.ReadEncodedInt(); goto case 0; } case 0: { - m_Town = Town.ReadReference( reader ); - m_Owner = Faction.ReadReference( reader ); + Town = Town.ReadReference( reader ); + Owner = Faction.ReadReference( reader ); m_Sheriff = reader.ReadMobile(); m_Finance = reader.ReadMobile(); - m_Town.State = this; + Town.State = this; break; } @@ -151,15 +118,15 @@ namespace Server.Factions { writer.WriteEncodedInt( (int) 3 ); // version - writer.Write( (DateTime) m_LastIncome ); + writer.Write( (DateTime) LastIncome ); - writer.WriteEncodedInt( (int) m_Tax ); - writer.Write( (DateTime) m_LastTaxChange ); + writer.WriteEncodedInt( (int) Tax ); + writer.Write( (DateTime) LastTaxChange ); - writer.WriteEncodedInt( (int) m_Silver ); + writer.WriteEncodedInt( (int) Silver ); - Town.WriteReference( writer, m_Town ); - Faction.WriteReference( writer, m_Owner ); + Town.WriteReference( writer, Town ); + Faction.WriteReference( writer, Owner ); writer.Write( (Mobile) m_Sheriff ); writer.Write( (Mobile) m_Finance ); diff --git a/Scripts/Engines/Factions/Core/VendorList.cs b/Scripts/Engines/Factions/Core/VendorList.cs index d2130d521..aa9c0bba5 100644 --- a/Scripts/Engines/Factions/Core/VendorList.cs +++ b/Scripts/Engines/Factions/Core/VendorList.cs @@ -5,22 +5,20 @@ namespace Server.Factions { public class VendorList { - private VendorDefinition m_Definition; - private List m_Vendors; + public VendorDefinition Definition { get; } - public VendorDefinition Definition => m_Definition; - public List Vendors => m_Vendors; + public List Vendors { get; } public BaseFactionVendor Construct( Town town, Faction faction ) { - try{ return Activator.CreateInstance( m_Definition.Type, new object[]{ town, faction } ) as BaseFactionVendor; } + try{ return Activator.CreateInstance( Definition.Type, new object[]{ town, faction } ) as BaseFactionVendor; } catch{ return null; } } public VendorList( VendorDefinition definition ) { - m_Definition = definition; - m_Vendors = new List(); + Definition = definition; + Vendors = new List(); } } } diff --git a/Scripts/Engines/Factions/Definitions/FactionDefinition.cs b/Scripts/Engines/Factions/Definitions/FactionDefinition.cs index f6a3115da..da6f6ee06 100644 --- a/Scripts/Engines/Factions/Definitions/FactionDefinition.cs +++ b/Scripts/Engines/Factions/Definitions/FactionDefinition.cs @@ -2,97 +2,83 @@ namespace Server.Factions { public class FactionDefinition { - private int m_Sort; + public int Sort { get; } - private int m_HuePrimary; - private int m_HueSecondary; - private int m_HueJoin; - private int m_HueBroadcast; + public int HuePrimary { get; } - private int m_WarHorseBody; - private int m_WarHorseItem; + public int HueSecondary { get; } - private string m_FriendlyName; - private string m_Keyword; - private string m_Abbreviation; + public int HueJoin { get; } - private TextDefinition m_Name; - private TextDefinition m_PropName; - private TextDefinition m_Header; - private TextDefinition m_About; - private TextDefinition m_CityControl; - private TextDefinition m_SigilControl; - private TextDefinition m_SignupName; - private TextDefinition m_FactionStoneName; - private TextDefinition m_OwnerLabel; + public int HueBroadcast { get; } - private TextDefinition m_GuardIgnore, m_GuardWarn, m_GuardAttack; + public int WarHorseBody { get; } - private StrongholdDefinition m_Stronghold; + public int WarHorseItem { get; } - private RankDefinition[] m_Ranks; - private GuardDefinition[] m_Guards; + public string FriendlyName { get; } - public int Sort => m_Sort; + public string Keyword { get; } - public int HuePrimary => m_HuePrimary; - public int HueSecondary => m_HueSecondary; - public int HueJoin => m_HueJoin; - public int HueBroadcast => m_HueBroadcast; + public string Abbreviation { get; } - public int WarHorseBody => m_WarHorseBody; - public int WarHorseItem => m_WarHorseItem; + public TextDefinition Name { get; } - public string FriendlyName => m_FriendlyName; - public string Keyword => m_Keyword; - public string Abbreviation => m_Abbreviation; + public TextDefinition PropName { get; } - public TextDefinition Name => m_Name; - public TextDefinition PropName => m_PropName; - public TextDefinition Header => m_Header; - public TextDefinition About => m_About; - public TextDefinition CityControl => m_CityControl; - public TextDefinition SigilControl => m_SigilControl; - public TextDefinition SignupName => m_SignupName; - public TextDefinition FactionStoneName => m_FactionStoneName; - public TextDefinition OwnerLabel => m_OwnerLabel; + public TextDefinition Header { get; } - public TextDefinition GuardIgnore => m_GuardIgnore; - public TextDefinition GuardWarn => m_GuardWarn; - public TextDefinition GuardAttack => m_GuardAttack; + public TextDefinition About { get; } - public StrongholdDefinition Stronghold => m_Stronghold; + public TextDefinition CityControl { get; } - public RankDefinition[] Ranks => m_Ranks; - public GuardDefinition[] Guards => m_Guards; + public TextDefinition SigilControl { get; } + + public TextDefinition SignupName { get; } + + public TextDefinition FactionStoneName { get; } + + public TextDefinition OwnerLabel { get; } + + public TextDefinition GuardIgnore { get; } + + public TextDefinition GuardWarn { get; } + + public TextDefinition GuardAttack { get; } + + public StrongholdDefinition Stronghold { get; } + + public RankDefinition[] Ranks { get; } + + public GuardDefinition[] Guards { get; } public FactionDefinition( int sort, int huePrimary, int hueSecondary, int hueJoin, int hueBroadcast, int warHorseBody, int warHorseItem, string friendlyName, string keyword, string abbreviation, TextDefinition name, TextDefinition propName, TextDefinition header, TextDefinition about, TextDefinition cityControl, TextDefinition sigilControl, TextDefinition signupName, TextDefinition factionStoneName, TextDefinition ownerLabel, TextDefinition guardIgnore, TextDefinition guardWarn, TextDefinition guardAttack, StrongholdDefinition stronghold, RankDefinition[] ranks, GuardDefinition[] guards ) { - m_Sort = sort; - m_HuePrimary = huePrimary; - m_HueSecondary = hueSecondary; - m_HueJoin = hueJoin; - m_HueBroadcast = hueBroadcast; - m_WarHorseBody = warHorseBody; - m_WarHorseItem = warHorseItem; - m_FriendlyName = friendlyName; - m_Keyword = keyword; - m_Abbreviation = abbreviation; - m_Name = name; - m_PropName = propName; - m_Header = header; - m_About = about; - m_CityControl = cityControl; - m_SigilControl = sigilControl; - m_SignupName = signupName; - m_FactionStoneName = factionStoneName; - m_OwnerLabel = ownerLabel; - m_GuardIgnore = guardIgnore; - m_GuardWarn = guardWarn; - m_GuardAttack = guardAttack; - m_Stronghold = stronghold; - m_Ranks = ranks; - m_Guards = guards; + Sort = sort; + HuePrimary = huePrimary; + HueSecondary = hueSecondary; + HueJoin = hueJoin; + HueBroadcast = hueBroadcast; + WarHorseBody = warHorseBody; + WarHorseItem = warHorseItem; + FriendlyName = friendlyName; + Keyword = keyword; + Abbreviation = abbreviation; + Name = name; + PropName = propName; + Header = header; + About = about; + CityControl = cityControl; + SigilControl = sigilControl; + SignupName = signupName; + FactionStoneName = factionStoneName; + OwnerLabel = ownerLabel; + GuardIgnore = guardIgnore; + GuardWarn = guardWarn; + GuardAttack = guardAttack; + Stronghold = stronghold; + Ranks = ranks; + Guards = guards; } } } diff --git a/Scripts/Engines/Factions/Definitions/FactionItemDefinition.cs b/Scripts/Engines/Factions/Definitions/FactionItemDefinition.cs index fe74d0663..dca8e633c 100644 --- a/Scripts/Engines/Factions/Definitions/FactionItemDefinition.cs +++ b/Scripts/Engines/Factions/Definitions/FactionItemDefinition.cs @@ -6,16 +6,14 @@ namespace Server.Factions { public class FactionItemDefinition { - private int m_SilverCost; - private Type m_VendorType; + public int SilverCost { get; } - public int SilverCost => m_SilverCost; - public Type VendorType => m_VendorType; + public Type VendorType { get; } public FactionItemDefinition( int silverCost, Type vendorType ) { - m_SilverCost = silverCost; - m_VendorType = vendorType; + SilverCost = silverCost; + VendorType = vendorType; } private static FactionItemDefinition m_MetalArmor = new FactionItemDefinition( 1000, typeof( Blacksmith ) ); diff --git a/Scripts/Engines/Factions/Definitions/GuardDefinition.cs b/Scripts/Engines/Factions/Definitions/GuardDefinition.cs index 9f5ee7894..86fe1f9ff 100644 --- a/Scripts/Engines/Factions/Definitions/GuardDefinition.cs +++ b/Scripts/Engines/Factions/Definitions/GuardDefinition.cs @@ -4,38 +4,31 @@ namespace Server.Factions { public class GuardDefinition { - private Type m_Type; + public Type Type { get; } - private int m_Price; - private int m_Upkeep; - private int m_Maximum; + public int Price { get; } - private int m_ItemID; + public int Upkeep { get; } - private TextDefinition m_Header; - private TextDefinition m_Label; + public int Maximum { get; } - public Type Type => m_Type; + public int ItemID { get; } - public int Price => m_Price; - public int Upkeep => m_Upkeep; - public int Maximum => m_Maximum; - public int ItemID => m_ItemID; + public TextDefinition Header { get; } - public TextDefinition Header => m_Header; - public TextDefinition Label => m_Label; + public TextDefinition Label { get; } public GuardDefinition( Type type, int itemID, int price, int upkeep, int maximum, TextDefinition header, TextDefinition label ) { - m_Type = type; + Type = type; - m_Price = price; - m_Upkeep = upkeep; - m_Maximum = maximum; - m_ItemID = itemID; + Price = price; + Upkeep = upkeep; + Maximum = maximum; + ItemID = itemID; - m_Header = header; - m_Label = label; + Header = header; + Label = label; } } } \ No newline at end of file diff --git a/Scripts/Engines/Factions/Definitions/RankDefinition.cs b/Scripts/Engines/Factions/Definitions/RankDefinition.cs index 8332ec5d7..883bf8fab 100644 --- a/Scripts/Engines/Factions/Definitions/RankDefinition.cs +++ b/Scripts/Engines/Factions/Definitions/RankDefinition.cs @@ -2,22 +2,20 @@ namespace Server.Factions { public class RankDefinition { - private int m_Rank; - private int m_Required; - private int m_MaxWearables; - private TextDefinition m_Title; + public int Rank { get; } - public int Rank => m_Rank; - public int Required => m_Required; - public int MaxWearables => m_MaxWearables; - public TextDefinition Title => m_Title; + public int Required { get; } + + public int MaxWearables { get; } + + public TextDefinition Title { get; } public RankDefinition( int rank, int required, int maxWearables, TextDefinition title ) { - m_Rank = rank; - m_Required = required; - m_Title = title; - m_MaxWearables = maxWearables; + Rank = rank; + Required = required; + Title = title; + MaxWearables = maxWearables; } } } \ No newline at end of file diff --git a/Scripts/Engines/Factions/Definitions/StrongholdDefintion.cs b/Scripts/Engines/Factions/Definitions/StrongholdDefintion.cs index a882f5867..1e2eecedd 100644 --- a/Scripts/Engines/Factions/Definitions/StrongholdDefintion.cs +++ b/Scripts/Engines/Factions/Definitions/StrongholdDefintion.cs @@ -2,24 +2,20 @@ namespace Server.Factions { public class StrongholdDefinition { - private Rectangle2D[] m_Area; - private Point3D m_JoinStone; - private Point3D m_FactionStone; - private Point3D[] m_Monoliths; + public Rectangle2D[] Area { get; } - public Rectangle2D[] Area => m_Area; + public Point3D JoinStone { get; } - public Point3D JoinStone => m_JoinStone; - public Point3D FactionStone => m_FactionStone; + public Point3D FactionStone { get; } - public Point3D[] Monoliths => m_Monoliths; + public Point3D[] Monoliths { get; } public StrongholdDefinition( Rectangle2D[] area, Point3D joinStone, Point3D factionStone, Point3D[] monoliths ) { - m_Area = area; - m_JoinStone = joinStone; - m_FactionStone = factionStone; - m_Monoliths = monoliths; + Area = area; + JoinStone = joinStone; + FactionStone = factionStone; + Monoliths = monoliths; } } } \ No newline at end of file diff --git a/Scripts/Engines/Factions/Definitions/TownDefinition.cs b/Scripts/Engines/Factions/Definitions/TownDefinition.cs index 73a9e0d56..e8a5b3581 100644 --- a/Scripts/Engines/Factions/Definitions/TownDefinition.cs +++ b/Scripts/Engines/Factions/Definitions/TownDefinition.cs @@ -2,56 +2,47 @@ namespace Server.Factions { public class TownDefinition { - private int m_Sort; - private int m_SigilID; + public int Sort { get; } - private string m_Region; + public int SigilID { get; } - private string m_FriendlyName; + public string Region { get; } - private TextDefinition m_TownName; - private TextDefinition m_TownStoneHeader; - private TextDefinition m_StrongholdMonolithName; - private TextDefinition m_TownMonolithName; - private TextDefinition m_TownStoneName; - private TextDefinition m_SigilName; - private TextDefinition m_CorruptedSigilName; + public string FriendlyName { get; } - private Point3D m_Monolith; - private Point3D m_TownStone; + public TextDefinition TownName { get; } - public int Sort => m_Sort; - public int SigilID => m_SigilID; + public TextDefinition TownStoneHeader { get; } - public string Region => m_Region; - public string FriendlyName => m_FriendlyName; + public TextDefinition StrongholdMonolithName { get; } - public TextDefinition TownName => m_TownName; - public TextDefinition TownStoneHeader => m_TownStoneHeader; - public TextDefinition StrongholdMonolithName => m_StrongholdMonolithName; - public TextDefinition TownMonolithName => m_TownMonolithName; - public TextDefinition TownStoneName => m_TownStoneName; - public TextDefinition SigilName => m_SigilName; - public TextDefinition CorruptedSigilName => m_CorruptedSigilName; + public TextDefinition TownMonolithName { get; } - public Point3D Monolith => m_Monolith; - public Point3D TownStone => m_TownStone; + public TextDefinition TownStoneName { get; } + + public TextDefinition SigilName { get; } + + public TextDefinition CorruptedSigilName { get; } + + public Point3D Monolith { get; } + + public Point3D TownStone { get; } public TownDefinition( int sort, int sigilID, string region, string friendlyName, TextDefinition townName, TextDefinition townStoneHeader, TextDefinition strongholdMonolithName, TextDefinition townMonolithName, TextDefinition townStoneName, TextDefinition sigilName, TextDefinition corruptedSigilName, Point3D monolith, Point3D townStone ) { - m_Sort = sort; - m_SigilID = sigilID; - m_Region = region; - m_FriendlyName = friendlyName; - m_TownName = townName; - m_TownStoneHeader = townStoneHeader; - m_StrongholdMonolithName = strongholdMonolithName; - m_TownMonolithName = townMonolithName; - m_TownStoneName = townStoneName; - m_SigilName = sigilName; - m_CorruptedSigilName = corruptedSigilName; - m_Monolith = monolith; - m_TownStone = townStone; + Sort = sort; + SigilID = sigilID; + Region = region; + FriendlyName = friendlyName; + TownName = townName; + TownStoneHeader = townStoneHeader; + StrongholdMonolithName = strongholdMonolithName; + TownMonolithName = townMonolithName; + TownStoneName = townStoneName; + SigilName = sigilName; + CorruptedSigilName = corruptedSigilName; + Monolith = monolith; + TownStone = townStone; } } } \ No newline at end of file diff --git a/Scripts/Engines/Factions/Definitions/VendorDefinition.cs b/Scripts/Engines/Factions/Definitions/VendorDefinition.cs index 158d55e93..f7cbc6dd1 100644 --- a/Scripts/Engines/Factions/Definitions/VendorDefinition.cs +++ b/Scripts/Engines/Factions/Definitions/VendorDefinition.cs @@ -4,78 +4,70 @@ namespace Server.Factions { public class VendorDefinition { - private Type m_Type; + public Type Type { get; } - private int m_Price; - private int m_Upkeep; - private int m_Maximum; + public int Price { get; } - private int m_ItemID; + public int Upkeep { get; } - private TextDefinition m_Header; - private TextDefinition m_Label; + public int Maximum { get; } - public Type Type => m_Type; + public int ItemID { get; } - public int Price => m_Price; - public int Upkeep => m_Upkeep; - public int Maximum => m_Maximum; - public int ItemID => m_ItemID; + public TextDefinition Header { get; } - public TextDefinition Header => m_Header; - public TextDefinition Label => m_Label; + public TextDefinition Label { get; } public VendorDefinition( Type type, int itemID, int price, int upkeep, int maximum, TextDefinition header, TextDefinition label ) { - m_Type = type; + Type = type; - m_Price = price; - m_Upkeep = upkeep; - m_Maximum = maximum; - m_ItemID = itemID; + Price = price; + Upkeep = upkeep; + Maximum = maximum; + ItemID = itemID; - m_Header = header; - m_Label = label; + Header = header; + Label = label; } - private static VendorDefinition[] m_Definitions = { - new VendorDefinition( typeof( FactionBottleVendor ), 0xF0E, - 5000, - 1000, - 10, - new TextDefinition( 1011549, "POTION BOTTLE VENDOR" ), - new TextDefinition( 1011544, "Buy Potion Bottle Vendor" ) - ), - new VendorDefinition( typeof( FactionBoardVendor ), 0x1BD7, - 3000, - 500, - 10, - new TextDefinition( 1011552, "WOOD VENDOR" ), - new TextDefinition( 1011545, "Buy Wooden Board Vendor" ) - ), - new VendorDefinition( typeof( FactionOreVendor ), 0x19B8, - 3000, - 500, - 10, - new TextDefinition( 1011553, "IRON ORE VENDOR" ), - new TextDefinition( 1011546, "Buy Iron Ore Vendor" ) - ), - new VendorDefinition( typeof( FactionReagentVendor ), 0xF86, - 5000, - 1000, - 10, - new TextDefinition( 1011554, "REAGENT VENDOR" ), - new TextDefinition( 1011547, "Buy Reagent Vendor" ) - ), - new VendorDefinition( typeof( FactionHorseVendor ), 0x20DD, - 5000, - 1000, - 1, - new TextDefinition( 1011556, "HORSE BREEDER" ), - new TextDefinition( 1011555, "Buy Horse Breeder" ) - ) - }; - - public static VendorDefinition[] Definitions => m_Definitions; + public static VendorDefinition[] Definitions { get; } = + { + new VendorDefinition( typeof( FactionBottleVendor ), 0xF0E, + 5000, + 1000, + 10, + new TextDefinition( 1011549, "POTION BOTTLE VENDOR" ), + new TextDefinition( 1011544, "Buy Potion Bottle Vendor" ) + ), + new VendorDefinition( typeof( FactionBoardVendor ), 0x1BD7, + 3000, + 500, + 10, + new TextDefinition( 1011552, "WOOD VENDOR" ), + new TextDefinition( 1011545, "Buy Wooden Board Vendor" ) + ), + new VendorDefinition( typeof( FactionOreVendor ), 0x19B8, + 3000, + 500, + 10, + new TextDefinition( 1011553, "IRON ORE VENDOR" ), + new TextDefinition( 1011546, "Buy Iron Ore Vendor" ) + ), + new VendorDefinition( typeof( FactionReagentVendor ), 0xF86, + 5000, + 1000, + 10, + new TextDefinition( 1011554, "REAGENT VENDOR" ), + new TextDefinition( 1011547, "Buy Reagent Vendor" ) + ), + new VendorDefinition( typeof( FactionHorseVendor ), 0x20DD, + 5000, + 1000, + 1, + new TextDefinition( 1011556, "HORSE BREEDER" ), + new TextDefinition( 1011555, "Buy Horse Breeder" ) + ) + }; } } \ No newline at end of file diff --git a/Scripts/Engines/Factions/Instances/Factions/CouncilOfMages.cs b/Scripts/Engines/Factions/Instances/Factions/CouncilOfMages.cs index 97cb2066e..a27f21c5d 100644 --- a/Scripts/Engines/Factions/Instances/Factions/CouncilOfMages.cs +++ b/Scripts/Engines/Factions/Instances/Factions/CouncilOfMages.cs @@ -2,13 +2,11 @@ namespace Server.Factions { public class CouncilOfMages : Faction { - private static Faction m_Instance; - - public static Faction Instance => m_Instance; + public static Faction Instance { get; private set; } public CouncilOfMages() { - m_Instance = this; + Instance = this; Definition = new FactionDefinition( diff --git a/Scripts/Engines/Factions/Instances/Factions/Minax.cs b/Scripts/Engines/Factions/Instances/Factions/Minax.cs index 22d2391b1..888801e9f 100644 --- a/Scripts/Engines/Factions/Instances/Factions/Minax.cs +++ b/Scripts/Engines/Factions/Instances/Factions/Minax.cs @@ -2,13 +2,11 @@ namespace Server.Factions { public class Minax : Faction { - private static Faction m_Instance; - - public static Faction Instance => m_Instance; + public static Faction Instance { get; private set; } public Minax() { - m_Instance = this; + Instance = this; Definition = new FactionDefinition( diff --git a/Scripts/Engines/Factions/Instances/Factions/Shadowlords.cs b/Scripts/Engines/Factions/Instances/Factions/Shadowlords.cs index d3f4d749f..bbb9c42ca 100644 --- a/Scripts/Engines/Factions/Instances/Factions/Shadowlords.cs +++ b/Scripts/Engines/Factions/Instances/Factions/Shadowlords.cs @@ -2,13 +2,11 @@ namespace Server.Factions { public class Shadowlords : Faction { - private static Faction m_Instance; - - public static Faction Instance => m_Instance; + public static Faction Instance { get; private set; } public Shadowlords() { - m_Instance = this; + Instance = this; Definition = new FactionDefinition( diff --git a/Scripts/Engines/Factions/Instances/Factions/TrueBritannians.cs b/Scripts/Engines/Factions/Instances/Factions/TrueBritannians.cs index 9681e22ba..910345e09 100644 --- a/Scripts/Engines/Factions/Instances/Factions/TrueBritannians.cs +++ b/Scripts/Engines/Factions/Instances/Factions/TrueBritannians.cs @@ -2,13 +2,11 @@ namespace Server.Factions { public class TrueBritannians : Faction { - private static Faction m_Instance; - - public static Faction Instance => m_Instance; + public static Faction Instance { get; private set; } public TrueBritannians() { - m_Instance = this; + Instance = this; Definition = new FactionDefinition( diff --git a/Scripts/Engines/Factions/Items/BaseMonolith.cs b/Scripts/Engines/Factions/Items/BaseMonolith.cs index 7066a40ba..7dec0555d 100644 --- a/Scripts/Engines/Factions/Items/BaseMonolith.cs +++ b/Scripts/Engines/Factions/Items/BaseMonolith.cs @@ -80,18 +80,18 @@ namespace Server.Factions Movable = false; Town = town; Faction = faction; - m_Monoliths.Add( this ); + Monoliths.Add( this ); } public BaseMonolith( Serial serial ) : base( serial ) { - m_Monoliths.Add( this ); + Monoliths.Add( this ); } public override void OnAfterDelete() { base.OnAfterDelete(); - m_Monoliths.Remove( this ); + Monoliths.Remove( this ); } public override void Serialize( GenericWriter writer ) @@ -124,12 +124,6 @@ namespace Server.Factions } } - private static List m_Monoliths = new List(); - - public static List Monoliths - { - get => m_Monoliths; - set => m_Monoliths = value; - } + public static List Monoliths { get; set; } = new List(); } } \ No newline at end of file diff --git a/Scripts/Engines/Factions/Items/Power Faction Items/PowerFactionItem.cs b/Scripts/Engines/Factions/Items/Power Faction Items/PowerFactionItem.cs index 313b164d0..bd0591b11 100644 --- a/Scripts/Engines/Factions/Items/Power Faction Items/PowerFactionItem.cs +++ b/Scripts/Engines/Factions/Items/Power Faction Items/PowerFactionItem.cs @@ -32,20 +32,17 @@ namespace Server { } private sealed class WeightedItem { - private int _weight; - private Type _type; + public int Weight { get; } - public int Weight => _weight; - - public Type Type => _type; + public Type Type { get; } public WeightedItem( int weight, Type type ) { - _weight = weight; - _type = type; + Weight = weight; + Type = type; } public Item Construct() { - return Activator.CreateInstance( _type ) as Item; + return Activator.CreateInstance( Type ) as Item; } } diff --git a/Scripts/Engines/Factions/Items/Sigil.cs b/Scripts/Engines/Factions/Items/Sigil.cs index dfae7bfa8..a4a52b809 100644 --- a/Scripts/Engines/Factions/Items/Sigil.cs +++ b/Scripts/Engines/Factions/Items/Sigil.cs @@ -22,44 +22,21 @@ namespace Server.Factions // Once it's been returned the corrupting faction owns the town for this period of time public static readonly TimeSpan PurificationPeriod = TimeSpan.FromDays( 3.0 ); - private BaseMonolith m_LastMonolith; - private Town m_Town; private Faction m_Corrupted; private Faction m_Corrupting; - private DateTime m_LastStolen; - private DateTime m_GraceStart; - private DateTime m_CorruptionStart; - private DateTime m_PurificationStart; + [CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )] + public DateTime LastStolen { get; set; } [CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )] - public DateTime LastStolen - { - get => m_LastStolen; - set => m_LastStolen = value; - } + public DateTime GraceStart { get; set; } [CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )] - public DateTime GraceStart - { - get => m_GraceStart; - set => m_GraceStart = value; - } + public DateTime CorruptionStart { get; set; } [CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )] - public DateTime CorruptionStart - { - get => m_CorruptionStart; - set => m_CorruptionStart = value; - } - - [CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )] - public DateTime PurificationStart - { - get => m_PurificationStart; - set => m_PurificationStart = value; - } + public DateTime PurificationStart { get; set; } [CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )] public Town Town @@ -83,20 +60,16 @@ namespace Server.Factions } [CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )] - public BaseMonolith LastMonolith - { - get => m_LastMonolith; - set => m_LastMonolith = value; - } + public BaseMonolith LastMonolith { get; set; } [CommandProperty( AccessLevel.Counselor )] - public bool IsBeingCorrupted => ( m_LastMonolith is StrongholdMonolith && m_LastMonolith.Faction == m_Corrupting && m_Corrupting != null ); + public bool IsBeingCorrupted => ( LastMonolith is StrongholdMonolith && LastMonolith.Faction == m_Corrupting && m_Corrupting != null ); [CommandProperty( AccessLevel.Counselor )] public bool IsCorrupted => ( m_Corrupted != null ); [CommandProperty( AccessLevel.Counselor )] - public bool IsPurifying => ( m_PurificationStart != DateTime.MinValue ); + public bool IsPurifying => ( PurificationStart != DateTime.MinValue ); [CommandProperty( AccessLevel.Counselor )] public bool IsCorrupting => ( m_Corrupting != null && m_Corrupting != m_Corrupted ); @@ -198,7 +171,7 @@ namespace Server.Factions Movable = false; Town = town; - m_Sigils.Add( this ); + Sigils.Add( this ); } public override void OnDoubleClick( Mobile from ) @@ -220,13 +193,13 @@ namespace Server.Factions private void BeginCorrupting( Faction faction ) { m_Corrupting = faction; - m_CorruptionStart = DateTime.UtcNow; + CorruptionStart = DateTime.UtcNow; } private void ClearCorrupting() { m_Corrupting = null; - m_CorruptionStart = DateTime.MinValue; + CorruptionStart = DateTime.MinValue; } [CommandProperty( AccessLevel.GameMaster )] @@ -237,7 +210,7 @@ namespace Server.Factions if ( !IsBeingCorrupted ) return TimeSpan.Zero; - TimeSpan ts = ( m_CorruptionStart + CorruptionPeriod ) - DateTime.UtcNow; + TimeSpan ts = ( CorruptionStart + CorruptionPeriod ) - DateTime.UtcNow; if ( ts < TimeSpan.Zero ) ts = TimeSpan.Zero; @@ -301,25 +274,25 @@ namespace Server.Factions if ( m_Corrupted != newController ) BeginCorrupting( newController ); } - else if ( m_GraceStart > DateTime.MinValue && (m_GraceStart + CorruptionGrace) < DateTime.UtcNow ) + else if ( GraceStart > DateTime.MinValue && (GraceStart + CorruptionGrace) < DateTime.UtcNow ) { if ( m_Corrupted != newController ) BeginCorrupting( newController ); // grace time over, reset period else ClearCorrupting(); - m_GraceStart = DateTime.MinValue; + GraceStart = DateTime.MinValue; } else if ( newController == oldController ) { - m_GraceStart = DateTime.MinValue; // returned within grace period + GraceStart = DateTime.MinValue; // returned within grace period } - else if ( m_GraceStart == DateTime.MinValue ) + else if ( GraceStart == DateTime.MinValue ) { - m_GraceStart = DateTime.UtcNow; + GraceStart = DateTime.UtcNow; } - m_PurificationStart = DateTime.MinValue; + PurificationStart = DateTime.MinValue; } } #endregion @@ -336,8 +309,8 @@ namespace Server.Factions tm.Sigil = this; m_Corrupting = null; - m_PurificationStart = DateTime.UtcNow; - m_CorruptionStart = DateTime.MinValue; + PurificationStart = DateTime.UtcNow; + CorruptionStart = DateTime.MinValue; m_Town.Capture( m_Corrupted ); m_Corrupted = null; @@ -355,7 +328,7 @@ namespace Server.Factions public Sigil( Serial serial ) : base( serial ) { - m_Sigils.Add( this ); + Sigils.Add( this ); } public override void Serialize( GenericWriter writer ) @@ -368,12 +341,12 @@ namespace Server.Factions Faction.WriteReference( writer, m_Corrupted ); Faction.WriteReference( writer, m_Corrupting ); - writer.Write( (Item) m_LastMonolith ); + writer.Write( (Item) LastMonolith ); - writer.Write( m_LastStolen ); - writer.Write( m_GraceStart ); - writer.Write( m_CorruptionStart ); - writer.Write( m_PurificationStart ); + writer.Write( LastStolen ); + writer.Write( GraceStart ); + writer.Write( CorruptionStart ); + writer.Write( PurificationStart ); } public override void Deserialize( GenericReader reader ) @@ -390,12 +363,12 @@ namespace Server.Factions m_Corrupted = Faction.ReadReference( reader ); m_Corrupting = Faction.ReadReference( reader ); - m_LastMonolith = reader.ReadItem() as BaseMonolith; + LastMonolith = reader.ReadItem() as BaseMonolith; - m_LastStolen = reader.ReadDateTime(); - m_GraceStart = reader.ReadDateTime(); - m_CorruptionStart = reader.ReadDateTime(); - m_PurificationStart = reader.ReadDateTime(); + LastStolen = reader.ReadDateTime(); + GraceStart = reader.ReadDateTime(); + CorruptionStart = reader.ReadDateTime(); + PurificationStart = reader.ReadDateTime(); Update(); @@ -409,7 +382,7 @@ namespace Server.Factions public bool ReturnHome() { - BaseMonolith monolith = m_LastMonolith; + BaseMonolith monolith = LastMonolith; if ( monolith == null && m_Town != null ) monolith = m_Town.Monolith; @@ -431,7 +404,7 @@ namespace Server.Factions { base.OnAfterDelete(); - m_Sigils.Remove( this ); + Sigils.Remove( this ); } public override void Delete() @@ -442,8 +415,6 @@ namespace Server.Factions base.Delete(); } - private static List m_Sigils = new List(); - - public static List Sigils => m_Sigils; + public static List Sigils { get; } = new List(); } } diff --git a/Scripts/Engines/Factions/Items/Traps/BaseFactionTrap.cs b/Scripts/Engines/Factions/Items/Traps/BaseFactionTrap.cs index 439ad1c04..b77d43c8c 100644 --- a/Scripts/Engines/Factions/Items/Traps/BaseFactionTrap.cs +++ b/Scripts/Engines/Factions/Items/Traps/BaseFactionTrap.cs @@ -15,32 +15,16 @@ namespace Server.Factions public abstract class BaseFactionTrap : BaseTrap { - private Faction m_Faction; - private Mobile m_Placer; - private DateTime m_TimeOfPlacement; - private Timer m_Concealing; [CommandProperty( AccessLevel.GameMaster )] - public Faction Faction - { - get => m_Faction; - set => m_Faction = value; - } + public Faction Faction { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Mobile Placer - { - get => m_Placer; - set => m_Placer = value; - } + public Mobile Placer { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime TimeOfPlacement - { - get => m_TimeOfPlacement; - set => m_TimeOfPlacement = value; - } + public DateTime TimeOfPlacement { get; set; } public virtual int EffectSound => 0; @@ -79,24 +63,24 @@ namespace Server.Factions int silverToAward = ( from.Alive ? 20 : 40 ); - if ( silverToAward > 0 && m_Placer != null && m_Faction != null ) + if ( silverToAward > 0 && Placer != null && Faction != null ) { PlayerState victimState = PlayerState.Find( from ); - if ( victimState != null && victimState.CanGiveSilverTo( m_Placer ) && victimState.KillPoints > 0 ) + if ( victimState != null && victimState.CanGiveSilverTo( Placer ) && victimState.KillPoints > 0 ) { - int silverGiven = m_Faction.AwardSilver( m_Placer, silverToAward ); + int silverGiven = Faction.AwardSilver( Placer, silverToAward ); if ( silverGiven > 0 ) { // TODO: Get real message if ( from.Alive ) - m_Placer.SendMessage( "You have earned {0} silver pieces because {1} fell for your trap.", silverGiven, from.Name ); + Placer.SendMessage( "You have earned {0} silver pieces because {1} fell for your trap.", silverGiven, from.Name ); else - m_Placer.SendLocalizedMessage( 1042736, $"{silverGiven} silver\t{from.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~! + Placer.SendLocalizedMessage( 1042736, $"{silverGiven} silver\t{from.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~! } - victimState.OnGivenSilverTo( m_Placer ); + victimState.OnGivenSilverTo( Placer ); } } @@ -131,7 +115,7 @@ namespace Server.Factions { StrongholdRegion region = (StrongholdRegion) Region.Find( p, m ).GetRegion( typeof( StrongholdRegion ) ); - if ( region != null && region.Faction == m_Faction ) + if ( region != null && region.Faction == Faction ) return 0; return 1010355; // This trap can only be placed in your stronghold @@ -149,7 +133,7 @@ namespace Server.Factions { Town town = Town.FromRegion( Region.Find( p, m ) ); - if ( town != null && town.Owner == m_Faction ) + if ( town != null && town.Owner == Faction ) return 0; return 1010357; // This trap can only be placed in a town your faction controls @@ -181,9 +165,9 @@ namespace Server.Factions { Visible = false; - m_Faction = f; - m_TimeOfPlacement = DateTime.UtcNow; - m_Placer = m; + Faction = f; + TimeOfPlacement = DateTime.UtcNow; + Placer = m; } public BaseFactionTrap( Serial serial ) : base( serial ) @@ -197,7 +181,7 @@ namespace Server.Factions if ( decayPeriod == TimeSpan.MaxValue ) return false; - if ( (m_TimeOfPlacement + decayPeriod) < DateTime.UtcNow ) + if ( (TimeOfPlacement + decayPeriod) < DateTime.UtcNow ) { Timer.DelayCall( TimeSpan.Zero, Delete ); return true; @@ -229,9 +213,9 @@ namespace Server.Factions writer.Write( (int) 0 ); // version - Faction.WriteReference( writer, m_Faction ); - writer.Write( (Mobile) m_Placer ); - writer.Write( (DateTime) m_TimeOfPlacement ); + Faction.WriteReference( writer, Faction ); + writer.Write( (Mobile) Placer ); + writer.Write( (DateTime) TimeOfPlacement ); if ( Visible ) BeginConceal(); @@ -243,9 +227,9 @@ namespace Server.Factions int version = reader.ReadInt(); - m_Faction = Faction.ReadReference( reader ); - m_Placer = reader.ReadMobile(); - m_TimeOfPlacement = reader.ReadDateTime(); + Faction = Faction.ReadReference( reader ); + Placer = reader.ReadMobile(); + TimeOfPlacement = reader.ReadDateTime(); if ( Visible ) BeginConceal(); @@ -255,8 +239,8 @@ namespace Server.Factions public override void OnDelete() { - if ( m_Faction != null && m_Faction.Traps.Contains( this ) ) - m_Faction.Traps.Remove( this ); + if ( Faction != null && Faction.Traps.Contains( this ) ) + Faction.Traps.Remove( this ); base.OnDelete(); } @@ -277,7 +261,7 @@ namespace Server.Factions if ( faction == null ) return false; - return ( faction != m_Faction ); + return ( faction != Faction ); } } } diff --git a/Scripts/Engines/Factions/Items/Traps/FactionTrapRemovalKit.cs b/Scripts/Engines/Factions/Items/Traps/FactionTrapRemovalKit.cs index d2d48f0f5..0ac9e701b 100644 --- a/Scripts/Engines/Factions/Items/Traps/FactionTrapRemovalKit.cs +++ b/Scripts/Engines/Factions/Items/Traps/FactionTrapRemovalKit.cs @@ -2,14 +2,8 @@ namespace Server.Factions { public class FactionTrapRemovalKit : Item { - private int m_Charges; - [CommandProperty( AccessLevel.GameMaster )] - public int Charges - { - get => m_Charges; - set => m_Charges = value; - } + public int Charges { get; set; } public override int LabelNumber => 1041508; // a faction trap removal kit @@ -17,14 +11,14 @@ namespace Server.Factions public FactionTrapRemovalKit() : base( 7867 ) { LootType = LootType.Blessed; - m_Charges = 25; + Charges = 25; } public void ConsumeCharge( Mobile consumer ) { - --m_Charges; + --Charges; - if ( m_Charges <= 0 ) + if ( Charges <= 0 ) { Delete(); @@ -37,7 +31,7 @@ namespace Server.Factions base.GetProperties( list ); // NOTE: OSI does not list uses remaining; intentional difference - list.Add( 1060584, m_Charges.ToString() ); // uses remaining: ~1_val~ + list.Add( 1060584, Charges.ToString() ); // uses remaining: ~1_val~ } public FactionTrapRemovalKit( Serial serial ) : base( serial ) @@ -50,7 +44,7 @@ namespace Server.Factions writer.Write( (int) 1 ); // version - writer.WriteEncodedInt( (int) m_Charges ); + writer.WriteEncodedInt( (int) Charges ); } public override void Deserialize( GenericReader reader ) @@ -63,12 +57,12 @@ namespace Server.Factions { case 1: { - m_Charges = reader.ReadEncodedInt(); + Charges = reader.ReadEncodedInt(); break; } case 0: { - m_Charges = 25; + Charges = 25; break; } } diff --git a/Scripts/Engines/Factions/Mobiles/Guards/BaseFactionGuard.cs b/Scripts/Engines/Factions/Mobiles/Guards/BaseFactionGuard.cs index 6c16998e5..72628f637 100644 --- a/Scripts/Engines/Factions/Mobiles/Guards/BaseFactionGuard.cs +++ b/Scripts/Engines/Factions/Mobiles/Guards/BaseFactionGuard.cs @@ -11,7 +11,6 @@ namespace Server.Factions { private Faction m_Faction; private Town m_Town; - private Orders m_Orders; public override bool BardImmune => true; @@ -22,7 +21,7 @@ namespace Server.Factions set{ Unregister(); m_Faction = value; Register(); } } - public Orders Orders => m_Orders; + public Orders Orders { get; private set; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] public Town Town @@ -79,7 +78,7 @@ namespace Server.Factions public override void OnMovement( Mobile m, Point3D oldLocation ) { - if ( m.Player && m.Alive && InRange( m, 10 ) && !InRange( oldLocation, 10 ) && InLOS( m ) && m_Orders.GetReaction( Faction.Find( m ) ).Type == ReactionType.Warn ) + if ( m.Player && m.Alive && InRange( m, 10 ) && !InRange( oldLocation, 10 ) && InLOS( m ) && Orders.GetReaction( Faction.Find( m ) ).Type == ReactionType.Warn ) { Direction = GetDirectionTo( m ); @@ -141,7 +140,7 @@ namespace Server.Factions Say( def.String ); } - m_Orders.SetReaction( faction, type ); + Orders.SetReaction( faction, type ); } private bool WasNamed( string speech ) @@ -217,7 +216,7 @@ namespace Server.Factions Home = Location; RangeHome = 6; Combatant = null; - m_Orders.Movement = MovementType.Patrol; + Orders.Movement = MovementType.Patrol; Say( 1005146 ); // This spot looks like it needs protection! I shall guard it with my life. understood = true; } @@ -226,8 +225,8 @@ namespace Server.Factions Home = Location; RangeHome = 6; Combatant = null; - m_Orders.Follow = from; - m_Orders.Movement = MovementType.Follow; + Orders.Follow = from; + Orders.Movement = MovementType.Follow; Say( 1005144 ); // Yes, Sire. understood = true; } @@ -391,7 +390,7 @@ namespace Server.Factions public BaseFactionGuard( string title ) : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 ) { - m_Orders = new Orders( this ); + Orders = new Orders( this ); Title = title; RangeHome = 6; @@ -410,7 +409,7 @@ namespace Server.Factions Faction.WriteReference( writer, m_Faction ); Town.WriteReference( writer, m_Town ); - m_Orders.Serialize( writer ); + Orders.Serialize( writer ); } public override void Deserialize( GenericReader reader ) @@ -421,7 +420,7 @@ namespace Server.Factions m_Faction = Faction.ReadReference( reader ); m_Town = Town.ReadReference( reader ); - m_Orders = new Orders( this, reader ); + Orders = new Orders( this, reader ); Timer.DelayCall( TimeSpan.Zero, Register ); } @@ -449,16 +448,15 @@ namespace Server.Factions public class VirtualMountItem : Item, IMountItem { - private Mobile m_Rider; private VirtualMount m_Mount; - public Mobile Rider => m_Rider; + public Mobile Rider { get; private set; } public VirtualMountItem( Mobile mob ) : base( 0x3EA0 ) { Layer = Layer.Mount; - m_Rider = mob; + Rider = mob; m_Mount = new VirtualMount( this ); } @@ -475,7 +473,7 @@ namespace Server.Factions writer.Write( (int) 0 ); // version - writer.Write( (Mobile) m_Rider ); + writer.Write( (Mobile) Rider ); } public override void Deserialize( GenericReader reader ) @@ -484,9 +482,9 @@ namespace Server.Factions int version = reader.ReadInt(); - m_Rider = reader.ReadMobile(); + Rider = reader.ReadMobile(); - if ( m_Rider == null ) + if ( Rider == null ) Delete(); } } diff --git a/Scripts/Engines/Factions/Mobiles/Guards/GuardAI.cs b/Scripts/Engines/Factions/Mobiles/Guards/GuardAI.cs index 536ed39e7..33c1208b7 100644 --- a/Scripts/Engines/Factions/Mobiles/Guards/GuardAI.cs +++ b/Scripts/Engines/Factions/Mobiles/Guards/GuardAI.cs @@ -26,13 +26,11 @@ namespace Server.Factions public class ComboEntry { - private Type m_Spell; - private TimeSpan m_Hold; - private int m_Chance; + public Type Spell { get; } - public Type Spell => m_Spell; - public TimeSpan Hold => m_Hold; - public int Chance => m_Chance; + public TimeSpan Hold { get; } + + public int Chance { get; } public ComboEntry( Type spell ) : this( spell, 100, TimeSpan.Zero ) { @@ -44,24 +42,22 @@ namespace Server.Factions public ComboEntry( Type spell, int chance, TimeSpan hold ) { - m_Spell = spell; - m_Chance = chance; - m_Hold = hold; + Spell = spell; + Chance = chance; + Hold = hold; } } public class SpellCombo { - private int m_Mana; - private ComboEntry[] m_Entries; + public int Mana { get; } - public int Mana => m_Mana; - public ComboEntry[] Entries => m_Entries; + public ComboEntry[] Entries { get; } public SpellCombo( int mana, params ComboEntry[] entries ) { - m_Mana = mana; - m_Entries = entries; + Mana = mana; + Entries = entries; } public static readonly SpellCombo Simple = new SpellCombo( 50, @@ -83,9 +79,9 @@ namespace Server.Factions public static Spell Process( Mobile mob, Mobile targ, ref SpellCombo combo, ref int index, ref DateTime releaseTime ) { - while ( ++index < combo.m_Entries.Length ) + while ( ++index < combo.Entries.Length ) { - ComboEntry entry = combo.m_Entries[index]; + ComboEntry entry = combo.Entries[index]; if ( entry.Spell == typeof( PoisonSpell ) && targ.Poisoned ) continue; diff --git a/Scripts/Engines/Factions/Mobiles/Guards/Orders.cs b/Scripts/Engines/Factions/Mobiles/Guards/Orders.cs index 3b2481fdf..28ba65ce9 100644 --- a/Scripts/Engines/Factions/Mobiles/Guards/Orders.cs +++ b/Scripts/Engines/Factions/Mobiles/Guards/Orders.cs @@ -18,18 +18,14 @@ namespace Server.Factions.AI public class Reaction { - private Faction m_Faction; - private ReactionType m_Type; + public Faction Faction { get; } - public Faction Faction => m_Faction; - public ReactionType Type{ get => m_Type; - set => m_Type = value; - } + public ReactionType Type { get; set; } public Reaction( Faction faction, ReactionType type ) { - m_Faction = faction; - m_Type = type; + Faction = faction; + Type = type; } public Reaction( GenericReader reader ) @@ -40,8 +36,8 @@ namespace Server.Factions.AI { case 0: { - m_Faction = Faction.ReadReference( reader ); - m_Type = (ReactionType) reader.ReadEncodedInt(); + Faction = Faction.ReadReference( reader ); + Type = (ReactionType) reader.ReadEncodedInt(); break; } @@ -52,27 +48,20 @@ namespace Server.Factions.AI { writer.WriteEncodedInt( (int) 0 ); // version - Faction.WriteReference( writer, m_Faction ); - writer.WriteEncodedInt( (int) m_Type ); + Faction.WriteReference( writer, Faction ); + writer.WriteEncodedInt( (int) Type ); } } public class Orders { - private BaseFactionGuard m_Guard; - private List m_Reactions; - private MovementType m_Movement; - private Mobile m_Follow; - public BaseFactionGuard Guard => m_Guard; + public BaseFactionGuard Guard { get; } - public MovementType Movement{ get => m_Movement; - set => m_Movement = value; - } - public Mobile Follow{ get => m_Follow; - set => m_Follow = value; - } + public MovementType Movement { get; set; } + + public Mobile Follow { get; set; } public Reaction GetReaction( Faction faction ) { @@ -86,7 +75,7 @@ namespace Server.Factions.AI return reaction; } - reaction = new Reaction( faction, ( faction == null || faction == m_Guard.Faction ) ? ReactionType.Ignore : ReactionType.Attack ); + reaction = new Reaction( faction, ( faction == null || faction == Guard.Faction ) ? ReactionType.Ignore : ReactionType.Attack ); m_Reactions.Add( reaction ); return reaction; @@ -101,14 +90,14 @@ namespace Server.Factions.AI public Orders( BaseFactionGuard guard ) { - m_Guard = guard; + Guard = guard; m_Reactions = new List(); - m_Movement = MovementType.Patrol; + Movement = MovementType.Patrol; } public Orders( BaseFactionGuard guard, GenericReader reader ) { - m_Guard = guard; + Guard = guard; int version = reader.ReadEncodedInt(); @@ -116,7 +105,7 @@ namespace Server.Factions.AI { case 1: { - m_Follow = reader.ReadMobile(); + Follow = reader.ReadMobile(); goto case 0; } case 0: @@ -127,7 +116,7 @@ namespace Server.Factions.AI for ( int i = 0; i < count; ++i ) m_Reactions.Add( new Reaction( reader ) ); - m_Movement = (MovementType)reader.ReadEncodedInt(); + Movement = (MovementType)reader.ReadEncodedInt(); break; } @@ -138,14 +127,14 @@ namespace Server.Factions.AI { writer.WriteEncodedInt( (int) 1 ); // version - writer.Write( (Mobile) m_Follow ); + writer.Write( (Mobile) Follow ); writer.WriteEncodedInt( (int) m_Reactions.Count ); for ( int i = 0; i < m_Reactions.Count; ++i ) m_Reactions[i].Serialize( writer ); - writer.WriteEncodedInt( (int) m_Movement ); + writer.WriteEncodedInt( (int) Movement ); } } } \ No newline at end of file diff --git a/Scripts/Engines/Factions/Mobiles/Vendors/BaseFactionVendor.cs b/Scripts/Engines/Factions/Mobiles/Vendors/BaseFactionVendor.cs index 210631065..f90c8ac1f 100644 --- a/Scripts/Engines/Factions/Mobiles/Vendors/BaseFactionVendor.cs +++ b/Scripts/Engines/Factions/Mobiles/Vendors/BaseFactionVendor.cs @@ -41,8 +41,7 @@ namespace Server.Factions m_Town?.UnregisterVendor( this ); } - private List m_SBInfos = new List(); - protected override List SBInfos => m_SBInfos; + protected override List SBInfos { get; } = new List(); public override void InitSBInfo() { diff --git a/Scripts/Engines/Factions/Mobiles/Vendors/FactionBoardVendor.cs b/Scripts/Engines/Factions/Mobiles/Vendors/FactionBoardVendor.cs index e8fecdd0a..fe90c0a6b 100644 --- a/Scripts/Engines/Factions/Mobiles/Vendors/FactionBoardVendor.cs +++ b/Scripts/Engines/Factions/Mobiles/Vendors/FactionBoardVendor.cs @@ -45,15 +45,13 @@ namespace Server.Factions public class SBFactionBoard : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBFactionBoard() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Engines/Factions/Mobiles/Vendors/FactionBottleVendor.cs b/Scripts/Engines/Factions/Mobiles/Vendors/FactionBottleVendor.cs index cefdb6381..b92e7e654 100644 --- a/Scripts/Engines/Factions/Mobiles/Vendors/FactionBottleVendor.cs +++ b/Scripts/Engines/Factions/Mobiles/Vendors/FactionBottleVendor.cs @@ -47,15 +47,13 @@ namespace Server.Factions public class SBFactionBottle : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBFactionBottle() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Engines/Factions/Mobiles/Vendors/FactionOreVendor.cs b/Scripts/Engines/Factions/Mobiles/Vendors/FactionOreVendor.cs index 7f210bf25..7db88c5c7 100644 --- a/Scripts/Engines/Factions/Mobiles/Vendors/FactionOreVendor.cs +++ b/Scripts/Engines/Factions/Mobiles/Vendors/FactionOreVendor.cs @@ -48,15 +48,13 @@ namespace Server.Factions { private static readonly object[] m_FixedSizeArgs = { true }; - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBFactionOre() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Engines/Factions/Mobiles/Vendors/FactionReagentVendor.cs b/Scripts/Engines/Factions/Mobiles/Vendors/FactionReagentVendor.cs index 4f0a41bfd..599e3b15e 100644 --- a/Scripts/Engines/Factions/Mobiles/Vendors/FactionReagentVendor.cs +++ b/Scripts/Engines/Factions/Mobiles/Vendors/FactionReagentVendor.cs @@ -52,15 +52,13 @@ namespace Server.Factions public class SBFactionReagent : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBFactionReagent() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Engines/Harvest/Core/BonusHarvestResource.cs b/Scripts/Engines/Harvest/Core/BonusHarvestResource.cs index f3f5df85c..b4683891e 100644 --- a/Scripts/Engines/Harvest/Core/BonusHarvestResource.cs +++ b/Scripts/Engines/Harvest/Core/BonusHarvestResource.cs @@ -4,34 +4,26 @@ namespace Server.Engines.Harvest { public class BonusHarvestResource { - private Type m_Type; - private double m_ReqSkill, m_Chance; - private TextDefinition m_SuccessMessage; + public Type Type { get; set; } - public Type Type { get => m_Type; - set => m_Type = value; - } - public double ReqSkill { get => m_ReqSkill; - set => m_ReqSkill = value; - } - public double Chance { get => m_Chance; - set => m_Chance = value; - } + public double ReqSkill { get; set; } - public TextDefinition SuccessMessage => m_SuccessMessage; + public double Chance { get; set; } + + public TextDefinition SuccessMessage { get; } public void SendSuccessTo( Mobile m ) { - TextDefinition.SendMessageTo( m, m_SuccessMessage ); + TextDefinition.SendMessageTo( m, SuccessMessage ); } public BonusHarvestResource( double reqSkill, double chance, TextDefinition message, Type type ) { - m_ReqSkill = reqSkill; + ReqSkill = reqSkill; - m_Chance = chance; - m_Type = type; - m_SuccessMessage = message; + Chance = chance; + Type = type; + SuccessMessage = message; } } } diff --git a/Scripts/Engines/Harvest/Core/HarvestBank.cs b/Scripts/Engines/Harvest/Core/HarvestBank.cs index 0a48dbe3a..c17199f3d 100644 --- a/Scripts/Engines/Harvest/Core/HarvestBank.cs +++ b/Scripts/Engines/Harvest/Core/HarvestBank.cs @@ -9,9 +9,7 @@ namespace Server.Engines.Harvest private DateTime m_NextRespawn; private HarvestVein m_Vein, m_DefaultVein; - HarvestDefinition m_Definition; - - public HarvestDefinition Definition => m_Definition; + public HarvestDefinition Definition { get; } public int Current { @@ -48,9 +46,9 @@ namespace Server.Engines.Harvest m_Current = m_Maximum; - if ( m_Definition.RandomizeVeins ) + if ( Definition.RandomizeVeins ) { - m_DefaultVein = m_Definition.GetVeinFrom( Utility.RandomDouble() ); + m_DefaultVein = Definition.GetVeinFrom( Utility.RandomDouble() ); } m_Vein = m_DefaultVein; @@ -62,14 +60,14 @@ namespace Server.Engines.Harvest if ( m_Current == m_Maximum ) { - double min = m_Definition.MinRespawn.TotalMinutes; - double max = m_Definition.MaxRespawn.TotalMinutes; + double min = Definition.MinRespawn.TotalMinutes; + double max = Definition.MaxRespawn.TotalMinutes; double rnd = Utility.RandomDouble(); m_Current = m_Maximum - amount; double minutes = min + (rnd * (max - min)); - if ( m_Definition.RaceBonus && from.Race == Race.Elf ) //def.RaceBonus = Core.ML + if ( Definition.RaceBonus && from.Race == Race.Elf ) //def.RaceBonus = Core.ML minutes *= .75; //25% off the time. m_NextRespawn = DateTime.UtcNow + TimeSpan.FromMinutes( minutes ); @@ -90,7 +88,7 @@ namespace Server.Engines.Harvest m_DefaultVein = defaultVein; m_Vein = m_DefaultVein; - m_Definition = def; + Definition = def; } } } \ No newline at end of file diff --git a/Scripts/Engines/Harvest/Core/HarvestDefinition.cs b/Scripts/Engines/Harvest/Core/HarvestDefinition.cs index 31b66194b..a49fcd256 100644 --- a/Scripts/Engines/Harvest/Core/HarvestDefinition.cs +++ b/Scripts/Engines/Harvest/Core/HarvestDefinition.cs @@ -5,123 +5,67 @@ namespace Server.Engines.Harvest { public class HarvestDefinition { - private int m_BankWidth, m_BankHeight; - private int m_MinTotal, m_MaxTotal; - private int[] m_Tiles; - private bool m_RangedTiles; - private TimeSpan m_MinRespawn, m_MaxRespawn; - private int m_MaxRange; - private int m_ConsumedPerHarvest, m_ConsumedPerFeluccaHarvest; - private bool m_PlaceAtFeetIfFull; - private SkillName m_Skill; - private int[] m_EffectActions; - private int[] m_EffectCounts; - private int[] m_EffectSounds; - private TimeSpan m_EffectSoundDelay; - private TimeSpan m_EffectDelay; - private object m_NoResourcesMessage, m_OutOfRangeMessage, m_TimedOutOfRangeMessage, m_DoubleHarvestMessage, m_FailMessage, m_PackFullMessage, m_ToolBrokeMessage; - private HarvestResource[] m_Resources; - private HarvestVein[] m_Veins; - private BonusHarvestResource[] m_BonusResources; - private bool m_RaceBonus; - private bool m_RandomizeVeins; + public int BankWidth { get; set; } - public int BankWidth{ get => m_BankWidth; - set => m_BankWidth = value; - } - public int BankHeight{ get => m_BankHeight; - set => m_BankHeight = value; - } - public int MinTotal{ get => m_MinTotal; - set => m_MinTotal = value; - } - public int MaxTotal{ get => m_MaxTotal; - set => m_MaxTotal = value; - } - public int[] Tiles{ get => m_Tiles; - set => m_Tiles = value; - } - public bool RangedTiles{ get => m_RangedTiles; - set => m_RangedTiles = value; - } - public TimeSpan MinRespawn{ get => m_MinRespawn; - set => m_MinRespawn = value; - } - public TimeSpan MaxRespawn{ get => m_MaxRespawn; - set => m_MaxRespawn = value; - } - public int MaxRange{ get => m_MaxRange; - set => m_MaxRange = value; - } - public int ConsumedPerHarvest{ get => m_ConsumedPerHarvest; - set => m_ConsumedPerHarvest = value; - } - public int ConsumedPerFeluccaHarvest{ get => m_ConsumedPerFeluccaHarvest; - set => m_ConsumedPerFeluccaHarvest = value; - } - public bool PlaceAtFeetIfFull{ get => m_PlaceAtFeetIfFull; - set => m_PlaceAtFeetIfFull = value; - } - public SkillName Skill{ get => m_Skill; - set => m_Skill = value; - } - public int[] EffectActions{ get => m_EffectActions; - set => m_EffectActions = value; - } - public int[] EffectCounts{ get => m_EffectCounts; - set => m_EffectCounts = value; - } - public int[] EffectSounds{ get => m_EffectSounds; - set => m_EffectSounds = value; - } - public TimeSpan EffectSoundDelay{ get => m_EffectSoundDelay; - set => m_EffectSoundDelay = value; - } - public TimeSpan EffectDelay{ get => m_EffectDelay; - set => m_EffectDelay = value; - } - public object NoResourcesMessage{ get => m_NoResourcesMessage; - set => m_NoResourcesMessage = value; - } - public object OutOfRangeMessage{ get => m_OutOfRangeMessage; - set => m_OutOfRangeMessage = value; - } - public object TimedOutOfRangeMessage{ get => m_TimedOutOfRangeMessage; - set => m_TimedOutOfRangeMessage = value; - } - public object DoubleHarvestMessage{ get => m_DoubleHarvestMessage; - set => m_DoubleHarvestMessage = value; - } - public object FailMessage{ get => m_FailMessage; - set => m_FailMessage = value; - } - public object PackFullMessage{ get => m_PackFullMessage; - set => m_PackFullMessage = value; - } - public object ToolBrokeMessage{ get => m_ToolBrokeMessage; - set => m_ToolBrokeMessage = value; - } - public HarvestResource[] Resources{ get => m_Resources; - set => m_Resources = value; - } - public HarvestVein[] Veins{ get => m_Veins; - set => m_Veins = value; - } - public BonusHarvestResource[] BonusResources{ get => m_BonusResources; - set => m_BonusResources = value; - } - public bool RaceBonus { get => m_RaceBonus; - set => m_RaceBonus = value; - } - public bool RandomizeVeins { get => m_RandomizeVeins; - set => m_RandomizeVeins = value; - } + public int BankHeight { get; set; } - private Dictionary> m_BanksByMap; + public int MinTotal { get; set; } - public Dictionary> Banks{ get => m_BanksByMap; - set => m_BanksByMap = value; - } + public int MaxTotal { get; set; } + + public int[] Tiles { get; set; } + + public bool RangedTiles { get; set; } + + public TimeSpan MinRespawn { get; set; } + + public TimeSpan MaxRespawn { get; set; } + + public int MaxRange { get; set; } + + public int ConsumedPerHarvest { get; set; } + + public int ConsumedPerFeluccaHarvest { get; set; } + + public bool PlaceAtFeetIfFull { get; set; } + + public SkillName Skill { get; set; } + + public int[] EffectActions { get; set; } + + public int[] EffectCounts { get; set; } + + public int[] EffectSounds { get; set; } + + public TimeSpan EffectSoundDelay { get; set; } + + public TimeSpan EffectDelay { get; set; } + + public object NoResourcesMessage { get; set; } + + public object OutOfRangeMessage { get; set; } + + public object TimedOutOfRangeMessage { get; set; } + + public object DoubleHarvestMessage { get; set; } + + public object FailMessage { get; set; } + + public object PackFullMessage { get; set; } + + public object ToolBrokeMessage { get; set; } + + public HarvestResource[] Resources { get; set; } + + public HarvestVein[] Veins { get; set; } + + public BonusHarvestResource[] BonusResources { get; set; } + + public bool RaceBonus { get; set; } + + public bool RandomizeVeins { get; set; } + + public Dictionary> Banks { get; set; } public void SendMessageTo( Mobile from, object message ) { @@ -136,13 +80,13 @@ namespace Server.Engines.Harvest if ( map == null || map == Map.Internal ) return null; - x /= m_BankWidth; - y /= m_BankHeight; + x /= BankWidth; + y /= BankHeight; - m_BanksByMap.TryGetValue( map, out Dictionary banks ); + Banks.TryGetValue( map, out Dictionary banks ); if ( banks == null ) - m_BanksByMap[map] = banks = new Dictionary(); + Banks[map] = banks = new Dictionary(); Point2D key = new Point2D( x, y ); banks.TryGetValue( key, out HarvestBank bank ); @@ -155,12 +99,12 @@ namespace Server.Engines.Harvest public HarvestVein GetVeinAt( Map map, int x, int y ) { - if ( m_Veins.Length == 1 ) - return m_Veins[0]; + if ( Veins.Length == 1 ) + return Veins[0]; double randomValue; - if ( m_RandomizeVeins ) + if ( RandomizeVeins ) { randomValue = Utility.RandomDouble(); } @@ -175,17 +119,17 @@ namespace Server.Engines.Harvest public HarvestVein GetVeinFrom( double randomValue ) { - if ( m_Veins.Length == 1 ) - return m_Veins[0]; + if ( Veins.Length == 1 ) + return Veins[0]; randomValue *= 100; - for ( int i = 0; i < m_Veins.Length; ++i ) + for ( int i = 0; i < Veins.Length; ++i ) { - if ( randomValue <= m_Veins[i].VeinChance ) - return m_Veins[i]; + if ( randomValue <= Veins[i].VeinChance ) + return Veins[i]; - randomValue -= m_Veins[i].VeinChance; + randomValue -= Veins[i].VeinChance; } return null; @@ -193,17 +137,17 @@ namespace Server.Engines.Harvest public BonusHarvestResource GetBonusResource() { - if ( m_BonusResources == null ) + if ( BonusResources == null ) return null; double randomValue = Utility.RandomDouble() * 100; - for ( int i = 0; i < m_BonusResources.Length; ++i ) + for ( int i = 0; i < BonusResources.Length; ++i ) { - if ( randomValue <= m_BonusResources[i].Chance ) - return m_BonusResources[i]; + if ( randomValue <= BonusResources[i].Chance ) + return BonusResources[i]; - randomValue -= m_BonusResources[i].Chance; + randomValue -= BonusResources[i].Chance; } return null; @@ -211,25 +155,25 @@ namespace Server.Engines.Harvest public HarvestDefinition() { - m_BanksByMap = new Dictionary>(); + Banks = new Dictionary>(); } public bool Validate( int tileID ) { - if ( m_RangedTiles ) + if ( RangedTiles ) { bool contains = false; - for ( int i = 0; !contains && i < m_Tiles.Length; i += 2 ) - contains = ( tileID >= m_Tiles[i] && tileID <= m_Tiles[i + 1] ); + for ( int i = 0; !contains && i < Tiles.Length; i += 2 ) + contains = ( tileID >= Tiles[i] && tileID <= Tiles[i + 1] ); return contains; } int dist = -1; - for ( int i = 0; dist < 0 && i < m_Tiles.Length; ++i ) - dist = ( m_Tiles[i] - tileID ); + for ( int i = 0; dist < 0 && i < Tiles.Length; ++i ) + dist = ( Tiles[i] - tileID ); return ( dist == 0 ); } diff --git a/Scripts/Engines/Harvest/Core/HarvestResource.cs b/Scripts/Engines/Harvest/Core/HarvestResource.cs index a16d5a596..3027ac19e 100644 --- a/Scripts/Engines/Harvest/Core/HarvestResource.cs +++ b/Scripts/Engines/Harvest/Core/HarvestResource.cs @@ -4,39 +4,31 @@ namespace Server.Engines.Harvest { public class HarvestResource { - private Type[] m_Types; - private double m_ReqSkill, m_MinSkill, m_MaxSkill; - private object m_SuccessMessage; + public Type[] Types { get; set; } - public Type[] Types{ get => m_Types; - set => m_Types = value; - } - public double ReqSkill{ get => m_ReqSkill; - set => m_ReqSkill = value; - } - public double MinSkill{ get => m_MinSkill; - set => m_MinSkill = value; - } - public double MaxSkill{ get => m_MaxSkill; - set => m_MaxSkill = value; - } - public object SuccessMessage => m_SuccessMessage; + public double ReqSkill { get; set; } + + public double MinSkill { get; set; } + + public double MaxSkill { get; set; } + + public object SuccessMessage { get; } public void SendSuccessTo( Mobile m ) { - if ( m_SuccessMessage is int messageInt ) + if ( SuccessMessage is int messageInt ) m.SendLocalizedMessage( messageInt ); else - m.SendMessage( m_SuccessMessage.ToString() ); + m.SendMessage( SuccessMessage.ToString() ); } public HarvestResource( double reqSkill, double minSkill, double maxSkill, object message, params Type[] types ) { - m_ReqSkill = reqSkill; - m_MinSkill = minSkill; - m_MaxSkill = maxSkill; - m_Types = types; - m_SuccessMessage = message; + ReqSkill = reqSkill; + MinSkill = minSkill; + MaxSkill = maxSkill; + Types = types; + SuccessMessage = message; } } } diff --git a/Scripts/Engines/Harvest/Core/HarvestSystem.cs b/Scripts/Engines/Harvest/Core/HarvestSystem.cs index 66123a748..81ca2a85d 100644 --- a/Scripts/Engines/Harvest/Core/HarvestSystem.cs +++ b/Scripts/Engines/Harvest/Core/HarvestSystem.cs @@ -7,13 +7,11 @@ namespace Server.Engines.Harvest { public abstract class HarvestSystem { - private List m_Definitions; - - public List Definitions => m_Definitions; + public List Definitions { get; } public HarvestSystem() { - m_Definitions = new List(); + Definitions = new List(); } public virtual bool CheckTool( Mobile from, Item tool ) @@ -390,9 +388,9 @@ namespace Server.Engines.Harvest { HarvestDefinition def = null; - for ( int i = 0; def == null && i < m_Definitions.Count; ++i ) + for ( int i = 0; def == null && i < Definitions.Count; ++i ) { - HarvestDefinition check = m_Definitions[i]; + HarvestDefinition check = Definitions[i]; if ( check.Validate( tileID ) ) def = check; diff --git a/Scripts/Engines/Harvest/Core/HarvestVein.cs b/Scripts/Engines/Harvest/Core/HarvestVein.cs index c6f619440..20431d747 100644 --- a/Scripts/Engines/Harvest/Core/HarvestVein.cs +++ b/Scripts/Engines/Harvest/Core/HarvestVein.cs @@ -2,30 +2,20 @@ namespace Server.Engines.Harvest { public class HarvestVein { - private double m_VeinChance; - private double m_ChanceToFallback; - private HarvestResource m_PrimaryResource; - private HarvestResource m_FallbackResource; + public double VeinChance { get; set; } - public double VeinChance{ get => m_VeinChance; - set => m_VeinChance = value; - } - public double ChanceToFallback{ get => m_ChanceToFallback; - set => m_ChanceToFallback = value; - } - public HarvestResource PrimaryResource{ get => m_PrimaryResource; - set => m_PrimaryResource = value; - } - public HarvestResource FallbackResource{ get => m_FallbackResource; - set => m_FallbackResource = value; - } + public double ChanceToFallback { get; set; } + + public HarvestResource PrimaryResource { get; set; } + + public HarvestResource FallbackResource { get; set; } public HarvestVein( double veinChance, double chanceToFallback, HarvestResource primaryResource, HarvestResource fallbackResource ) { - m_VeinChance = veinChance; - m_ChanceToFallback = chanceToFallback; - m_PrimaryResource = primaryResource; - m_FallbackResource = fallbackResource; + VeinChance = veinChance; + ChanceToFallback = chanceToFallback; + PrimaryResource = primaryResource; + FallbackResource = fallbackResource; } } } \ No newline at end of file diff --git a/Scripts/Engines/Harvest/Fishing.cs b/Scripts/Engines/Harvest/Fishing.cs index 53d48bb0f..1169902e4 100644 --- a/Scripts/Engines/Harvest/Fishing.cs +++ b/Scripts/Engines/Harvest/Fishing.cs @@ -23,9 +23,7 @@ namespace Server.Engines.Harvest } } - private HarvestDefinition m_Definition; - - public HarvestDefinition Definition => m_Definition; + public HarvestDefinition Definition { get; } private Fishing() { @@ -97,7 +95,7 @@ namespace Server.Engines.Harvest }; } - m_Definition = fish; + Definition = fish; Definitions.Add( fish ); #endregion } diff --git a/Scripts/Engines/Harvest/Lumberjacking.cs b/Scripts/Engines/Harvest/Lumberjacking.cs index 38a1559b0..21cd1e70d 100644 --- a/Scripts/Engines/Harvest/Lumberjacking.cs +++ b/Scripts/Engines/Harvest/Lumberjacking.cs @@ -19,9 +19,7 @@ namespace Server.Engines.Harvest } } - private HarvestDefinition m_Definition; - - public HarvestDefinition Definition => m_Definition; + public HarvestDefinition Definition { get; } private Lumberjacking() { @@ -123,7 +121,7 @@ namespace Server.Engines.Harvest lumber.RaceBonus = Core.ML; lumber.RandomizeVeins = Core.ML; - m_Definition = lumber; + Definition = lumber; Definitions.Add( lumber ); #endregion } diff --git a/Scripts/Engines/Harvest/Mining.cs b/Scripts/Engines/Harvest/Mining.cs index c3a9f9222..e49364fc9 100644 --- a/Scripts/Engines/Harvest/Mining.cs +++ b/Scripts/Engines/Harvest/Mining.cs @@ -20,11 +20,9 @@ namespace Server.Engines.Harvest } } - private HarvestDefinition m_OreAndStone, m_Sand; + public HarvestDefinition OreAndStone { get; } - public HarvestDefinition OreAndStone => m_OreAndStone; - - public HarvestDefinition Sand => m_Sand; + public HarvestDefinition Sand { get; } private Mining() { @@ -32,7 +30,7 @@ namespace Server.Engines.Harvest HarvestVein[] veins; #region Mining for ore and stone - HarvestDefinition oreAndStone = m_OreAndStone = new HarvestDefinition(); + HarvestDefinition oreAndStone = OreAndStone = new HarvestDefinition(); // Resource banks are every 8x8 tiles oreAndStone.BankWidth = 8; @@ -124,7 +122,7 @@ namespace Server.Engines.Harvest #endregion #region Mining for sand - HarvestDefinition sand = m_Sand = new HarvestDefinition(); + HarvestDefinition sand = Sand = new HarvestDefinition(); // Resource banks are every 8x8 tiles sand.BankWidth = 8; @@ -185,7 +183,7 @@ namespace Server.Engines.Harvest public override Type GetResourceType( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, HarvestResource resource ) { - if ( def == m_OreAndStone ) + if ( def == OreAndStone ) { if ( from is PlayerMobile pm && pm.StoneMining && pm.ToggleMiningStone && from.Skills[SkillName.Mining].Base >= 100.0 && 0.1 > Utility.RandomDouble() ) return resource.Types[1]; @@ -229,7 +227,7 @@ namespace Server.Engines.Harvest if ( !base.CheckHarvest( from, tool, def, toHarvest ) ) return false; - if ( def == m_Sand && !(from is PlayerMobile mobile && mobile.Skills[SkillName.Mining].Base >= 100.0 && mobile.SandMining) ) + if ( def == Sand && !(from is PlayerMobile mobile && mobile.Skills[SkillName.Mining].Base >= 100.0 && mobile.SandMining) ) { OnBadHarvestTarget( from, tool, toHarvest ); return false; @@ -250,7 +248,7 @@ namespace Server.Engines.Harvest public override HarvestVein MutateVein( Mobile from, Item tool, HarvestDefinition def, HarvestBank bank, object toHarvest, HarvestVein vein ) { - if ( tool is GargoylesPickaxe && def == m_OreAndStone ) + if ( tool is GargoylesPickaxe && def == OreAndStone ) { int veinIndex = Array.IndexOf( def.Veins, vein ); @@ -274,7 +272,7 @@ namespace Server.Engines.Harvest public override void OnHarvestFinished( Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested ) { - if ( tool is GargoylesPickaxe && def == m_OreAndStone && 0.1 > Utility.RandomDouble() ) + if ( tool is GargoylesPickaxe && def == OreAndStone && 0.1 > Utility.RandomDouble() ) { HarvestResource res = vein.PrimaryResource; diff --git a/Scripts/Engines/Help/PageQueue.cs b/Scripts/Engines/Help/PageQueue.cs index 31fcc187a..7ba84c190 100644 --- a/Scripts/Engines/Help/PageQueue.cs +++ b/Scripts/Engines/Help/PageQueue.cs @@ -31,20 +31,11 @@ namespace Server.Engines.Help PageType.VerbalHarassment }; - private Mobile m_Sender; private Mobile m_Handler; - private DateTime m_Sent; - private string m_Message; - private PageType m_Type; - private Point3D m_PageLocation; - private Map m_PageMap; - private List m_SpeechLog; - private PageInfo m_PageInfo; + public PageInfo PageInfo { get; } - public PageInfo PageInfo => m_PageInfo; - - public Mobile Sender => m_Sender; + public Mobile Sender { get; } public Mobile Handler { @@ -56,17 +47,17 @@ namespace Server.Engines.Help } } - public DateTime Sent => m_Sent; + public DateTime Sent { get; } - public string Message => m_Message; + public string Message { get; } - public PageType Type => m_Type; + public PageType Type { get; } - public Point3D PageLocation => m_PageLocation; + public Point3D PageLocation { get; } - public Map PageMap => m_PageMap; + public Map PageMap { get; } - public List SpeechLog => m_SpeechLog; + public List SpeechLog { get; } private Timer m_Timer; @@ -79,27 +70,27 @@ namespace Server.Engines.Help public void AddResponse( Mobile mob, string text ) { - if ( m_PageInfo != null ) + if ( PageInfo != null ) { - lock ( m_PageInfo ) - m_PageInfo.Responses.Add( PageInfo.GetAccount( mob ), text ); + lock ( PageInfo ) + PageInfo.Responses.Add( PageInfo.GetAccount( mob ), text ); if ( PageInfo.ResFromResp( text ) != PageResolution.None ) - m_PageInfo.UpdateResolver(); + PageInfo.UpdateResolver(); } } public PageEntry( Mobile sender, string message, PageType type ) { - m_Sender = sender; - m_Sent = DateTime.UtcNow; - m_Message = Utility.FixHtml( message ); - m_Type = type; - m_PageLocation = sender.Location; - m_PageMap = sender.Map; + Sender = sender; + Sent = DateTime.UtcNow; + Message = Utility.FixHtml( message ); + Type = type; + PageLocation = sender.Location; + PageMap = sender.Map; if ( sender is PlayerMobile pm && pm.SpeechLog != null && Array.IndexOf( SpeechLogAttachment, type ) >= 0 ) - m_SpeechLog = new List( pm.SpeechLog ); + SpeechLog = new List( pm.SpeechLog ); m_Timer = new InternalTimer( this ); m_Timer.Start(); @@ -108,9 +99,9 @@ namespace Server.Engines.Help if ( history != null ) { - m_PageInfo = new PageInfo( this ); + PageInfo = new PageInfo( this ); - history.AddPage( m_PageInfo ); + history.AddPage( PageInfo ); } } @@ -151,7 +142,6 @@ namespace Server.Engines.Help public class PageQueue { - private static ArrayList m_List = new ArrayList(); private static Hashtable m_KeyedByHandler = new Hashtable(); private static Hashtable m_KeyedBySender = new Hashtable(); @@ -207,7 +197,7 @@ namespace Server.Engines.Help { e.Mobile.SendGump( new PageEntryGump( e.Mobile, entry ) ); } - else if ( m_List.Count > 0 ) + else if ( List.Count > 0 ) { e.Mobile.SendGump( new PageQueueGump() ); } @@ -229,7 +219,7 @@ namespace Server.Engines.Help public static int IndexOf( PageEntry e ) { - return m_List.IndexOf( e ); + return List.IndexOf( e ); } public static void Cancel( Mobile sender ) @@ -244,7 +234,7 @@ namespace Server.Engines.Help e.Stop(); - m_List.Remove( e ); + List.Remove( e ); m_KeyedBySender.Remove( e.Sender ); if ( e.Handler != null ) @@ -261,11 +251,11 @@ namespace Server.Engines.Help Remove( GetEntry( sender ) ); } - public static ArrayList List => m_List; + public static ArrayList List { get; } = new ArrayList(); public static void Enqueue( PageEntry entry ) { - m_List.Add( entry ); + List.Add( entry ); m_KeyedBySender[entry.Sender] = entry; bool isStaffOnline = false; diff --git a/Scripts/Engines/Help/PageQueueGump.cs b/Scripts/Engines/Help/PageQueueGump.cs index 6a154fdbc..7eabb0d19 100644 --- a/Scripts/Engines/Help/PageQueueGump.cs +++ b/Scripts/Engines/Help/PageQueueGump.cs @@ -126,20 +126,14 @@ namespace Server.Engines.Help public class PredefinedResponse { - private string m_Title; - private string m_Message; + public string Title { get; set; } - public string Title{ get => m_Title; - set => m_Title = value; - } - public string Message{ get => m_Message; - set => m_Message = value; - } + public string Message { get; set; } public PredefinedResponse( string title, string message ) { - m_Title = title; - m_Message = message; + Title = title; + Message = message; } private static ArrayList m_List; diff --git a/Scripts/Engines/Help/SpeechLog.cs b/Scripts/Engines/Help/SpeechLog.cs index d060fe0bb..51d93de07 100644 --- a/Scripts/Engines/Help/SpeechLog.cs +++ b/Scripts/Engines/Help/SpeechLog.cs @@ -127,19 +127,17 @@ namespace Server.Engines.Help public class SpeechLogEntry { - private Mobile m_From; - private string m_Speech; - private DateTime m_Created; + public Mobile From { get; } - public Mobile From => m_From; - public string Speech => m_Speech; - public DateTime Created => m_Created; + public string Speech { get; } + + public DateTime Created { get; } public SpeechLogEntry( Mobile from, string speech ) { - m_From = from; - m_Speech = speech; - m_Created = DateTime.UtcNow; + From = from; + Speech = speech; + Created = DateTime.UtcNow; } } } diff --git a/Scripts/Engines/Help/StuckMenu.cs b/Scripts/Engines/Help/StuckMenu.cs index 44db94e98..9079e7a35 100644 --- a/Scripts/Engines/Help/StuckMenu.cs +++ b/Scripts/Engines/Help/StuckMenu.cs @@ -7,16 +7,14 @@ namespace Server.Menus.Questions { public class StuckMenuEntry { - private int m_Name; - private Point3D[] m_Locations; + public int Name { get; } - public int Name => m_Name; - public Point3D[] Locations => m_Locations; + public Point3D[] Locations { get; } public StuckMenuEntry( int name, Point3D[] locations ) { - m_Name = name; - m_Locations = locations; + Name = name; + Locations = locations; } } diff --git a/Scripts/Engines/Khaldun/KhaldunPitTeleporter.cs b/Scripts/Engines/Khaldun/KhaldunPitTeleporter.cs index bfe9ab3d1..0ee3f128b 100644 --- a/Scripts/Engines/Khaldun/KhaldunPitTeleporter.cs +++ b/Scripts/Engines/Khaldun/KhaldunPitTeleporter.cs @@ -2,30 +2,14 @@ namespace Server.Items { public class KhaldunPitTeleporter : Item { - private bool m_Active; - private Point3D m_PointDest; - private Map m_MapDest; + [CommandProperty( AccessLevel.GameMaster )] + public bool Active { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool Active - { - get => m_Active; - set => m_Active = value; - } + public Point3D PointDest { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D PointDest - { - get => m_PointDest; - set => m_PointDest = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public Map MapDest - { - get => m_MapDest; - set => m_MapDest = value; - } + public Map MapDest { get; set; } public override int LabelNumber => 1016511; // the floor of the cavern seems to have collapsed here - a faint light is visible at the bottom of the pit @@ -40,9 +24,9 @@ namespace Server.Items Movable = false; Hue = 1; - m_Active = true; - m_PointDest = pointDest; - m_MapDest = mapDest; + Active = true; + PointDest = pointDest; + MapDest = mapDest; } public KhaldunPitTeleporter( Serial serial ) : base( serial ) @@ -51,24 +35,24 @@ namespace Server.Items public override void OnDoubleClick( Mobile m ) { - if ( !m_Active ) + if ( !Active ) return; - Map map = m_MapDest; + Map map = MapDest; if ( map == null || map == Map.Internal ) map = m.Map; - Point3D p = m_PointDest; + Point3D p = PointDest; if ( p == Point3D.Zero ) p = m.Location; if ( m.InRange( this, 3 ) ) { - Mobiles.BaseCreature.TeleportPets( m, m_PointDest, m_MapDest ); + Mobiles.BaseCreature.TeleportPets( m, PointDest, MapDest ); - m.MoveToWorld( m_PointDest, m_MapDest ); + m.MoveToWorld( PointDest, MapDest ); } else { @@ -87,9 +71,9 @@ namespace Server.Items writer.Write( (int)0 ); // version - writer.Write( m_Active ); - writer.Write( m_PointDest ); - writer.Write( m_MapDest ); + writer.Write( Active ); + writer.Write( PointDest ); + writer.Write( MapDest ); } public override void Deserialize( GenericReader reader ) @@ -98,9 +82,9 @@ namespace Server.Items int version = reader.ReadInt(); - m_Active = reader.ReadBool(); - m_PointDest = reader.ReadPoint3D(); - m_MapDest = reader.ReadMap(); + Active = reader.ReadBool(); + PointDest = reader.ReadPoint3D(); + MapDest = reader.ReadMap(); } } } diff --git a/Scripts/Engines/Khaldun/PuzzleChest.cs b/Scripts/Engines/Khaldun/PuzzleChest.cs index 9080b7c11..360dba56d 100644 --- a/Scripts/Engines/Khaldun/PuzzleChest.cs +++ b/Scripts/Engines/Khaldun/PuzzleChest.cs @@ -22,24 +22,22 @@ namespace Server.Items { public const int Length = 5; - private PuzzleChestCylinder[] m_Cylinders = new PuzzleChestCylinder[Length]; + public PuzzleChestCylinder[] Cylinders { get; } = new PuzzleChestCylinder[Length]; - public PuzzleChestCylinder[] Cylinders => m_Cylinders; - - public PuzzleChestCylinder First{ get => m_Cylinders[0]; - set => m_Cylinders[0] = value; + public PuzzleChestCylinder First{ get => Cylinders[0]; + set => Cylinders[0] = value; } - public PuzzleChestCylinder Second{ get => m_Cylinders[1]; - set => m_Cylinders[1] = value; + public PuzzleChestCylinder Second{ get => Cylinders[1]; + set => Cylinders[1] = value; } - public PuzzleChestCylinder Third{ get => m_Cylinders[2]; - set => m_Cylinders[2] = value; + public PuzzleChestCylinder Third{ get => Cylinders[2]; + set => Cylinders[2] = value; } - public PuzzleChestCylinder Fourth{ get => m_Cylinders[3]; - set => m_Cylinders[3] = value; + public PuzzleChestCylinder Fourth{ get => Cylinders[3]; + set => Cylinders[3] = value; } - public PuzzleChestCylinder Fifth{ get => m_Cylinders[4]; - set => m_Cylinders[4] = value; + public PuzzleChestCylinder Fifth{ get => Cylinders[4]; + set => Cylinders[4] = value; } public static PuzzleChestCylinder RandomCylinder() @@ -59,8 +57,8 @@ namespace Server.Items public PuzzleChestSolution() { - for ( int i = 0; i < m_Cylinders.Length; i++ ) { - m_Cylinders[i] = RandomCylinder(); + for ( int i = 0; i < Cylinders.Length; i++ ) { + Cylinders[i] = RandomCylinder(); } } @@ -75,8 +73,8 @@ namespace Server.Items public PuzzleChestSolution( PuzzleChestSolution solution ) { - for ( int i = 0; i < m_Cylinders.Length; i++ ) { - m_Cylinders[i] = solution.m_Cylinders[i]; + for ( int i = 0; i < Cylinders.Length; i++ ) { + Cylinders[i] = solution.Cylinders[i]; } } @@ -85,12 +83,12 @@ namespace Server.Items cylinders = 0; colors = 0; - bool[] matchesSrc = new bool[solution.m_Cylinders.Length]; - bool[] matchesDst = new bool[solution.m_Cylinders.Length]; + bool[] matchesSrc = new bool[solution.Cylinders.Length]; + bool[] matchesDst = new bool[solution.Cylinders.Length]; - for ( int i = 0; i < m_Cylinders.Length; i++ ) + for ( int i = 0; i < Cylinders.Length; i++ ) { - if ( m_Cylinders[i] == solution.m_Cylinders[i] ) + if ( Cylinders[i] == solution.Cylinders[i] ) { cylinders++; @@ -99,13 +97,13 @@ namespace Server.Items } } - for ( int i = 0; i < m_Cylinders.Length; i++ ) + for ( int i = 0; i < Cylinders.Length; i++ ) { if ( !matchesSrc[i] ) { - for ( int j = 0; j < solution.m_Cylinders.Length; j++ ) + for ( int j = 0; j < solution.Cylinders.Length; j++ ) { - if ( m_Cylinders[i] == solution.m_Cylinders[j] && !matchesDst[j] ) + if ( Cylinders[i] == solution.Cylinders[j] && !matchesDst[j] ) { colors++; @@ -115,17 +113,17 @@ namespace Server.Items } } - return cylinders == m_Cylinders.Length; + return cylinders == Cylinders.Length; } public virtual void Serialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); // version - writer.WriteEncodedInt( (int) m_Cylinders.Length ); - for ( int i = 0; i < m_Cylinders.Length; i++ ) + writer.WriteEncodedInt( (int) Cylinders.Length ); + for ( int i = 0; i < Cylinders.Length; i++ ) { - writer.Write( (int) m_Cylinders[i] ); + writer.Write( (int) Cylinders[i] ); } } @@ -140,12 +138,12 @@ namespace Server.Items { PuzzleChestCylinder cylinder = (PuzzleChestCylinder) reader.ReadInt(); - if ( i < m_Cylinders.Length ) - m_Cylinders[i] = cylinder; + if ( i < Cylinders.Length ) + Cylinders[i] = cylinder; } - else if ( i < m_Cylinders.Length ) + else if ( i < Cylinders.Length ) { - m_Cylinders[i] = RandomCylinder(); + Cylinders[i] = RandomCylinder(); } else { @@ -157,13 +155,11 @@ namespace Server.Items public class PuzzleChestSolutionAndTime : PuzzleChestSolution { - private DateTime m_When; - - public DateTime When => m_When; + public DateTime When { get; } public PuzzleChestSolutionAndTime( DateTime when, PuzzleChestSolution solution ) : base( solution ) { - m_When = when; + When = when; } public override void Serialize( GenericWriter writer ) @@ -172,14 +168,14 @@ namespace Server.Items writer.WriteEncodedInt( (int) 0 ); // version - writer.WriteDeltaTime( m_When ); + writer.WriteDeltaTime( When ); } public PuzzleChestSolutionAndTime( GenericReader reader ) : base( reader ) { int version = reader.ReadEncodedInt(); - m_When = reader.ReadDeltaTime(); + When = reader.ReadDeltaTime(); } } @@ -189,7 +185,6 @@ namespace Server.Items public readonly TimeSpan CleanupTime = TimeSpan.FromHours( 1.0 ); private PuzzleChestSolution m_Solution; - private PuzzleChestCylinder[] m_Hints = new PuzzleChestCylinder[HintsCount]; private Dictionary m_Guesses = new Dictionary(); public PuzzleChestSolution Solution @@ -202,16 +197,16 @@ namespace Server.Items } } - public PuzzleChestCylinder[] Hints => m_Hints; + public PuzzleChestCylinder[] Hints { get; private set; } = new PuzzleChestCylinder[HintsCount]; - public PuzzleChestCylinder FirstHint{ get => m_Hints[0]; - set => m_Hints[0] = value; + public PuzzleChestCylinder FirstHint{ get => Hints[0]; + set => Hints[0] = value; } - public PuzzleChestCylinder SecondHint{ get => m_Hints[1]; - set => m_Hints[1] = value; + public PuzzleChestCylinder SecondHint{ get => Hints[1]; + set => Hints[1] = value; } - public PuzzleChestCylinder ThirdHint{ get => m_Hints[2]; - set => m_Hints[2] = value; + public PuzzleChestCylinder ThirdHint{ get => Hints[2]; + set => Hints[2] = value; } public override string DefaultName => null; @@ -226,11 +221,11 @@ namespace Server.Items for ( int i = 1; i < Solution.Cylinders.Length; i++ ) list.Add( Solution.Cylinders[i] ); - m_Hints = new PuzzleChestCylinder[HintsCount]; + Hints = new PuzzleChestCylinder[HintsCount]; - for ( int i = 0; i < m_Hints.Length; i++ ) { + for ( int i = 0; i < Hints.Length; i++ ) { int pos = Utility.Random( list.Count ); - m_Hints[i] = list[pos]; + Hints[i] = list[pos]; list.RemoveAt( pos ); } } @@ -685,10 +680,10 @@ namespace Server.Items m_Solution.Serialize( writer ); - writer.WriteEncodedInt( (int) m_Hints.Length ); - for ( int i = 0; i < m_Hints.Length; i++ ) + writer.WriteEncodedInt( (int) Hints.Length ); + for ( int i = 0; i < Hints.Length; i++ ) { - writer.Write( (int) m_Hints[i] ); + writer.Write( (int) Hints[i] ); } writer.WriteEncodedInt( (int) m_Guesses.Count ); @@ -711,10 +706,10 @@ namespace Server.Items { PuzzleChestCylinder cylinder = (PuzzleChestCylinder) reader.ReadInt(); - if ( length == m_Hints.Length ) - m_Hints[i] = cylinder; + if ( length == Hints.Length ) + Hints[i] = cylinder; } - if ( length != m_Hints.Length ) + if ( length != Hints.Length ) InitHints(); int guesses = reader.ReadEncodedInt(); diff --git a/Scripts/Engines/Khaldun/RaisableItem.cs b/Scripts/Engines/Khaldun/RaisableItem.cs index 71e8a3f59..f2aaa9abb 100644 --- a/Scripts/Engines/Khaldun/RaisableItem.cs +++ b/Scripts/Engines/Khaldun/RaisableItem.cs @@ -5,9 +5,6 @@ namespace Server.Items public class RaisableItem : Item { private int m_MaxElevation; - private int m_MoveSound; - private int m_StopSound; - private TimeSpan m_CloseDelay; [CommandProperty( AccessLevel.GameMaster )] public int MaxElevation @@ -25,19 +22,13 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public int MoveSound{ get => m_MoveSound; - set => m_MoveSound = value; - } + public int MoveSound { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int StopSound{ get => m_StopSound; - set => m_StopSound = value; - } + public int StopSound { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan CloseDelay{ get => m_CloseDelay; - set => m_CloseDelay = value; - } + public TimeSpan CloseDelay { get; set; } [Constructible] public RaisableItem( int itemID ) : this( itemID, 20, -1, -1, TimeSpan.FromMinutes( 1.0 ) ) @@ -55,9 +46,9 @@ namespace Server.Items Movable = false; m_MaxElevation = maxElevation; - m_MoveSound = moveSound; - m_StopSound = stopSound; - m_CloseDelay = closeDelay; + MoveSound = moveSound; + StopSound = stopSound; + CloseDelay = closeDelay; } private int m_Elevation; @@ -154,9 +145,9 @@ namespace Server.Items writer.WriteEncodedInt( (int) 0 ); // version writer.WriteEncodedInt( (int) m_MaxElevation ); - writer.WriteEncodedInt( (int) m_MoveSound ); - writer.WriteEncodedInt( (int) m_StopSound ); - writer.Write( (TimeSpan) m_CloseDelay ); + writer.WriteEncodedInt( (int) MoveSound ); + writer.WriteEncodedInt( (int) StopSound ); + writer.Write( (TimeSpan) CloseDelay ); writer.WriteEncodedInt( (int) m_Elevation ); } @@ -168,9 +159,9 @@ namespace Server.Items int version = reader.ReadEncodedInt(); m_MaxElevation = reader.ReadEncodedInt(); - m_MoveSound = reader.ReadEncodedInt(); - m_StopSound = reader.ReadEncodedInt(); - m_CloseDelay = reader.ReadTimeSpan(); + MoveSound = reader.ReadEncodedInt(); + StopSound = reader.ReadEncodedInt(); + CloseDelay = reader.ReadTimeSpan(); int elevation = reader.ReadEncodedInt(); Z -= elevation; diff --git a/Scripts/Engines/Khaldun/RaiseSwitch.cs b/Scripts/Engines/Khaldun/RaiseSwitch.cs index 27ca22645..d7fc4ba9c 100644 --- a/Scripts/Engines/Khaldun/RaiseSwitch.cs +++ b/Scripts/Engines/Khaldun/RaiseSwitch.cs @@ -5,14 +5,8 @@ namespace Server.Items { public class RaiseSwitch : Item { - private RaisableItem m_RaisableItem; - [CommandProperty( AccessLevel.GameMaster )] - public RaisableItem RaisableItem - { - get => m_RaisableItem; - set => m_RaisableItem = value; - } + public RaisableItem RaisableItem { get; set; } [Constructible] public RaiseSwitch() : this( 0x1093 ) @@ -129,7 +123,7 @@ namespace Server.Items writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( (Item) m_RaisableItem ); + writer.Write( (Item) RaisableItem ); } public override void Deserialize( GenericReader reader ) @@ -138,7 +132,7 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - m_RaisableItem = (RaisableItem) reader.ReadItem(); + RaisableItem = (RaisableItem) reader.ReadItem(); Reset(); } diff --git a/Scripts/Engines/MLQuests/Gumps/BaseQuestGump.cs b/Scripts/Engines/MLQuests/Gumps/BaseQuestGump.cs index a63fad086..8e9874a05 100644 --- a/Scripts/Engines/MLQuests/Gumps/BaseQuestGump.cs +++ b/Scripts/Engines/MLQuests/Gumps/BaseQuestGump.cs @@ -30,19 +30,17 @@ namespace Server.Engines.MLQuests.Gumps { private struct ButtonInfo { - private ButtonPosition m_Position; - private ButtonGraphic m_Graphic; - private int m_ButtonID; + public ButtonPosition Position { get; } - public ButtonPosition Position => m_Position; - public ButtonGraphic Graphic => m_Graphic; - public int ButtonID => m_ButtonID; + public ButtonGraphic Graphic { get; } + + public int ButtonID { get; } public ButtonInfo( ButtonPosition position, ButtonGraphic graphic, int buttonID ) { - m_Position = position; - m_Graphic = graphic; - m_ButtonID = buttonID; + Position = position; + Graphic = graphic; + ButtonID = buttonID; } } diff --git a/Scripts/Engines/MLQuests/Items/Teleporters.cs b/Scripts/Engines/MLQuests/Items/Teleporters.cs index b4d49fac0..8f85ce8d4 100644 --- a/Scripts/Engines/MLQuests/Items/Teleporters.cs +++ b/Scripts/Engines/MLQuests/Items/Teleporters.cs @@ -7,7 +7,6 @@ namespace Server.Engines.MLQuests.Items public class MLQuestTeleporter : Teleporter { private Type m_QuestType; - private TextDefinition m_Message; [CommandProperty(AccessLevel.GameMaster)] public Type QuestType @@ -17,11 +16,7 @@ namespace Server.Engines.MLQuests.Items } [CommandProperty(AccessLevel.GameMaster)] - public TextDefinition Message - { - get => m_Message; - set => m_Message = value; - } + public TextDefinition Message { get; set; } [Constructible] public MLQuestTeleporter() @@ -40,7 +35,7 @@ namespace Server.Engines.MLQuests.Items : base(pointDest, mapDest) { m_QuestType = questType; - m_Message = message; + Message = message; } public override bool CanTeleport(Mobile m) @@ -58,7 +53,7 @@ namespace Server.Engines.MLQuests.Items if (context?.IsDoingQuest(m_QuestType) == true || context?.HasDoneQuest(m_QuestType) == true) return true; - TextDefinition.SendMessageTo(m, m_Message); + TextDefinition.SendMessageTo(m, Message); return false; } @@ -83,7 +78,7 @@ namespace Server.Engines.MLQuests.Items writer.Write((int)0); // version writer.Write((m_QuestType != null) ? m_QuestType.FullName : null); - TextDefinition.Serialize(writer, m_Message); + TextDefinition.Serialize(writer, Message); } public override void Deserialize(GenericReader reader) @@ -97,7 +92,7 @@ namespace Server.Engines.MLQuests.Items if (typeName != null) m_QuestType = ScriptCompiler.FindTypeByFullName(typeName, false); - m_Message = TextDefinition.Deserialize(reader); + Message = TextDefinition.Deserialize(reader); } } @@ -109,7 +104,6 @@ namespace Server.Engines.MLQuests.Items public class TicketTeleporter : Teleporter { private Type m_TicketType; - private TextDefinition m_Message; [CommandProperty(AccessLevel.GameMaster)] public Type TicketType @@ -119,11 +113,7 @@ namespace Server.Engines.MLQuests.Items } [CommandProperty(AccessLevel.GameMaster)] - public TextDefinition Message - { - get => m_Message; - set => m_Message = value; - } + public TextDefinition Message { get; set; } [Constructible] public TicketTeleporter() @@ -142,7 +132,7 @@ namespace Server.Engines.MLQuests.Items : base(pointDest, mapDest) { m_TicketType = ticketType; - m_Message = message; + Message = message; } public override bool CanTeleport(Mobile m) @@ -172,7 +162,7 @@ namespace Server.Engines.MLQuests.Items if (ticket == null) { - TextDefinition.SendMessageTo(m, m_Message); + TextDefinition.SendMessageTo(m, Message); return false; } @@ -202,7 +192,7 @@ namespace Server.Engines.MLQuests.Items writer.Write((int)0); // version writer.Write((m_TicketType != null) ? m_TicketType.FullName : null); - TextDefinition.Serialize(writer, m_Message); + TextDefinition.Serialize(writer, Message); } public override void Deserialize(GenericReader reader) @@ -216,7 +206,7 @@ namespace Server.Engines.MLQuests.Items if (typeName != null) m_TicketType = ScriptCompiler.FindTypeByFullName(typeName, false); - m_Message = TextDefinition.Deserialize(reader); + Message = TextDefinition.Deserialize(reader); } } } diff --git a/Scripts/Engines/MLQuests/MLQuest.cs b/Scripts/Engines/MLQuests/MLQuest.cs index c7b625f93..6982dd1d3 100644 --- a/Scripts/Engines/MLQuests/MLQuest.cs +++ b/Scripts/Engines/MLQuests/MLQuest.cs @@ -15,84 +15,29 @@ namespace Server.Engines.MLQuests public class MLQuest { - private bool m_Deserialized; - private bool m_SaveEnabled; + public bool Deserialized { get; set; } - public bool Deserialized - { - get => m_Deserialized; - set => m_Deserialized = value; - } - - public bool SaveEnabled - { - get => m_SaveEnabled; - set => m_SaveEnabled = value; - } - - private bool m_Activated; - private List m_Objectives; - private ObjectiveType m_ObjectiveType; - private List m_Rewards; - - private List m_Instances; - - private TextDefinition m_Title; - private TextDefinition m_Description; - private TextDefinition m_RefuseMessage; - private TextDefinition m_InProgressMessage; - private TextDefinition m_CompletionMessage; - private TextDefinition m_CompletionNotice; + public bool SaveEnabled { get; set; } // TODO: Flags? (Deserialized, SaveEnabled, Activated) - private bool m_OneTimeOnly; - private bool m_HasRestartDelay; - public bool Activated - { - get => m_Activated; - set => m_Activated = value; - } + public bool Activated { get; set; } - public List Objectives - { - get => m_Objectives; - set => m_Objectives = value; - } + public List Objectives { get; set; } - public ObjectiveType ObjectiveType - { - get => m_ObjectiveType; - set => m_ObjectiveType = value; - } + public ObjectiveType ObjectiveType { get; set; } - public List Rewards - { - get => m_Rewards; - set => m_Rewards = value; - } + public List Rewards { get; set; } - public List Instances - { - get => m_Instances; - set => m_Instances = value; - } + public List Instances { get; set; } - public bool OneTimeOnly - { - get => m_OneTimeOnly; - set => m_OneTimeOnly = value; - } + public bool OneTimeOnly { get; set; } - public bool HasRestartDelay - { - get => m_HasRestartDelay; - set => m_HasRestartDelay = value; - } + public bool HasRestartDelay { get; set; } public bool HasObjective() where T : BaseObjective { - foreach ( BaseObjective obj in m_Objectives ) + foreach ( BaseObjective obj in Objectives ) { if ( obj is T ) return true; @@ -107,29 +52,22 @@ namespace Server.Engines.MLQuests public bool RequiresCollection => HasObjective() || HasObjective(); - public virtual bool RecordCompletion => ( m_OneTimeOnly || m_HasRestartDelay ); + public virtual bool RecordCompletion => ( OneTimeOnly || HasRestartDelay ); public virtual bool IsChainTriggered => false; public virtual Type NextQuest => null; - public TextDefinition Title { get => m_Title; - set => m_Title = value; - } - public TextDefinition Description { get => m_Description; - set => m_Description = value; - } - public TextDefinition RefusalMessage { get => m_RefuseMessage; - set => m_RefuseMessage = value; - } - public TextDefinition InProgressMessage { get => m_InProgressMessage; - set => m_InProgressMessage = value; - } - public TextDefinition CompletionMessage { get => m_CompletionMessage; - set => m_CompletionMessage = value; - } - public TextDefinition CompletionNotice { get => m_CompletionNotice; - set => m_CompletionNotice = value; - } + public TextDefinition Title { get; set; } + + public TextDefinition Description { get; set; } + + public TextDefinition RefusalMessage { get; set; } + + public TextDefinition InProgressMessage { get; set; } + + public TextDefinition CompletionMessage { get; set; } + + public TextDefinition CompletionNotice { get; set; } public static readonly TextDefinition CompletionNoticeDefault = new TextDefinition( 1072273 ); // You've completed a quest! Don't forget to collect your reward. public static readonly TextDefinition CompletionNoticeShort = new TextDefinition( 1046258 ); // Your quest is complete. @@ -138,15 +76,15 @@ namespace Server.Engines.MLQuests public MLQuest() { - m_Activated = false; - m_Objectives = new List(); - m_ObjectiveType = ObjectiveType.All; - m_Rewards = new List(); - m_CompletionNotice = CompletionNoticeDefault; + Activated = false; + Objectives = new List(); + ObjectiveType = ObjectiveType.All; + Rewards = new List(); + CompletionNotice = CompletionNoticeDefault; - m_Instances = new List(); + Instances = new List(); - m_SaveEnabled = true; + SaveEnabled = true; } public virtual void Generate() @@ -208,7 +146,7 @@ namespace Server.Engines.MLQuests public virtual bool CanOffer( IQuestGiver quester, PlayerMobile pm, MLQuestContext context, bool message ) { - if ( !m_Activated || quester.Deleted ) + if ( !Activated || quester.Deleted ) return false; if ( context != null ) @@ -253,7 +191,7 @@ namespace Server.Engines.MLQuests } } - foreach ( BaseObjective obj in m_Objectives ) + foreach ( BaseObjective obj in Objectives ) { if ( !obj.CanOffer( quester, pm, message ) ) return false; @@ -333,7 +271,7 @@ namespace Server.Engines.MLQuests return; // not saved or no longer exists quest.Refresh( oldVersion ); - quest.m_Deserialized = true; + quest.Deserialized = true; } public virtual int Version => 0; diff --git a/Scripts/Engines/MLQuests/MLQuestContext.cs b/Scripts/Engines/MLQuests/MLQuestContext.cs index f78fb9abe..7b7c2cce2 100644 --- a/Scripts/Engines/MLQuests/MLQuestContext.cs +++ b/Scripts/Engines/MLQuests/MLQuestContext.cs @@ -46,20 +46,17 @@ namespace Server.Engines.MLQuests } } - private PlayerMobile m_Owner; - private List m_QuestInstances; private List m_DoneQuests; - private List m_ChainOffers; private MLQuestFlag m_Flags; - public PlayerMobile Owner => m_Owner; + public PlayerMobile Owner { get; } - public List QuestInstances => m_QuestInstances; + public List QuestInstances { get; } - public List ChainOffers => m_ChainOffers; + public List ChainOffers { get; } [CommandProperty( AccessLevel.GameMaster )] - public bool IsFull => m_QuestInstances.Count >= MLQuestSystem.MaxConcurrentQuests; + public bool IsFull => QuestInstances.Count >= MLQuestSystem.MaxConcurrentQuests; [CommandProperty( AccessLevel.GameMaster )] public bool Spellweaving @@ -91,10 +88,10 @@ namespace Server.Engines.MLQuests public MLQuestContext( PlayerMobile owner ) { - m_Owner = owner; - m_QuestInstances = new List(); + Owner = owner; + QuestInstances = new List(); m_DoneQuests = new List(); - m_ChainOffers = new List(); + ChainOffers = new List(); m_Flags = MLQuestFlag.None; } @@ -164,14 +161,14 @@ namespace Server.Engines.MLQuests public void HandleDeath() { - for ( int i = m_QuestInstances.Count - 1; i >= 0; --i ) - m_QuestInstances[i].OnPlayerDeath(); + for ( int i = QuestInstances.Count - 1; i >= 0; --i ) + QuestInstances[i].OnPlayerDeath(); } public void HandleDeletion() { - for ( int i = m_QuestInstances.Count - 1; i >= 0; --i ) - m_QuestInstances[i].Remove(); + for ( int i = QuestInstances.Count - 1; i >= 0; --i ) + QuestInstances[i].Remove(); } public MLQuestInstance FindInstance( Type questType ) @@ -186,7 +183,7 @@ namespace Server.Engines.MLQuests public MLQuestInstance FindInstance( MLQuest quest ) { - foreach ( MLQuestInstance instance in m_QuestInstances ) + foreach ( MLQuestInstance instance in QuestInstances ) { if ( instance.Quest == quest ) return instance; @@ -211,10 +208,10 @@ namespace Server.Engines.MLQuests { // Version info is written in MLQuestPersistence.Serialize - writer.WriteMobile( m_Owner ); - writer.Write( m_QuestInstances.Count ); + writer.WriteMobile( Owner ); + writer.Write( QuestInstances.Count ); - foreach ( MLQuestInstance instance in m_QuestInstances ) + foreach ( MLQuestInstance instance in QuestInstances ) instance.Serialize( writer ); writer.Write( m_DoneQuests.Count ); @@ -222,9 +219,9 @@ namespace Server.Engines.MLQuests foreach ( MLDoneQuestInfo info in m_DoneQuests ) info.Serialize( writer ); - writer.Write( m_ChainOffers.Count ); + writer.Write( ChainOffers.Count ); - foreach ( MLQuest quest in m_ChainOffers ) + foreach ( MLQuest quest in ChainOffers ) MLQuestSystem.WriteQuestRef( writer, quest ); writer.WriteEncodedInt( (int)m_Flags ); @@ -232,19 +229,19 @@ namespace Server.Engines.MLQuests public MLQuestContext( GenericReader reader, int version ) { - m_Owner = reader.ReadMobile(); - m_QuestInstances = new List(); + Owner = reader.ReadMobile(); + QuestInstances = new List(); m_DoneQuests = new List(); - m_ChainOffers = new List(); + ChainOffers = new List(); int instances = reader.ReadInt(); for ( int i = 0; i < instances; ++i ) { - MLQuestInstance instance = MLQuestInstance.Deserialize( reader, version, m_Owner ); + MLQuestInstance instance = MLQuestInstance.Deserialize( reader, version, Owner ); if ( instance != null ) - m_QuestInstances.Add( instance ); + QuestInstances.Add( instance ); } int doneQuests = reader.ReadInt(); @@ -264,7 +261,7 @@ namespace Server.Engines.MLQuests MLQuest quest = MLQuestSystem.ReadQuestRef( reader ); if ( quest != null && quest.IsChainTriggered ) - m_ChainOffers.Add( quest ); + ChainOffers.Add( quest ); } m_Flags = (MLQuestFlag)reader.ReadEncodedInt(); diff --git a/Scripts/Engines/MLQuests/MLQuestEntry.cs b/Scripts/Engines/MLQuests/MLQuestEntry.cs index d0df3bb9b..eb90896e2 100644 --- a/Scripts/Engines/MLQuests/MLQuestEntry.cs +++ b/Scripts/Engines/MLQuests/MLQuestEntry.cs @@ -18,38 +18,31 @@ namespace Server.Engines.MLQuests public class MLQuestInstance { - private MLQuest m_Quest; - private IQuestGiver m_Quester; - private Type m_QuesterType; - private PlayerMobile m_Player; - private DateTime m_Accepted; private MLQuestInstanceFlags m_Flags; - private BaseObjectiveInstance[] m_ObjectiveInstances; - private Timer m_Timer; public MLQuestInstance( MLQuest quest, IQuestGiver quester, PlayerMobile player ) { - m_Quest = quest; + Quest = quest; m_Quester = quester; - m_QuesterType = quester?.GetType(); - m_Player = player; + QuesterType = quester?.GetType(); + Player = player; - m_Accepted = DateTime.UtcNow; + Accepted = DateTime.UtcNow; m_Flags = MLQuestInstanceFlags.None; - m_ObjectiveInstances = new BaseObjectiveInstance[quest.Objectives.Count]; + Objectives = new BaseObjectiveInstance[quest.Objectives.Count]; BaseObjectiveInstance obj; bool timed = false; for ( int i = 0; i < quest.Objectives.Count; ++i ) { - m_ObjectiveInstances[i] = obj = quest.Objectives[i].CreateInstance( this ); + Objectives[i] = obj = quest.Objectives[i].CreateInstance( this ); if ( obj.IsTimed ) timed = true; @@ -63,27 +56,23 @@ namespace Server.Engines.MLQuests private void Register() { - m_Quest?.Instances?.Add( this ); + Quest?.Instances?.Add( this ); - if ( m_Player != null ) + if ( Player != null ) PlayerContext.QuestInstances.Add( this ); } private void Unregister() { - m_Quest?.Instances?.Remove( this ); + Quest?.Instances?.Remove( this ); - if ( m_Player != null ) + if ( Player != null ) PlayerContext.QuestInstances.Remove( this ); Removed = true; } - public MLQuest Quest - { - get => m_Quest; - set => m_Quest = value; - } + public MLQuest Quest { get; set; } public IQuestGiver Quester { @@ -91,25 +80,17 @@ namespace Server.Engines.MLQuests set { m_Quester = value; - m_QuesterType = value?.GetType(); + QuesterType = value?.GetType(); } } - public Type QuesterType => m_QuesterType; + public Type QuesterType { get; private set; } - public PlayerMobile Player - { - get => m_Player; - set => m_Player = value; - } + public PlayerMobile Player { get; set; } - public MLQuestContext PlayerContext => MLQuestSystem.GetOrCreateContext( m_Player ); + public MLQuestContext PlayerContext => MLQuestSystem.GetOrCreateContext( Player ); - public DateTime Accepted - { - get => m_Accepted; - set => m_Accepted = value; - } + public DateTime Accepted { get; set; } public bool ClaimReward { @@ -129,15 +110,11 @@ namespace Server.Engines.MLQuests set => SetFlag( MLQuestInstanceFlags.Failed, value ); } - public BaseObjectiveInstance[] Objectives - { - get => m_ObjectiveInstances; - set => m_ObjectiveInstances = value; - } + public BaseObjectiveInstance[] Objectives { get; set; } public bool AllowsQuestItem( Item item, Type type ) { - foreach ( BaseObjectiveInstance objective in m_ObjectiveInstances ) + foreach ( BaseObjectiveInstance objective in Objectives ) { if ( !objective.Expired && objective.AllowsQuestItem( item, type ) ) return true; @@ -148,9 +125,9 @@ namespace Server.Engines.MLQuests public bool IsCompleted() { - bool requiresAll = ( m_Quest.ObjectiveType == ObjectiveType.All ); + bool requiresAll = ( Quest.ObjectiveType == ObjectiveType.All ); - foreach ( BaseObjectiveInstance obj in m_ObjectiveInstances ) + foreach ( BaseObjectiveInstance obj in Objectives ) { bool complete = obj.IsCompleted(); @@ -167,12 +144,12 @@ namespace Server.Engines.MLQuests { if ( IsCompleted() ) { - m_Player.PlaySound( 0x5B5 ); // public sound + Player.PlaySound( 0x5B5 ); // public sound - foreach ( BaseObjectiveInstance obj in m_ObjectiveInstances ) + foreach ( BaseObjectiveInstance obj in Objectives ) obj.OnQuestCompleted(); - TextDefinition.SendMessageTo( m_Player, m_Quest.CompletionNotice, 0x23 ); + TextDefinition.SendMessageTo( Player, Quest.CompletionNotice, 0x23 ); /* * Advance to the ClaimReward=true stage if this quest has no @@ -182,7 +159,7 @@ namespace Server.Engines.MLQuests * For quests that require collections, this is done later when * the player double clicks the quester. */ - if ( !Removed && SkipReportBack && !m_Quest.RequiresCollection ) // An OnQuestCompleted can potentially have removed this instance already + if ( !Removed && SkipReportBack && !Quest.RequiresCollection ) // An OnQuestCompleted can potentially have removed this instance already ContinueReportBack( false ); } } @@ -203,13 +180,13 @@ namespace Server.Engines.MLQuests bool hasAnyFails = false; bool hasAnyLeft = false; - foreach ( BaseObjectiveInstance obj in m_ObjectiveInstances ) + foreach ( BaseObjectiveInstance obj in Objectives ) { if ( !obj.Expired ) { if ( obj.IsTimed && obj.EndTime <= DateTime.UtcNow ) { - m_Player.SendLocalizedMessage( 1072258 ); // You failed to complete an objective in time! + Player.SendLocalizedMessage( 1072258 ); // You failed to complete an objective in time! obj.Expired = true; obj.OnExpire(); @@ -223,7 +200,7 @@ namespace Server.Engines.MLQuests } } - if ( ( m_Quest.ObjectiveType == ObjectiveType.All && hasAnyFails ) || !hasAnyLeft ) + if ( ( Quest.ObjectiveType == ObjectiveType.All && hasAnyFails ) || !hasAnyLeft ) Fail(); if ( !hasAnyLeft ) @@ -232,18 +209,18 @@ namespace Server.Engines.MLQuests public void SendProgressGump() { - m_Player.SendGump( new QuestConversationGump( m_Quest, m_Player, m_Quest.InProgressMessage ) ); + Player.SendGump( new QuestConversationGump( Quest, Player, Quest.InProgressMessage ) ); } public void SendRewardOffer() { - m_Quest.GetRewards( this ); + Quest.GetRewards( this ); } // TODO: Split next quest stuff from SendRewardGump stuff? public void SendRewardGump() { - Type nextQuestType = m_Quest.NextQuest; + Type nextQuestType = Quest.NextQuest; if ( nextQuestType != null ) { @@ -253,45 +230,45 @@ namespace Server.Engines.MLQuests { MLQuest nextQuest = MLQuestSystem.FindQuest( nextQuestType ); - nextQuest?.SendOffer( m_Quester, m_Player ); + nextQuest?.SendOffer( m_Quester, Player ); } } else { - m_Player.SendGump( new QuestRewardGump( this ) ); + Player.SendGump( new QuestRewardGump( this ) ); } } - public bool SkipReportBack => TextDefinition.IsNullOrEmpty( m_Quest.CompletionMessage ); + public bool SkipReportBack => TextDefinition.IsNullOrEmpty( Quest.CompletionMessage ); public void SendReportBackGump() { if ( SkipReportBack ) ContinueReportBack( true ); // skip ahead else - m_Player.SendGump( new QuestReportBackGump( this ) ); + Player.SendGump( new QuestReportBackGump( this ) ); } public void ContinueReportBack( bool sendRewardGump ) { // There is a backpack check here on OSI for the rewards as well (even though it's not needed...) - if ( m_Quest.ObjectiveType == ObjectiveType.All ) + if ( Quest.ObjectiveType == ObjectiveType.All ) { // TODO: 1115877 - You no longer have the required items to complete this quest. - foreach ( BaseObjectiveInstance objective in m_ObjectiveInstances ) + foreach ( BaseObjectiveInstance objective in Objectives ) { if ( !objective.IsCompleted() ) return; } - foreach ( BaseObjectiveInstance objective in m_ObjectiveInstances ) + foreach ( BaseObjectiveInstance objective in Objectives ) { if ( !objective.OnBeforeClaimReward() ) return; } - foreach ( BaseObjectiveInstance objective in m_ObjectiveInstances ) + foreach ( BaseObjectiveInstance objective in Objectives ) objective.OnClaimReward(); } else @@ -302,7 +279,7 @@ namespace Server.Engines.MLQuests */ bool complete = false; - foreach ( BaseObjectiveInstance objective in m_ObjectiveInstances ) + foreach ( BaseObjectiveInstance objective in Objectives ) { if ( objective.IsCompleted() ) { @@ -322,11 +299,11 @@ namespace Server.Engines.MLQuests ClaimReward = true; - if ( m_Quest.HasRestartDelay ) - PlayerContext.SetDoneQuest( m_Quest, DateTime.UtcNow + m_Quest.GetRestartDelay() ); + if ( Quest.HasRestartDelay ) + PlayerContext.SetDoneQuest( Quest, DateTime.UtcNow + Quest.GetRestartDelay() ); // This is correct for ObjectiveType.Any as well - foreach ( BaseObjectiveInstance objective in m_ObjectiveInstances ) + foreach ( BaseObjectiveInstance objective in Objectives ) objective.OnAfterClaimReward(); if ( sendRewardGump ) @@ -335,13 +312,13 @@ namespace Server.Engines.MLQuests public void ClaimRewards() { - if ( m_Quest == null || m_Player == null || m_Player.Deleted || !ClaimReward || Removed ) + if ( Quest == null || Player == null || Player.Deleted || !ClaimReward || Removed ) return; List rewards = new List(); - foreach ( BaseReward reward in m_Quest.Rewards ) - reward.AddRewardItems( m_Player, rewards ); + foreach ( BaseReward reward in Quest.Rewards ) + reward.AddRewardItems( Player, rewards ); if ( rewards.Count != 0 ) { @@ -351,7 +328,7 @@ namespace Server.Engines.MLQuests foreach ( Item rewardItem in rewards ) { - if ( !m_Player.AddToBackpack( rewardItem ) ) + if ( !Player.AddToBackpack( rewardItem ) ) { canFit = false; break; @@ -363,7 +340,7 @@ namespace Server.Engines.MLQuests foreach ( Item rewardItem in rewards ) rewardItem.Delete(); - m_Player.SendLocalizedMessage( 1078524 ); // Your backpack is full. You cannot complete the quest and receive your reward. + Player.SendLocalizedMessage( 1078524 ); // Your backpack is full. You cannot complete the quest and receive your reward. return; } @@ -372,26 +349,26 @@ namespace Server.Engines.MLQuests string rewardName = rewardItem.Name ?? string.Concat( "#", rewardItem.LabelNumber ); if ( rewardItem.Stackable ) - m_Player.SendLocalizedMessage( 1115917, string.Concat( rewardItem.Amount, "\t", rewardName ) ); // You receive a reward: ~1_QUANTITY~ ~2_ITEM~ + Player.SendLocalizedMessage( 1115917, string.Concat( rewardItem.Amount, "\t", rewardName ) ); // You receive a reward: ~1_QUANTITY~ ~2_ITEM~ else - m_Player.SendLocalizedMessage( 1074360, rewardName ); // You receive a reward: ~1_REWARD~ + Player.SendLocalizedMessage( 1074360, rewardName ); // You receive a reward: ~1_REWARD~ } } - foreach ( BaseObjectiveInstance objective in m_ObjectiveInstances ) + foreach ( BaseObjectiveInstance objective in Objectives ) objective.OnRewardClaimed(); - m_Quest.OnRewardClaimed( this ); + Quest.OnRewardClaimed( this ); MLQuestContext context = PlayerContext; - if ( m_Quest.RecordCompletion && !m_Quest.HasRestartDelay ) // Quests with restart delays are logged earlier as per OSI - context.SetDoneQuest( m_Quest ); + if ( Quest.RecordCompletion && !Quest.HasRestartDelay ) // Quests with restart delays are logged earlier as per OSI + context.SetDoneQuest( Quest ); - if ( m_Quest.IsChainTriggered ) - context.ChainOffers.Remove( m_Quest ); + if ( Quest.IsChainTriggered ) + context.ChainOffers.Remove( Quest ); - Type nextQuestType = m_Quest.NextQuest; + Type nextQuestType = Quest.NextQuest; if ( nextQuestType != null ) { @@ -413,15 +390,15 @@ namespace Server.Engines.MLQuests { Remove(); - m_Player.SendSound( 0x5B3 ); // private sound + Player.SendSound( 0x5B3 ); // private sound - foreach ( BaseObjectiveInstance obj in m_ObjectiveInstances ) + foreach ( BaseObjectiveInstance obj in Objectives ) obj.OnQuestCancelled(); - m_Quest.OnCancel( this ); + Quest.OnCancel( this ); if ( removeChain ) - PlayerContext.ChainOffers.Remove( m_Quest ); + PlayerContext.ChainOffers.Remove( Quest ); } public void Remove() @@ -441,18 +418,18 @@ namespace Server.Engines.MLQuests public void OnQuesterDeleted() { - foreach ( BaseObjectiveInstance obj in m_ObjectiveInstances ) + foreach ( BaseObjectiveInstance obj in Objectives ) obj.OnQuesterDeleted(); - m_Quest.OnQuesterDeleted( this ); + Quest.OnQuesterDeleted( this ); } public void OnPlayerDeath() { - foreach ( BaseObjectiveInstance obj in m_ObjectiveInstances ) + foreach ( BaseObjectiveInstance obj in Objectives ) obj.OnPlayerDeath(); - m_Quest.OnPlayerDeath( this ); + Quest.OnPlayerDeath( this ); } private bool GetFlag( MLQuestInstanceFlags flag ) @@ -472,7 +449,7 @@ namespace Server.Engines.MLQuests { // Version info is written in MLQuestPersistence.Serialize - MLQuestSystem.WriteQuestRef( writer, m_Quest ); + MLQuestSystem.WriteQuestRef( writer, Quest ); if ( m_Quester == null || m_Quester.Deleted ) writer.Write( Serial.MinusOne ); @@ -480,9 +457,9 @@ namespace Server.Engines.MLQuests writer.Write( m_Quester.Serial ); writer.Write( ClaimReward ); - writer.Write( m_ObjectiveInstances.Length ); + writer.Write( Objectives.Length ); - foreach ( BaseObjectiveInstance objInstance in m_ObjectiveInstances ) + foreach ( BaseObjectiveInstance objInstance in Objectives ) objInstance.Serialize( writer ); } diff --git a/Scripts/Engines/MLQuests/MLQuestSystem.cs b/Scripts/Engines/MLQuests/MLQuestSystem.cs index 960327330..7b14756cc 100644 --- a/Scripts/Engines/MLQuests/MLQuestSystem.cs +++ b/Scripts/Engines/MLQuests/MLQuestSystem.cs @@ -23,23 +23,19 @@ namespace Server.Engines.MLQuests public static readonly bool AutoGenerateNew = true; public static readonly bool Debug = false; - private static Dictionary m_Quests; - private static Dictionary> m_QuestGivers; - private static Dictionary m_Contexts; - public static readonly List EmptyList = new List(); - public static Dictionary Quests => m_Quests; + public static Dictionary Quests { get; } - public static Dictionary> QuestGivers => m_QuestGivers; + public static Dictionary> QuestGivers { get; } - public static Dictionary Contexts => m_Contexts; + public static Dictionary Contexts { get; } static MLQuestSystem() { - m_Quests = new Dictionary(); - m_QuestGivers = new Dictionary>(); - m_Contexts = new Dictionary(); + Quests = new Dictionary(); + QuestGivers = new Dictionary>(); + Contexts = new Dictionary(); string cfgPath = Path.Combine( Core.BaseDirectory, Path.Combine( "Data", "MLQuests.cfg" ) ); @@ -103,13 +99,13 @@ namespace Server.Engines.MLQuests private static void Register( Type type, MLQuest quest ) { - m_Quests[type] = quest; + Quests[type] = quest; } private static void RegisterQuestGiver( MLQuest quest, Type questerType ) { - if (!m_QuestGivers.TryGetValue( questerType, out List questList )) - m_QuestGivers[questerType] = questList = new List(); + if (!QuestGivers.TryGetValue( questerType, out List questList )) + QuestGivers[questerType] = questList = new List(); questList.Add( quest ); } @@ -129,7 +125,7 @@ namespace Server.Engines.MLQuests if ( AutoGenerateNew ) { - foreach ( MLQuest quest in m_Quests.Values ) + foreach ( MLQuest quest in Quests.Values ) { if ( quest != null && !quest.Deserialized ) quest.Generate(); @@ -157,14 +153,14 @@ namespace Server.Engines.MLQuests if ( e.Length == 0 ) { - m.SendMessage( "Quest table length: {0}", m_Quests.Count ); + m.SendMessage( "Quest table length: {0}", Quests.Count ); return; } Type index = ScriptCompiler.FindTypeByName( e.GetString( 0 ) ); MLQuest quest; - if ( index == null || !m_Quests.TryGetValue( index, out quest ) ) + if ( index == null || !Quests.TryGetValue( index, out quest ) ) { m.SendMessage( "Invalid quest type name." ); return; @@ -238,7 +234,7 @@ namespace Server.Engines.MLQuests Type index = ScriptCompiler.FindTypeByName( e.GetString( 0 ) ); - if ( index == null || !m_Quests.TryGetValue( index, out MLQuest quest ) ) + if ( index == null || !Quests.TryGetValue( index, out MLQuest quest ) ) { m.SendMessage( "Invalid quest type name." ); return; @@ -267,7 +263,7 @@ namespace Server.Engines.MLQuests bool enable = ( e.Length == 1 ) ? e.GetBoolean( 0 ) : true; - foreach ( MLQuest quest in m_Quests.Values ) + foreach ( MLQuest quest in Quests.Values ) quest.SaveEnabled = enable; m.SendMessage( "Serialization for all quests is now {0}.", enable ? "enabled" : "disabled" ); @@ -561,15 +557,15 @@ namespace Server.Engines.MLQuests public static MLQuestContext GetContext( PlayerMobile pm ) { - m_Contexts.TryGetValue( pm, out MLQuestContext context ); + Contexts.TryGetValue( pm, out MLQuestContext context ); return context; } public static MLQuestContext GetOrCreateContext( PlayerMobile pm ) { - if (!m_Contexts.TryGetValue( pm, out MLQuestContext context )) - m_Contexts[pm] = context = new MLQuestContext( pm ); + if (!Contexts.TryGetValue( pm, out MLQuestContext context )) + Contexts[pm] = context = new MLQuestContext( pm ); return context; } @@ -588,7 +584,7 @@ namespace Server.Engines.MLQuests if ( context != null ) { context.HandleDeletion(); - m_Contexts.Remove( pm ); + Contexts.Remove( pm ); } } @@ -725,14 +721,14 @@ namespace Server.Engines.MLQuests public static MLQuest FindQuest( Type questType ) { - m_Quests.TryGetValue( questType, out MLQuest result ); + Quests.TryGetValue( questType, out MLQuest result ); return result; } public static List FindQuestList( Type questerType ) { - return m_QuestGivers.TryGetValue(questerType, out List result) ? result : EmptyList; + return QuestGivers.TryGetValue(questerType, out List result) ? result : EmptyList; } } } diff --git a/Scripts/Engines/MLQuests/Objectives/BaseObjective.cs b/Scripts/Engines/MLQuests/Objectives/BaseObjective.cs index 96b10069e..bb3554803 100644 --- a/Scripts/Engines/MLQuests/Objectives/BaseObjective.cs +++ b/Scripts/Engines/MLQuests/Objectives/BaseObjective.cs @@ -28,38 +28,26 @@ namespace Server.Engines.MLQuests.Objectives public abstract class BaseObjectiveInstance { - private MLQuestInstance m_Instance; - private DateTime m_EndTime; - private bool m_Expired; + public MLQuestInstance Instance { get; } - public MLQuestInstance Instance => m_Instance; + public bool IsTimed => ( EndTime != DateTime.MinValue ); - public bool IsTimed => ( m_EndTime != DateTime.MinValue ); + public DateTime EndTime { get; set; } - public DateTime EndTime - { - get => m_EndTime; - set => m_EndTime = value; - } - - public bool Expired - { - get => m_Expired; - set => m_Expired = value; - } + public bool Expired { get; set; } public BaseObjectiveInstance( MLQuestInstance instance, BaseObjective obj ) { - m_Instance = instance; + Instance = instance; if ( obj.IsTimed ) - m_EndTime = DateTime.UtcNow + obj.Duration; + EndTime = DateTime.UtcNow + obj.Duration; } public virtual void WriteToGump( Gump g, ref int y ) { if ( IsTimed ) - WriteTimeRemaining( g, ref y, ( m_EndTime > DateTime.UtcNow ) ? ( m_EndTime - DateTime.UtcNow ) : TimeSpan.Zero ); + WriteTimeRemaining( g, ref y, ( EndTime > DateTime.UtcNow ) ? ( EndTime - DateTime.UtcNow ) : TimeSpan.Zero ); } public static void WriteTimeRemaining( Gump g, ref int y, TimeSpan timeRemaining ) @@ -83,8 +71,8 @@ namespace Server.Engines.MLQuests.Objectives { if ( IsCompleted() ) { - m_Instance.Player.PlaySound( 0x5B6 ); // public sound - m_Instance.CheckComplete(); + Instance.Player.PlaySound( 0x5B6 ); // public sound + Instance.CheckComplete(); } } @@ -146,7 +134,7 @@ namespace Server.Engines.MLQuests.Objectives if ( IsTimed ) { writer.Write( true ); - writer.WriteDeltaTime( m_EndTime ); + writer.WriteDeltaTime( EndTime ); } else { diff --git a/Scripts/Engines/MLQuests/Objectives/CollectObjective.cs b/Scripts/Engines/MLQuests/Objectives/CollectObjective.cs index ad81acfd8..a9f68ac96 100644 --- a/Scripts/Engines/MLQuests/Objectives/CollectObjective.cs +++ b/Scripts/Engines/MLQuests/Objectives/CollectObjective.cs @@ -7,27 +7,11 @@ namespace Server.Engines.MLQuests.Objectives { public class CollectObjective : BaseObjective { - private int m_DesiredAmount; - private Type m_AcceptedType; - private TextDefinition m_Name; + public int DesiredAmount { get; set; } - public int DesiredAmount - { - get => m_DesiredAmount; - set => m_DesiredAmount = value; - } + public Type AcceptedType { get; set; } - public Type AcceptedType - { - get => m_AcceptedType; - set => m_AcceptedType = value; - } - - public TextDefinition Name - { - get => m_Name; - set => m_Name = value; - } + public TextDefinition Name { get; set; } public virtual bool ShowDetailed => true; @@ -38,9 +22,9 @@ namespace Server.Engines.MLQuests.Objectives public CollectObjective( int amount, Type type, TextDefinition name ) { - m_DesiredAmount = amount; - m_AcceptedType = type; - m_Name = name; + DesiredAmount = amount; + AcceptedType = type; + Name = name; if ( MLQuestSystem.Debug && ShowDetailed && name.Number > 0 ) { @@ -53,7 +37,7 @@ namespace Server.Engines.MLQuests.Objectives public bool CheckType( Type type ) { - return ( m_AcceptedType != null && m_AcceptedType.IsAssignableFrom( type ) ); + return ( AcceptedType != null && AcceptedType.IsAssignableFrom( type ) ); } public virtual bool CheckItem( Item item ) @@ -72,27 +56,27 @@ namespace Server.Engines.MLQuests.Objectives { if ( ShowDetailed ) { - string amount = m_DesiredAmount.ToString(); + string amount = DesiredAmount.ToString(); g.AddHtmlLocalized( 98, y, 350, 16, 1072205, 0x15F90, false, false ); // Obtain g.AddLabel( 143, y, 0x481, amount ); - if ( m_Name.Number > 0 ) + if ( Name.Number > 0 ) { - g.AddHtmlLocalized( 143 + amount.Length * 15, y, 190, 18, m_Name.Number, 0x77BF, false, false ); - g.AddItem( 350, y, LabelToItemID( m_Name.Number ) ); + g.AddHtmlLocalized( 143 + amount.Length * 15, y, 190, 18, Name.Number, 0x77BF, false, false ); + g.AddItem( 350, y, LabelToItemID( Name.Number ) ); } - else if ( m_Name.String != null ) + else if ( Name.String != null ) { - g.AddLabel( 143 + amount.Length * 15, y, 0x481, m_Name.String ); + g.AddLabel( 143 + amount.Length * 15, y, 0x481, Name.String ); } } else { - if ( m_Name.Number > 0 ) - g.AddHtmlLocalized( 98, y, 312, 32, m_Name.Number, 0x15F90, false, false ); - else if ( m_Name.String != null ) - g.AddLabel( 98, y, 0x481, m_Name.String ); + if ( Name.Number > 0 ) + g.AddHtmlLocalized( 98, y, 312, 32, Name.Number, 0x15F90, false, false ); + else if ( Name.String != null ) + g.AddLabel( 98, y, 0x481, Name.String ); } y += 32; @@ -108,15 +92,13 @@ namespace Server.Engines.MLQuests.Objectives public class TimedCollectObjective : CollectObjective { - private TimeSpan m_Duration; - public override bool IsTimed => true; - public override TimeSpan Duration => m_Duration; + public override TimeSpan Duration { get; } public TimedCollectObjective( TimeSpan duration, int amount, Type type, TextDefinition name ) : base( amount, type, name ) { - m_Duration = duration; + Duration = duration; } } @@ -124,18 +106,12 @@ namespace Server.Engines.MLQuests.Objectives public class CollectObjectiveInstance : BaseObjectiveInstance { - private CollectObjective m_Objective; - - public CollectObjective Objective - { - get => m_Objective; - set => m_Objective = value; - } + public CollectObjective Objective { get; set; } public CollectObjectiveInstance( CollectObjective objective, MLQuestInstance instance ) : base( instance, objective ) { - m_Objective = objective; + Objective = objective; } private int GetCurrentTotal() @@ -145,12 +121,12 @@ namespace Server.Engines.MLQuests.Objectives if ( pack == null ) return 0; - Item[] items = pack.FindItemsByType( m_Objective.AcceptedType, false ); // Note: subclasses are included + Item[] items = pack.FindItemsByType( Objective.AcceptedType, false ); // Note: subclasses are included int total = 0; foreach ( Item item in items ) { - if ( item.QuestItem && m_Objective.CheckItem( item ) ) + if ( item.QuestItem && Objective.CheckItem( item ) ) total += item.Amount; } @@ -159,12 +135,12 @@ namespace Server.Engines.MLQuests.Objectives public override bool AllowsQuestItem( Item item, Type type ) { - return ( m_Objective.CheckType( type ) && m_Objective.CheckItem( item ) ); + return ( Objective.CheckType( type ) && Objective.CheckItem( item ) ); } public override bool IsCompleted() { - return ( GetCurrentTotal() >= m_Objective.DesiredAmount ); + return ( GetCurrentTotal() >= Objective.DesiredAmount ); } public override void OnQuestCancelled() @@ -175,7 +151,7 @@ namespace Server.Engines.MLQuests.Objectives if ( pack == null ) return; - Type checkType = m_Objective.AcceptedType; + Type checkType = Objective.AcceptedType; Item[] items = pack.FindItemsByType( checkType, false ); foreach ( Item item in items ) @@ -195,12 +171,12 @@ namespace Server.Engines.MLQuests.Objectives // TODO: OSI also counts the item in the cursor? - Item[] items = pack.FindItemsByType( m_Objective.AcceptedType, false ); - int left = m_Objective.DesiredAmount; + Item[] items = pack.FindItemsByType( Objective.AcceptedType, false ); + int left = Objective.DesiredAmount; foreach ( Item item in items ) { - if ( item.QuestItem && m_Objective.CheckItem( item ) ) + if ( item.QuestItem && Objective.CheckItem( item ) ) { if ( left == 0 ) return; @@ -233,10 +209,10 @@ namespace Server.Engines.MLQuests.Objectives public override void WriteToGump( Gump g, ref int y ) { - m_Objective.WriteToGump( g, ref y ); + Objective.WriteToGump( g, ref y ); y -= 16; - if ( m_Objective.ShowDetailed ) + if ( Objective.ShowDetailed ) { base.WriteToGump( g, ref y ); diff --git a/Scripts/Engines/MLQuests/Objectives/DeliverObjective.cs b/Scripts/Engines/MLQuests/Objectives/DeliverObjective.cs index 569297a3c..f5aa27ce1 100644 --- a/Scripts/Engines/MLQuests/Objectives/DeliverObjective.cs +++ b/Scripts/Engines/MLQuests/Objectives/DeliverObjective.cs @@ -8,41 +8,15 @@ namespace Server.Engines.MLQuests.Objectives { public class DeliverObjective : BaseObjective { - private Type m_Delivery; - private int m_Amount; - private TextDefinition m_Name; - private Type m_Destination; - private bool m_SpawnsDelivery; + public Type Delivery { get; set; } - public Type Delivery - { - get => m_Delivery; - set => m_Delivery = value; - } + public int Amount { get; set; } - public int Amount - { - get => m_Amount; - set => m_Amount = value; - } + public TextDefinition Name { get; set; } - public TextDefinition Name - { - get => m_Name; - set => m_Name = value; - } + public Type Destination { get; set; } - public Type Destination - { - get => m_Destination; - set => m_Destination = value; - } - - public bool SpawnsDelivery - { - get => m_SpawnsDelivery; - set => m_SpawnsDelivery = value; - } + public bool SpawnsDelivery { get; set; } public DeliverObjective( Type delivery, int amount, TextDefinition name, Type destination ) : this( delivery, amount, name, destination, true ) @@ -51,11 +25,11 @@ namespace Server.Engines.MLQuests.Objectives public DeliverObjective( Type delivery, int amount, TextDefinition name, Type destination, bool spawnsDelivery ) { - m_Delivery = delivery; - m_Amount = amount; - m_Name = name; - m_Destination = destination; - m_SpawnsDelivery = spawnsDelivery; + Delivery = delivery; + Amount = amount; + Name = name; + Destination = destination; + SpawnsDelivery = spawnsDelivery; if ( MLQuestSystem.Debug && name.Number > 0 ) { @@ -68,21 +42,21 @@ namespace Server.Engines.MLQuests.Objectives public virtual void SpawnDelivery( Container pack ) { - if ( !m_SpawnsDelivery || pack == null ) + if ( !SpawnsDelivery || pack == null ) return; List delivery = new List(); - for ( int i = 0; i < m_Amount; ++i ) + for ( int i = 0; i < Amount; ++i ) { - if ( !(Activator.CreateInstance( m_Delivery ) is Item item) ) + if ( !(Activator.CreateInstance( Delivery ) is Item item) ) continue; delivery.Add( item ); - if ( item.Stackable && m_Amount > 1 ) + if ( item.Stackable && Amount > 1 ) { - item.Amount = m_Amount; + item.Amount = Amount; break; } } @@ -93,25 +67,25 @@ namespace Server.Engines.MLQuests.Objectives public override void WriteToGump( Gump g, ref int y ) { - string amount = m_Amount.ToString(); + string amount = Amount.ToString(); g.AddHtmlLocalized( 98, y, 312, 16, 1072207, 0x15F90, false, false ); // Deliver g.AddLabel( 143, y, 0x481, amount ); - if ( m_Name.Number > 0 ) + if ( Name.Number > 0 ) { - g.AddHtmlLocalized( 143 + amount.Length * 15, y, 190, 18, m_Name.Number, 0x77BF, false, false ); - g.AddItem( 350, y, CollectObjective.LabelToItemID( m_Name.Number ) ); + g.AddHtmlLocalized( 143 + amount.Length * 15, y, 190, 18, Name.Number, 0x77BF, false, false ); + g.AddItem( 350, y, CollectObjective.LabelToItemID( Name.Number ) ); } - else if ( m_Name.String != null ) + else if ( Name.String != null ) { - g.AddLabel( 143 + amount.Length * 15, y, 0x481, m_Name.String ); + g.AddLabel( 143 + amount.Length * 15, y, 0x481, Name.String ); } y += 32; g.AddHtmlLocalized( 103, y, 120, 16, 1072379, 0x15F90, false, false ); // Deliver to - g.AddLabel( 223, y, 0x481, QuesterNameAttribute.GetQuesterNameFor( m_Destination ) ); + g.AddLabel( 223, y, 0x481, QuesterNameAttribute.GetQuesterNameFor( Destination ) ); y += 16; } @@ -126,10 +100,8 @@ namespace Server.Engines.MLQuests.Objectives public class TimedDeliverObjective : DeliverObjective { - private TimeSpan m_Duration; - public override bool IsTimed => true; - public override TimeSpan Duration => m_Duration; + public override TimeSpan Duration { get; } public TimedDeliverObjective( TimeSpan duration, Type delivery, int amount, TextDefinition name, Type destination ) : this( duration, delivery, amount, name, destination, true ) @@ -139,7 +111,7 @@ namespace Server.Engines.MLQuests.Objectives public TimedDeliverObjective( TimeSpan duration, Type delivery, int amount, TextDefinition name, Type destination, bool spawnsDelivery ) : base( delivery, amount, name, destination, spawnsDelivery ) { - m_Duration = duration; + Duration = duration; } } @@ -147,42 +119,31 @@ namespace Server.Engines.MLQuests.Objectives public class DeliverObjectiveInstance : BaseObjectiveInstance { - private DeliverObjective m_Objective; - private bool m_HasCompleted; + public DeliverObjective Objective { get; set; } - public DeliverObjective Objective - { - get => m_Objective; - set => m_Objective = value; - } - - public bool HasCompleted - { - get => m_HasCompleted; - set => m_HasCompleted = value; - } + public bool HasCompleted { get; set; } public DeliverObjectiveInstance( DeliverObjective objective, MLQuestInstance instance ) : base( instance, objective ) { - m_Objective = objective; + Objective = objective; } public virtual bool IsDestination( IQuestGiver quester, Type type ) { - Type destType = m_Objective.Destination; + Type destType = Objective.Destination; return ( destType != null && destType.IsAssignableFrom( type ) ); } public override bool IsCompleted() { - return m_HasCompleted; + return HasCompleted; } public override void OnQuestAccepted() { - m_Objective.SpawnDelivery( Instance.Player.Backpack ); + Objective.SpawnDelivery( Instance.Player.Backpack ); } // This is VERY similar to CollectObjective.GetCurrentTotal @@ -193,7 +154,7 @@ namespace Server.Engines.MLQuests.Objectives if ( pack == null ) return 0; - Item[] items = pack.FindItemsByType( m_Objective.Delivery, false ); // Note: subclasses are included + Item[] items = pack.FindItemsByType( Objective.Delivery, false ); // Note: subclasses are included int total = 0; foreach ( Item item in items ) @@ -207,7 +168,7 @@ namespace Server.Engines.MLQuests.Objectives PlayerMobile pm = Instance.Player; int total = GetCurrentTotal(); - int desired = m_Objective.Amount; + int desired = Objective.Amount; if ( total < desired ) { @@ -227,8 +188,8 @@ namespace Server.Engines.MLQuests.Objectives if ( pack == null ) return; - Item[] items = pack.FindItemsByType( m_Objective.Delivery, false ); - int left = m_Objective.Amount; + Item[] items = pack.FindItemsByType( Objective.Delivery, false ); + int left = Objective.Amount; foreach ( Item item in items ) { @@ -262,7 +223,7 @@ namespace Server.Engines.MLQuests.Objectives public override void WriteToGump( Gump g, ref int y ) { - m_Objective.WriteToGump( g, ref y ); + Objective.WriteToGump( g, ref y ); base.WriteToGump( g, ref y ); @@ -275,7 +236,7 @@ namespace Server.Engines.MLQuests.Objectives { base.Serialize( writer ); - writer.Write( m_HasCompleted ); + writer.Write( HasCompleted ); } } } diff --git a/Scripts/Engines/MLQuests/Objectives/EscortObjective.cs b/Scripts/Engines/MLQuests/Objectives/EscortObjective.cs index 26607e0ab..d601e258a 100644 --- a/Scripts/Engines/MLQuests/Objectives/EscortObjective.cs +++ b/Scripts/Engines/MLQuests/Objectives/EscortObjective.cs @@ -7,13 +7,7 @@ namespace Server.Engines.MLQuests.Objectives { public class EscortObjective : BaseObjective { - private QuestArea m_Destination; - - public QuestArea Destination - { - get => m_Destination; - set => m_Destination = value; - } + public QuestArea Destination { get; set; } public EscortObjective() : this( null ) @@ -22,7 +16,7 @@ namespace Server.Engines.MLQuests.Objectives public EscortObjective( QuestArea destination ) { - m_Destination = destination; + Destination = destination; } public override bool CanOffer( IQuestGiver quester, PlayerMobile pm, bool message ) @@ -70,17 +64,17 @@ namespace Server.Engines.MLQuests.Objectives { g.AddHtmlLocalized( 98, y, 312, 16, 1072206, 0x15F90, false, false ); // Escort to - if ( m_Destination.Name.Number > 0 ) - g.AddHtmlLocalized( 173, y, 312, 20, m_Destination.Name.Number, 0xFFFFFF, false, false ); - else if ( m_Destination.Name.String != null ) - g.AddLabel( 173, y, 0x481, m_Destination.Name.String ); + if ( Destination.Name.Number > 0 ) + g.AddHtmlLocalized( 173, y, 312, 20, Destination.Name.Number, 0xFFFFFF, false, false ); + else if ( Destination.Name.String != null ) + g.AddLabel( 173, y, 0x481, Destination.Name.String ); y += 16; } public override BaseObjectiveInstance CreateInstance( MLQuestInstance instance ) { - if ( instance == null || m_Destination == null ) + if ( instance == null || Destination == null ) return null; return new EscortObjectiveInstance( this, instance ); @@ -90,22 +84,17 @@ namespace Server.Engines.MLQuests.Objectives public class EscortObjectiveInstance : BaseObjectiveInstance { private EscortObjective m_Objective; - private bool m_HasCompleted; private Timer m_Timer; private DateTime m_LastSeenEscorter; private BaseCreature m_Escort; - public bool HasCompleted - { - get => m_HasCompleted; - set => m_HasCompleted = value; - } + public bool HasCompleted { get; set; } public EscortObjectiveInstance( EscortObjective objective, MLQuestInstance instance ) : base( instance, objective ) { m_Objective = objective; - m_HasCompleted = false; + HasCompleted = false; m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 5 ), TimeSpan.FromSeconds( 5 ), CheckDestination ); m_LastSeenEscorter = DateTime.UtcNow; m_Escort = instance.Quester as BaseCreature; @@ -116,12 +105,12 @@ namespace Server.Engines.MLQuests.Objectives public override bool IsCompleted() { - return m_HasCompleted; + return HasCompleted; } private void CheckDestination() { - if ( m_Escort == null || m_HasCompleted ) // Completed by deserialization + if ( m_Escort == null || HasCompleted ) // Completed by deserialization { StopTimer(); return; @@ -146,7 +135,7 @@ namespace Server.Engines.MLQuests.Objectives EndFollow( m_Escort ); StopTimer(); - m_HasCompleted = true; + HasCompleted = true; CheckComplete(); // Auto claim reward @@ -275,7 +264,7 @@ namespace Server.Engines.MLQuests.Objectives { base.Serialize( writer ); - writer.Write( m_HasCompleted ); + writer.Write( HasCompleted ); } } } diff --git a/Scripts/Engines/MLQuests/Objectives/GainSkillObjective.cs b/Scripts/Engines/MLQuests/Objectives/GainSkillObjective.cs index 5f33afd40..52abae1c6 100644 --- a/Scripts/Engines/MLQuests/Objectives/GainSkillObjective.cs +++ b/Scripts/Engines/MLQuests/Objectives/GainSkillObjective.cs @@ -13,21 +13,11 @@ namespace Server.Engines.MLQuests.Objectives public class GainSkillObjective : BaseObjective { - private SkillName m_Skill; - private int m_ThresholdFixed; private GainSkillObjectiveFlags m_Flags; - public SkillName Skill - { - get => m_Skill; - set => m_Skill = value; - } + public SkillName Skill { get; set; } - public int ThresholdFixed - { - get => m_ThresholdFixed; - set => m_ThresholdFixed = value; - } + public int ThresholdFixed { get; set; } public bool UseReal { @@ -53,8 +43,8 @@ namespace Server.Engines.MLQuests.Objectives public GainSkillObjective( SkillName skill, int thresholdFixed, bool useReal, bool accelerate ) { - m_Skill = skill; - m_ThresholdFixed = thresholdFixed; + Skill = skill; + ThresholdFixed = thresholdFixed; m_Flags = GainSkillObjectiveFlags.None; if ( useReal ) @@ -66,9 +56,9 @@ namespace Server.Engines.MLQuests.Objectives public override bool CanOffer( IQuestGiver quester, PlayerMobile pm, bool message ) { - Skill skill = pm.Skills[m_Skill]; + Skill skill = pm.Skills[Skill]; - if ( ( UseReal ? skill.Fixed : skill.BaseFixedPoint ) >= m_ThresholdFixed ) + if ( ( UseReal ? skill.Fixed : skill.BaseFixedPoint ) >= ThresholdFixed ) { if ( message ) MLQuestSystem.Tell( quester, pm, 1077772 ); // I cannot teach you, for you know all I can teach! @@ -81,13 +71,13 @@ namespace Server.Engines.MLQuests.Objectives public override void WriteToGump( Gump g, ref int y ) { - int skillLabel = AosSkillBonuses.GetLabel( m_Skill ); + int skillLabel = AosSkillBonuses.GetLabel( Skill ); string args; - if ( m_ThresholdFixed % 10 == 0 ) - args = $"#{skillLabel}\t{m_ThresholdFixed / 10}"; // as seen on OSI + if ( ThresholdFixed % 10 == 0 ) + args = $"#{skillLabel}\t{ThresholdFixed / 10}"; // as seen on OSI else - args = $"#{skillLabel}\t{(double) m_ThresholdFixed / 10:0.0}"; // for non-integer skill levels + args = $"#{skillLabel}\t{(double) ThresholdFixed / 10:0.0}"; // for non-integer skill levels g.AddHtmlLocalized( 98, y, 312, 16, 1077485, args, 0x15F90, false, false ); // Increase ~1_SKILL~ to ~2_VALUE~ y += 16; @@ -115,50 +105,44 @@ namespace Server.Engines.MLQuests.Objectives // On OSI, once this is complete, it will *stay* complete, even if you lower your skill again public class GainSkillObjectiveInstance : BaseObjectiveInstance { - private GainSkillObjective m_Objective; - - public GainSkillObjective Objective - { - get => m_Objective; - set => m_Objective = value; - } + public GainSkillObjective Objective { get; set; } public GainSkillObjectiveInstance( GainSkillObjective objective, MLQuestInstance instance ) : base( instance, objective ) { - m_Objective = objective; + Objective = objective; } public bool Handles( SkillName skill ) { - return ( m_Objective.Skill == skill ); + return ( Objective.Skill == skill ); } public override bool IsCompleted() { PlayerMobile pm = Instance.Player; - int valueFixed = m_Objective.UseReal ? pm.Skills[m_Objective.Skill].Fixed : pm.Skills[m_Objective.Skill].BaseFixedPoint; + int valueFixed = Objective.UseReal ? pm.Skills[Objective.Skill].Fixed : pm.Skills[Objective.Skill].BaseFixedPoint; - return ( valueFixed >= m_Objective.ThresholdFixed ); + return ( valueFixed >= Objective.ThresholdFixed ); } // TODO: This may interfere with scrolls, or even quests among each other // How does OSI deal with this? public override void OnQuestAccepted() { - if ( !m_Objective.Accelerate ) + if ( !Objective.Accelerate ) return; PlayerMobile pm = Instance.Player; - pm.AcceleratedSkill = m_Objective.Skill; + pm.AcceleratedSkill = Objective.Skill; pm.AcceleratedStart = DateTime.UtcNow + TimeSpan.FromMinutes( 15 ); // TODO: Is there a max duration? } public override void OnQuestCancelled() { - if ( !m_Objective.Accelerate ) + if ( !Objective.Accelerate ) return; PlayerMobile pm = Instance.Player; @@ -174,7 +158,7 @@ namespace Server.Engines.MLQuests.Objectives public override void WriteToGump( Gump g, ref int y ) { - m_Objective.WriteToGump( g, ref y ); + Objective.WriteToGump( g, ref y ); base.WriteToGump( g, ref y ); diff --git a/Scripts/Engines/MLQuests/Objectives/KillObjective.cs b/Scripts/Engines/MLQuests/Objectives/KillObjective.cs index b8c6b284c..5433fcc93 100644 --- a/Scripts/Engines/MLQuests/Objectives/KillObjective.cs +++ b/Scripts/Engines/MLQuests/Objectives/KillObjective.cs @@ -6,34 +6,13 @@ namespace Server.Engines.MLQuests.Objectives { public class KillObjective : BaseObjective { - private int m_DesiredAmount; - private Type[] m_AcceptedTypes; // Example of Type[] requirement on OSI: killing X bone magis or skeletal mages (probably the same type on OSI though?) - private TextDefinition m_Name; - private QuestArea m_Area; + public int DesiredAmount { get; set; } - public int DesiredAmount - { - get => m_DesiredAmount; - set => m_DesiredAmount = value; - } + public Type[] AcceptedTypes { get; set; } - public Type[] AcceptedTypes - { - get => m_AcceptedTypes; - set => m_AcceptedTypes = value; - } + public TextDefinition Name { get; set; } - public TextDefinition Name - { - get => m_Name; - set => m_Name = value; - } - - public QuestArea Area - { - get => m_Area; - set => m_Area = value; - } + public QuestArea Area { get; set; } public KillObjective() : this( 0, null, null, null ) @@ -47,35 +26,35 @@ namespace Server.Engines.MLQuests.Objectives public KillObjective( int amount, Type[] types, TextDefinition name, QuestArea area ) { - m_DesiredAmount = amount; - m_AcceptedTypes = types; - m_Name = name; - m_Area = area; + DesiredAmount = amount; + AcceptedTypes = types; + Name = name; + Area = area; } public override void WriteToGump( Gump g, ref int y ) { - string amount = m_DesiredAmount.ToString(); + string amount = DesiredAmount.ToString(); g.AddHtmlLocalized( 98, y, 312, 16, 1072204, 0x15F90, false, false ); // Slay g.AddLabel( 133, y, 0x481, amount ); - if ( m_Name.Number > 0 ) - g.AddHtmlLocalized( 133 + amount.Length * 15, y, 190, 18, m_Name.Number, 0x77BF, false, false ); - else if ( m_Name.String != null ) - g.AddLabel( 133 + amount.Length * 15, y, 0x481, m_Name.String ); + if ( Name.Number > 0 ) + g.AddHtmlLocalized( 133 + amount.Length * 15, y, 190, 18, Name.Number, 0x77BF, false, false ); + else if ( Name.String != null ) + g.AddLabel( 133 + amount.Length * 15, y, 0x481, Name.String ); y += 16; #region Location - if ( m_Area != null ) + if ( Area != null ) { g.AddHtmlLocalized( 103, y, 312, 20, 1018327, 0x15F90, false, false ); // Location - if ( m_Area.Name.Number > 0 ) - g.AddHtmlLocalized( 223, y, 312, 20, m_Area.Name.Number, 0xFFFFFF, false, false ); - else if ( m_Area.Name.String != null ) - g.AddLabel( 223, y, 0x481, m_Area.Name.String ); + if ( Area.Name.Number > 0 ) + g.AddHtmlLocalized( 223, y, 312, 20, Area.Name.Number, 0xFFFFFF, false, false ); + else if ( Area.Name.String != null ) + g.AddLabel( 223, y, 0x481, Area.Name.String ); y += 16; } @@ -92,10 +71,8 @@ namespace Server.Engines.MLQuests.Objectives public class TimedKillObjective : KillObjective { - private TimeSpan m_Duration; - public override bool IsTimed => true; - public override TimeSpan Duration => m_Duration; + public override TimeSpan Duration { get; } public TimedKillObjective( TimeSpan duration, int amount, Type[] types, TextDefinition name ) : this( duration, amount, types, name, null ) @@ -105,7 +82,7 @@ namespace Server.Engines.MLQuests.Objectives public TimedKillObjective( TimeSpan duration, int amount, Type[] types, TextDefinition name, QuestArea area ) : base( amount, types, name, area ) { - m_Duration = duration; + Duration = duration; } } @@ -113,45 +90,34 @@ namespace Server.Engines.MLQuests.Objectives public class KillObjectiveInstance : BaseObjectiveInstance { - private KillObjective m_Objective; - private int m_Slain; + public KillObjective Objective { get; set; } - public KillObjective Objective - { - get => m_Objective; - set => m_Objective = value; - } - - public int Slain - { - get => m_Slain; - set => m_Slain = value; - } + public int Slain { get; set; } public KillObjectiveInstance( KillObjective objective, MLQuestInstance instance ) : base( instance, objective ) { - m_Objective = objective; - m_Slain = 0; + Objective = objective; + Slain = 0; } public bool AddKill( Mobile mob, Type type ) { - int desired = m_Objective.DesiredAmount; + int desired = Objective.DesiredAmount; - foreach ( Type acceptedType in m_Objective.AcceptedTypes ) + foreach ( Type acceptedType in Objective.AcceptedTypes ) { if ( acceptedType.IsAssignableFrom( type ) ) { - if ( m_Objective.Area != null && !m_Objective.Area.Contains( mob ) ) + if ( Objective.Area != null && !Objective.Area.Contains( mob ) ) return false; PlayerMobile pm = Instance.Player; - if ( ++m_Slain >= desired ) + if ( ++Slain >= desired ) pm.SendLocalizedMessage( 1075050 ); // You have killed all the required quest creatures of this type. else - pm.SendLocalizedMessage( 1075051, ( desired - m_Slain ).ToString() ); // You have killed a quest creature. ~1_val~ more left. + pm.SendLocalizedMessage( 1075051, ( desired - Slain ).ToString() ); // You have killed a quest creature. ~1_val~ more left. return true; } @@ -162,17 +128,17 @@ namespace Server.Engines.MLQuests.Objectives public override bool IsCompleted() { - return ( m_Slain >= m_Objective.DesiredAmount ); + return ( Slain >= Objective.DesiredAmount ); } public override void WriteToGump( Gump g, ref int y ) { - m_Objective.WriteToGump( g, ref y ); + Objective.WriteToGump( g, ref y ); base.WriteToGump( g, ref y ); g.AddHtmlLocalized( 103, y, 120, 16, 3000087, 0x15F90, false, false ); // Total - g.AddLabel( 223, y, 0x481, m_Slain.ToString() ); + g.AddLabel( 223, y, 0x481, Slain.ToString() ); y += 16; g.AddHtmlLocalized( 103, y, 120, 16, 1074782, 0x15F90, false, false ); // Return to @@ -186,7 +152,7 @@ namespace Server.Engines.MLQuests.Objectives { base.Serialize( writer ); - writer.Write( m_Slain ); + writer.Write( Slain ); } } } diff --git a/Scripts/Engines/MLQuests/QuestArea.cs b/Scripts/Engines/MLQuests/QuestArea.cs index 82982e196..7d2a32c72 100644 --- a/Scripts/Engines/MLQuests/QuestArea.cs +++ b/Scripts/Engines/MLQuests/QuestArea.cs @@ -4,27 +4,11 @@ namespace Server.Engines.MLQuests { public class QuestArea { - private TextDefinition m_Name; // So we can add custom names, different from the Region name - private string m_RegionName; - private Map m_ForceMap; + public TextDefinition Name { get; set; } - public TextDefinition Name - { - get => m_Name; - set => m_Name = value; - } + public string RegionName { get; set; } - public string RegionName - { - get => m_RegionName; - set => m_RegionName = value; - } - - public Map ForceMap - { - get => m_ForceMap; - set => m_ForceMap = value; - } + public Map ForceMap { get; set; } public QuestArea( TextDefinition name, string region ) : this( name, region, null ) @@ -33,9 +17,9 @@ namespace Server.Engines.MLQuests public QuestArea( TextDefinition name, string region, Map forceMap ) { - m_Name = name; - m_RegionName = region; - m_ForceMap = forceMap; + Name = name; + RegionName = region; + ForceMap = forceMap; if ( MLQuestSystem.Debug ) ValidationQueue.Add( this ); @@ -48,10 +32,10 @@ namespace Server.Engines.MLQuests public bool Contains( Region reg ) { - if ( reg == null || ( m_ForceMap != null && reg.Map != m_ForceMap ) ) + if ( reg == null || ( ForceMap != null && reg.Map != ForceMap ) ) return false; - return reg.IsPartOf( m_RegionName ); + return reg.IsPartOf( RegionName ); } // Debug method @@ -61,7 +45,7 @@ namespace Server.Engines.MLQuests foreach ( Region r in Region.Regions ) { - if ( r.Name == m_RegionName && ( m_ForceMap == null || r.Map == m_ForceMap ) ) + if ( r.Name == RegionName && ( ForceMap == null || r.Map == ForceMap ) ) { found = true; break; @@ -69,7 +53,7 @@ namespace Server.Engines.MLQuests } if ( !found ) - Console.WriteLine( "Warning: QuestArea region '{0}' does not exist (ForceMap = {1})", m_RegionName, ( m_ForceMap == null ) ? "-null-" : m_ForceMap.ToString() ); + Console.WriteLine( "Warning: QuestArea region '{0}' does not exist (ForceMap = {1})", RegionName, ( ForceMap == null ) ? "-null-" : ForceMap.ToString() ); } } } diff --git a/Scripts/Engines/MLQuests/QuesterNameAttribute.cs b/Scripts/Engines/MLQuests/QuesterNameAttribute.cs index cdd446eb4..58e6f5692 100644 --- a/Scripts/Engines/MLQuests/QuesterNameAttribute.cs +++ b/Scripts/Engines/MLQuests/QuesterNameAttribute.cs @@ -6,13 +6,11 @@ namespace Server.Engines.MLQuests [AttributeUsage( AttributeTargets.Class )] public class QuesterNameAttribute : Attribute { - private string m_QuesterName; - - public string QuesterName => m_QuesterName; + public string QuesterName { get; } public QuesterNameAttribute( string questerName ) { - m_QuesterName = questerName; + QuesterName = questerName; } private static readonly Type m_Type = typeof( QuesterNameAttribute ); diff --git a/Scripts/Engines/MLQuests/Rewards/BaseReward.cs b/Scripts/Engines/MLQuests/Rewards/BaseReward.cs index e07e75100..dd63b78ef 100644 --- a/Scripts/Engines/MLQuests/Rewards/BaseReward.cs +++ b/Scripts/Engines/MLQuests/Rewards/BaseReward.cs @@ -6,24 +6,18 @@ namespace Server.Engines.MLQuests.Rewards { public abstract class BaseReward { - private TextDefinition m_Name; - - public TextDefinition Name - { - get => m_Name; - set => m_Name = value; - } + public TextDefinition Name { get; set; } public BaseReward( TextDefinition name ) { - m_Name = name; + Name = name; } protected virtual int LabelHeight => 16; public void WriteToGump( Gump g, int x, ref int y ) { - TextDefinition.AddHtmlText( g, x, y, 280, LabelHeight, m_Name, false, false, 0x15F90, 0xBDE784 ); + TextDefinition.AddHtmlText( g, x, y, 280, LabelHeight, Name, false, false, 0x15F90, 0xBDE784 ); } public abstract void AddRewardItems( PlayerMobile pm, List rewards ); diff --git a/Scripts/Engines/MyRunUO/DatabaseCommandQueue.cs b/Scripts/Engines/MyRunUO/DatabaseCommandQueue.cs index 0fcce464f..e66f4d21e 100644 --- a/Scripts/Engines/MyRunUO/DatabaseCommandQueue.cs +++ b/Scripts/Engines/MyRunUO/DatabaseCommandQueue.cs @@ -11,12 +11,10 @@ namespace Server.Engines.MyRunUO private ManualResetEvent m_Sync; private Thread m_Thread; - private bool m_HasCompleted; - private string m_CompletionString; private string m_ConnectionString; - public bool HasCompleted => m_HasCompleted; + public bool HasCompleted { get; private set; } public void Enqueue( object obj ) { @@ -115,7 +113,7 @@ namespace Server.Engines.MyRunUO catch{} Console.WriteLine( m_CompletionString, (DateTime.UtcNow - start).TotalSeconds ); - m_HasCompleted = true; + HasCompleted = true; return; } @@ -164,7 +162,7 @@ namespace Server.Engines.MyRunUO Console.WriteLine( "MyRunUO: Unable to connect to the database" ); Console.WriteLine( e ); - m_HasCompleted = true; + HasCompleted = true; return; } } diff --git a/Scripts/Engines/MyRunUO/LayerComparer.cs b/Scripts/Engines/MyRunUO/LayerComparer.cs index 1b11f5db6..8130456a4 100644 --- a/Scripts/Engines/MyRunUO/LayerComparer.cs +++ b/Scripts/Engines/MyRunUO/LayerComparer.cs @@ -35,21 +35,19 @@ namespace Server.Engines.MyRunUO Layer.Talisman }; - private static int[] m_TranslationTable; - - public static int[] TranslationTable => m_TranslationTable; + public static int[] TranslationTable { get; } static LayerComparer() { - m_TranslationTable = new int[256]; + TranslationTable = new int[256]; for ( int i = 0; i < m_DesiredLayerOrder.Length; ++i ) - m_TranslationTable[(int)m_DesiredLayerOrder[i]] = m_DesiredLayerOrder.Length - i; + TranslationTable[(int)m_DesiredLayerOrder[i]] = m_DesiredLayerOrder.Length - i; } public static bool IsValid( Item item ) { - return ( m_TranslationTable[(int)item.Layer] > 0 ); + return ( TranslationTable[(int)item.Layer] > 0 ); } public static readonly IComparer Instance = new LayerComparer(); @@ -86,7 +84,7 @@ namespace Server.Engines.MyRunUO aLayer = Fix( a.ItemID, aLayer ); bLayer = Fix( b.ItemID, bLayer ); - return m_TranslationTable[(int)bLayer] - m_TranslationTable[(int)aLayer]; + return TranslationTable[(int)bLayer] - TranslationTable[(int)aLayer]; } } } \ No newline at end of file diff --git a/Scripts/Engines/Party/Party.cs b/Scripts/Engines/Party/Party.cs index 5bd5efd88..73458eb93 100644 --- a/Scripts/Engines/Party/Party.cs +++ b/Scripts/Engines/Party/Party.cs @@ -9,10 +9,7 @@ namespace Server.Engines.PartySystem { public class Party : IParty { - private Mobile m_Leader; - private List m_Members; - private List m_Candidates; - private List m_Listeners; // staff listening + private List m_Listeners; // staff listening public const int Capacity = 10; @@ -141,13 +138,13 @@ namespace Server.Engines.PartySystem public Party( Mobile leader ) { - m_Leader = leader; + Leader = leader; - m_Members = new List(); - m_Candidates = new List(); + Members = new List(); + Candidates = new List(); m_Listeners = new List(); - m_Members.Add( new PartyMemberInfo( leader ) ); + Members.Add( new PartyMemberInfo( leader ) ); } public void Add( Mobile m ) @@ -156,15 +153,15 @@ namespace Server.Engines.PartySystem if ( mi == null ) { - m_Members.Add( new PartyMemberInfo( m ) ); + Members.Add( new PartyMemberInfo( m ) ); m.Party = this; Packet memberList = Packet.Acquire( new PartyMemberList( this ) ); Packet attrs = Packet.Acquire( new MobileAttributesN( m ) ); - for ( int i = 0; i < m_Members.Count; ++i ) + for ( int i = 0; i < Members.Count; ++i ) { - Mobile f = ((PartyMemberInfo)m_Members[i]).Mobile; + Mobile f = ((PartyMemberInfo)Members[i]).Mobile; f.Send( memberList ); @@ -189,7 +186,7 @@ namespace Server.Engines.PartySystem public void OnAccept( Mobile from, bool force ) { - Faction ourFaction = Faction.Find( m_Leader ); + Faction ourFaction = Faction.Find( Leader ); Faction theirFaction = Faction.Find( from ); if ( !force && ourFaction != null && theirFaction != null && ourFaction != theirFaction ) @@ -200,7 +197,7 @@ namespace Server.Engines.PartySystem from.SendLocalizedMessage( 1005445 ); // You have been added to the party. - m_Candidates.Remove( from ); + Candidates.Remove( from ); Add( from ); } @@ -211,34 +208,34 @@ namespace Server.Engines.PartySystem from.SendLocalizedMessage( 1008092 ); // You notify them that you do not wish to join the party. - m_Candidates.Remove( from ); + Candidates.Remove( from ); from.Send( new PartyEmptyList( from ) ); - if ( m_Candidates.Count == 0 && m_Members.Count <= 1 ) + if ( Candidates.Count == 0 && Members.Count <= 1 ) { - for ( int i = 0; i < m_Members.Count; ++i ) + for ( int i = 0; i < Members.Count; ++i ) { this[i].Mobile.Send( new PartyEmptyList( this[i].Mobile ) ); this[i].Mobile.Party = null; } - m_Members.Clear(); + Members.Clear(); } } public void Remove( Mobile m ) { - if ( m == m_Leader ) + if ( m == Leader ) { Disband(); } else { - for ( int i = 0; i < m_Members.Count; ++i ) + for ( int i = 0; i < Members.Count; ++i ) { - if ( ((PartyMemberInfo)m_Members[i]).Mobile == m ) + if ( ((PartyMemberInfo)Members[i]).Mobile == m ) { - m_Members.RemoveAt( i ); + Members.RemoveAt( i ); m.Party = null; m.Send( new PartyEmptyList( m ) ); @@ -252,7 +249,7 @@ namespace Server.Engines.PartySystem } } - if ( m_Members.Count == 1 ) + if ( Members.Count == 1 ) { SendToAll( 1005450 ); // The last person has left the party... Disband(); @@ -269,13 +266,13 @@ namespace Server.Engines.PartySystem { SendToAll( 1005449 ); // Your party has disbanded. - for ( int i = 0; i < m_Members.Count; ++i ) + for ( int i = 0; i < Members.Count; ++i ) { this[i].Mobile.Send( new PartyEmptyList( this[i].Mobile ) ); this[i].Mobile.Party = null; } - m_Members.Clear(); + Members.Clear(); } public static void Invite( Mobile from, Mobile target ) @@ -382,8 +379,8 @@ namespace Server.Engines.PartySystem { p.Acquire(); - for ( int i = 0; i < m_Members.Count; ++i ) - m_Members[i].Mobile.Send( p ); + for ( int i = 0; i < Members.Count; ++i ) + Members[i].Mobile.Send( p ); if ( p is MessageLocalized || p is MessageLocalizedAffix || p is UnicodeMessage || p is AsciiMessage ) { @@ -403,9 +400,9 @@ namespace Server.Engines.PartySystem { Packet p = null; - for ( int i = 0; i < m_Members.Count; ++i ) + for ( int i = 0; i < Members.Count; ++i ) { - Mobile c = m_Members[i].Mobile; + Mobile c = Members[i].Mobile; if ( c != m && m.Map == c.Map && Utility.InUpdateRange( c, m ) && c.CanSee( m ) ) { @@ -423,9 +420,9 @@ namespace Server.Engines.PartySystem { Packet p = null; - for ( int i = 0; i < m_Members.Count; ++i ) + for ( int i = 0; i < Members.Count; ++i ) { - Mobile c = m_Members[i].Mobile; + Mobile c = Members[i].Mobile; if ( c != m && m.Map == c.Map && Utility.InUpdateRange( c, m ) && c.CanSee( m ) ) { @@ -450,21 +447,23 @@ namespace Server.Engines.PartySystem } } - public int Count => m_Members.Count; - public bool Active => m_Members.Count > 1; - public Mobile Leader => m_Leader; - public List Members => m_Members; - public List Candidates => m_Candidates; + public int Count => Members.Count; + public bool Active => Members.Count > 1; + public Mobile Leader { get; } - public PartyMemberInfo this[int index] => m_Members[index]; + public List Members { get; } + + public List Candidates { get; } + + public PartyMemberInfo this[int index] => Members[index]; public PartyMemberInfo this[Mobile m] { get { - for ( int i = 0; i < m_Members.Count; ++i ) - if ( m_Members[i].Mobile == m ) - return m_Members[i]; + for ( int i = 0; i < Members.Count; ++i ) + if ( Members[i].Mobile == m ) + return Members[i]; return null; } diff --git a/Scripts/Engines/Party/PartyMemberInfo.cs b/Scripts/Engines/Party/PartyMemberInfo.cs index b7eb55be4..68df0113d 100644 --- a/Scripts/Engines/Party/PartyMemberInfo.cs +++ b/Scripts/Engines/Party/PartyMemberInfo.cs @@ -2,18 +2,14 @@ namespace Server.Engines.PartySystem { public class PartyMemberInfo { - private Mobile m_Mobile; - private bool m_CanLoot; + public Mobile Mobile { get; } - public Mobile Mobile => m_Mobile; - public bool CanLoot{ get => m_CanLoot; - set => m_CanLoot = value; - } + public bool CanLoot { get; set; } public PartyMemberInfo( Mobile m ) { - m_Mobile = m; - m_CanLoot = !Core.ML; + Mobile = m; + CanLoot = !Core.ML; } } } \ No newline at end of file diff --git a/Scripts/Engines/Pathing/Movement.cs b/Scripts/Engines/Pathing/Movement.cs index ecd822907..98353d373 100644 --- a/Scripts/Engines/Pathing/Movement.cs +++ b/Scripts/Engines/Pathing/Movement.cs @@ -12,23 +12,13 @@ namespace Server.Movement private const TileFlag ImpassableSurface = TileFlag.Impassable | TileFlag.Surface; - private static bool m_AlwaysIgnoreDoors; - private static bool m_IgnoreMovableImpassables; - private static bool m_IgnoreSpellFields; - private static Point3D m_Goal; + public static bool AlwaysIgnoreDoors { get; set; } - public static bool AlwaysIgnoreDoors{ get => m_AlwaysIgnoreDoors; - set => m_AlwaysIgnoreDoors = value; - } - public static bool IgnoreMovableImpassables{ get => m_IgnoreMovableImpassables; - set => m_IgnoreMovableImpassables = value; - } - public static bool IgnoreSpellFields{ get => m_IgnoreSpellFields; - set => m_IgnoreSpellFields = value; - } - public static Point3D Goal{ get => m_Goal; - set => m_Goal = value; - } + public static bool IgnoreMovableImpassables { get; set; } + + public static bool IgnoreSpellFields { get; set; } + + public static Point3D Goal { get; set; } public static void Configure() { @@ -120,7 +110,7 @@ namespace Server.Movement int stepTop = startTop + StepHeight; int checkTop = startZ + PersonHeight; - bool ignoreDoors = ( m_AlwaysIgnoreDoors || !m.Alive || m.Body.BodyID == 0x3DB || m.IsDeadBondedPet ); + bool ignoreDoors = ( AlwaysIgnoreDoors || !m.Alive || m.Body.BodyID == 0x3DB || m.IsDeadBondedPet ); bool ignoreSpellFields = m is PlayerMobile && map != Map.Felucca; #region Tiles @@ -311,7 +301,7 @@ namespace Server.Movement List itemsLeft = m_Pools[2]; List itemsRight = m_Pools[3]; - bool ignoreMovableImpassables = m_IgnoreMovableImpassables; + bool ignoreMovableImpassables = IgnoreMovableImpassables; TileFlag reqFlags = ImpassableSurface; if ( m.CanSwim ) @@ -321,7 +311,7 @@ namespace Server.Movement List mobsLeft = m_MobPools[1]; List mobsRight = m_MobPools[2]; - bool checkMobs = ( m is BaseCreature creature && !creature.Controlled && ( xForward != m_Goal.X || yForward != m_Goal.Y ) ); + bool checkMobs = ( m is BaseCreature creature && !creature.Controlled && ( xForward != Goal.X || yForward != Goal.Y ) ); if ( checkDiagonals ) { diff --git a/Scripts/Engines/Pathing/MovementPath.cs b/Scripts/Engines/Pathing/MovementPath.cs index 9ae7fa5d2..f341568a8 100644 --- a/Scripts/Engines/Pathing/MovementPath.cs +++ b/Scripts/Engines/Pathing/MovementPath.cs @@ -9,16 +9,15 @@ namespace Server { public sealed class MovementPath { - private Map m_Map; - private Point3D m_Start; - private Point3D m_Goal; - private Direction[] m_Directions; + public Map Map { get; } - public Map Map => m_Map; - public Point3D Start => m_Start; - public Point3D Goal => m_Goal; - public Direction[] Directions => m_Directions; - public bool Success => ( m_Directions != null && m_Directions.Length > 0 ); + public Point3D Start { get; } + + public Point3D Goal { get; } + + public Direction[] Directions { get; } + + public bool Success => ( Directions != null && Directions.Length > 0 ); public static void Initialize() { @@ -33,7 +32,7 @@ namespace Server private static void Path( Mobile from, IPoint3D p, PathAlgorithm alg, string name, int zOffset ) { - m_OverrideAlgorithm = alg; + OverrideAlgorithm = alg; long start = DateTime.UtcNow.Ticks; MovementPath path = new MovementPath( from, new Point3D( p ) ); @@ -70,7 +69,7 @@ namespace Server Path( from, p, FastAStarAlgorithm.Instance, "Fast", 0 ); Path( from, p, SlowAStarAlgorithm.Instance, "Slow", 2 ); - m_OverrideAlgorithm = null; + OverrideAlgorithm = null; /*MovementPath path = new MovementPath( from, new Point3D( p ) ); @@ -114,22 +113,16 @@ namespace Server } } - private static PathAlgorithm m_OverrideAlgorithm; - - public static PathAlgorithm OverrideAlgorithm - { - get => m_OverrideAlgorithm; - set => m_OverrideAlgorithm = value; - } + public static PathAlgorithm OverrideAlgorithm { get; set; } public MovementPath( Mobile m, Point3D goal ) { Point3D start = m.Location; Map map = m.Map; - m_Map = map; - m_Start = start; - m_Goal = goal; + Map = map; + Start = start; + Goal = goal; if ( map == null || map == Map.Internal ) return; @@ -139,7 +132,7 @@ namespace Server try { - PathAlgorithm alg = m_OverrideAlgorithm; + PathAlgorithm alg = OverrideAlgorithm; if ( alg == null ) { @@ -150,7 +143,7 @@ namespace Server } if ( alg != null && alg.CheckCondition( m, map, start, goal ) ) - m_Directions = alg.Find( m, map, start, goal ); + Directions = alg.Find( m, map, start, goal ); } catch ( Exception e ) { diff --git a/Scripts/Engines/Pathing/PathFollower.cs b/Scripts/Engines/Pathing/PathFollower.cs index 5aebaec54..29822b74a 100644 --- a/Scripts/Engines/Pathing/PathFollower.cs +++ b/Scripts/Engines/Pathing/PathFollower.cs @@ -9,41 +9,35 @@ namespace Server private static bool Enabled = true; private Mobile m_From; - private IPoint3D m_Goal; private MovementPath m_Path; private int m_Index; private Point3D m_Next, m_LastGoalLoc; private DateTime m_LastPathTime; - private MoveMethod m_Mover; - public MoveMethod Mover - { - get => m_Mover; - set => m_Mover = value; - } + public MoveMethod Mover { get; set; } - public IPoint3D Goal => m_Goal; + public IPoint3D Goal { get; } public PathFollower( Mobile from, IPoint3D goal ) { m_From = from; - m_Goal = goal; + Goal = goal; } public MoveResult Move( Direction d ) { - if ( m_Mover == null ) + if ( Mover == null ) return ( m_From.Move( d ) ? MoveResult.Success : MoveResult.Blocked ); - return m_Mover( d ); + return Mover( d ); } public Point3D GetGoalLocation() { - if ( m_Goal is Item item ) + if ( Goal is Item item ) return item.GetWorldLocation(); - return new Point3D( m_Goal ); + return new Point3D( Goal ); } private static TimeSpan RepathDelay = TimeSpan.FromSeconds( 2.0 ); diff --git a/Scripts/Engines/Plants/MiscItems/GreenThorns.cs b/Scripts/Engines/Plants/MiscItems/GreenThorns.cs index 835bc74f4..30897ce47 100644 --- a/Scripts/Engines/Plants/MiscItems/GreenThorns.cs +++ b/Scripts/Engines/Plants/MiscItems/GreenThorns.cs @@ -145,16 +145,14 @@ namespace Server.Items { private class TilesAndEffect { - private int[] m_Tiles; - private Type m_Effect; + public int[] Tiles { get; } - public int[] Tiles => m_Tiles; - public Type Effect => m_Effect; + public Type Effect { get; } public TilesAndEffect( int[] tiles, Type effect ) { - m_Tiles = tiles; - m_Effect = effect; + Tiles = tiles; + Effect = effect; } } @@ -285,19 +283,17 @@ namespace Server.Items return null; } - private Point3D m_Location; - private Map m_Map; - private Mobile m_From; + public Point3D Location { get; } - public Point3D Location => m_Location; - public Map Map => m_Map; - public Mobile From => m_From; + public Map Map { get; } + + public Mobile From { get; } public GreenThornsEffect( Point3D location, Map map, Mobile from ) : base( TimeSpan.FromSeconds( 2.5 ) ) { - m_Location = location; - m_Map = map; - m_From = from; + Location = location; + Map = map; + From = from; Priority = TimerPriority.TwoFiftyMS; } diff --git a/Scripts/Engines/Plants/MiscItems/OrangePetals.cs b/Scripts/Engines/Plants/MiscItems/OrangePetals.cs index 8809bff2f..073fba61b 100644 --- a/Scripts/Engines/Plants/MiscItems/OrangePetals.cs +++ b/Scripts/Engines/Plants/MiscItems/OrangePetals.cs @@ -117,13 +117,11 @@ namespace Server.Items private class OrangePetalsContext { - private Timer m_Timer; - - public Timer Timer => m_Timer; + public Timer Timer { get; } public OrangePetalsContext( Timer timer ) { - m_Timer = timer; + Timer = timer; } } diff --git a/Scripts/Engines/Plants/PlantHue.cs b/Scripts/Engines/Plants/PlantHue.cs index 86c6902cc..1009a2323 100644 --- a/Scripts/Engines/Plants/PlantHue.cs +++ b/Scripts/Engines/Plants/PlantHue.cs @@ -141,15 +141,13 @@ namespace Server.Engines.Plants return notBrightFirst & notBrightSecond; } - private int m_Hue; - private int m_Name; - private PlantHue m_PlantHue; - private int m_GumpHue; + public int Hue { get; } - public int Hue => m_Hue; - public int Name => m_Name; - public PlantHue PlantHue => m_PlantHue; - public int GumpHue => m_GumpHue; + public int Name { get; } + + public PlantHue PlantHue { get; } + + public int GumpHue { get; } private PlantHueInfo( int hue, int name, PlantHue plantHue ) : this( hue, name, plantHue, hue ) { @@ -157,30 +155,30 @@ namespace Server.Engines.Plants private PlantHueInfo( int hue, int name, PlantHue plantHue, int gumpHue ) { - m_Hue = hue; - m_Name = name; - m_PlantHue = plantHue; - m_GumpHue = gumpHue; + Hue = hue; + Name = name; + PlantHue = plantHue; + GumpHue = gumpHue; } public bool IsCrossable() { - return IsCrossable( m_PlantHue ); + return IsCrossable( PlantHue ); } public bool IsBright() { - return IsBright( m_PlantHue ); + return IsBright( PlantHue ); } public PlantHue GetNotBright() { - return GetNotBright( m_PlantHue ); + return GetNotBright( PlantHue ); } public bool IsPrimary() { - return IsPrimary( m_PlantHue ); + return IsPrimary( PlantHue ); } } } diff --git a/Scripts/Engines/Plants/PlantItem.cs b/Scripts/Engines/Plants/PlantItem.cs index 066cd5840..0ed4215cc 100644 --- a/Scripts/Engines/Plants/PlantItem.cs +++ b/Scripts/Engines/Plants/PlantItem.cs @@ -38,23 +38,15 @@ namespace Server.Engines.Plants */ private static readonly bool ShowContainerType = true; - private PlantSystem m_PlantSystem; - private PlantStatus m_PlantStatus; private PlantType m_PlantType; private PlantHue m_PlantHue; private bool m_ShowType; - private SecureLevel m_Level; - [CommandProperty( AccessLevel.GameMaster )] - public SecureLevel Level - { - get => m_Level; - set => m_Level = value; - } + public SecureLevel Level { get; set; } - public PlantSystem PlantSystem => m_PlantSystem; + public PlantSystem PlantSystem { get; private set; } public override bool ForceShowProperties => ObjectPropertyList.Enabled; @@ -80,8 +72,8 @@ namespace Server.Engines.Plants return; double ratio; - if ( m_PlantSystem != null ) - ratio = (double) m_PlantSystem.Hits / m_PlantSystem.MaxHits; + if ( PlantSystem != null ) + ratio = (double) PlantSystem.Hits / PlantSystem.MaxHits; else ratio = 1.0; @@ -89,19 +81,19 @@ namespace Server.Engines.Plants if ( m_PlantStatus >= PlantStatus.DecorativePlant ) { - m_PlantSystem = null; + PlantSystem = null; } else { - if ( m_PlantSystem == null ) - m_PlantSystem = new PlantSystem( this, false ); + if ( PlantSystem == null ) + PlantSystem = new PlantSystem( this, false ); - int hits = (int)( m_PlantSystem.MaxHits * ratio ); + int hits = (int)( PlantSystem.MaxHits * ratio ); if ( hits == 0 && m_PlantStatus > PlantStatus.BowlOfDirt ) - m_PlantSystem.Hits = hits + 1; + PlantSystem.Hits = hits + 1; else - m_PlantSystem.Hits = hits; + PlantSystem.Hits = hits; } Update(); @@ -173,9 +165,7 @@ namespace Server.Engines.Plants [CommandProperty( AccessLevel.GameMaster )] public bool Reproduces => PlantHueInfo.CanReproduce( PlantHue ) && PlantTypeInfo.CanReproduce( PlantType ); - private static ArrayList m_Instances = new ArrayList(); - - public static ArrayList Plants => m_Instances; + public static ArrayList Plants { get; } = new ArrayList(); [Constructible] public PlantItem() : this( false ) @@ -188,10 +178,10 @@ namespace Server.Engines.Plants Weight = 1.0; m_PlantStatus = PlantStatus.BowlOfDirt; - m_PlantSystem = new PlantSystem( this, fertileDirt ); - m_Level = SecureLevel.Owner; + PlantSystem = new PlantSystem( this, fertileDirt ); + Level = SecureLevel.Owner; - m_Instances.Add( this ); + Plants.Add( this ); } public PlantItem( Serial serial ) : base( serial ) @@ -257,9 +247,9 @@ namespace Server.Engines.Plants string args; if ( ShowContainerType ) - args = $"#{GetLocalizedContainerType()}\t#{m_PlantSystem.GetLocalizedDirtStatus()}"; + args = $"#{GetLocalizedContainerType()}\t#{PlantSystem.GetLocalizedDirtStatus()}"; else - args = $"#{m_PlantSystem.GetLocalizedDirtStatus()}"; + args = $"#{PlantSystem.GetLocalizedDirtStatus()}"; list.Add( 1060830, args ); // a ~1_val~ of ~2_val~ dirt } @@ -275,7 +265,7 @@ namespace Server.Engines.Plants else if ( m_PlantStatus >= PlantStatus.FullGrownPlant ) { list.Add( typeInfo.GetPlantLabelFullGrown( hueInfo ), - $"#{m_PlantSystem.GetLocalizedHealth()}\t#{hueInfo.Name}\t#{typeInfo.Name}"); + $"#{PlantSystem.GetLocalizedHealth()}\t#{hueInfo.Name}\t#{typeInfo.Name}"); } else { @@ -283,9 +273,9 @@ namespace Server.Engines.Plants if ( ShowContainerType ) args = - $"#{GetLocalizedContainerType()}\t#{m_PlantSystem.GetLocalizedDirtStatus()}\t#{m_PlantSystem.GetLocalizedHealth()}"; + $"#{GetLocalizedContainerType()}\t#{PlantSystem.GetLocalizedDirtStatus()}\t#{PlantSystem.GetLocalizedHealth()}"; else - args = $"#{m_PlantSystem.GetLocalizedDirtStatus()}\t#{m_PlantSystem.GetLocalizedHealth()}"; + args = $"#{PlantSystem.GetLocalizedDirtStatus()}\t#{PlantSystem.GetLocalizedHealth()}"; if ( m_ShowType ) { @@ -348,7 +338,7 @@ namespace Server.Engines.Plants { from.SendLocalizedMessage( 1080389, "#" + GetLocalizedPlantStatus().ToString() ); // This bowl of dirt already has a ~1_val~ in it! } - else if ( m_PlantSystem.Water < 2 ) + else if ( PlantSystem.Water < 2 ) { LabelTo( from, 1061920 ); // The dirt needs to be softened first. } @@ -362,7 +352,7 @@ namespace Server.Engines.Plants PlantStatus = PlantStatus.Seed; - m_PlantSystem.Reset( false ); + PlantSystem.Reset( false ); LabelTo( from, 1061922 ); // You plant the seed in the bowl of dirt. } @@ -377,7 +367,7 @@ namespace Server.Engines.Plants else { PlantStatus = PlantStatus.BowlOfDirt; - m_PlantSystem.Reset( true ); + PlantSystem.Reset( true ); } } @@ -410,7 +400,7 @@ namespace Server.Engines.Plants return; beverage.Quantity--; - m_PlantSystem.Water++; + PlantSystem.Water++; from.PlaySound( 0x4E ); LabelTo( from, 1061858 ); // You soften the dirt with water. @@ -464,31 +454,31 @@ namespace Server.Engines.Plants if ( effect == PotionEffect.PoisonGreater || effect == PotionEffect.PoisonDeadly ) { - if ( m_PlantSystem.IsFullPoisonPotion ) + if ( PlantSystem.IsFullPoisonPotion ) full = true; else if ( !testOnly ) - m_PlantSystem.PoisonPotion++; + PlantSystem.PoisonPotion++; } else if ( effect == PotionEffect.CureGreater ) { - if ( m_PlantSystem.IsFullCurePotion ) + if ( PlantSystem.IsFullCurePotion ) full = true; else if ( !testOnly ) - m_PlantSystem.CurePotion++; + PlantSystem.CurePotion++; } else if ( effect == PotionEffect.HealGreater ) { - if ( m_PlantSystem.IsFullHealPotion ) + if ( PlantSystem.IsFullHealPotion ) full = true; else if ( !testOnly ) - m_PlantSystem.HealPotion++; + PlantSystem.HealPotion++; } else if ( effect == PotionEffect.StrengthGreater ) { - if ( m_PlantSystem.IsFullStrengthPotion ) + if ( PlantSystem.IsFullStrengthPotion ) full = true; else if ( !testOnly ) - m_PlantSystem.StrengthPotion++; + PlantSystem.StrengthPotion++; } else if ( effect == PotionEffect.PoisonLesser || effect == PotionEffect.Poison || effect == PotionEffect.CureLesser || effect == PotionEffect.Cure || effect == PotionEffect.HealLesser || effect == PotionEffect.Heal || effect == PotionEffect.Strength ) @@ -518,7 +508,7 @@ namespace Server.Engines.Plants writer.Write( (int) 2 ); // version - writer.Write( (int) m_Level ); + writer.Write( (int) Level ); writer.Write( (int) m_PlantStatus ); writer.Write( (int) m_PlantType ); @@ -526,7 +516,7 @@ namespace Server.Engines.Plants writer.Write( (bool) m_ShowType ); if ( m_PlantStatus < PlantStatus.DecorativePlant ) - m_PlantSystem.Save( writer ); + PlantSystem.Save( writer ); } public override void Deserialize( GenericReader reader ) @@ -540,13 +530,13 @@ namespace Server.Engines.Plants case 2: case 1: { - m_Level = (SecureLevel)reader.ReadInt(); + Level = (SecureLevel)reader.ReadInt(); goto case 0; } case 0: { if ( version < 1 ) - m_Level = SecureLevel.CoOwners; + Level = SecureLevel.CoOwners; m_PlantStatus = (PlantStatus)reader.ReadInt(); m_PlantType = (PlantType)reader.ReadInt(); @@ -554,7 +544,7 @@ namespace Server.Engines.Plants m_ShowType = reader.ReadBool(); if ( m_PlantStatus < PlantStatus.DecorativePlant ) - m_PlantSystem = new PlantSystem( this, reader ); + PlantSystem = new PlantSystem( this, reader ); if ( version < 2 && PlantHueInfo.IsCrossable( m_PlantHue ) ) m_PlantHue |= PlantHue.Reproduces; @@ -563,14 +553,14 @@ namespace Server.Engines.Plants } } - m_Instances.Add( this ); + Plants.Add( this ); } public override void OnAfterDelete() { base.OnAfterDelete(); - m_Instances.Remove( this ); + Plants.Remove( this ); } } } diff --git a/Scripts/Engines/Plants/PlantResources.cs b/Scripts/Engines/Plants/PlantResources.cs index fba42994c..f2f18a3cf 100644 --- a/Scripts/Engines/Plants/PlantResources.cs +++ b/Scripts/Engines/Plants/PlantResources.cs @@ -28,24 +28,22 @@ namespace Server.Engines.Plants return null; } - private PlantType m_PlantType; - private PlantHue m_PlantHue; - private Type m_ResourceType; + public PlantType PlantType { get; } - public PlantType PlantType => m_PlantType; - public PlantHue PlantHue => m_PlantHue; - public Type ResourceType => m_ResourceType; + public PlantHue PlantHue { get; } + + public Type ResourceType { get; } private PlantResourceInfo( PlantType plantType, PlantHue plantHue, Type resourceType ) { - m_PlantType = plantType; - m_PlantHue = plantHue; - m_ResourceType = resourceType; + PlantType = plantType; + PlantHue = plantHue; + ResourceType = resourceType; } public Item CreateResource() { - return (Item)Activator.CreateInstance( m_ResourceType ); + return (Item)Activator.CreateInstance( ResourceType ); } } } diff --git a/Scripts/Engines/Plants/PlantSystem.cs b/Scripts/Engines/Plants/PlantSystem.cs index d353b294a..b64969c13 100644 --- a/Scripts/Engines/Plants/PlantSystem.cs +++ b/Scripts/Engines/Plants/PlantSystem.cs @@ -27,12 +27,6 @@ namespace Server.Engines.Plants { public static readonly TimeSpan CheckDelay = TimeSpan.FromHours( 23.0 ); - private PlantItem m_Plant; - private bool m_FertileDirt; - - private DateTime m_NextGrowth; - private PlantGrowthIndicator m_GrowthIndicator; - private int m_Water; private int m_Hits; @@ -45,7 +39,6 @@ namespace Server.Engines.Plants private int m_HealPotion; private int m_StrengthPotion; - private bool m_Pollinated; private PlantType m_SeedType; private PlantHue m_SeedHue; private int m_AvailableSeeds; @@ -54,17 +47,13 @@ namespace Server.Engines.Plants private int m_AvailableResources; private int m_LeftResources; - public PlantItem Plant => m_Plant; + public PlantItem Plant { get; } - public bool FertileDirt - { - get => m_FertileDirt; - set => m_FertileDirt = value; - } + public bool FertileDirt { get; set; } - public DateTime NextGrowth => m_NextGrowth; + public DateTime NextGrowth { get; private set; } - public PlantGrowthIndicator GrowthIndicator => m_GrowthIndicator; + public PlantGrowthIndicator GrowthIndicator { get; private set; } public bool IsFullWater => m_Water >= 4; @@ -80,7 +69,7 @@ namespace Server.Engines.Plants else m_Water = value; - m_Plant.InvalidateProperties(); + Plant.InvalidateProperties(); } } @@ -100,13 +89,13 @@ namespace Server.Engines.Plants m_Hits = value; if ( m_Hits == 0 ) - m_Plant.Die(); + Plant.Die(); - m_Plant.InvalidateProperties(); + Plant.InvalidateProperties(); } } - public int MaxHits => 10 + (int)m_Plant.PlantStatus * 2; + public int MaxHits => 10 + (int)Plant.PlantStatus * 2; public PlantHealth Health { @@ -246,21 +235,17 @@ namespace Server.Engines.Plants public bool HasMaladies => Infestation > 0 || Fungus > 0 || Poison > 0 || Disease > 0 || Water != 2; - public bool PollenProducing => m_Plant.IsCrossable && m_Plant.PlantStatus >= PlantStatus.FullGrownPlant; + public bool PollenProducing => Plant.IsCrossable && Plant.PlantStatus >= PlantStatus.FullGrownPlant; - public bool Pollinated - { - get => m_Pollinated; - set => m_Pollinated = value; - } + public bool Pollinated { get; set; } public PlantType SeedType { get { - if ( m_Pollinated ) + if ( Pollinated ) return m_SeedType; - return m_Plant.PlantType; + return Plant.PlantType; } set => m_SeedType = value; } @@ -269,9 +254,9 @@ namespace Server.Engines.Plants { get { - if ( m_Pollinated ) + if ( Pollinated ) return m_SeedHue; - return m_Plant.PlantHue; + return Plant.PlantHue; } set => m_SeedHue = value; } @@ -302,11 +287,11 @@ namespace Server.Engines.Plants public PlantSystem( PlantItem plant, bool fertileDirt ) { - m_Plant = plant; - m_FertileDirt = fertileDirt; + Plant = plant; + FertileDirt = fertileDirt; - m_NextGrowth = DateTime.UtcNow + CheckDelay; - m_GrowthIndicator = PlantGrowthIndicator.None; + NextGrowth = DateTime.UtcNow + CheckDelay; + GrowthIndicator = PlantGrowthIndicator.None; m_Hits = MaxHits; m_LeftSeeds = 8; m_LeftResources = 8; @@ -314,8 +299,8 @@ namespace Server.Engines.Plants public void Reset( bool potions ) { - m_NextGrowth = DateTime.UtcNow + CheckDelay; - m_GrowthIndicator = PlantGrowthIndicator.None; + NextGrowth = DateTime.UtcNow + CheckDelay; + GrowthIndicator = PlantGrowthIndicator.None; Hits = MaxHits; m_Infestation = 0; @@ -331,7 +316,7 @@ namespace Server.Engines.Plants m_StrengthPotion = 0; } - m_Pollinated = false; + Pollinated = false; m_AvailableSeeds = 0; m_LeftSeeds = 8; @@ -426,24 +411,24 @@ namespace Server.Engines.Plants public void DoGrowthCheck() { - if ( !m_Plant.IsGrowable ) + if ( !Plant.IsGrowable ) return; - if ( DateTime.UtcNow < m_NextGrowth ) + if ( DateTime.UtcNow < NextGrowth ) { - m_GrowthIndicator = PlantGrowthIndicator.Delay; + GrowthIndicator = PlantGrowthIndicator.Delay; return; } - m_NextGrowth = DateTime.UtcNow + CheckDelay; + NextGrowth = DateTime.UtcNow + CheckDelay; - if ( !m_Plant.ValidGrowthLocation ) + if ( !Plant.ValidGrowthLocation ) { - m_GrowthIndicator = PlantGrowthIndicator.InvalidLocation; + GrowthIndicator = PlantGrowthIndicator.InvalidLocation; return; } - if ( m_Plant.PlantStatus == PlantStatus.BowlOfDirt) + if ( Plant.PlantStatus == PlantStatus.BowlOfDirt) { if ( Water > 2 || Utility.RandomDouble() < 0.9 ) Water--; @@ -540,51 +525,51 @@ namespace Server.Engines.Plants Hits -= damage; - return m_Plant.IsGrowable && m_Plant.PlantStatus != PlantStatus.BowlOfDirt; + return Plant.IsGrowable && Plant.PlantStatus != PlantStatus.BowlOfDirt; } private void Grow() { if ( Health < PlantHealth.Healthy ) { - m_GrowthIndicator = PlantGrowthIndicator.NotHealthy; + GrowthIndicator = PlantGrowthIndicator.NotHealthy; } - else if ( m_FertileDirt && m_Plant.PlantStatus <= PlantStatus.Stage5 && Utility.RandomDouble() < 0.1 ) + else if ( FertileDirt && Plant.PlantStatus <= PlantStatus.Stage5 && Utility.RandomDouble() < 0.1 ) { - int curStage = (int)m_Plant.PlantStatus; - m_Plant.PlantStatus = (PlantStatus)( curStage + 2 ); + int curStage = (int)Plant.PlantStatus; + Plant.PlantStatus = (PlantStatus)( curStage + 2 ); - m_GrowthIndicator = PlantGrowthIndicator.DoubleGrown; + GrowthIndicator = PlantGrowthIndicator.DoubleGrown; } - else if ( m_Plant.PlantStatus < PlantStatus.Stage9 ) + else if ( Plant.PlantStatus < PlantStatus.Stage9 ) { - int curStage = (int)m_Plant.PlantStatus; - m_Plant.PlantStatus = (PlantStatus)( curStage + 1 ); + int curStage = (int)Plant.PlantStatus; + Plant.PlantStatus = (PlantStatus)( curStage + 1 ); - m_GrowthIndicator = PlantGrowthIndicator.Grown; + GrowthIndicator = PlantGrowthIndicator.Grown; } else { - if ( Pollinated && LeftSeeds > 0 && m_Plant.Reproduces ) + if ( Pollinated && LeftSeeds > 0 && Plant.Reproduces ) { LeftSeeds--; AvailableSeeds++; } - if ( LeftResources > 0 && PlantResourceInfo.GetInfo( m_Plant.PlantType, m_Plant.PlantHue ) != null ) + if ( LeftResources > 0 && PlantResourceInfo.GetInfo( Plant.PlantType, Plant.PlantHue ) != null ) { LeftResources--; AvailableResources++; } - m_GrowthIndicator = PlantGrowthIndicator.Grown; + GrowthIndicator = PlantGrowthIndicator.Grown; } - if ( m_Plant.PlantStatus >= PlantStatus.Stage9 && !Pollinated ) + if ( Plant.PlantStatus >= PlantStatus.Stage9 && !Pollinated ) { Pollinated = true; - SeedType = m_Plant.PlantType; - SeedHue = m_Plant.PlantHue; + SeedType = Plant.PlantType; + SeedHue = Plant.PlantHue; } } @@ -592,11 +577,11 @@ namespace Server.Engines.Plants { double infestationChance = 0.30 - StrengthPotion * 0.075 + ( Water - 2 ) * 0.10; - PlantTypeInfo typeInfo = PlantTypeInfo.GetInfo( m_Plant.PlantType ); + PlantTypeInfo typeInfo = PlantTypeInfo.GetInfo( Plant.PlantType ); if ( typeInfo.Flowery ) infestationChance += 0.10; - if ( PlantHueInfo.IsBright( m_Plant.PlantHue ) ) + if ( PlantHueInfo.IsBright( Plant.PlantHue ) ) infestationChance += 0.10; if ( Utility.RandomDouble() < infestationChance ) @@ -630,10 +615,10 @@ namespace Server.Engines.Plants { writer.Write( (int) 2 ); // version - writer.Write( (bool) m_FertileDirt ); + writer.Write( (bool) FertileDirt ); - writer.Write( (DateTime) m_NextGrowth ); - writer.Write( (int) m_GrowthIndicator ); + writer.Write( (DateTime) NextGrowth ); + writer.Write( (int) GrowthIndicator ); writer.Write( (int) m_Water ); @@ -647,7 +632,7 @@ namespace Server.Engines.Plants writer.Write( (int) m_HealPotion ); writer.Write( (int) m_StrengthPotion ); - writer.Write( (bool) m_Pollinated ); + writer.Write( (bool) Pollinated ); writer.Write( (int) m_SeedType ); writer.Write( (int) m_SeedHue ); writer.Write( (int) m_AvailableSeeds ); @@ -659,18 +644,18 @@ namespace Server.Engines.Plants public PlantSystem( PlantItem plant, GenericReader reader ) { - m_Plant = plant; + Plant = plant; int version = reader.ReadInt(); - m_FertileDirt = reader.ReadBool(); + FertileDirt = reader.ReadBool(); if ( version >= 1 ) - m_NextGrowth = reader.ReadDateTime(); + NextGrowth = reader.ReadDateTime(); else - m_NextGrowth = reader.ReadDeltaTime(); + NextGrowth = reader.ReadDeltaTime(); - m_GrowthIndicator = (PlantGrowthIndicator)reader.ReadInt(); + GrowthIndicator = (PlantGrowthIndicator)reader.ReadInt(); m_Water = reader.ReadInt(); @@ -684,7 +669,7 @@ namespace Server.Engines.Plants m_HealPotion = reader.ReadInt(); m_StrengthPotion = reader.ReadInt(); - m_Pollinated = reader.ReadBool(); + Pollinated = reader.ReadBool(); m_SeedType = (PlantType)reader.ReadInt(); m_SeedHue = (PlantHue)reader.ReadInt(); m_AvailableSeeds = reader.ReadInt(); diff --git a/Scripts/Engines/Plants/PlantType.cs b/Scripts/Engines/Plants/PlantType.cs index 2b8e04408..ba3dfd838 100644 --- a/Scripts/Engines/Plants/PlantType.cs +++ b/Scripts/Engines/Plants/PlantType.cs @@ -256,7 +256,7 @@ namespace Server.Engines.Plants if ( m_PlantLabelPlant != -1 ) return m_PlantLabelPlant; - if ( m_ContainsPlant ) + if ( ContainsPlant ) return hueInfo.IsBright() ? 1060832 : 1060831; // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~ return hueInfo.IsBright() ? 1061887 : 1061888; // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~ ~6_val~ } @@ -266,7 +266,7 @@ namespace Server.Engines.Plants if ( m_PlantLabelFullGrown != -1 ) return m_PlantLabelFullGrown; - if ( m_ContainsPlant ) + if ( ContainsPlant ) return hueInfo.IsBright() ? 1061891 : 1061889; // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~ return hueInfo.IsBright() ? 1061892 : 1061890; // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~ plant } @@ -295,16 +295,6 @@ namespace Server.Engines.Plants return hueInfo.IsBright() ? 1113493 : 1113492; // ~1_amount~ [bright] ~2_color~ ~3_type~ seeds } - private int m_ItemID; - private int m_OffsetX; - private int m_OffsetY; - private PlantType m_PlantType; - private bool m_ContainsPlant; - private bool m_Flowery; - private bool m_Crossable; - private bool m_Reproduces; - private PlantCategory m_PlantCategory; - // Cliloc overrides private int m_PlantLabelSeed; private int m_PlantLabelPlant; @@ -313,17 +303,25 @@ namespace Server.Engines.Plants private int m_SeedLabel; private int m_SeedLabelPlural; - public int ItemID => m_ItemID; - public int OffsetX => m_OffsetX; - public int OffsetY => m_OffsetY; - public PlantType PlantType => m_PlantType; - public PlantCategory PlantCategory => m_PlantCategory; - public int Name => ( m_ItemID < 0x4000 ) ? 1020000 + m_ItemID : 1078872 + m_ItemID; + public int ItemID { get; } - public bool ContainsPlant => m_ContainsPlant; - public bool Flowery => m_Flowery; - public bool Crossable => m_Crossable; - public bool Reproduces => m_Reproduces; + public int OffsetX { get; } + + public int OffsetY { get; } + + public PlantType PlantType { get; } + + public PlantCategory PlantCategory { get; } + + public int Name => ( ItemID < 0x4000 ) ? 1020000 + ItemID : 1078872 + ItemID; + + public bool ContainsPlant { get; } + + public bool Flowery { get; } + + public bool Crossable { get; } + + public bool Reproduces { get; } private PlantTypeInfo( int itemID, int offsetX, int offsetY, PlantType plantType, bool containsPlant, bool flowery, bool crossable, bool reproduces, PlantCategory plantCategory ) : this( itemID, offsetX, offsetY, plantType, containsPlant, flowery, crossable, reproduces, plantCategory, -1, -1, -1, -1, -1, -1 ) @@ -332,15 +330,15 @@ namespace Server.Engines.Plants private PlantTypeInfo( int itemID, int offsetX, int offsetY, PlantType plantType, bool containsPlant, bool flowery, bool crossable, bool reproduces, PlantCategory plantCategory, int plantLabelSeed, int plantLabelPlant, int plantLabelFullGrown, int plantLabelDecorative, int seedLabel, int seedLabelPlural ) { - m_ItemID = itemID; - m_OffsetX = offsetX; - m_OffsetY = offsetY; - m_PlantType = plantType; - m_ContainsPlant = containsPlant; - m_Flowery = flowery; - m_Crossable = crossable; - m_Reproduces = reproduces; - m_PlantCategory = plantCategory; + ItemID = itemID; + OffsetX = offsetX; + OffsetY = offsetY; + PlantType = plantType; + ContainsPlant = containsPlant; + Flowery = flowery; + Crossable = crossable; + Reproduces = reproduces; + PlantCategory = plantCategory; m_PlantLabelSeed = plantLabelSeed; m_PlantLabelPlant = plantLabelPlant; m_PlantLabelFullGrown = plantLabelFullGrown; diff --git a/Scripts/Engines/Quests/Ambitious Solen Queen/AmbitiousQueenQuest.cs b/Scripts/Engines/Quests/Ambitious Solen Queen/AmbitiousQueenQuest.cs index 7af2a2737..26b4c6f67 100644 --- a/Scripts/Engines/Quests/Ambitious Solen Queen/AmbitiousQueenQuest.cs +++ b/Scripts/Engines/Quests/Ambitious Solen Queen/AmbitiousQueenQuest.cs @@ -32,13 +32,11 @@ namespace Server.Engines.Quests.Ambitious public override int Picture => 0x15C9; - private bool m_RedSolen; - - public bool RedSolen => m_RedSolen; + public bool RedSolen { get; private set; } public AmbitiousQueenQuest( PlayerMobile from, bool redSolen ) : base( from ) { - m_RedSolen = redSolen; + RedSolen = redSolen; } // Serialization @@ -50,14 +48,14 @@ namespace Server.Engines.Quests.Ambitious { int version = reader.ReadEncodedInt(); - m_RedSolen = reader.ReadBool(); + RedSolen = reader.ReadBool(); } public override void ChildSerialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( (bool) m_RedSolen ); + writer.Write( (bool) RedSolen ); } public override void Accept() diff --git a/Scripts/Engines/Quests/Ambitious Solen Queen/Objectives.cs b/Scripts/Engines/Quests/Ambitious Solen Queen/Objectives.cs index 023d6f67a..6314fea1c 100644 --- a/Scripts/Engines/Quests/Ambitious Solen Queen/Objectives.cs +++ b/Scripts/Engines/Quests/Ambitious Solen Queen/Objectives.cs @@ -95,25 +95,17 @@ namespace Server.Engines.Quests.Ambitious { public override object Message => 1054148; - private bool m_BagOfSending; - private bool m_PowderOfTranslocation; - private bool m_Gold; + public bool BagOfSending { get; set; } - public bool BagOfSending{ get => m_BagOfSending; - set => m_BagOfSending = value; - } - public bool PowderOfTranslocation{ get => m_PowderOfTranslocation; - set => m_PowderOfTranslocation = value; - } - public bool Gold{ get => m_Gold; - set => m_Gold = value; - } + public bool PowderOfTranslocation { get; set; } + + public bool Gold { get; set; } public GetRewardObjective( bool bagOfSending, bool powderOfTranslocation, bool gold) { - m_BagOfSending = bagOfSending; - m_PowderOfTranslocation = powderOfTranslocation; - m_Gold = gold; + BagOfSending = bagOfSending; + PowderOfTranslocation = powderOfTranslocation; + Gold = gold; } public GetRewardObjective() @@ -129,18 +121,18 @@ namespace Server.Engines.Quests.Ambitious { int version = reader.ReadEncodedInt(); - m_BagOfSending = reader.ReadBool(); - m_PowderOfTranslocation = reader.ReadBool(); - m_Gold = reader.ReadBool(); + BagOfSending = reader.ReadBool(); + PowderOfTranslocation = reader.ReadBool(); + Gold = reader.ReadBool(); } public override void ChildSerialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( (bool) m_BagOfSending ); - writer.Write( (bool) m_PowderOfTranslocation ); - writer.Write( (bool) m_Gold ); + writer.Write( (bool) BagOfSending ); + writer.Write( (bool) PowderOfTranslocation ); + writer.Write( (bool) Gold ); } } } diff --git a/Scripts/Engines/Quests/Collector/Items/ImageType.cs b/Scripts/Engines/Quests/Collector/Items/ImageType.cs index a656d9a63..b3f6dc9a2 100644 --- a/Scripts/Engines/Quests/Collector/Items/ImageType.cs +++ b/Scripts/Engines/Quests/Collector/Items/ImageType.cs @@ -82,23 +82,21 @@ namespace Server.Engines.Quests.Collector return images; } - private int m_Figurine; - private Type m_Type; - private int m_X; - private int m_Y; + public int Figurine { get; } - public int Figurine => m_Figurine; - public Type Type => m_Type; - public int Name => m_Figurine < 0x4000 ? 1020000 + m_Figurine : 1078872 + m_Figurine; - public int X => m_X; - public int Y => m_Y; + public Type Type { get; } + + public int Name => Figurine < 0x4000 ? 1020000 + Figurine : 1078872 + Figurine; + public int X { get; } + + public int Y { get; } public ImageTypeInfo( int figurine, Type type, int x, int y ) { - m_Figurine = figurine; - m_Type = type; - m_X = x; - m_Y = y; + Figurine = figurine; + Type = type; + X = x; + Y = y; } } } diff --git a/Scripts/Engines/Quests/Core/Items/HornOfRetreat.cs b/Scripts/Engines/Quests/Core/Items/HornOfRetreat.cs index a271ad643..45fc3d8c0 100644 --- a/Scripts/Engines/Quests/Core/Items/HornOfRetreat.cs +++ b/Scripts/Engines/Quests/Core/Items/HornOfRetreat.cs @@ -5,23 +5,13 @@ namespace Server.Engines.Quests { public class HornOfRetreat : Item { - private Point3D m_DestLoc; - private Map m_DestMap; private int m_Charges; [CommandProperty( AccessLevel.GameMaster )] - public Point3D DestLoc - { - get => m_DestLoc; - set => m_DestLoc = value; - } + public Point3D DestLoc { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Map DestMap - { - get => m_DestMap; - set => m_DestMap = value; - } + public Map DestMap { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int Charges @@ -116,8 +106,8 @@ namespace Server.Engines.Quests writer.Write( (int) 0 ); // version - writer.Write( m_DestLoc ); - writer.Write( m_DestMap ); + writer.Write( DestLoc ); + writer.Write( DestMap ); writer.Write( m_Charges ); } @@ -131,8 +121,8 @@ namespace Server.Engines.Quests { case 0: { - m_DestLoc = reader.ReadPoint3D(); - m_DestMap = reader.ReadMap(); + DestLoc = reader.ReadPoint3D(); + DestMap = reader.ReadMap(); m_Charges = reader.ReadInt(); break; } diff --git a/Scripts/Engines/Quests/Core/QuestConversation.cs b/Scripts/Engines/Quests/Core/QuestConversation.cs index b9b59924f..06e93ae30 100644 --- a/Scripts/Engines/Quests/Core/QuestConversation.cs +++ b/Scripts/Engines/Quests/Core/QuestConversation.cs @@ -6,25 +6,14 @@ namespace Server.Engines.Quests { public abstract class QuestConversation { - private QuestSystem m_System; - private bool m_HasBeenRead; - public abstract object Message{ get; } public virtual QuestItemInfo[] Info => null; public virtual bool Logged => true; - public QuestSystem System - { - get => m_System; - set => m_System = value; - } + public QuestSystem System { get; set; } - public bool HasBeenRead - { - get => m_HasBeenRead; - set => m_HasBeenRead = value; - } + public bool HasBeenRead { get; set; } public QuestConversation() { @@ -38,7 +27,7 @@ namespace Server.Engines.Quests { case 0: { - m_HasBeenRead = reader.ReadBool(); + HasBeenRead = reader.ReadBool(); break; } @@ -56,7 +45,7 @@ namespace Server.Engines.Quests { writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( (bool) m_HasBeenRead ); + writer.Write( (bool) HasBeenRead ); ChildSerialize( writer ); } diff --git a/Scripts/Engines/Quests/Core/QuestItemInfo.cs b/Scripts/Engines/Quests/Core/QuestItemInfo.cs index 5fd7e56da..705b7f44d 100644 --- a/Scripts/Engines/Quests/Core/QuestItemInfo.cs +++ b/Scripts/Engines/Quests/Core/QuestItemInfo.cs @@ -4,25 +4,14 @@ namespace Server.Engines.Quests { public class QuestItemInfo { - private object m_Name; - private int m_ItemID; + public object Name { get; set; } - public object Name - { - get => m_Name; - set => m_Name = value; - } - - public int ItemID - { - get => m_ItemID; - set => m_ItemID = value; - } + public int ItemID { get; set; } public QuestItemInfo( object name, int itemID ) { - m_Name = name; - m_ItemID = itemID; + Name = name; + ItemID = itemID; } } diff --git a/Scripts/Engines/Quests/Core/QuestObjective.cs b/Scripts/Engines/Quests/Core/QuestObjective.cs index ae91ec2f1..c4017c65b 100644 --- a/Scripts/Engines/Quests/Core/QuestObjective.cs +++ b/Scripts/Engines/Quests/Core/QuestObjective.cs @@ -8,27 +8,16 @@ namespace Server.Engines.Quests { public abstract class QuestObjective { - private QuestSystem m_System; - private bool m_HasBeenRead; private int m_CurProgress; - private bool m_HasCompleted; public abstract object Message{ get; } public virtual int MaxProgress => 1; public virtual QuestItemInfo[] Info => null; - public QuestSystem System - { - get => m_System; - set => m_System = value; - } + public QuestSystem System { get; set; } - public bool HasBeenRead - { - get => m_HasBeenRead; - set => m_HasBeenRead = value; - } + public bool HasBeenRead { get; set; } public int CurProgress { @@ -36,11 +25,7 @@ namespace Server.Engines.Quests set{ m_CurProgress = value; CheckCompletionStatus(); } } - public bool HasCompleted - { - get => m_HasCompleted; - set => m_HasCompleted = value; - } + public bool HasCompleted { get; set; } public virtual bool Completed => m_CurProgress >= MaxProgress; @@ -58,13 +43,13 @@ namespace Server.Engines.Quests { case 1: { - m_HasBeenRead = reader.ReadBool(); + HasBeenRead = reader.ReadBool(); goto case 0; } case 0: { m_CurProgress = reader.ReadEncodedInt(); - m_HasCompleted = reader.ReadBool(); + HasCompleted = reader.ReadBool(); break; } @@ -82,9 +67,9 @@ namespace Server.Engines.Quests { writer.WriteEncodedInt( (int) 1 ); // version - writer.Write( (bool) m_HasBeenRead ); + writer.Write( (bool) HasBeenRead ); writer.WriteEncodedInt( (int) m_CurProgress ); - writer.Write( (bool) m_HasCompleted ); + writer.Write( (bool) HasCompleted ); ChildSerialize( writer ); } diff --git a/Scripts/Engines/Quests/Core/QuestRestartInfo.cs b/Scripts/Engines/Quests/Core/QuestRestartInfo.cs index 17151c1e4..c1e3668b7 100644 --- a/Scripts/Engines/Quests/Core/QuestRestartInfo.cs +++ b/Scripts/Engines/Quests/Core/QuestRestartInfo.cs @@ -4,39 +4,28 @@ namespace Server.Engines.Quests { public class QuestRestartInfo { - private Type m_QuestType; - private DateTime m_RestartTime; + public Type QuestType { get; set; } - public Type QuestType - { - get => m_QuestType; - set => m_QuestType = value; - } - - public DateTime RestartTime - { - get => m_RestartTime; - set => m_RestartTime = value; - } + public DateTime RestartTime { get; set; } public void Reset( TimeSpan restartDelay ) { if ( restartDelay < TimeSpan.MaxValue ) - m_RestartTime = DateTime.UtcNow + restartDelay; + RestartTime = DateTime.UtcNow + restartDelay; else - m_RestartTime = DateTime.MaxValue; + RestartTime = DateTime.MaxValue; } public QuestRestartInfo( Type questType, TimeSpan restartDelay ) { - m_QuestType = questType; + QuestType = questType; Reset( restartDelay ); } public QuestRestartInfo( Type questType, DateTime restartTime ) { - m_QuestType = questType; - m_RestartTime = restartTime; + QuestType = questType; + RestartTime = restartTime; } } } \ No newline at end of file diff --git a/Scripts/Engines/Quests/Core/QuestSystem.cs b/Scripts/Engines/Quests/Core/QuestSystem.cs index 5c46c4d21..ed4534b86 100644 --- a/Scripts/Engines/Quests/Core/QuestSystem.cs +++ b/Scripts/Engines/Quests/Core/QuestSystem.cs @@ -37,27 +37,11 @@ namespace Server.Engines.Quests public abstract Type[] TypeReferenceTable{ get; } - private PlayerMobile m_From; - private ArrayList m_Objectives; - private ArrayList m_Conversations; + public PlayerMobile From { get; set; } - public PlayerMobile From - { - get => m_From; - set => m_From = value; - } + public ArrayList Objectives { get; set; } - public ArrayList Objectives - { - get => m_Objectives; - set => m_Objectives = value; - } - - public ArrayList Conversations - { - get => m_Conversations; - set => m_Conversations = value; - } + public ArrayList Conversations { get; set; } private Timer m_Timer; @@ -78,9 +62,9 @@ namespace Server.Engines.Quests public virtual void Slice() { - for ( int i = m_Objectives.Count - 1; i >= 0; --i ) + for ( int i = Objectives.Count - 1; i >= 0; --i ) { - QuestObjective obj = (QuestObjective)m_Objectives[i]; + QuestObjective obj = (QuestObjective)Objectives[i]; if ( obj.GetTimerEvent() ) obj.CheckProgress(); @@ -89,9 +73,9 @@ namespace Server.Engines.Quests public virtual void OnKill( BaseCreature creature, Container corpse ) { - for ( int i = m_Objectives.Count - 1; i >= 0; --i ) + for ( int i = Objectives.Count - 1; i >= 0; --i ) { - QuestObjective obj = (QuestObjective)m_Objectives[i]; + QuestObjective obj = (QuestObjective)Objectives[i]; if ( obj.GetKillEvent( creature, corpse ) ) obj.OnKill( creature, corpse ); @@ -100,9 +84,9 @@ namespace Server.Engines.Quests public virtual bool IgnoreYoungProtection( Mobile from ) { - for ( int i = m_Objectives.Count - 1; i >= 0; --i ) + for ( int i = Objectives.Count - 1; i >= 0; --i ) { - QuestObjective obj = (QuestObjective)m_Objectives[i]; + QuestObjective obj = (QuestObjective)Objectives[i]; if ( obj.IgnoreYoungProtection( from ) ) return true; @@ -113,9 +97,9 @@ namespace Server.Engines.Quests public QuestSystem( PlayerMobile from ) { - m_From = from; - m_Objectives = new ArrayList(); - m_Conversations = new ArrayList(); + From = from; + Objectives = new ArrayList(); + Conversations = new ArrayList(); } public QuestSystem() @@ -134,7 +118,7 @@ namespace Server.Engines.Quests { int count = reader.ReadEncodedInt(); - m_Objectives = new ArrayList( count ); + Objectives = new ArrayList( count ); for ( int i = 0; i < count; ++i ) { @@ -143,13 +127,13 @@ namespace Server.Engines.Quests if ( obj != null ) { obj.System = this; - m_Objectives.Add( obj ); + Objectives.Add( obj ); } } count = reader.ReadEncodedInt(); - m_Conversations = new ArrayList( count ); + Conversations = new ArrayList( count ); for ( int i = 0; i < count; ++i ) { @@ -158,7 +142,7 @@ namespace Server.Engines.Quests if ( conv != null ) { conv.System = this; - m_Conversations.Add( conv ); + Conversations.Add( conv ); } } @@ -180,15 +164,15 @@ namespace Server.Engines.Quests writer.WriteEncodedInt( (int) 0 ); // version - writer.WriteEncodedInt( (int) m_Objectives.Count ); + writer.WriteEncodedInt( (int) Objectives.Count ); - for ( int i = 0; i < m_Objectives.Count; ++i ) - QuestSerializer.Serialize( referenceTable, (QuestObjective) m_Objectives[i], writer ); + for ( int i = 0; i < Objectives.Count; ++i ) + QuestSerializer.Serialize( referenceTable, (QuestObjective) Objectives[i], writer ); - writer.WriteEncodedInt( (int) m_Conversations.Count ); + writer.WriteEncodedInt( (int) Conversations.Count ); - for ( int i = 0; i < m_Conversations.Count; ++i ) - QuestSerializer.Serialize( referenceTable, (QuestConversation) m_Conversations[i], writer ); + for ( int i = 0; i < Conversations.Count; ++i ) + QuestSerializer.Serialize( referenceTable, (QuestConversation) Conversations[i], writer ); ChildSerialize( writer ); } @@ -207,9 +191,9 @@ namespace Server.Engines.Quests public QuestObjective FindObjective( Type type ) { - for ( int i = m_Objectives.Count - 1; i >= 0; --i ) + for ( int i = Objectives.Count - 1; i >= 0; --i ) { - QuestObjective obj = (QuestObjective)m_Objectives[i]; + QuestObjective obj = (QuestObjective)Objectives[i]; if ( obj.GetType() == type ) return obj; @@ -220,15 +204,15 @@ namespace Server.Engines.Quests public virtual void SendOffer() { - m_From.SendGump( new QuestOfferGump( this ) ); + From.SendGump( new QuestOfferGump( this ) ); } public virtual void GetContextMenuEntries( List list ) { - if ( m_Objectives.Count > 0 ) + if ( Objectives.Count > 0 ) list.Add( new QuestCallbackEntry( 6154, ShowQuestLog ) ); // View Quest Log - if ( m_Conversations.Count > 0 ) + if ( Conversations.Count > 0 ) list.Add( new QuestCallbackEntry( 6156, ShowQuestConversation ) ); // Quest Conversation list.Add( new QuestCallbackEntry( 6155, BeginCancelQuest ) ); // Cancel Quest @@ -236,63 +220,63 @@ namespace Server.Engines.Quests public virtual void ShowQuestLogUpdated() { - m_From.CloseGump( typeof( QuestLogUpdatedGump ) ); - m_From.SendGump( new QuestLogUpdatedGump( this ) ); + From.CloseGump( typeof( QuestLogUpdatedGump ) ); + From.SendGump( new QuestLogUpdatedGump( this ) ); } public virtual void ShowQuestLog() { - if ( m_Objectives.Count > 0 ) + if ( Objectives.Count > 0 ) { - m_From.CloseGump( typeof( QuestItemInfoGump ) ); - m_From.CloseGump( typeof( QuestLogUpdatedGump ) ); - m_From.CloseGump( typeof( QuestObjectivesGump ) ); - m_From.CloseGump( typeof( QuestConversationsGump ) ); + From.CloseGump( typeof( QuestItemInfoGump ) ); + From.CloseGump( typeof( QuestLogUpdatedGump ) ); + From.CloseGump( typeof( QuestObjectivesGump ) ); + From.CloseGump( typeof( QuestConversationsGump ) ); - m_From.SendGump( new QuestObjectivesGump( m_Objectives ) ); + From.SendGump( new QuestObjectivesGump( Objectives ) ); - QuestObjective last = (QuestObjective)m_Objectives[m_Objectives.Count - 1]; + QuestObjective last = (QuestObjective)Objectives[Objectives.Count - 1]; if ( last.Info != null ) - m_From.SendGump( new QuestItemInfoGump( last.Info ) ); + From.SendGump( new QuestItemInfoGump( last.Info ) ); } } public virtual void ShowQuestConversation() { - if ( m_Conversations.Count > 0 ) + if ( Conversations.Count > 0 ) { - m_From.CloseGump( typeof( QuestItemInfoGump ) ); - m_From.CloseGump( typeof( QuestObjectivesGump ) ); - m_From.CloseGump( typeof( QuestConversationsGump ) ); + From.CloseGump( typeof( QuestItemInfoGump ) ); + From.CloseGump( typeof( QuestObjectivesGump ) ); + From.CloseGump( typeof( QuestConversationsGump ) ); - m_From.SendGump( new QuestConversationsGump( m_Conversations ) ); + From.SendGump( new QuestConversationsGump( Conversations ) ); - QuestConversation last = (QuestConversation)m_Conversations[m_Conversations.Count - 1]; + QuestConversation last = (QuestConversation)Conversations[Conversations.Count - 1]; if ( last.Info != null ) - m_From.SendGump( new QuestItemInfoGump( last.Info ) ); + From.SendGump( new QuestItemInfoGump( last.Info ) ); } } public virtual void BeginCancelQuest() { - m_From.SendGump( new QuestCancelGump( this ) ); + From.SendGump( new QuestCancelGump( this ) ); } public virtual void EndCancelQuest( bool shouldCancel ) { - if ( m_From.Quest != this ) + if ( From.Quest != this ) return; if ( shouldCancel ) { - m_From.SendLocalizedMessage( 1049015 ); // You have canceled your quest. + From.SendLocalizedMessage( 1049015 ); // You have canceled your quest. Cancel(); } else { - m_From.SendLocalizedMessage( 1049014 ); // You have chosen not to cancel your quest. + From.SendLocalizedMessage( 1049014 ); // You have chosen not to cancel your quest. } } @@ -310,18 +294,18 @@ namespace Server.Engines.Quests { StopTimer(); - if ( m_From.Quest == this ) + if ( From.Quest == this ) { - m_From.Quest = null; + From.Quest = null; TimeSpan restartDelay = RestartDelay; if ( ( completed && restartDelay > TimeSpan.Zero ) || ( !completed && restartDelay == TimeSpan.MaxValue ) ) { - List doneQuests = m_From.DoneQuests; + List doneQuests = From.DoneQuests; if ( doneQuests == null ) - m_From.DoneQuests = doneQuests = new List(); + From.DoneQuests = doneQuests = new List(); bool found = false; @@ -350,43 +334,43 @@ namespace Server.Engines.Quests conv.System = this; if ( conv.Logged ) - m_Conversations.Add( conv ); + Conversations.Add( conv ); - m_From.CloseGump( typeof( QuestItemInfoGump ) ); - m_From.CloseGump( typeof( QuestObjectivesGump ) ); - m_From.CloseGump( typeof( QuestConversationsGump ) ); + From.CloseGump( typeof( QuestItemInfoGump ) ); + From.CloseGump( typeof( QuestObjectivesGump ) ); + From.CloseGump( typeof( QuestConversationsGump ) ); if ( conv.Logged ) - m_From.SendGump( new QuestConversationsGump( m_Conversations ) ); + From.SendGump( new QuestConversationsGump( Conversations ) ); else - m_From.SendGump( new QuestConversationsGump( conv ) ); + From.SendGump( new QuestConversationsGump( conv ) ); if ( conv.Info != null ) - m_From.SendGump( new QuestItemInfoGump( conv.Info ) ); + From.SendGump( new QuestItemInfoGump( conv.Info ) ); } public virtual void AddObjective( QuestObjective obj ) { obj.System = this; - m_Objectives.Add( obj ); + Objectives.Add( obj ); ShowQuestLogUpdated(); } public virtual void Accept() { - if ( m_From.Quest != null ) + if ( From.Quest != null ) return; - m_From.Quest = this; - m_From.SendLocalizedMessage( 1049019 ); // You have accepted the Quest. + From.Quest = this; + From.SendLocalizedMessage( 1049019 ); // You have accepted the Quest. StartTimer(); } public virtual void Decline() { - m_From.SendLocalizedMessage( 1049018 ); // You have declined the Quest. + From.SendLocalizedMessage( 1049018 ); // You have declined the Quest. } public static bool CanOfferQuest( Mobile check, Type questType ) diff --git a/Scripts/Engines/Quests/Dark Tides/Items/MaabusCoffin.cs b/Scripts/Engines/Quests/Dark Tides/Items/MaabusCoffin.cs index aedce96c6..d07810b87 100644 --- a/Scripts/Engines/Quests/Dark Tides/Items/MaabusCoffin.cs +++ b/Scripts/Engines/Quests/Dark Tides/Items/MaabusCoffin.cs @@ -5,16 +5,11 @@ namespace Server.Engines.Quests.Necro { public class MaabusCoffin : BaseAddon { - private Maabus m_Maabus; - private Point3D m_SpawnLocation; + [CommandProperty( AccessLevel.GameMaster )] + public Maabus Maabus { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public Maabus Maabus => m_Maabus; - - [CommandProperty( AccessLevel.GameMaster )] - public Point3D SpawnLocation { get => m_SpawnLocation; - set => m_SpawnLocation = value; - } + public Point3D SpawnLocation { get; set; } [Constructible] public MaabusCoffin() @@ -32,42 +27,42 @@ namespace Server.Engines.Quests.Necro public void Awake( Mobile caller ) { - if ( m_Maabus != null || m_SpawnLocation == Point3D.Zero ) + if ( Maabus != null || SpawnLocation == Point3D.Zero ) return; foreach ( MaabusCoffinComponent c in Components ) c.TurnToEmpty(); - m_Maabus = new Maabus(); + Maabus = new Maabus(); - m_Maabus.Location = m_SpawnLocation; - m_Maabus.Map = Map; + Maabus.Location = SpawnLocation; + Maabus.Map = Map; - m_Maabus.Direction = m_Maabus.GetDirectionTo( caller ); + Maabus.Direction = Maabus.GetDirectionTo( caller ); Timer.DelayCall( TimeSpan.FromSeconds( 7.5 ), BeginSleep ); } public void BeginSleep() { - if ( m_Maabus == null ) + if ( Maabus == null ) return; - Effects.PlaySound( m_Maabus.Location, m_Maabus.Map, 0x48E ); + Effects.PlaySound( Maabus.Location, Maabus.Map, 0x48E ); Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), Sleep ); } public void Sleep() { - if ( m_Maabus == null ) + if ( Maabus == null ) return; - Effects.SendLocationParticles( EffectItem.Create( m_Maabus.Location, m_Maabus.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 0x7E7 ); - Effects.PlaySound( m_Maabus.Location, m_Maabus.Map, 0x1FE ); + Effects.SendLocationParticles( EffectItem.Create( Maabus.Location, Maabus.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 0x7E7 ); + Effects.PlaySound( Maabus.Location, Maabus.Map, 0x1FE ); - m_Maabus.Delete(); - m_Maabus = null; + Maabus.Delete(); + Maabus = null; foreach ( MaabusCoffinComponent c in Components ) c.TurnToFull(); @@ -83,8 +78,8 @@ namespace Server.Engines.Quests.Necro writer.Write( (int) 0 ); // version - writer.Write( (Mobile) m_Maabus ); - writer.Write( (Point3D) m_SpawnLocation ); + writer.Write( (Mobile) Maabus ); + writer.Write( (Point3D) SpawnLocation ); } public override void Deserialize( GenericReader reader ) @@ -93,8 +88,8 @@ namespace Server.Engines.Quests.Necro int version = reader.ReadInt(); - m_Maabus = reader.ReadMobile() as Maabus; - m_SpawnLocation = reader.ReadPoint3D(); + Maabus = reader.ReadMobile() as Maabus; + SpawnLocation = reader.ReadPoint3D(); Sleep(); } diff --git a/Scripts/Engines/Quests/Emino's Undertaking/Mobiles/HiddenFigure.cs b/Scripts/Engines/Quests/Emino's Undertaking/Mobiles/HiddenFigure.cs index 455212b89..df15a6997 100644 --- a/Scripts/Engines/Quests/Emino's Undertaking/Mobiles/HiddenFigure.cs +++ b/Scripts/Engines/Quests/Emino's Undertaking/Mobiles/HiddenFigure.cs @@ -11,17 +11,13 @@ namespace Server.Engines.Quests.Ninja 1063192 // Ah, a quiet hideout. }; - private int m_Message; - [CommandProperty( AccessLevel.GameMaster )] - public int Message{ get => m_Message; - set => m_Message = value; - } + public int Message { get; set; } [Constructible] public HiddenFigure() { - m_Message = Utility.RandomList( Messages ); + Message = Utility.RandomList( Messages ); } public override void InitBody() @@ -67,7 +63,7 @@ namespace Server.Engines.Quests.Ninja public override void OnTalk( PlayerMobile player, bool contextMenu ) { - PrivateOverheadMessage( MessageType.Regular, 0x3B2, m_Message, player.NetState ); + PrivateOverheadMessage( MessageType.Regular, 0x3B2, Message, player.NetState ); } public HiddenFigure( Serial serial ) : base( serial ) @@ -80,7 +76,7 @@ namespace Server.Engines.Quests.Ninja writer.WriteEncodedInt( 0 ); // version - writer.Write( (int) m_Message ); + writer.Write( (int) Message ); } public override void Deserialize( GenericReader reader ) @@ -89,7 +85,7 @@ namespace Server.Engines.Quests.Ninja int version = reader.ReadEncodedInt(); - m_Message = reader.ReadInt(); + Message = reader.ReadInt(); } } } diff --git a/Scripts/Engines/Quests/Emino's Undertaking/Objectives.cs b/Scripts/Engines/Quests/Emino's Undertaking/Objectives.cs index 8215b5b37..5a49a7f28 100644 --- a/Scripts/Engines/Quests/Emino's Undertaking/Objectives.cs +++ b/Scripts/Engines/Quests/Emino's Undertaking/Objectives.cs @@ -53,13 +53,7 @@ namespace Server.Engines.Quests.Ninja public class SneakPastGuardiansObjective : QuestObjective { - private bool m_TaughtHowToUseSkills; - - public bool TaughtHowToUseSkills - { - get => m_TaughtHowToUseSkills; - set => m_TaughtHowToUseSkills = value; - } + public bool TaughtHowToUseSkills { get; set; } public override object Message => 1063261; @@ -82,14 +76,14 @@ namespace Server.Engines.Quests.Ninja { int version = reader.ReadEncodedInt(); - m_TaughtHowToUseSkills = reader.ReadBool(); + TaughtHowToUseSkills = reader.ReadBool(); } public override void ChildSerialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( (bool) m_TaughtHowToUseSkills ); + writer.Write( (bool) TaughtHowToUseSkills ); } } @@ -173,13 +167,7 @@ namespace Server.Engines.Quests.Ninja public class HallwayWalkObjective : QuestObjective { - private bool m_StolenTreasure; - - public bool StolenTreasure - { - get => m_StolenTreasure; - set => m_StolenTreasure = value; - } + public bool StolenTreasure { get; set; } public override object Message => 1063202; @@ -196,14 +184,14 @@ namespace Server.Engines.Quests.Ninja { int version = reader.ReadEncodedInt(); - m_StolenTreasure = reader.ReadBool(); + StolenTreasure = reader.ReadBool(); } public override void ChildSerialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( (bool) m_StolenTreasure ); + writer.Write( (bool) StolenTreasure ); } } diff --git a/Scripts/Engines/Quests/Haochi's Trials/Objectives.cs b/Scripts/Engines/Quests/Haochi's Trials/Objectives.cs index 6a683e744..125aa8527 100644 --- a/Scripts/Engines/Quests/Haochi's Trials/Objectives.cs +++ b/Scripts/Engines/Quests/Haochi's Trials/Objectives.cs @@ -155,13 +155,11 @@ namespace Server.Engines.Quests.Samurai { public override object Message => 1063229; - private bool m_Dragon; - - public bool Dragon => m_Dragon; + public bool Dragon { get; private set; } public SecondTrialReturnObjective( bool dragon ) { - m_Dragon = dragon; + Dragon = dragon; } public SecondTrialReturnObjective() @@ -170,21 +168,21 @@ namespace Server.Engines.Quests.Samurai public override void OnComplete() { - System.AddConversation( new ThirdTrialIntroConversation( m_Dragon ) ); + System.AddConversation( new ThirdTrialIntroConversation( Dragon ) ); } public override void ChildDeserialize( GenericReader reader ) { int version = reader.ReadEncodedInt(); - m_Dragon = reader.ReadBool(); + Dragon = reader.ReadBool(); } public override void ChildSerialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( (bool) m_Dragon ); + writer.Write( (bool) Dragon ); } } @@ -272,13 +270,11 @@ namespace Server.Engines.Quests.Samurai { public override object Message => 1063242; - private bool m_KilledCat; - - public bool KilledCat => m_KilledCat; + public bool KilledCat { get; private set; } public FourthTrialReturnObjective( bool killedCat ) { - m_KilledCat = killedCat; + KilledCat = killedCat; } public FourthTrialReturnObjective() @@ -287,21 +283,21 @@ namespace Server.Engines.Quests.Samurai public override void OnComplete() { - System.AddConversation( new FifthTrialIntroConversation( m_KilledCat ) ); + System.AddConversation( new FifthTrialIntroConversation( KilledCat ) ); } public override void ChildDeserialize( GenericReader reader ) { int version = reader.ReadEncodedInt(); - m_KilledCat = reader.ReadBool(); + KilledCat = reader.ReadBool(); } public override void ChildSerialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( (bool) m_KilledCat ); + writer.Write( (bool) KilledCat ); } } @@ -309,11 +305,7 @@ namespace Server.Engines.Quests.Samurai { public override object Message => 1063072; - private bool m_StolenTreasure; - - public bool StolenTreasure{ get => m_StolenTreasure; - set => m_StolenTreasure = value; - } + public bool StolenTreasure { get; set; } public FifthTrialIntroObjective() { @@ -328,14 +320,14 @@ namespace Server.Engines.Quests.Samurai { int version = reader.ReadEncodedInt(); - m_StolenTreasure = reader.ReadBool(); + StolenTreasure = reader.ReadBool(); } public override void ChildSerialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( (bool) m_StolenTreasure ); + writer.Write( (bool) StolenTreasure ); } } diff --git a/Scripts/Engines/Quests/Solen Matriarch/SolenMatriarchQuest.cs b/Scripts/Engines/Quests/Solen Matriarch/SolenMatriarchQuest.cs index 60a7d2190..3b08a99e9 100644 --- a/Scripts/Engines/Quests/Solen Matriarch/SolenMatriarchQuest.cs +++ b/Scripts/Engines/Quests/Solen Matriarch/SolenMatriarchQuest.cs @@ -87,13 +87,11 @@ namespace Server.Engines.Quests.Matriarch public override int Picture => 0x15C9; - private bool m_RedSolen; - - public bool RedSolen => m_RedSolen; + public bool RedSolen { get; private set; } public SolenMatriarchQuest( PlayerMobile from, bool redSolen ) : base( from ) { - m_RedSolen = redSolen; + RedSolen = redSolen; } // Serialization @@ -105,14 +103,14 @@ namespace Server.Engines.Quests.Matriarch { int version = reader.ReadEncodedInt(); - m_RedSolen = reader.ReadBool(); + RedSolen = reader.ReadBool(); } public override void ChildSerialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( (bool) m_RedSolen ); + writer.Write( (bool) RedSolen ); } public override void Accept() diff --git a/Scripts/Engines/Quests/Study of the Solen Hive/NestArea.cs b/Scripts/Engines/Quests/Study of the Solen Hive/NestArea.cs index d451e2e07..f3fb3aba5 100644 --- a/Scripts/Engines/Quests/Study of the Solen Hive/NestArea.cs +++ b/Scripts/Engines/Quests/Study of the Solen Hive/NestArea.cs @@ -49,10 +49,9 @@ namespace Server.Engines.Quests.Naturalist return null; } - private bool m_Special; private Rectangle2D[] m_Rects; - public bool Special => m_Special; + public bool Special { get; } public int ID { @@ -69,7 +68,7 @@ namespace Server.Engines.Quests.Naturalist private NestArea( bool special, params Rectangle2D[] rects ) { - m_Special = special; + Special = special; m_Rects = rects; } diff --git a/Scripts/Engines/Quests/Study of the Solen Hive/Objectives.cs b/Scripts/Engines/Quests/Study of the Solen Hive/Objectives.cs index 2710dd27f..ee0994d1b 100644 --- a/Scripts/Engines/Quests/Study of the Solen Hive/Objectives.cs +++ b/Scripts/Engines/Quests/Study of the Solen Hive/Objectives.cs @@ -17,9 +17,8 @@ namespace Server.Engines.Quests.Naturalist private StudyState m_StudyState; private ArrayList m_StudiedNests; - private bool m_StudiedSpecialNest; - public bool StudiedSpecialNest => m_StudiedSpecialNest; + public bool StudiedSpecialNest { get; private set; } public StudyNestsObjective() { @@ -53,7 +52,7 @@ namespace Server.Engines.Quests.Naturalist if ( m_CurrentNest.Special ) { from.SendLocalizedMessage( 1054057 ); // You complete your examination of this bizarre Egg Nest. The Naturalist will undoubtedly be quite interested in these notes! - m_StudiedSpecialNest = true; + StudiedSpecialNest = true; } else { @@ -142,7 +141,7 @@ namespace Server.Engines.Quests.Naturalist m_StudiedNests.Add( nest ); } - m_StudiedSpecialNest = reader.ReadBool(); + StudiedSpecialNest = reader.ReadBool(); } public override void ChildSerialize( GenericWriter writer ) @@ -155,7 +154,7 @@ namespace Server.Engines.Quests.Naturalist writer.WriteEncodedInt( (int) nest.ID ); } - writer.Write( (bool) m_StudiedSpecialNest ); + writer.Write( (bool) StudiedSpecialNest ); } } diff --git a/Scripts/Engines/Quests/Study of the Solen Hive/StudyOfSolenQuest.cs b/Scripts/Engines/Quests/Study of the Solen Hive/StudyOfSolenQuest.cs index efcffdd81..fcdd7c81d 100644 --- a/Scripts/Engines/Quests/Study of the Solen Hive/StudyOfSolenQuest.cs +++ b/Scripts/Engines/Quests/Study of the Solen Hive/StudyOfSolenQuest.cs @@ -27,13 +27,11 @@ namespace Server.Engines.Quests.Naturalist public override int Picture => 0x15C7; - private Naturalist m_Naturalist; - - public Naturalist Naturalist => m_Naturalist; + public Naturalist Naturalist { get; private set; } public StudyOfSolenQuest( PlayerMobile from, Naturalist naturalist ) : base( from ) { - m_Naturalist = naturalist; + Naturalist = naturalist; } // Serialization @@ -45,21 +43,21 @@ namespace Server.Engines.Quests.Naturalist { int version = reader.ReadEncodedInt(); - m_Naturalist = (Naturalist) reader.ReadMobile(); + Naturalist = (Naturalist) reader.ReadMobile(); } public override void ChildSerialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( (Mobile) m_Naturalist ); + writer.Write( (Mobile) Naturalist ); } public override void Accept() { base.Accept(); - m_Naturalist?.PlaySound( 0x431 ); + Naturalist?.PlaySound( 0x431 ); AddConversation( new AcceptConversation() ); } diff --git a/Scripts/Engines/Quests/The Summoning/Items/BellOfTheDead.cs b/Scripts/Engines/Quests/The Summoning/Items/BellOfTheDead.cs index ae29f82d7..bf870a96f 100644 --- a/Scripts/Engines/Quests/The Summoning/Items/BellOfTheDead.cs +++ b/Scripts/Engines/Quests/The Summoning/Items/BellOfTheDead.cs @@ -16,30 +16,14 @@ namespace Server.Engines.Quests.Doom Movable = false; } - private Chyloth m_Chyloth; - private SkeletalDragon m_Dragon; - private bool m_Summoning; + [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] + public Chyloth Chyloth { get; set; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] - public Chyloth Chyloth - { - get => m_Chyloth; - set => m_Chyloth = value; - } + public SkeletalDragon Dragon { get; set; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] - public SkeletalDragon Dragon - { - get => m_Dragon; - set => m_Dragon = value; - } - - [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] - public bool Summoning - { - get => m_Summoning; - set => m_Summoning = value; - } + public bool Summoning { get; set; } public override void OnDoubleClick( Mobile from ) { @@ -51,17 +35,17 @@ namespace Server.Engines.Quests.Doom public virtual void BeginSummon( Mobile from ) { - if ( m_Chyloth != null && !m_Chyloth.Deleted ) + if ( Chyloth != null && !Chyloth.Deleted ) { from.SendLocalizedMessage( 1050010 ); // The ferry man has already been summoned. There is no need to ring for him again. } - else if ( m_Dragon != null && !m_Dragon.Deleted ) + else if ( Dragon != null && !Dragon.Deleted ) { from.SendLocalizedMessage( 1050017 ); // The ferryman has recently been summoned already. You decide against ringing the bell again so soon. } - else if ( !m_Summoning ) + else if ( !Summoning ) { - m_Summoning = true; + Summoning = true; Effects.PlaySound( GetWorldLocation(), Map, 0x100 ); @@ -73,17 +57,17 @@ namespace Server.Engines.Quests.Doom { Mobile from = (Mobile)state; - if ( m_Chyloth != null && !m_Chyloth.Deleted ) + if ( Chyloth != null && !Chyloth.Deleted ) { from.SendLocalizedMessage( 1050010 ); // The ferry man has already been summoned. There is no need to ring for him again. } - else if ( m_Dragon != null && !m_Dragon.Deleted ) + else if ( Dragon != null && !Dragon.Deleted ) { from.SendLocalizedMessage( 1050017 ); // The ferryman has recently been summoned already. You decide against ringing the bell again so soon. } - else if ( m_Summoning ) + else if ( Summoning ) { - m_Summoning = false; + Summoning = false; Point3D loc = GetWorldLocation(); @@ -92,15 +76,15 @@ namespace Server.Engines.Quests.Doom Effects.SendLocationParticles( EffectItem.Create( loc, Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 0, 0, 2023, 0 ); Effects.PlaySound( loc, Map, 0x1FE ); - m_Chyloth = new Chyloth(); + Chyloth = new Chyloth(); - m_Chyloth.Direction = (Direction)(7 & (4 + (int)from.GetDirectionTo( loc ))); - m_Chyloth.MoveToWorld( loc, Map ); + Chyloth.Direction = (Direction)(7 & (4 + (int)from.GetDirectionTo( loc ))); + Chyloth.MoveToWorld( loc, Map ); - m_Chyloth.Bell = this; - m_Chyloth.AngryAt = from; - m_Chyloth.BeginGiveWarning(); - m_Chyloth.BeginRemove( TimeSpan.FromSeconds( 40.0 ) ); + Chyloth.Bell = this; + Chyloth.AngryAt = from; + Chyloth.BeginGiveWarning(); + Chyloth.BeginRemove( TimeSpan.FromSeconds( 40.0 ) ); } } @@ -114,8 +98,8 @@ namespace Server.Engines.Quests.Doom writer.Write( (int) 0 ); // version - writer.Write( (Mobile) m_Chyloth ); - writer.Write( (Mobile) m_Dragon ); + writer.Write( (Mobile) Chyloth ); + writer.Write( (Mobile) Dragon ); } public override void Deserialize( GenericReader reader ) @@ -124,10 +108,10 @@ namespace Server.Engines.Quests.Doom int version = reader.ReadInt(); - m_Chyloth = reader.ReadMobile() as Chyloth; - m_Dragon = reader.ReadMobile() as SkeletalDragon; + Chyloth = reader.ReadMobile() as Chyloth; + Dragon = reader.ReadMobile() as SkeletalDragon; - m_Chyloth?.Delete(); + Chyloth?.Delete(); } } } diff --git a/Scripts/Engines/Quests/The Summoning/Mobiles/Chyloth.cs b/Scripts/Engines/Quests/The Summoning/Mobiles/Chyloth.cs index b485f006e..bb0bd8cc1 100644 --- a/Scripts/Engines/Quests/The Summoning/Mobiles/Chyloth.cs +++ b/Scripts/Engines/Quests/The Summoning/Mobiles/Chyloth.cs @@ -34,24 +34,13 @@ namespace Server.Engines.Quests.Doom EquipItem( new ChylothStaff() ); } - private Mobile m_AngryAt; - private BellOfTheDead m_Bell; + public BellOfTheDead Bell { get; set; } - public BellOfTheDead Bell - { - get => m_Bell; - set => m_Bell = value; - } - - public Mobile AngryAt - { - get => m_AngryAt; - set => m_AngryAt = value; - } + public Mobile AngryAt { get; set; } public virtual void BeginGiveWarning() { - if ( Deleted || m_AngryAt == null ) + if ( Deleted || AngryAt == null ) return; Timer.DelayCall( TimeSpan.FromSeconds( 4.0 ), EndGiveWarning ); @@ -59,10 +48,10 @@ namespace Server.Engines.Quests.Doom public virtual void EndGiveWarning() { - if ( Deleted || m_AngryAt == null ) + if ( Deleted || AngryAt == null ) return; - PublicOverheadMessage( MessageType.Regular, 0x3B2, 1050013, m_AngryAt.Name ); // You have summoned me in vain ~1_NAME~! Only the dead may cross! + PublicOverheadMessage( MessageType.Regular, 0x3B2, 1050013, AngryAt.Name ); // You have summoned me in vain ~1_NAME~! Only the dead may cross! PublicOverheadMessage( MessageType.Regular, 0x3B2, 1050014 ); // Why have you disturbed me, mortal?!? BeginSummonDragon(); @@ -70,7 +59,7 @@ namespace Server.Engines.Quests.Doom public virtual void BeginSummonDragon() { - if ( Deleted || m_AngryAt == null ) + if ( Deleted || AngryAt == null ) return; Timer.DelayCall( TimeSpan.FromSeconds( 30.0 ), EndSummonDragon ); @@ -108,15 +97,15 @@ namespace Server.Engines.Quests.Doom public virtual void EndSummonDragon() { - if ( Deleted || m_AngryAt == null ) + if ( Deleted || AngryAt == null ) return; - Map map = m_AngryAt.Map; + Map map = AngryAt.Map; if ( map == null ) return; - if ( !m_AngryAt.Region.IsPartOf( "Doom" ) ) + if ( !AngryAt.Region.IsPartOf( "Doom" ) ) return; PublicOverheadMessage( MessageType.Regular, 0x3B2, 1050015 ); // Feel the wrath of my legions!!! @@ -130,12 +119,12 @@ namespace Server.Engines.Quests.Doom for ( int i = 0; i < m_Offsets.Length; i += 2 ) { - int x = m_AngryAt.X + m_Offsets[(offset + i) % m_Offsets.Length]; - int y = m_AngryAt.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length]; + int x = AngryAt.X + m_Offsets[(offset + i) % m_Offsets.Length]; + int y = AngryAt.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length]; - if ( map.CanSpawnMobile( x, y, m_AngryAt.Z ) ) + if ( map.CanSpawnMobile( x, y, AngryAt.Z ) ) { - dragon.MoveToWorld( new Point3D( x, y, m_AngryAt.Z ), map ); + dragon.MoveToWorld( new Point3D( x, y, AngryAt.Z ), map ); foundLoc = true; break; } @@ -151,12 +140,12 @@ namespace Server.Engines.Quests.Doom } if ( !foundLoc ) - dragon.MoveToWorld( m_AngryAt.Location, map ); + dragon.MoveToWorld( AngryAt.Location, map ); - dragon.Combatant = m_AngryAt; + dragon.Combatant = AngryAt; - if ( m_Bell != null ) - m_Bell.Dragon = dragon; + if ( Bell != null ) + Bell.Dragon = dragon; } public static void TeleportToFerry( Mobile from ) @@ -192,8 +181,8 @@ namespace Server.Engines.Quests.Doom if ( member != from && member.Map == Map.Malas && member.Region.IsPartOf( "Doom" ) ) { - if ( m_AngryAt == member ) - m_AngryAt = null; + if ( AngryAt == member ) + AngryAt = null; member.CloseGump( typeof( ChylothPartyGump ) ); member.SendGump( new ChylothPartyGump( from, member ) ); @@ -201,8 +190,8 @@ namespace Server.Engines.Quests.Doom } } - if ( m_AngryAt == from ) - m_AngryAt = null; + if ( AngryAt == from ) + AngryAt = null; TeleportToFerry( from ); diff --git a/Scripts/Engines/Quests/The Summoning/Objectives.cs b/Scripts/Engines/Quests/The Summoning/Objectives.cs index ab91c3da9..3a027eff3 100644 --- a/Scripts/Engines/Quests/The Summoning/Objectives.cs +++ b/Scripts/Engines/Quests/The Summoning/Objectives.cs @@ -72,13 +72,8 @@ namespace Server.Engines.Quests.Doom public class VanquishDaemonObjective : QuestObjective { private BoneDemon m_Daemon; - private Corpse m_CorpseWithSkull; - public Corpse CorpseWithSkull - { - get => m_CorpseWithSkull; - set => m_CorpseWithSkull = value; - } + public Corpse CorpseWithSkull { get; set; } public override object Message => 1050037; @@ -143,7 +138,7 @@ namespace Server.Engines.Quests.Doom from.SendLocalizedMessage( 1050035 ); // The devourer lies dead. Search his corpse to claim your prize! if ( m_Daemon != null ) - m_CorpseWithSkull = m_Daemon.Corpse as Corpse; + CorpseWithSkull = m_Daemon.Corpse as Corpse; } } } @@ -153,7 +148,7 @@ namespace Server.Engines.Quests.Doom int version = reader.ReadEncodedInt(); m_Daemon = reader.ReadMobile() as BoneDemon; - m_CorpseWithSkull = reader.ReadItem() as Corpse; + CorpseWithSkull = reader.ReadItem() as Corpse; } public override void ChildSerialize( GenericWriter writer ) @@ -161,7 +156,7 @@ namespace Server.Engines.Quests.Doom writer.WriteEncodedInt( (int) 0 ); // version writer.Write( (Mobile) m_Daemon ); - writer.Write( (Item) m_CorpseWithSkull ); + writer.Write( (Item) CorpseWithSkull ); } } } diff --git a/Scripts/Engines/Quests/The Summoning/TheSummoningQuest.cs b/Scripts/Engines/Quests/The Summoning/TheSummoningQuest.cs index 1204d2d4e..4f79ac933 100644 --- a/Scripts/Engines/Quests/The Summoning/TheSummoningQuest.cs +++ b/Scripts/Engines/Quests/The Summoning/TheSummoningQuest.cs @@ -15,16 +15,9 @@ namespace Server.Engines.Quests.Doom public override Type[] TypeReferenceTable => m_TypeReferenceTable; - private Victoria m_Victoria; - private bool m_WaitForSummon; + public Victoria Victoria { get; private set; } - public Victoria Victoria => m_Victoria; - - public bool WaitForSummon - { - get => m_WaitForSummon; - set => m_WaitForSummon = value; - } + public bool WaitForSummon { get; set; } public override object Name => 1050025; @@ -38,15 +31,15 @@ namespace Server.Engines.Quests.Doom public override void Slice() { - if ( m_WaitForSummon && m_Victoria != null ) + if ( WaitForSummon && Victoria != null ) { - SummoningAltar altar = m_Victoria.Altar; + SummoningAltar altar = Victoria.Altar; if ( altar != null && (altar.Daemon == null || !altar.Daemon.Alive) ) { - if ( From.Map == m_Victoria.Map && From.InRange( m_Victoria, 8 ) ) + if ( From.Map == Victoria.Map && From.InRange( Victoria, 8 ) ) { - m_WaitForSummon = false; + WaitForSummon = false; AddConversation( new VanquishDaemonConversation() ); } @@ -72,7 +65,7 @@ namespace Server.Engines.Quests.Doom public TheSummoningQuest( Victoria victoria, PlayerMobile from ) : base( from ) { - m_Victoria = victoria; + Victoria = victoria; } public TheSummoningQuest() @@ -104,16 +97,16 @@ namespace Server.Engines.Quests.Doom { int version = reader.ReadEncodedInt(); - m_Victoria = reader.ReadMobile() as Victoria; - m_WaitForSummon = reader.ReadBool(); + Victoria = reader.ReadMobile() as Victoria; + WaitForSummon = reader.ReadBool(); } public override void ChildSerialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( (Mobile) m_Victoria ); - writer.Write( (bool) m_WaitForSummon ); + writer.Write( (Mobile) Victoria ); + writer.Write( (bool) WaitForSummon ); } } } diff --git a/Scripts/Engines/Quests/Uzeraan Turmoil/Items/Cannon.cs b/Scripts/Engines/Quests/Uzeraan Turmoil/Items/Cannon.cs index 74c1a8b51..f6d749b65 100644 --- a/Scripts/Engines/Quests/Uzeraan Turmoil/Items/Cannon.cs +++ b/Scripts/Engines/Quests/Uzeraan Turmoil/Items/Cannon.cs @@ -12,21 +12,16 @@ namespace Server.Engines.Quests.Haven public class Cannon : BaseAddon { - private CannonDirection m_CannonDirection; - private MilitiaCanoneer m_Canoneer; + [CommandProperty( AccessLevel.GameMaster )] + public CannonDirection CannonDirection { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public CannonDirection CannonDirection => m_CannonDirection; - - [CommandProperty( AccessLevel.GameMaster )] - public MilitiaCanoneer Canoneer { get => m_Canoneer; - set => m_Canoneer = value; - } + public MilitiaCanoneer Canoneer { get; set; } [Constructible] public Cannon( CannonDirection direction ) { - m_CannonDirection = direction; + CannonDirection = direction; switch ( direction ) { @@ -72,7 +67,7 @@ namespace Server.Engines.Quests.Haven public void DoFireEffect( IPoint3D target ) { Point3D from; - switch ( m_CannonDirection ) + switch ( CannonDirection ) { case CannonDirection.North: from = new Point3D( X, Y - 1, Z ); break; case CannonDirection.East: from = new Point3D( X + 1, Y, Z ); break; @@ -94,15 +89,15 @@ namespace Server.Engines.Quests.Haven target.Damage( 9999, from ); } - public override bool HandlesOnMovement => m_Canoneer != null && !m_Canoneer.Deleted && m_Canoneer.Active; + public override bool HandlesOnMovement => Canoneer != null && !Canoneer.Deleted && Canoneer.Active; public override void OnMovement( Mobile m, Point3D oldLocation ) { - if ( m_Canoneer == null || m_Canoneer.Deleted || !m_Canoneer.Active ) + if ( Canoneer == null || Canoneer.Deleted || !Canoneer.Active ) return; bool canFire; - switch ( m_CannonDirection ) + switch ( CannonDirection ) { case CannonDirection.North: canFire = m.X >= X - 7 && m.X <= X + 7 && m.Y == Y - 7 && oldLocation.Y < Y - 7; @@ -118,21 +113,21 @@ namespace Server.Engines.Quests.Haven break; } - if ( canFire && m_Canoneer.WillFire( this, m ) ) - Fire( m_Canoneer, m ); + if ( canFire && Canoneer.WillFire( this, m ) ) + Fire( Canoneer, m ); } public override void Serialize( GenericWriter writer ) { - if ( m_Canoneer != null && m_Canoneer.Deleted ) - m_Canoneer = null; + if ( Canoneer != null && Canoneer.Deleted ) + Canoneer = null; base.Serialize( writer ); writer.Write( (int) 0 ); // version - writer.WriteEncodedInt( (int) m_CannonDirection ); - writer.Write( (Mobile) m_Canoneer ); + writer.WriteEncodedInt( (int) CannonDirection ); + writer.Write( (Mobile) Canoneer ); } public override void Deserialize( GenericReader reader ) @@ -141,8 +136,8 @@ namespace Server.Engines.Quests.Haven int version = reader.ReadInt(); - m_CannonDirection = (CannonDirection) reader.ReadEncodedInt(); - m_Canoneer = (MilitiaCanoneer) reader.ReadMobile(); + CannonDirection = (CannonDirection) reader.ReadEncodedInt(); + Canoneer = (MilitiaCanoneer) reader.ReadMobile(); } } diff --git a/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/Dryad.cs b/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/Dryad.cs index 53af313f6..b6223f1b5 100644 --- a/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/Dryad.cs +++ b/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/Dryad.cs @@ -149,15 +149,13 @@ namespace Server.Engines.Quests.Haven public class SBDryad : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBDryad() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/MilitiaCanoneer.cs b/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/MilitiaCanoneer.cs index c2a2dbe7b..f0bd0a865 100644 --- a/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/MilitiaCanoneer.cs +++ b/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/MilitiaCanoneer.cs @@ -5,19 +5,13 @@ namespace Server.Engines.Quests.Haven { public class MilitiaCanoneer : BaseQuester { - private bool m_Active; - [CommandProperty( AccessLevel.GameMaster )] - public bool Active - { - get => m_Active; - set => m_Active = value; - } + public bool Active { get; set; } [Constructible] public MilitiaCanoneer() : base( "the Militia Canoneer" ) { - m_Active = true; + Active = true; } public override void InitBody() @@ -73,7 +67,7 @@ namespace Server.Engines.Quests.Haven public bool WillFire( Cannon cannon, Mobile target ) { - if ( m_Active && IsEnemy( target ) ) + if ( Active && IsEnemy( target ) ) { Direction = GetDirectionTo( target ); Say( Utility.RandomList( 500651, 1049098, 1049320, 1043149 ) ); @@ -93,7 +87,7 @@ namespace Server.Engines.Quests.Haven writer.Write( (int) 0 ); // version - writer.Write( (bool) m_Active ); + writer.Write( (bool) Active ); } public override void Deserialize( GenericReader reader ) @@ -102,7 +96,7 @@ namespace Server.Engines.Quests.Haven int version = reader.ReadInt(); - m_Active = reader.ReadBool(); + Active = reader.ReadBool(); } } } diff --git a/Scripts/Engines/Quests/Uzeraan Turmoil/Objectives.cs b/Scripts/Engines/Quests/Uzeraan Turmoil/Objectives.cs index a034de8b7..97d30be0e 100644 --- a/Scripts/Engines/Quests/Uzeraan Turmoil/Objectives.cs +++ b/Scripts/Engines/Quests/Uzeraan Turmoil/Objectives.cs @@ -74,15 +74,13 @@ namespace Server.Engines.Quests.Haven public class KillHordeMinionsObjective : QuestObjective { - private KillHordeMinionsStep m_Step; - - public KillHordeMinionsStep Step => m_Step; + public KillHordeMinionsStep Step { get; private set; } public override object Message { get { - switch ( m_Step ) + switch ( Step ) { case KillHordeMinionsStep.First: /* Find the mountain pass beyond the house which lies at the @@ -112,7 +110,7 @@ namespace Server.Engines.Quests.Haven { if ( System.From.Profession == 5 ) // paladin { - switch ( m_Step ) + switch ( Step ) { case KillHordeMinionsStep.First: return 1; case KillHordeMinionsStep.LearnKarma: return 2; @@ -128,7 +126,7 @@ namespace Server.Engines.Quests.Haven { get { - if ( m_Step == KillHordeMinionsStep.LearnKarma && HasBeenRead ) + if ( Step == KillHordeMinionsStep.LearnKarma && HasBeenRead ) return true; return base.Completed; } @@ -140,7 +138,7 @@ namespace Server.Engines.Quests.Haven public KillHordeMinionsObjective( KillHordeMinionsStep step ) { - m_Step = step; + Step = step; } public override void RenderProgress( BaseQuestGump gump ) @@ -185,7 +183,7 @@ namespace Server.Engines.Quests.Haven { if ( System.From.Profession == 5 ) { - switch ( m_Step ) + switch ( Step ) { case KillHordeMinionsStep.First: { @@ -218,14 +216,14 @@ namespace Server.Engines.Quests.Haven { int version = reader.ReadEncodedInt(); - m_Step = (KillHordeMinionsStep) reader.ReadEncodedInt(); + Step = (KillHordeMinionsStep) reader.ReadEncodedInt(); } public override void ChildSerialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); // version - writer.WriteEncodedInt( (int) m_Step ); + writer.WriteEncodedInt( (int) Step ); } } @@ -391,13 +389,7 @@ namespace Server.Engines.Quests.Haven public class GetDaemonBoneObjective : QuestObjective { - private Container m_CorpseWithBone; - - public Container CorpseWithBone - { - get => m_CorpseWithBone; - set => m_CorpseWithBone = value; - } + public Container CorpseWithBone { get; set; } public override object Message { @@ -451,7 +443,7 @@ namespace Server.Engines.Quests.Haven if ( ( creature is Zombie || creature is Skeleton ) && corpse.Map == Map.Trammel && corpse.X >= 3391 && corpse.X <= 3424 && corpse.Y >= 2639 && corpse.Y <= 2664 ) // Haven graveyard { if ( Utility.RandomDouble() < 0.25 ) - m_CorpseWithBone = corpse; + CorpseWithBone = corpse; } } @@ -459,17 +451,17 @@ namespace Server.Engines.Quests.Haven { int version = reader.ReadEncodedInt(); - m_CorpseWithBone = (Container) reader.ReadItem(); + CorpseWithBone = (Container) reader.ReadItem(); } public override void ChildSerialize( GenericWriter writer ) { - if ( m_CorpseWithBone != null && m_CorpseWithBone.Deleted ) - m_CorpseWithBone = null; + if ( CorpseWithBone != null && CorpseWithBone.Deleted ) + CorpseWithBone = null; writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( (Item) m_CorpseWithBone ); + writer.Write( (Item) CorpseWithBone ); } } diff --git a/Scripts/Engines/Quests/Witch Apprentice/Ingredient.cs b/Scripts/Engines/Quests/Witch Apprentice/Ingredient.cs index 2018b030c..3005ef13d 100644 --- a/Scripts/Engines/Quests/Witch Apprentice/Ingredient.cs +++ b/Scripts/Engines/Quests/Witch Apprentice/Ingredient.cs @@ -91,19 +91,17 @@ namespace Server.Engines.Quests.Hag return ingredients[index]; } - private int m_Name; - private Type[] m_Creatures; - private int m_Quantity; + public int Name { get; } - public int Name => m_Name; - public Type[] Creatures => m_Creatures; - public int Quantity => m_Quantity; + public Type[] Creatures { get; } + + public int Quantity { get; } private IngredientInfo( int name, int quantity, params Type[] creatures ) { - m_Name = name; - m_Creatures = creatures; - m_Quantity = quantity; + Name = name; + Creatures = creatures; + Quantity = quantity; } } } diff --git a/Scripts/Engines/Quests/Witch Apprentice/Items/HangoverCure.cs b/Scripts/Engines/Quests/Witch Apprentice/Items/HangoverCure.cs index a54313ddb..f2ea98834 100644 --- a/Scripts/Engines/Quests/Witch Apprentice/Items/HangoverCure.cs +++ b/Scripts/Engines/Quests/Witch Apprentice/Items/HangoverCure.cs @@ -2,16 +2,10 @@ namespace Server.Engines.Quests.Hag { public class HangoverCure : Item { - private int m_Uses; - public override int LabelNumber => 1055060; // Grizelda's Extra Strength Hangover Cure [CommandProperty( AccessLevel.GameMaster )] - public int Uses - { - get => m_Uses; - set => m_Uses = value; - } + public int Uses { get; set; } [Constructible] public HangoverCure() : base( 0xE2B ) @@ -19,7 +13,7 @@ namespace Server.Engines.Quests.Hag Weight = 1.0; Hue = 0x2D; - m_Uses = 20; + Uses = 20; } public override void OnDoubleClick( Mobile from ) @@ -30,7 +24,7 @@ namespace Server.Engines.Quests.Hag return; } - if ( m_Uses > 0 ) + if ( Uses > 0 ) { from.PlaySound( 0x2D6 ); from.SendLocalizedMessage( 501206 ); // An awful taste fills your mouth. @@ -41,7 +35,7 @@ namespace Server.Engines.Quests.Hag from.SendLocalizedMessage( 501204 ); // You are now sober! } - m_Uses--; + Uses--; } else { @@ -60,7 +54,7 @@ namespace Server.Engines.Quests.Hag writer.Write( (int) 1 ); // version - writer.WriteEncodedInt( m_Uses ); + writer.WriteEncodedInt( Uses ); } public override void Deserialize( GenericReader reader ) @@ -73,12 +67,12 @@ namespace Server.Engines.Quests.Hag { case 1: { - m_Uses = reader.ReadEncodedInt(); + Uses = reader.ReadEncodedInt(); break; } case 0: { - m_Uses = 20; + Uses = 20; break; } } diff --git a/Scripts/Engines/Quests/Witch Apprentice/Objectives.cs b/Scripts/Engines/Quests/Witch Apprentice/Objectives.cs index 7b75135b1..ae86c00e5 100644 --- a/Scripts/Engines/Quests/Witch Apprentice/Objectives.cs +++ b/Scripts/Engines/Quests/Witch Apprentice/Objectives.cs @@ -21,12 +21,11 @@ namespace Server.Engines.Quests.Hag return m_CorpseLocations[index]; } - private Corpse m_Corpse; private Point3D m_CorpseLocation; public override object Message => 1055014; - public Corpse Corpse => m_Corpse; + public Corpse Corpse { get; private set; } public FindApprenticeObjective( bool init ) { @@ -43,10 +42,10 @@ namespace Server.Engines.Quests.Hag PlayerMobile player = System.From; Map map = player.Map; - if ( ( m_Corpse == null || m_Corpse.Deleted ) && ( map == Map.Trammel || map == Map.Felucca ) && player.InRange( m_CorpseLocation, 8 ) ) + if ( ( Corpse == null || Corpse.Deleted ) && ( map == Map.Trammel || map == Map.Felucca ) && player.InRange( m_CorpseLocation, 8 ) ) { - m_Corpse = new HagApprenticeCorpse(); - m_Corpse.MoveToWorld( m_CorpseLocation, map ); + Corpse = new HagApprenticeCorpse(); + Corpse.MoveToWorld( m_CorpseLocation, map ); Effects.SendLocationEffect( m_CorpseLocation, map, 0x3728, 10, 10 ); Effects.PlaySound( m_CorpseLocation, map, 0x1FE ); @@ -55,7 +54,7 @@ namespace Server.Engines.Quests.Hag imp.MoveToWorld( m_CorpseLocation, map ); // * You see a strange imp stealing a scrap of paper from the bloodied corpse * - m_Corpse.SendLocalizedMessageTo( player, 1055049 ); + Corpse.SendLocalizedMessageTo( player, 1055049 ); Timer.DelayCall( TimeSpan.FromSeconds( 3.0 ), new TimerStateCallback( DeleteImp ), imp ); } @@ -90,7 +89,7 @@ namespace Server.Engines.Quests.Hag } case 0: { - m_Corpse = (Corpse) reader.ReadItem(); + Corpse = (Corpse) reader.ReadItem(); break; } } @@ -101,13 +100,13 @@ namespace Server.Engines.Quests.Hag public override void ChildSerialize( GenericWriter writer ) { - if ( m_Corpse != null && m_Corpse.Deleted ) - m_Corpse = null; + if ( Corpse != null && Corpse.Deleted ) + Corpse = null; writer.WriteEncodedInt( (int) 1 ); // version writer.Write( (Point3D) m_CorpseLocation ); - writer.Write( (Item) m_Corpse ); + writer.Write( (Item) Corpse ); } } @@ -192,15 +191,13 @@ namespace Server.Engines.Quests.Hag public class FindZeefzorpulObjective : QuestObjective { - private Point3D m_ImpLocation; - public override object Message => 1055017; - public Point3D ImpLocation => m_ImpLocation; + public Point3D ImpLocation { get; private set; } public FindZeefzorpulObjective( Point3D impLocation ) { - m_ImpLocation = impLocation; + ImpLocation = impLocation; } public FindZeefzorpulObjective() @@ -212,11 +209,11 @@ namespace Server.Engines.Quests.Hag Mobile from = System.From; Map map = from.Map; - Effects.SendLocationEffect( m_ImpLocation, map, 0x3728, 10, 10 ); - Effects.PlaySound( m_ImpLocation, map, 0x1FE ); + Effects.SendLocationEffect( ImpLocation, map, 0x3728, 10, 10 ); + Effects.PlaySound( ImpLocation, map, 0x1FE ); Mobile imp = new Zeefzorpul(); - imp.MoveToWorld( m_ImpLocation, map ); + imp.MoveToWorld( ImpLocation, map ); imp.Direction = imp.GetDirectionTo( from ); @@ -242,14 +239,14 @@ namespace Server.Engines.Quests.Hag { int version = reader.ReadEncodedInt(); - m_ImpLocation = reader.ReadPoint3D(); + ImpLocation = reader.ReadPoint3D(); } public override void ChildSerialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( (Point3D) m_ImpLocation ); + writer.Write( (Point3D) ImpLocation ); } } @@ -269,14 +266,11 @@ namespace Server.Engines.Quests.Hag public class FindIngredientObjective : QuestObjective { - private Ingredient[] m_Ingredients; - private bool m_BlackheartMet; - public override object Message { get { - if ( !m_BlackheartMet ) + if ( !BlackheartMet ) { switch ( Step ) { @@ -317,10 +311,11 @@ namespace Server.Engines.Quests.Hag } } - public Ingredient[] Ingredients => m_Ingredients; - public Ingredient Ingredient => m_Ingredients[m_Ingredients.Length - 1]; - public int Step => m_Ingredients.Length; - public bool BlackheartMet => m_BlackheartMet; + public Ingredient[] Ingredients { get; private set; } + + public Ingredient Ingredient => Ingredients[Ingredients.Length - 1]; + public int Step => Ingredients.Length; + public bool BlackheartMet { get; private set; } public FindIngredientObjective( Ingredient[] oldIngredients ) : this( oldIngredients, false ) { @@ -330,22 +325,22 @@ namespace Server.Engines.Quests.Hag { if ( !blackheartMet ) { - m_Ingredients = new Ingredient[oldIngredients.Length + 1]; + Ingredients = new Ingredient[oldIngredients.Length + 1]; for ( int i = 0; i < oldIngredients.Length; i++ ) - m_Ingredients[i] = oldIngredients[i]; + Ingredients[i] = oldIngredients[i]; - m_Ingredients[m_Ingredients.Length - 1] = IngredientInfo.RandomIngredient( oldIngredients ); + Ingredients[Ingredients.Length - 1] = IngredientInfo.RandomIngredient( oldIngredients ); } else { - m_Ingredients = new Ingredient[oldIngredients.Length]; + Ingredients = new Ingredient[oldIngredients.Length]; for ( int i = 0; i < oldIngredients.Length; i++ ) - m_Ingredients[i] = oldIngredients[i]; + Ingredients[i] = oldIngredients[i]; } - m_BlackheartMet = blackheartMet; + BlackheartMet = blackheartMet; } public FindIngredientObjective() @@ -418,7 +413,7 @@ namespace Server.Engines.Quests.Hag System.From.SendLocalizedMessage( 1055046 ); // You have completed your current task on the Hag's Magic Brew Recipe list. if ( Step < 3 ) - System.AddObjective( new FindIngredientObjective( m_Ingredients ) ); + System.AddObjective( new FindIngredientObjective( Ingredients ) ); else System.AddObjective( new ReturnIngredientsObjective() ); } @@ -427,22 +422,22 @@ namespace Server.Engines.Quests.Hag { int version = reader.ReadEncodedInt(); - m_Ingredients = new Ingredient[reader.ReadEncodedInt()]; - for ( int i = 0; i < m_Ingredients.Length; i++ ) - m_Ingredients[i] = (Ingredient) reader.ReadEncodedInt(); + Ingredients = new Ingredient[reader.ReadEncodedInt()]; + for ( int i = 0; i < Ingredients.Length; i++ ) + Ingredients[i] = (Ingredient) reader.ReadEncodedInt(); - m_BlackheartMet = reader.ReadBool(); + BlackheartMet = reader.ReadBool(); } public override void ChildSerialize( GenericWriter writer ) { writer.WriteEncodedInt( (int) 0 ); // version - writer.WriteEncodedInt( (int) m_Ingredients.Length ); - for ( int i = 0; i < m_Ingredients.Length; i++ ) - writer.WriteEncodedInt( (int) m_Ingredients[i] ); + writer.WriteEncodedInt( (int) Ingredients.Length ); + for ( int i = 0; i < Ingredients.Length; i++ ) + writer.WriteEncodedInt( (int) Ingredients[i] ); - writer.Write( (bool) m_BlackheartMet ); + writer.Write( (bool) BlackheartMet ); } } diff --git a/Scripts/Engines/RemoteAdmin/RemoteAdminLogging.cs b/Scripts/Engines/RemoteAdmin/RemoteAdminLogging.cs index 047863b99..cccbe096e 100644 --- a/Scripts/Engines/RemoteAdmin/RemoteAdminLogging.cs +++ b/Scripts/Engines/RemoteAdmin/RemoteAdminLogging.cs @@ -10,19 +10,14 @@ namespace Server.RemoteAdmin const string LogBaseDirectory = "Logs"; const string LogSubDirectory = "RemoteAdmin"; - private static StreamWriter m_Output; - private static bool m_Enabled = true; + public static bool Enabled { get; set; } = true; - public static bool Enabled { get => m_Enabled; - set => m_Enabled = value; - } - - public static StreamWriter Output => m_Output; + public static StreamWriter Output { get; private set; } private static bool Initialized; public static void LazyInitialize() { - if ( Initialized || !m_Enabled ) return; + if ( Initialized || !Enabled ) return; Initialized = true; if ( !Directory.Exists( LogBaseDirectory ) ) @@ -35,20 +30,20 @@ namespace Server.RemoteAdmin try { - m_Output = new StreamWriter( Path.Combine( directory, string.Format( LogSubDirectory + "{0}.log", DateTime.UtcNow.ToString( "yyyyMMdd" ) ) ), true ); + Output = new StreamWriter( Path.Combine( directory, string.Format( LogSubDirectory + "{0}.log", DateTime.UtcNow.ToString( "yyyyMMdd" ) ) ), true ); - m_Output.AutoFlush = true; + Output.AutoFlush = true; - m_Output.WriteLine( "##############################" ); - m_Output.WriteLine( "Log started on {0}", DateTime.UtcNow ); - m_Output.WriteLine(); + Output.WriteLine( "##############################" ); + Output.WriteLine( "Log started on {0}", DateTime.UtcNow ); + Output.WriteLine(); } catch { Utility.PushColor( ConsoleColor.Red ); Console.WriteLine( "RemoteAdminLogging: Failed to initialize LogWriter." ); Utility.PopColor(); - m_Enabled = false; + Enabled = false; } } @@ -73,7 +68,7 @@ namespace Server.RemoteAdmin { LazyInitialize(); - if ( !m_Enabled ) return; + if ( !Enabled ) return; try { @@ -82,7 +77,7 @@ namespace Server.RemoteAdmin string accesslevel = acct == null ? "NoAccount" : acct.AccessLevel.ToString(); string statestr = state == null ? "NULLSTATE" : state.ToString(); - m_Output.WriteLine( "{0}: {1}: {2}: {3}", DateTime.UtcNow, statestr, name, text ); + Output.WriteLine( "{0}: {1}: {2}: {3}", DateTime.UtcNow, statestr, name, text ); string path = Core.BaseDirectory; diff --git a/Scripts/Engines/Reports/Objects/Charts/BarGraph.cs b/Scripts/Engines/Reports/Objects/Charts/BarGraph.cs index 36dfdab95..fe7ad6abe 100644 --- a/Scripts/Engines/Reports/Objects/Charts/BarGraph.cs +++ b/Scripts/Engines/Reports/Objects/Charts/BarGraph.cs @@ -22,50 +22,28 @@ namespace Server.Engines.Reports public override PersistableType TypeID => ThisTypeID; #endregion - private int m_Ticks; - private BarGraphRenderMode m_RenderMode; + public int Ticks { get; set; } - private string m_xTitle; - private string m_yTitle; + public BarGraphRenderMode RenderMode { get; set; } - private int m_FontSize = 7; - private int m_Interval = 1; + public string xTitle { get; set; } - private BarRegion[] m_Regions; + public string yTitle { get; set; } - public int Ticks{ get => m_Ticks; - set => m_Ticks = value; - } - public BarGraphRenderMode RenderMode{ get => m_RenderMode; - set => m_RenderMode = value; - } + public int FontSize { get; set; } = 7; - public string xTitle{ get => m_xTitle; - set => m_xTitle = value; - } - public string yTitle{ get => m_yTitle; - set => m_yTitle = value; - } + public int Interval { get; set; } = 1; - public int FontSize{ get => m_FontSize; - set => m_FontSize = value; - } - public int Interval{ get => m_Interval; - set => m_Interval = value; - } - - public BarRegion[] Regions{ get => m_Regions; - set => m_Regions = value; - } + public BarRegion[] Regions { get; set; } public BarGraph( string name, string fileName, int ticks, string xTitle, string yTitle, BarGraphRenderMode rm ) { m_Name = name; m_FileName = fileName; - m_Ticks = ticks; - m_xTitle = xTitle; - m_yTitle = yTitle; - m_RenderMode = rm; + Ticks = ticks; + this.xTitle = xTitle; + this.yTitle = yTitle; + RenderMode = rm; } private BarGraph() @@ -76,28 +54,28 @@ namespace Server.Engines.Reports { base.SerializeAttributes( op ); - op.SetInt32( "t", m_Ticks ); - op.SetInt32( "r", (int) m_RenderMode ); + op.SetInt32( "t", Ticks ); + op.SetInt32( "r", (int) RenderMode ); - op.SetString( "x", m_xTitle ); - op.SetString( "y", m_yTitle ); + op.SetString( "x", xTitle ); + op.SetString( "y", yTitle ); - op.SetInt32( "s", m_FontSize ); - op.SetInt32( "i", m_Interval ); + op.SetInt32( "s", FontSize ); + op.SetInt32( "i", Interval ); } public override void DeserializeAttributes( PersistanceReader ip ) { base.DeserializeAttributes( ip ); - m_Ticks = ip.GetInt32( "t" ); - m_RenderMode = (BarGraphRenderMode) ip.GetInt32( "r" ); + Ticks = ip.GetInt32( "t" ); + RenderMode = (BarGraphRenderMode) ip.GetInt32( "r" ); - m_xTitle = Utility.Intern( ip.GetString( "x" ) ); - m_yTitle = Utility.Intern( ip.GetString( "y" ) ); + xTitle = Utility.Intern( ip.GetString( "x" ) ); + yTitle = Utility.Intern( ip.GetString( "y" ) ); - m_FontSize = ip.GetInt32( "s" ); - m_Interval = ip.GetInt32( "i" ); + FontSize = ip.GetInt32( "s" ); + Interval = ip.GetInt32( "i" ); } public static int LookupReportValue( Snapshot ss, string reportName, string valueName ) @@ -148,7 +126,7 @@ namespace Server.Engines.Reports BarGraph barGraph = new BarGraph( "Hourly average " + valueName, "graphs_" + valueName.ToLower() + "_avg", 10, "Time", valueName, BarGraphRenderMode.Lines ); - barGraph.m_FontSize = 6; + barGraph.FontSize = 6; for ( int i = 7; i <= totals.Length+7; ++i ) { diff --git a/Scripts/Engines/Reports/Objects/Charts/ChartItem.cs b/Scripts/Engines/Reports/Objects/Charts/ChartItem.cs index ca288b368..0faed7bfd 100644 --- a/Scripts/Engines/Reports/Objects/Charts/ChartItem.cs +++ b/Scripts/Engines/Reports/Objects/Charts/ChartItem.cs @@ -13,15 +13,9 @@ namespace Server.Engines.Reports public override PersistableType TypeID => ThisTypeID; #endregion - private string m_Name; - private int m_Value; + public string Name { get; set; } - public string Name{ get => m_Name; - set => m_Name = value; - } - public int Value{ get => m_Value; - set => m_Value = value; - } + public int Value { get; set; } private ChartItem() { @@ -29,20 +23,20 @@ namespace Server.Engines.Reports public ChartItem( string name, int value ) { - m_Name = name; - m_Value = value; + Name = name; + Value = value; } public override void SerializeAttributes( PersistanceWriter op ) { - op.SetString( "n", m_Name ); - op.SetInt32( "v", m_Value ); + op.SetString( "n", Name ); + op.SetInt32( "v", Value ); } public override void DeserializeAttributes( PersistanceReader ip ) { - m_Name = Utility.Intern( ip.GetString( "n" ) ); - m_Value = ip.GetInt32( "v" ); + Name = Utility.Intern( ip.GetString( "n" ) ); + Value = ip.GetInt32( "v" ); } } } diff --git a/Scripts/Engines/Reports/Objects/Charts/PieChart.cs b/Scripts/Engines/Reports/Objects/Charts/PieChart.cs index bb6d08f9a..d50814964 100644 --- a/Scripts/Engines/Reports/Objects/Charts/PieChart.cs +++ b/Scripts/Engines/Reports/Objects/Charts/PieChart.cs @@ -13,17 +13,13 @@ namespace Server.Engines.Reports public override PersistableType TypeID => ThisTypeID; #endregion - private bool m_ShowPercents; - - public bool ShowPercents{ get => m_ShowPercents; - set => m_ShowPercents = value; - } + public bool ShowPercents { get; set; } public PieChart( string name, string fileName, bool showPercents ) { m_Name = name; m_FileName = fileName; - m_ShowPercents = showPercents; + ShowPercents = showPercents; } private PieChart() @@ -34,14 +30,14 @@ namespace Server.Engines.Reports { base.SerializeAttributes( op ); - op.SetBoolean( "p", m_ShowPercents ); + op.SetBoolean( "p", ShowPercents ); } public override void DeserializeAttributes( PersistanceReader ip ) { base.DeserializeAttributes( ip ); - m_ShowPercents = ip.GetBoolean( "p" ); + ShowPercents = ip.GetBoolean( "p" ); } } } diff --git a/Scripts/Engines/Reports/Objects/Reports/ItemValue.cs b/Scripts/Engines/Reports/Objects/Reports/ItemValue.cs index e5c5085ec..09ae5c817 100644 --- a/Scripts/Engines/Reports/Objects/Reports/ItemValue.cs +++ b/Scripts/Engines/Reports/Objects/Reports/ItemValue.cs @@ -14,14 +14,11 @@ namespace Server.Engines.Reports #endregion private string m_Value; - private string m_Format; public string Value{ get => m_Value; set => m_Value = value; } - public string Format{ get => m_Format; - set => m_Format = value; - } + public string Format { get; set; } private ItemValue() { @@ -34,21 +31,21 @@ namespace Server.Engines.Reports public ItemValue( string value, string format ) { m_Value = value; - m_Format = format; + Format = format; } public override void SerializeAttributes( PersistanceWriter op ) { op.SetString( "v", m_Value ); - op.SetString( "f", m_Format ); + op.SetString( "f", Format ); } public override void DeserializeAttributes( PersistanceReader ip ) { m_Value = ip.GetString( "v" ); - m_Format = Utility.Intern( ip.GetString( "f" ) ); + Format = Utility.Intern( ip.GetString( "f" ) ); - if ( m_Format == null ) + if ( Format == null ) Utility.Intern( ref m_Value ); } } diff --git a/Scripts/Engines/Reports/Objects/Reports/Report.cs b/Scripts/Engines/Reports/Objects/Reports/Report.cs index c61a6b45d..e63f915c8 100644 --- a/Scripts/Engines/Reports/Objects/Reports/Report.cs +++ b/Scripts/Engines/Reports/Objects/Reports/Report.cs @@ -13,19 +13,13 @@ namespace Server.Engines.Reports public override PersistableType TypeID => ThisTypeID; #endregion - private string m_Name; - private string m_Width; - private ReportColumnCollection m_Columns; - private ReportItemCollection m_Items; + public string Name { get; set; } - public string Name{ get => m_Name; - set => m_Name = value; - } - public string Width{ get => m_Width; - set => m_Width = value; - } - public ReportColumnCollection Columns => m_Columns; - public ReportItemCollection Items => m_Items; + public string Width { get; set; } + + public ReportColumnCollection Columns { get; } + + public ReportItemCollection Items { get; } private Report() : this( null, null ) { @@ -33,31 +27,31 @@ namespace Server.Engines.Reports public Report( string name, string width ) { - m_Name = name; - m_Width = width; - m_Columns = new ReportColumnCollection(); - m_Items = new ReportItemCollection(); + Name = name; + Width = width; + Columns = new ReportColumnCollection(); + Items = new ReportItemCollection(); } public override void SerializeAttributes( PersistanceWriter op ) { - op.SetString( "n", m_Name ); - op.SetString( "w", m_Width ); + op.SetString( "n", Name ); + op.SetString( "w", Width ); } public override void DeserializeAttributes( PersistanceReader ip ) { - m_Name = Utility.Intern( ip.GetString( "n" ) ); - m_Width = Utility.Intern( ip.GetString( "w" ) ); + Name = Utility.Intern( ip.GetString( "n" ) ); + Width = Utility.Intern( ip.GetString( "w" ) ); } public override void SerializeChildren( PersistanceWriter op ) { - for ( int i = 0; i < m_Columns.Count; ++i ) - m_Columns[i].Serialize( op ); + for ( int i = 0; i < Columns.Count; ++i ) + Columns[i].Serialize( op ); - for ( int i = 0; i < m_Items.Count; ++i ) - m_Items[i].Serialize( op ); + for ( int i = 0; i < Items.Count; ++i ) + Items[i].Serialize( op ); } public override void DeserializeChildren( PersistanceReader ip ) @@ -67,9 +61,9 @@ namespace Server.Engines.Reports PersistableObject child = ip.GetChild(); if ( child is ReportColumn column ) - m_Columns.Add( column ); + Columns.Add( column ); else if ( child is ReportItem item ) - m_Items.Add( item ); + Items.Add( item ); } } } diff --git a/Scripts/Engines/Reports/Objects/Reports/ReportColumn.cs b/Scripts/Engines/Reports/Objects/Reports/ReportColumn.cs index 8b34c50fd..76658635f 100644 --- a/Scripts/Engines/Reports/Objects/Reports/ReportColumn.cs +++ b/Scripts/Engines/Reports/Objects/Reports/ReportColumn.cs @@ -13,19 +13,11 @@ namespace Server.Engines.Reports public override PersistableType TypeID => ThisTypeID; #endregion - private string m_Width; - private string m_Align; - private string m_Name; + public string Width { get; set; } - public string Width{ get => m_Width; - set => m_Width = value; - } - public string Align{ get => m_Align; - set => m_Align = value; - } - public string Name{ get => m_Name; - set => m_Name = value; - } + public string Align { get; set; } + + public string Name { get; set; } private ReportColumn() { @@ -37,23 +29,23 @@ namespace Server.Engines.Reports public ReportColumn( string width, string align, string name ) { - m_Width = width; - m_Align = align; - m_Name = name; + Width = width; + Align = align; + Name = name; } public override void SerializeAttributes( PersistanceWriter op ) { - op.SetString( "w", m_Width ); - op.SetString( "a", m_Align ); - op.SetString( "n", m_Name ); + op.SetString( "w", Width ); + op.SetString( "a", Align ); + op.SetString( "n", Name ); } public override void DeserializeAttributes( PersistanceReader ip ) { - m_Width = Utility.Intern( ip.GetString( "w" ) ); - m_Align = Utility.Intern( ip.GetString( "a" ) ); - m_Name = Utility.Intern( ip.GetString( "n" ) ); + Width = Utility.Intern( ip.GetString( "w" ) ); + Align = Utility.Intern( ip.GetString( "a" ) ); + Name = Utility.Intern( ip.GetString( "n" ) ); } } } diff --git a/Scripts/Engines/Reports/Objects/Reports/ReportItem.cs b/Scripts/Engines/Reports/Objects/Reports/ReportItem.cs index 8a9dd1be6..dc03350da 100644 --- a/Scripts/Engines/Reports/Objects/Reports/ReportItem.cs +++ b/Scripts/Engines/Reports/Objects/Reports/ReportItem.cs @@ -13,25 +13,23 @@ namespace Server.Engines.Reports public override PersistableType TypeID => ThisTypeID; #endregion - private ItemValueCollection m_Values; - - public ItemValueCollection Values => m_Values; + public ItemValueCollection Values { get; } public ReportItem() { - m_Values = new ItemValueCollection(); + Values = new ItemValueCollection(); } public override void SerializeChildren( PersistanceWriter op ) { - for ( int i = 0; i < m_Values.Count; ++i ) - m_Values[i].Serialize( op ); + for ( int i = 0; i < Values.Count; ++i ) + Values[i].Serialize( op ); } public override void DeserializeChildren( PersistanceReader ip ) { while ( ip.HasChild ) - m_Values.Add( ip.GetChild() as ItemValue ); + Values.Add( ip.GetChild() as ItemValue ); } } } diff --git a/Scripts/Engines/Reports/Objects/Snapshots/Snapshot.cs b/Scripts/Engines/Reports/Objects/Snapshots/Snapshot.cs index 462dfbf58..380dbee0b 100644 --- a/Scripts/Engines/Reports/Objects/Snapshots/Snapshot.cs +++ b/Scripts/Engines/Reports/Objects/Snapshots/Snapshot.cs @@ -15,41 +15,35 @@ namespace Server.Engines.Reports public override PersistableType TypeID => ThisTypeID; #endregion - private DateTime m_TimeStamp; - private ObjectCollection m_Children; + public DateTime TimeStamp { get; set; } - public DateTime TimeStamp{ get => m_TimeStamp; - set => m_TimeStamp = value; - } - public ObjectCollection Children{ get => m_Children; - set => m_Children = value; - } + public ObjectCollection Children { get; set; } public Snapshot() { - m_Children = new ObjectCollection(); + Children = new ObjectCollection(); } public override void SerializeAttributes( PersistanceWriter op ) { - op.SetDateTime( "t", m_TimeStamp ); + op.SetDateTime( "t", TimeStamp ); } public override void DeserializeAttributes( PersistanceReader ip ) { - m_TimeStamp = ip.GetDateTime( "t" ); + TimeStamp = ip.GetDateTime( "t" ); } public override void SerializeChildren( PersistanceWriter op ) { - for ( int i = 0; i < m_Children.Count; ++i ) - m_Children[i].Serialize( op ); + for ( int i = 0; i < Children.Count; ++i ) + Children[i].Serialize( op ); } public override void DeserializeChildren( PersistanceReader ip ) { while ( ip.HasChild ) - m_Children.Add( ip.GetChild() ); + Children.Add( ip.GetChild() ); } } } diff --git a/Scripts/Engines/Reports/Objects/Snapshots/SnapshotHistory.cs b/Scripts/Engines/Reports/Objects/Snapshots/SnapshotHistory.cs index 1eff8bc62..f8ba68b9f 100644 --- a/Scripts/Engines/Reports/Objects/Snapshots/SnapshotHistory.cs +++ b/Scripts/Engines/Reports/Objects/Snapshots/SnapshotHistory.cs @@ -15,15 +15,11 @@ namespace Server.Engines.Reports public override PersistableType TypeID => ThisTypeID; #endregion - private SnapshotCollection m_Snapshots; - - public SnapshotCollection Snapshots{ get => m_Snapshots; - set => m_Snapshots = value; - } + public SnapshotCollection Snapshots { get; set; } public SnapshotHistory() { - m_Snapshots = new SnapshotCollection(); + Snapshots = new SnapshotCollection(); } public void Save() @@ -52,14 +48,14 @@ namespace Server.Engines.Reports public override void SerializeChildren( PersistanceWriter op ) { - for ( int i = 0; i < m_Snapshots.Count; ++i ) - m_Snapshots[i].Serialize( op ); + for ( int i = 0; i < Snapshots.Count; ++i ) + Snapshots[i].Serialize( op ); } public override void DeserializeChildren( PersistanceReader ip ) { while ( ip.HasChild ) - m_Snapshots.Add( ip.GetChild() as Snapshot ); + Snapshots.Add( ip.GetChild() as Snapshot ); } } } diff --git a/Scripts/Engines/Reports/Objects/Staffing/Info.cs b/Scripts/Engines/Reports/Objects/Staffing/Info.cs index f8d917c0d..c90af00c3 100644 --- a/Scripts/Engines/Reports/Objects/Staffing/Info.cs +++ b/Scripts/Engines/Reports/Objects/Staffing/Info.cs @@ -5,22 +5,13 @@ namespace Server.Engines.Reports { public abstract class BaseInfo : IComparable { - private static TimeSpan m_SortRange; + public static TimeSpan SortRange { get; set; } - public static TimeSpan SortRange{ get => m_SortRange; - set => m_SortRange = value; - } - - private string m_Account; private string m_Display; - private PageInfoCollection m_Pages; - public string Account{ get => m_Account; - set => m_Account = value; - } - public PageInfoCollection Pages{ get => m_Pages; - set => m_Pages = value; - } + public string Account { get; set; } + + public PageInfoCollection Pages { get; set; } public string Display { @@ -29,9 +20,9 @@ namespace Server.Engines.Reports if ( m_Display != null ) return m_Display; - if ( m_Account != null ) + if ( Account != null ) { - IAccount acct = Accounts.GetAccount( m_Account ); + IAccount acct = Accounts.GetAccount( Account ); if ( acct != null ) { @@ -50,37 +41,37 @@ namespace Server.Engines.Reports } } - return ( m_Display = m_Account ); + return ( m_Display = Account ); } } public int GetPageCount( PageResolution res, DateTime min, DateTime max ) { - return StaffHistory.GetPageCount( m_Pages, res, min, max ); + return StaffHistory.GetPageCount( Pages, res, min, max ); } public BaseInfo( string account ) { - m_Account = account; - m_Pages = new PageInfoCollection(); + Account = account; + Pages = new PageInfoCollection(); } public void Register( PageInfo page ) { - m_Pages.Add( page ); + Pages.Add( page ); } public void Unregister( PageInfo page ) { - m_Pages.Remove( page ); + Pages.Remove( page ); } public int CompareTo( object obj ) { BaseInfo cmp = obj as BaseInfo; - int v = cmp.GetPageCount( cmp is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.UtcNow - m_SortRange, DateTime.UtcNow ) - - GetPageCount( this is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.UtcNow - m_SortRange, DateTime.UtcNow ); + int v = cmp.GetPageCount( cmp is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.UtcNow - SortRange, DateTime.UtcNow ) + - GetPageCount( this is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.UtcNow - SortRange, DateTime.UtcNow ); if ( v == 0 ) v = string.Compare( Display, cmp.Display ); diff --git a/Scripts/Engines/Reports/Objects/Staffing/PageInfo.cs b/Scripts/Engines/Reports/Objects/Staffing/PageInfo.cs index 63c4ee647..8c226ca6f 100644 --- a/Scripts/Engines/Reports/Objects/Staffing/PageInfo.cs +++ b/Scripts/Engines/Reports/Objects/Staffing/PageInfo.cs @@ -68,17 +68,7 @@ namespace Server.Engines.Reports } } - private PageType m_PageType; - private PageResolution m_Resolution; - - private DateTime m_TimeSent; - private DateTime m_TimeResolved; - private string m_SentBy; - private string m_ResolvedBy; - - private string m_Message; - private ResponseInfoCollection m_Responses; public StaffHistory History { @@ -104,15 +94,13 @@ namespace Server.Engines.Reports } } - public PageType PageType{ get => m_PageType; - set => m_PageType = value; - } - public PageResolution Resolution => m_Resolution; + public PageType PageType { get; set; } - public DateTime TimeSent{ get => m_TimeSent; - set => m_TimeSent = value; - } - public DateTime TimeResolved => m_TimeResolved; + public PageResolution Resolution { get; private set; } + + public DateTime TimeSent { get; set; } + + public DateTime TimeResolved { get; private set; } public string SentBy { @@ -126,14 +114,11 @@ namespace Server.Engines.Reports } } - public string ResolvedBy => m_ResolvedBy; + public string ResolvedBy { get; private set; } - public string Message{ get => m_Message; - set => m_Message = value; - } - public ResponseInfoCollection Responses{ get => m_Responses; - set => m_Responses = value; - } + public string Message { get; set; } + + public ResponseInfoCollection Responses { get; set; } public void UpdateResolver() { @@ -146,9 +131,9 @@ namespace Server.Engines.Reports else Resolver = null; - m_ResolvedBy = resolvedBy; - m_TimeResolved = timeResolved; - m_Resolution = res; + ResolvedBy = resolvedBy; + TimeResolved = timeResolved; + Resolution = res; } public bool IsStaffResolution( PageResolution res ) @@ -171,9 +156,9 @@ namespace Server.Engines.Reports public PageResolution GetResolution( out string resolvedBy, out DateTime timeResolved ) { - for ( int i = m_Responses.Count - 1; i >= 0; --i ) + for ( int i = Responses.Count - 1; i >= 0; --i ) { - ResponseInfo resp = m_Responses[i]; + ResponseInfo resp = Responses[i]; PageResolution res = ResFromResp( resp.Message ); if ( res != PageResolution.None ) @@ -185,7 +170,7 @@ namespace Server.Engines.Reports } resolvedBy = m_SentBy; - timeResolved = m_TimeSent; + timeResolved = TimeSent; return PageResolution.None; } @@ -196,53 +181,53 @@ namespace Server.Engines.Reports public PageInfo() { - m_Responses = new ResponseInfoCollection(); + Responses = new ResponseInfoCollection(); } public PageInfo( PageEntry entry ) { - m_PageType = entry.Type; + PageType = entry.Type; - m_TimeSent = entry.Sent; + TimeSent = entry.Sent; m_SentBy = GetAccount( entry.Sender ); - m_Message = entry.Message; - m_Responses = new ResponseInfoCollection(); + Message = entry.Message; + Responses = new ResponseInfoCollection(); } public override void SerializeAttributes( PersistanceWriter op ) { - op.SetInt32( "p", (int)m_PageType ); + op.SetInt32( "p", (int)PageType ); - op.SetDateTime( "ts", m_TimeSent ); + op.SetDateTime( "ts", TimeSent ); op.SetString( "s", m_SentBy ); - op.SetString( "m", m_Message ); + op.SetString( "m", Message ); } public override void DeserializeAttributes( PersistanceReader ip ) { - m_PageType = (PageType) ip.GetInt32( "p" ); + PageType = (PageType) ip.GetInt32( "p" ); - m_TimeSent = ip.GetDateTime( "ts" ); + TimeSent = ip.GetDateTime( "ts" ); m_SentBy = ip.GetString( "s" ); - m_Message = ip.GetString( "m" ); + Message = ip.GetString( "m" ); } public override void SerializeChildren( PersistanceWriter op ) { lock ( this ) { - for ( int i = 0; i < m_Responses.Count; ++i ) - m_Responses[i].Serialize( op ); + for ( int i = 0; i < Responses.Count; ++i ) + Responses[i].Serialize( op ); } } public override void DeserializeChildren( PersistanceReader ip ) { while ( ip.HasChild ) - m_Responses.Add( ip.GetChild() as ResponseInfo ); + Responses.Add( ip.GetChild() as ResponseInfo ); } } } diff --git a/Scripts/Engines/Reports/Objects/Staffing/QueueStatus.cs b/Scripts/Engines/Reports/Objects/Staffing/QueueStatus.cs index 4939f4fae..77909126b 100644 --- a/Scripts/Engines/Reports/Objects/Staffing/QueueStatus.cs +++ b/Scripts/Engines/Reports/Objects/Staffing/QueueStatus.cs @@ -15,15 +15,9 @@ namespace Server.Engines.Reports public override PersistableType TypeID => ThisTypeID; #endregion - private DateTime m_TimeStamp; - private int m_Count; + public DateTime TimeStamp { get; set; } - public DateTime TimeStamp{ get => m_TimeStamp; - set => m_TimeStamp = value; - } - public int Count{ get => m_Count; - set => m_Count = value; - } + public int Count { get; set; } public QueueStatus() { @@ -31,20 +25,20 @@ namespace Server.Engines.Reports public QueueStatus( int count ) { - m_TimeStamp = DateTime.UtcNow; - m_Count = count; + TimeStamp = DateTime.UtcNow; + Count = count; } public override void SerializeAttributes( PersistanceWriter op ) { - op.SetDateTime( "t", m_TimeStamp ); - op.SetInt32( "c", m_Count ); + op.SetDateTime( "t", TimeStamp ); + op.SetInt32( "c", Count ); } public override void DeserializeAttributes( PersistanceReader ip ) { - m_TimeStamp = ip.GetDateTime( "t" ); - m_Count = ip.GetInt32( "c" ); + TimeStamp = ip.GetDateTime( "t" ); + Count = ip.GetInt32( "c" ); } } } diff --git a/Scripts/Engines/Reports/Objects/Staffing/ResponseInfo.cs b/Scripts/Engines/Reports/Objects/Staffing/ResponseInfo.cs index 54468e18d..2485b5b14 100644 --- a/Scripts/Engines/Reports/Objects/Staffing/ResponseInfo.cs +++ b/Scripts/Engines/Reports/Objects/Staffing/ResponseInfo.cs @@ -15,21 +15,11 @@ namespace Server.Engines.Reports public override PersistableType TypeID => ThisTypeID; #endregion - private DateTime m_TimeStamp; + public DateTime TimeStamp { get; set; } - private string m_SentBy; - private string m_Message; + public string SentBy { get; set; } - public DateTime TimeStamp{ get => m_TimeStamp; - set => m_TimeStamp = value; - } - - public string SentBy{ get => m_SentBy; - set => m_SentBy = value; - } - public string Message{ get => m_Message; - set => m_Message = value; - } + public string Message { get; set; } public ResponseInfo() { @@ -37,25 +27,25 @@ namespace Server.Engines.Reports public ResponseInfo( string sentBy, string message ) { - m_TimeStamp = DateTime.UtcNow; - m_SentBy = sentBy; - m_Message = message; + TimeStamp = DateTime.UtcNow; + SentBy = sentBy; + Message = message; } public override void SerializeAttributes( PersistanceWriter op ) { - op.SetDateTime( "t", m_TimeStamp ); + op.SetDateTime( "t", TimeStamp ); - op.SetString( "s", m_SentBy ); - op.SetString( "m", m_Message ); + op.SetString( "s", SentBy ); + op.SetString( "m", Message ); } public override void DeserializeAttributes( PersistanceReader ip ) { - m_TimeStamp = ip.GetDateTime( "t" ); + TimeStamp = ip.GetDateTime( "t" ); - m_SentBy = ip.GetString( "s" ); - m_Message = ip.GetString( "m" ); + SentBy = ip.GetString( "s" ); + Message = ip.GetString( "m" ); } } } diff --git a/Scripts/Engines/Reports/Objects/Staffing/StaffHistory.cs b/Scripts/Engines/Reports/Objects/Staffing/StaffHistory.cs index 14eb9c9fb..77db0e770 100644 --- a/Scripts/Engines/Reports/Objects/Staffing/StaffHistory.cs +++ b/Scripts/Engines/Reports/Objects/Staffing/StaffHistory.cs @@ -17,41 +17,29 @@ namespace Server.Engines.Reports public override PersistableType TypeID => ThisTypeID; #endregion - private PageInfoCollection m_Pages; - private QueueStatusCollection m_QueueStats; + public PageInfoCollection Pages { get; set; } - private Hashtable m_UserInfo; - private Hashtable m_StaffInfo; + public QueueStatusCollection QueueStats { get; set; } - public PageInfoCollection Pages{ get => m_Pages; - set => m_Pages = value; - } - public QueueStatusCollection QueueStats{ get => m_QueueStats; - set => m_QueueStats = value; - } + public Hashtable UserInfo { get; set; } - public Hashtable UserInfo{ get => m_UserInfo; - set => m_UserInfo = value; - } - public Hashtable StaffInfo{ get => m_StaffInfo; - set => m_StaffInfo = value; - } + public Hashtable StaffInfo { get; set; } public void AddPage( PageInfo info ) { lock ( SaveLock ) - m_Pages.Add( info ); + Pages.Add( info ); info.History = this; } public StaffHistory() { - m_Pages = new PageInfoCollection(); - m_QueueStats = new QueueStatusCollection(); + Pages = new PageInfoCollection(); + QueueStats = new QueueStatusCollection(); - m_UserInfo = new Hashtable( StringComparer.OrdinalIgnoreCase ); - m_StaffInfo = new Hashtable( StringComparer.OrdinalIgnoreCase ); + UserInfo = new Hashtable( StringComparer.OrdinalIgnoreCase ); + StaffInfo = new Hashtable( StringComparer.OrdinalIgnoreCase ); } public StaffInfo GetStaffInfo( string account ) @@ -61,8 +49,8 @@ namespace Server.Engines.Reports if ( string.IsNullOrEmpty(account) ) return null; - if ( !(m_StaffInfo[account] is StaffInfo info) ) - m_StaffInfo[account] = info = new StaffInfo( account ); + if ( !(StaffInfo[account] is StaffInfo info) ) + StaffInfo[account] = info = new StaffInfo( account ); return info; } @@ -73,8 +61,8 @@ namespace Server.Engines.Reports if ( string.IsNullOrEmpty(account) ) return null; - if ( !(m_UserInfo[account] is UserInfo info) ) - m_UserInfo[account] = info = new UserInfo( account ); + if ( !(UserInfo[account] is UserInfo info) ) + UserInfo[account] = info = new UserInfo( account ); return info; } @@ -111,11 +99,11 @@ namespace Server.Engines.Reports public override void SerializeChildren( PersistanceWriter op ) { - for ( int i = 0; i < m_Pages.Count; ++i ) - m_Pages[i].Serialize( op ); + for ( int i = 0; i < Pages.Count; ++i ) + Pages[i].Serialize( op ); - for ( int i = 0; i < m_QueueStats.Count; ++i ) - m_QueueStats[i].Serialize( op ); + for ( int i = 0; i < QueueStats.Count; ++i ) + QueueStats[i].Serialize( op ); } public override void DeserializeChildren( PersistanceReader ip ) @@ -132,7 +120,7 @@ namespace Server.Engines.Reports if ( pageInfo.TimeSent >= min || pageInfo.TimeResolved >= min ) { - m_Pages.Add( pageInfo ); + Pages.Add( pageInfo ); pageInfo.History = this; } else @@ -144,17 +132,17 @@ namespace Server.Engines.Reports else if ( obj is QueueStatus queueStatus ) { if ( queueStatus.TimeStamp >= min ) - m_QueueStats.Add( queueStatus ); + QueueStats.Add( queueStatus ); } } } public StaffInfo[] GetStaff() { - StaffInfo[] staff = new StaffInfo[m_StaffInfo.Count]; + StaffInfo[] staff = new StaffInfo[StaffInfo.Count]; int index = 0; - foreach ( StaffInfo staffInfo in m_StaffInfo.Values ) + foreach ( StaffInfo staffInfo in StaffInfo.Values ) staff[index++] = staffInfo; return staff; @@ -171,11 +159,11 @@ namespace Server.Engines.Reports BaseInfo.SortRange = TimeSpan.FromDays( 7.0 ); Array.Sort( staff ); - objects.Add( GraphHourlyPages( m_Pages, PageResolution.None, "New pages by hour", "graph_new_pages_hr" ) ); - objects.Add( GraphHourlyPages( m_Pages, PageResolution.Handled, "Handled pages by hour", "graph_handled_pages_hr" ) ); - objects.Add( GraphHourlyPages( m_Pages, PageResolution.Deleted, "Deleted pages by hour", "graph_deleted_pages_hr" ) ); - objects.Add( GraphHourlyPages( m_Pages, PageResolution.Canceled, "Canceled pages by hour", "graph_canceled_pages_hr" ) ); - objects.Add( GraphHourlyPages( m_Pages, PageResolution.Logged, "Logged-out pages by hour", "graph_logged_pages_hr" ) ); + objects.Add( GraphHourlyPages( Pages, PageResolution.None, "New pages by hour", "graph_new_pages_hr" ) ); + objects.Add( GraphHourlyPages( Pages, PageResolution.Handled, "Handled pages by hour", "graph_handled_pages_hr" ) ); + objects.Add( GraphHourlyPages( Pages, PageResolution.Deleted, "Deleted pages by hour", "graph_deleted_pages_hr" ) ); + objects.Add( GraphHourlyPages( Pages, PageResolution.Canceled, "Canceled pages by hour", "graph_canceled_pages_hr" ) ); + objects.Add( GraphHourlyPages( Pages, PageResolution.Logged, "Logged-out pages by hour", "graph_logged_pages_hr" ) ); BaseInfo.SortRange = TimeSpan.FromDays( 1.0 ); Array.Sort( staff ); @@ -231,9 +219,9 @@ namespace Server.Engines.Reports DateTime max = DateTime.UtcNow; DateTime min = max - TimeSpan.FromDays( 7.0 ); - for ( int i = 0; i < m_QueueStats.Count; ++i ) + for ( int i = 0; i < QueueStats.Count; ++i ) { - DateTime ts = m_QueueStats[i].TimeStamp; + DateTime ts = QueueStats[i].TimeStamp; if ( ts >= min && ts < max ) { @@ -242,7 +230,7 @@ namespace Server.Engines.Reports int hour = time.Hours; - totals[hour] += m_QueueStats[i].Count; + totals[hour] += QueueStats[i].Count; counts[hour]++; } } @@ -386,11 +374,11 @@ namespace Server.Engines.Reports PieChart resChart = new PieChart( title + " Resolutions", fname + "_resol", true ); - int countTotal = GetPageCount( m_Pages, PageResolution.None, min, max ); - int countHandled = GetPageCount( m_Pages, PageResolution.Handled, min, max ); - int countDeleted = GetPageCount( m_Pages, PageResolution.Deleted, min, max ); - int countCanceled = GetPageCount( m_Pages, PageResolution.Canceled, min, max ); - int countLogged = GetPageCount( m_Pages, PageResolution.Logged, min, max ); + int countTotal = GetPageCount( Pages, PageResolution.None, min, max ); + int countHandled = GetPageCount( Pages, PageResolution.Handled, min, max ); + int countDeleted = GetPageCount( Pages, PageResolution.Deleted, min, max ); + int countCanceled = GetPageCount( Pages, PageResolution.Canceled, min, max ); + int countLogged = GetPageCount( Pages, PageResolution.Logged, min, max ); int countUnres = countTotal - ( countHandled + countDeleted + countCanceled + countLogged ); resChart.Items.Add( "Handled", countHandled ); diff --git a/Scripts/Engines/Reports/Persistance/PersistableType.cs b/Scripts/Engines/Reports/Persistance/PersistableType.cs index ac58de7ce..d1b17addb 100644 --- a/Scripts/Engines/Reports/Persistance/PersistableType.cs +++ b/Scripts/Engines/Reports/Persistance/PersistableType.cs @@ -43,16 +43,14 @@ namespace Server.Engines.Reports public sealed class PersistableType { - private string m_Name; - private ConstructCallback m_Constructor; + public string Name { get; } - public string Name => m_Name; - public ConstructCallback Constructor => m_Constructor; + public ConstructCallback Constructor { get; } public PersistableType( string name, ConstructCallback constructor ) { - m_Name = name; - m_Constructor = constructor; + Name = name; + Constructor = constructor; } } } \ No newline at end of file diff --git a/Scripts/Engines/Reports/Rendering/BarGraphRenderer.cs b/Scripts/Engines/Reports/Rendering/BarGraphRenderer.cs index ff77d7e5f..10e3b924d 100644 --- a/Scripts/Engines/Reports/Rendering/BarGraphRenderer.cs +++ b/Scripts/Engines/Reports/Rendering/BarGraphRenderer.cs @@ -38,11 +38,8 @@ namespace Server.Engines.Reports public BarRegion[] _regions; - private BarGraphRenderMode _renderMode; - // Overall related members private Color _backColor; - private string _fontFamily; private string _longestTickValue = string.Empty; // Used to calculate max value width private float _maxTickValueWidth; // Used to calculate left offset of bar graph private float _totalHeight; @@ -51,7 +48,6 @@ namespace Server.Engines.Reports // Graph related members private float _barWidth; private float _bottomBuffer; // Space from bottom to x axis - private bool _displayBarData; private Color _fontColor; private float _graphHeight; private float _graphWidth; @@ -61,27 +57,16 @@ namespace Server.Engines.Reports private float _topBuffer; // Space from top to the top of y axis private float _xOrigin; // x position where graph starts drawing private float _yOrigin; // y position where graph starts drawing - private string _yLabel; - private int _yTickCount; private float _yTickValue; // Value for each tick = _maxValue/_yTickCount // Legend related members - private bool _displayLegend; private float _legendWidth; private string _longestLabel = string.Empty; // Used to calculate legend width private float _maxLabelWidth; - public string FontFamily - { - get => _fontFamily; - set => _fontFamily = value; - } + public string FontFamily { get; set; } - public BarGraphRenderMode RenderMode - { - get => _renderMode; - set => _renderMode = value; - } + public BarGraphRenderMode RenderMode { get; set; } public Color BackgroundColor { @@ -110,33 +95,18 @@ namespace Server.Engines.Reports set => _totalWidth = Convert.ToSingle(value); } - public bool ShowLegend - { - get => _displayLegend; - set => _displayLegend = value; - } + public bool ShowLegend { get; set; } + + public bool ShowData { get; set; } - public bool ShowData - { - get => _displayBarData; - set => _displayBarData = value; - } public int TopBuffer { set => _topBuffer = Convert.ToSingle(value); } - public string VerticalLabel - { - get => _yLabel; - set => _yLabel = value; - } + public string VerticalLabel { get; set; } - public int VerticalTickCount - { - get => _yTickCount; - set => _yTickCount = value; - } + public int VerticalTickCount { get; set; } private string _xTitle, _yTitle; @@ -182,7 +152,7 @@ namespace Server.Engines.Reports if (_maxValue < temp) _maxValue = temp; // Find the longest description - if (_displayLegend) + if (ShowLegend) { string currentLbl = labels[i] + " (" + shortLbl + ")"; float currentWidth = CalculateImgFontWidth(currentLbl, _legendFontSize, FontFamily); @@ -225,7 +195,7 @@ namespace Server.Engines.Reports textFormat.Alignment = StringAlignment.Center; textFormat.LineAlignment = StringAlignment.Center; - using ( Font font = new Font( _fontFamily, _labelFontSize ) ) + using ( Font font = new Font( FontFamily, _labelFontSize ) ) { using ( Brush textBrush = new SolidBrush( _fontColor ) ) { @@ -288,7 +258,7 @@ namespace Server.Engines.Reports DrawBars(graph); DrawXLabelArea(graph); - if (_displayLegend) + if (ShowLegend) DrawLegend(graph); } @@ -312,14 +282,14 @@ namespace Server.Engines.Reports try { brsFont = new SolidBrush(_fontColor); - valFont = new Font(_fontFamily, _labelFontSize); + valFont = new Font(FontFamily, _labelFontSize); sfFormat = new StringFormat(); sfFormat.Alignment = StringAlignment.Center; int i = 0; PointF[] linePoints = null; - if ( _renderMode == BarGraphRenderMode.Lines ) + if ( RenderMode == BarGraphRenderMode.Lines ) linePoints = new PointF[DataPoints.Count]; int pointIndex = 0; @@ -335,11 +305,11 @@ namespace Server.Engines.Reports { float itemY = _yOrigin + _graphHeight - item.SweepSize; - if ( _renderMode == BarGraphRenderMode.Lines ) + if ( RenderMode == BarGraphRenderMode.Lines ) { linePoints[pointIndex++] = new PointF( _xOrigin + item.StartPos + (_barWidth / 2), itemY ); } - else if ( _renderMode == BarGraphRenderMode.Bars ) + else if ( RenderMode == BarGraphRenderMode.Bars ) { float ox = _xOrigin + item.StartPos; float oy = itemY; @@ -376,7 +346,7 @@ namespace Server.Engines.Reports graph.DrawLine( pen, pts[3], pts[6] ); // Draw data value - if (_displayBarData&&(i%_interval)==0) + if (ShowData&&(i%_interval)==0) { float sectionWidth = ( _barWidth + _spaceBtwBars ); float startX = _xOrigin + (i * sectionWidth) + (sectionWidth / 2); // This draws the value on center of the bar @@ -408,7 +378,7 @@ namespace Server.Engines.Reports } } - if ( _renderMode == BarGraphRenderMode.Lines ) + if ( RenderMode == BarGraphRenderMode.Lines ) { if ( linePoints.Length >= 2 ) { @@ -426,7 +396,7 @@ namespace Server.Engines.Reports float itemY = _yOrigin + _graphHeight - item.SweepSize; // Draw data value - if (_displayBarData&&(j%_interval)==0) + if (ShowData&&(j%_interval)==0) { graph.FillEllipse( brsFont, new RectangleF( linePoints[j].X-2.0f, linePoints[j].Y-2.0f, 4.0f, 4.0f ) ); @@ -495,7 +465,7 @@ namespace Server.Engines.Reports sfVLabel.LineAlignment = StringAlignment.Center; sfVLabel.FormatFlags=StringFormatFlags.DirectionVertical; - lblFont = new Font(_fontFamily, _labelFontSize+4.0f); + lblFont = new Font(FontFamily, _labelFontSize+4.0f); graph.DrawString(_yTitle,lblFont,brs,new RectangleF( 0.0f, _yOrigin, 20.0f, _graphHeight ), sfVLabel ); lblFont.Dispose(); } @@ -505,19 +475,19 @@ namespace Server.Engines.Reports lblFormat.FormatFlags|=StringFormatFlags.NoClip; // Draw vertical label at the top of y-axis and place it in the middle top of y-axis - lblFont = new Font(_fontFamily, _labelFontSize+2.0f,FontStyle.Bold); + lblFont = new Font(FontFamily, _labelFontSize+2.0f,FontStyle.Bold); RectangleF recVLabel = new RectangleF(0, _yOrigin-2*_spacer-lblFont.Height, _xOrigin*2, lblFont.Height); sfVLabel.Alignment = StringAlignment.Center; sfVLabel.FormatFlags|=StringFormatFlags.NoClip; //graph.DrawRectangle(Pens.Black,Rectangle.Truncate(recVLabel)); - graph.DrawString(_yLabel, lblFont, brs, recVLabel, sfVLabel); + graph.DrawString(VerticalLabel, lblFont, brs, recVLabel, sfVLabel); lblFont.Dispose(); - lblFont = new Font(_fontFamily, _labelFontSize); + lblFont = new Font(FontFamily, _labelFontSize); // Draw all tick values and tick marks using ( Pen smallPen = new Pen(Color.FromArgb(96,_fontColor),0.8f) ) { - for (int i=0; i<_yTickCount; i++) + for (int i=0; i24?16.0f:0.0f), _graphWidth, 20.0f ), lblFormat ); + lblFont = new Font(FontFamily, _labelFontSize+2.0f, FontStyle.Bold); + graph.DrawString(_xTitle,lblFont,brs,new RectangleF( _xOrigin, _yOrigin+_graphHeight+14.0f+(RenderMode==BarGraphRenderMode.Bars?10.0f:0.0f)+((DataPoints.Count/_interval)>24?16.0f:0.0f), _graphWidth, 20.0f ), lblFormat ); } - lblFont = new Font(_fontFamily, _labelFontSize); + lblFont = new Font(FontFamily, _labelFontSize); lblFormat = new StringFormat(); lblFormat.Alignment = StringAlignment.Center; lblFormat.FormatFlags |= StringFormatFlags.NoClip; @@ -610,7 +580,7 @@ namespace Server.Engines.Reports float of = 0.0f; - if ( _renderMode == BarGraphRenderMode.Bars ) + if ( RenderMode == BarGraphRenderMode.Bars ) { of = 10.0f; @@ -633,7 +603,7 @@ namespace Server.Engines.Reports { currentX = _xOrigin + (i * labelWidth)+of+(labelWidth/2); RectangleF recLbl = new RectangleF(currentX-((labelWidth*_interval)/2), currentY+of, labelWidth*_interval, lblFont.Height*2); - string lblString = _displayLegend ? item.Label : item.Description; // Decide what to show: short or long + string lblString = ShowLegend ? item.Label : item.Description; // Decide what to show: short or long graph.DrawString(lblString, lblFont, brs, recLbl, lblFormat); } @@ -665,7 +635,7 @@ namespace Server.Engines.Reports try { - lblFont = new Font(_fontFamily, _legendFontSize); + lblFont = new Font(FontFamily, _legendFontSize); brs = new SolidBrush(_fontColor); lblFormat = new StringFormat(); pen = new Pen(_fontColor); @@ -723,7 +693,7 @@ namespace Server.Engines.Reports float currentTick; string tickString; - for (int i=0; i<_yTickCount; i++) + for (int i=0; i _dataPoints; - set => _dataPoints = value; - } + public ChartItemsCollection DataPoints { get; set; } = new ChartItemsCollection(); public void SetColor(int index, Color NewColor) { diff --git a/Scripts/Engines/Reports/Rendering/DataItem.cs b/Scripts/Engines/Reports/Rendering/DataItem.cs index 2e7f30b13..d07aeb32e 100644 --- a/Scripts/Engines/Reports/Rendering/DataItem.cs +++ b/Scripts/Engines/Reports/Rendering/DataItem.cs @@ -15,60 +15,29 @@ namespace Server.Engines.Reports public class DataItem { - private string _label; - private string _description; - private float _value; - private Color _color; - private float _startPos; - private float _sweepSize; - private DataItem() {} public DataItem(string label, string desc, float data, float start, float sweep, Color clr) { - _label = label; - _description = desc; - _value = data; - _startPos = start; - _sweepSize = sweep; - _color = clr; + Label = label; + Description = desc; + Value = data; + StartPos = start; + SweepSize = sweep; + ItemColor = clr; } - public string Label - { - get => _label; - set => _label = value; - } + public string Label { get; set; } - public string Description - { - get => _description; - set => _description = value; - } + public string Description { get; set; } - public float Value - { - get => _value; - set => _value = value; - } + public float Value { get; set; } - public Color ItemColor - { - get => _color; - set => _color = value; - } + public Color ItemColor { get; set; } - public float StartPos - { - get => _startPos; - set => _startPos = value; - } + public float StartPos { get; set; } - public float SweepSize - { - get => _sweepSize; - set => _sweepSize = value; - } + public float SweepSize { get; set; } } //********************************************************************* diff --git a/Scripts/Engines/Reports/Rendering/PieChartRenderer.cs b/Scripts/Engines/Reports/Rendering/PieChartRenderer.cs index 0401bfa7f..15197b4ca 100644 --- a/Scripts/Engines/Reports/Rendering/PieChartRenderer.cs +++ b/Scripts/Engines/Reports/Rendering/PieChartRenderer.cs @@ -28,11 +28,8 @@ namespace Server.Engines.Reports private int _legendFontHeight; private string _legendFontStyle; private float _legendFontSize; - private bool _showPercents; - public bool ShowPercents{ get => _showPercents; - set => _showPercents = value; - } + public bool ShowPercents { get; set; } public PieChartRenderer() { @@ -131,7 +128,7 @@ namespace Server.Engines.Reports if ( fnt == null ) fnt = new Font( _legendFontStyle, _legendFontSize ); - if ( _showPercents && item.SweepSize > 10 ) + if ( ShowPercents && item.SweepSize > 10 ) { if ( sfp == null ) { diff --git a/Scripts/Engines/Reports/Reports.cs b/Scripts/Engines/Reports/Reports.cs index 1003701fc..53d55d544 100644 --- a/Scripts/Engines/Reports/Reports.cs +++ b/Scripts/Engines/Reports/Reports.cs @@ -22,8 +22,8 @@ namespace Server.Engines.Reports m_StatsHistory = new SnapshotHistory(); m_StatsHistory.Load(); - m_StaffHistory = new StaffHistory(); - m_StaffHistory.Load(); + StaffHistory = new StaffHistory(); + StaffHistory.Load(); DateTime now = DateTime.UtcNow; @@ -47,9 +47,8 @@ namespace Server.Engines.Reports } private static SnapshotHistory m_StatsHistory; - private static StaffHistory m_StaffHistory; - public static StaffHistory StaffHistory => m_StaffHistory; + public static StaffHistory StaffHistory { get; private set; } public static void Generate() { @@ -60,7 +59,7 @@ namespace Server.Engines.Reports FillSnapshot( ss ); m_StatsHistory.Snapshots.Add( ss ); - m_StaffHistory.QueueStats.Add( new QueueStatus( Help.PageQueue.List.Count ) ); + StaffHistory.QueueStats.Add( new QueueStatus( Help.PageQueue.List.Count ) ); ThreadPool.QueueUserWorkItem( UpdateOutput, ss ); } @@ -68,13 +67,13 @@ namespace Server.Engines.Reports private static void UpdateOutput( object state ) { m_StatsHistory.Save(); - m_StaffHistory.Save(); + StaffHistory.Save(); HtmlRenderer renderer = new HtmlRenderer( "stats", (Snapshot) state, m_StatsHistory ); renderer.Render(); renderer.Upload(); - renderer = new HtmlRenderer( "staff", m_StaffHistory ); + renderer = new HtmlRenderer( "staff", StaffHistory ); renderer.Render(); renderer.Upload(); } diff --git a/Scripts/Engines/Spawner/ProximitySpawner.cs b/Scripts/Engines/Spawner/ProximitySpawner.cs index 9b1ca9d65..4fb8e63a2 100644 --- a/Scripts/Engines/Spawner/ProximitySpawner.cs +++ b/Scripts/Engines/Spawner/ProximitySpawner.cs @@ -4,30 +4,14 @@ namespace Server.Mobiles { public class ProximitySpawner : Spawner { - private int m_TriggerRange; - private TextDefinition m_SpawnMessage; - private bool m_InstantFlag; + [CommandProperty( AccessLevel.Developer )] + public int TriggerRange { get; set; } [CommandProperty( AccessLevel.Developer )] - public int TriggerRange - { - get => m_TriggerRange; - set => m_TriggerRange = value; - } + public TextDefinition SpawnMessage { get; set; } [CommandProperty( AccessLevel.Developer )] - public TextDefinition SpawnMessage - { - get => m_SpawnMessage; - set => m_SpawnMessage = value; - } - - [CommandProperty( AccessLevel.Developer )] - public bool InstantFlag - { - get => m_InstantFlag; - set => m_InstantFlag = value; - } + public bool InstantFlag { get; set; } [Constructible] public ProximitySpawner() @@ -50,9 +34,9 @@ namespace Server.Mobiles public ProximitySpawner( int amount, int minDelay, int maxDelay, int team, int homeRange, int triggerRange, string spawnMessage, bool instantFlag, string spawnName ) : base( amount, minDelay, maxDelay, team, homeRange, spawnName ) { - m_TriggerRange = triggerRange; - m_SpawnMessage = TextDefinition.Parse( spawnMessage ); - m_InstantFlag = instantFlag; + TriggerRange = triggerRange; + SpawnMessage = TextDefinition.Parse( spawnMessage ); + InstantFlag = instantFlag; } public ProximitySpawner( int amount, TimeSpan minDelay, TimeSpan maxDelay, int team, int homeRange, params string[] spawnedNames ) @@ -63,9 +47,9 @@ namespace Server.Mobiles public ProximitySpawner( int amount, TimeSpan minDelay, TimeSpan maxDelay, int team, int homeRange, int triggerRange, TextDefinition spawnMessage, bool instantFlag, params string[] spawnedNames ) : base( amount, minDelay, maxDelay, team, homeRange, spawnedNames ) { - m_TriggerRange = triggerRange; - m_SpawnMessage = spawnMessage; - m_InstantFlag = instantFlag; + TriggerRange = triggerRange; + SpawnMessage = spawnMessage; + InstantFlag = instantFlag; } public override string DefaultName => "Proximity Spawner"; @@ -100,14 +84,14 @@ namespace Server.Mobiles if ( !Running ) return; - if ( IsEmpty && End <= DateTime.UtcNow && m.InRange( GetWorldLocation(), m_TriggerRange ) && m.Location != oldLocation && ValidTrigger( m ) ) + if ( IsEmpty && End <= DateTime.UtcNow && m.InRange( GetWorldLocation(), TriggerRange ) && m.Location != oldLocation && ValidTrigger( m ) ) { - TextDefinition.SendMessageTo( m, m_SpawnMessage ); + TextDefinition.SendMessageTo( m, SpawnMessage ); DoTimer(); Spawn(); - if ( m_InstantFlag ) + if ( InstantFlag ) { foreach ( ISpawnable spawned in Spawned.Keys ) if ( spawned is Mobile mobile ) @@ -127,9 +111,9 @@ namespace Server.Mobiles writer.WriteEncodedInt( (int) 0 ); // version - writer.Write( m_TriggerRange ); - TextDefinition.Serialize( writer, m_SpawnMessage ); - writer.Write( m_InstantFlag ); + writer.Write( TriggerRange ); + TextDefinition.Serialize( writer, SpawnMessage ); + writer.Write( InstantFlag ); } public override void Deserialize( GenericReader reader ) @@ -138,9 +122,9 @@ namespace Server.Mobiles int version = reader.ReadEncodedInt(); - m_TriggerRange = reader.ReadInt(); - m_SpawnMessage = TextDefinition.Deserialize( reader ); - m_InstantFlag = reader.ReadBool(); + TriggerRange = reader.ReadInt(); + SpawnMessage = TextDefinition.Deserialize( reader ); + InstantFlag = reader.ReadBool(); } } } diff --git a/Scripts/Engines/Spawner/Spawner.cs b/Scripts/Engines/Spawner/Spawner.cs index ecfe497c4..5a8c8545c 100644 --- a/Scripts/Engines/Spawner/Spawner.cs +++ b/Scripts/Engines/Spawner/Spawner.cs @@ -17,34 +17,28 @@ namespace Server.Mobiles private TimeSpan m_MinDelay; private TimeSpan m_MaxDelay; - private List m_Entries; - private Dictionary m_Spawned; - - private DateTime m_End; private InternalTimer m_Timer; private bool m_Running; private bool m_Group; - private WayPoint m_WayPoint; public override string DefaultName => "Spawner"; - public bool IsFull => ( m_Spawned != null && m_Spawned.Count >= m_Count ); - public bool IsEmpty => ( m_Spawned != null && m_Spawned.Count == 0 ); + public bool IsFull => ( Spawned != null && Spawned.Count >= m_Count ); + public bool IsEmpty => ( Spawned != null && Spawned.Count == 0 ); public Point3D HomeLocation => Location; public bool UnlinkOnTaming => true; - public DateTime End{ get => m_End; - set => m_End = value; - } + public DateTime End { get; set; } - public List Entries => m_Entries; - public Dictionary Spawned => m_Spawned; + public List Entries { get; private set; } + + public Dictionary Spawned { get; private set; } public override void OnAfterDuped( Item newItem ) { if ( newItem is Spawner newSpawner ) { - for ( int i = 0; i < m_Entries.Count; i++ ) - newSpawner.AddEntry( m_Entries[i].SpawnedName, m_Entries[i].SpawnedProbability, m_Entries[i].SpawnedMaxCount, false ); + for ( int i = 0; i < Entries.Count; i++ ) + newSpawner.AddEntry( Entries[i].SpawnedName, Entries[i].SpawnedProbability, Entries[i].SpawnedMaxCount, false ); } } @@ -67,9 +61,7 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.Developer )] - public WayPoint WayPoint{ get => m_WayPoint; - set => m_WayPoint = value; - } + public WayPoint WayPoint { get; set; } [CommandProperty( AccessLevel.Developer )] public bool Running @@ -112,7 +104,7 @@ namespace Server.Mobiles get { if ( m_Running && m_Timer != null && m_Timer.Running ) - return m_End - DateTime.UtcNow; + return End - DateTime.UtcNow; return TimeSpan.FromSeconds( 0 ); } set @@ -166,7 +158,7 @@ namespace Server.Mobiles public SpawnerEntry AddEntry( string creaturename, int probability, int amount, bool dotimer ) { SpawnerEntry entry = new SpawnerEntry( creaturename, probability, amount ); - m_Entries.Add( entry ); + Entries.Add( entry ); if ( dotimer ) DoTimer( TimeSpan.FromSeconds( 1 ) ); @@ -184,8 +176,8 @@ namespace Server.Mobiles m_Count = amount; m_Team = team; m_HomeRange = homeRange; - m_Entries = new List(); - m_Spawned = new Dictionary(); + Entries = new List(); + Spawned = new Dictionary(); DoTimer( TimeSpan.FromSeconds( 1 ) ); } @@ -216,8 +208,8 @@ namespace Server.Mobiles list.Add( 1060659, "team\t{0}", m_Team ); // ~1_val~: ~2_val~ list.Add( 1060660, "speed\t{0} to {1}", m_MinDelay, m_MaxDelay ); // ~1_val~: ~2_val~ - for ( int i = 0; i < 3 && i < m_Entries.Count; ++i ) - list.Add( 1060661 + i, "{0}\t{1}", m_Entries[i].SpawnedName, CountSpawns( m_Entries[i] ) ); + for ( int i = 0; i < 3 && i < Entries.Count; ++i ) + list.Add( 1060661 + i, "{0}\t{1}", Entries[i].SpawnedName, CountSpawns( Entries[i] ) ); } else list.Add( 1060743 ); // inactive @@ -237,7 +229,7 @@ namespace Server.Mobiles { if ( !m_Running ) { - if ( m_Entries.Count > 0 ) + if ( Entries.Count > 0 ) { m_Running = true; DoTimer(); @@ -256,11 +248,11 @@ namespace Server.Mobiles public void Defrag() { - if ( m_Entries == null ) - m_Entries = new List(); + if ( Entries == null ) + Entries = new List(); - for ( int i = 0; i < m_Entries.Count; ++i ) - m_Entries[i].Defrag( this ); + for ( int i = 0; i < Entries.Count; ++i ) + Entries[i].Defrag( this ); } public void OnTick() @@ -271,7 +263,7 @@ namespace Server.Mobiles { Defrag(); - if ( m_Spawned.Count > 0 ) + if ( Spawned.Count > 0 ) return; Respawn(); @@ -304,21 +296,21 @@ namespace Server.Mobiles { Defrag(); - if ( m_Entries.Count > 0 && !IsFull ) + if ( Entries.Count > 0 && !IsFull ) { int probsum = 0; - for ( int i = 0; i < m_Entries.Count; i++ ) - if ( !m_Entries[i].IsFull ) - probsum += m_Entries[i].SpawnedProbability; + for ( int i = 0; i < Entries.Count; i++ ) + if ( !Entries[i].IsFull ) + probsum += Entries[i].SpawnedProbability; if ( probsum > 0 ) { int rand = Utility.RandomMinMax( 1, probsum ); - for ( int i = 0; i < m_Entries.Count; i++ ) + for ( int i = 0; i < Entries.Count; i++ ) { - SpawnerEntry entry = m_Entries[i]; + SpawnerEntry entry = Entries[i]; if ( !entry.IsFull ) { bool success = true; @@ -400,8 +392,8 @@ namespace Server.Mobiles public bool Spawn( int index, out EntryFlags flags ) { - if ( index >= 0 && index < m_Entries.Count ) - return Spawn( m_Entries[index], out flags ); + if ( index >= 0 && index < Entries.Count ) + return Spawn( Entries[index], out flags ); flags = EntryFlags.InvalidEntry; return false; } @@ -491,7 +483,7 @@ namespace Server.Mobiles if ( o is Mobile m ) { - m_Spawned.Add( m, entry ); + Spawned.Add( m, entry ); entry.Spawned.Add( m ); Point3D loc = ( m is BaseVendor ? Location : GetSpawnPosition( m, map ) ); @@ -524,7 +516,7 @@ namespace Server.Mobiles } else if ( o is Item item ) { - m_Spawned.Add( item, entry ); + Spawned.Add( item, entry ); entry.Spawned.Add( item ); Point3D loc = GetSpawnPosition( item, map ); @@ -564,7 +556,7 @@ namespace Server.Mobiles public virtual WayPoint GetWayPoint() { - return m_WayPoint; + return WayPoint; } public virtual Point3D GetSpawnPosition( ISpawnable spawned, Map map ) @@ -659,7 +651,7 @@ namespace Server.Mobiles if ( !m_Running ) return; - m_End = DateTime.UtcNow + delay; + End = DateTime.UtcNow + delay; m_Timer?.Stop(); @@ -708,7 +700,7 @@ namespace Server.Mobiles e?.Delete(); } - m_Entries.Remove( entry ); + Entries.Remove( entry ); if ( m_Running && !IsFull && m_Timer != null && !m_Timer.Running ) DoTimer(); @@ -722,11 +714,11 @@ namespace Server.Mobiles if ( spawn != null ) { - m_Spawned.TryGetValue( spawn, out SpawnerEntry entry ); + Spawned.TryGetValue( spawn, out SpawnerEntry entry ); entry?.Spawned.Remove( spawn ); - m_Spawned.Remove( spawn ); + Spawned.Remove( spawn ); } if ( m_Running && !IsFull && m_Timer != null && !m_Timer.Running ) @@ -735,8 +727,8 @@ namespace Server.Mobiles public void RemoveSpawn( int index ) //Entry { - if ( index >= 0 && index < m_Entries.Count ) - RemoveSpawn( m_Entries[index] ); + if ( index >= 0 && index < Entries.Count ) + RemoveSpawn( Entries[index] ); } public void RemoveSpawn( SpawnerEntry entry ) @@ -748,7 +740,7 @@ namespace Server.Mobiles if ( e != null ) { entry.Spawned.RemoveAt( i ); - m_Spawned.Remove( e ); + Spawned.Remove( e ); e.Delete(); } @@ -759,9 +751,9 @@ namespace Server.Mobiles { Defrag(); - for ( int i = 0;i < m_Entries.Count; i++ ) + for ( int i = 0;i < Entries.Count; i++ ) { - SpawnerEntry entry = m_Entries[i]; + SpawnerEntry entry = Entries[i]; for ( int j = entry.Spawned.Count - 1; j >= 0; j-- ) { @@ -769,7 +761,7 @@ namespace Server.Mobiles if ( e != null ) { - m_Spawned.Remove( e ); + Spawned.Remove( e ); entry.Spawned.RemoveAt( j ); e.Delete(); } @@ -786,7 +778,7 @@ namespace Server.Mobiles { Defrag(); - foreach( ISpawnable e in m_Spawned.Keys ) + foreach( ISpawnable e in Spawned.Keys ) { e?.MoveToWorld( Location, Map ); } @@ -806,14 +798,14 @@ namespace Server.Mobiles writer.Write( (int) 7 ); // version - writer.Write( m_Entries.Count ); + writer.Write( Entries.Count ); - for ( int i = 0; i < m_Entries.Count; ++i ) - m_Entries[i].Serialize( writer ); + for ( int i = 0; i < Entries.Count; ++i ) + Entries[i].Serialize( writer ); writer.Write( m_WalkingRange ); - writer.Write( m_WayPoint ); + writer.Write( WayPoint ); writer.Write( m_Group ); @@ -825,7 +817,7 @@ namespace Server.Mobiles writer.Write( m_Running ); if ( m_Running ) - writer.WriteDeltaTime( m_End ); + writer.WriteDeltaTime( End ); } private static WarnTimer m_WarnTimer; @@ -836,10 +828,10 @@ namespace Server.Mobiles int version = reader.ReadInt(); - m_Spawned = new Dictionary(); + Spawned = new Dictionary(); if ( version < 7 ) - m_Entries = new List(); + Entries = new List(); switch ( version ) { @@ -847,10 +839,10 @@ namespace Server.Mobiles { int size = reader.ReadInt(); - m_Entries = new List( size ); + Entries = new List( size ); for ( int i = 0; i < size; ++i ) - m_Entries.Add( new SpawnerEntry( this, reader ) ); + Entries.Add( new SpawnerEntry( this, reader ) ); goto case 4; //Skip the other crap } @@ -858,13 +850,13 @@ namespace Server.Mobiles { int size = reader.ReadInt(); - bool addentries = m_Entries.Count == 0; + bool addentries = Entries.Count == 0; for ( int i = 0; i < size; ++i ) if ( addentries ) - m_Entries.Add( new SpawnerEntry( string.Empty, 100, reader.ReadInt() ) ); + Entries.Add( new SpawnerEntry( string.Empty, 100, reader.ReadInt() ) ); else - m_Entries[i].SpawnedMaxCount = reader.ReadInt(); + Entries[i].SpawnedMaxCount = reader.ReadInt(); goto case 5; } @@ -872,13 +864,13 @@ namespace Server.Mobiles { int size = reader.ReadInt(); - bool addentries = m_Entries.Count == 0; + bool addentries = Entries.Count == 0; for ( int i = 0; i < size; ++i ) if ( addentries ) - m_Entries.Add( new SpawnerEntry( string.Empty, reader.ReadInt(), 1 ) ); + Entries.Add( new SpawnerEntry( string.Empty, reader.ReadInt(), 1 ) ); else - m_Entries[i].SpawnedProbability = reader.ReadInt(); + Entries[i].SpawnedProbability = reader.ReadInt(); goto case 4; } @@ -891,7 +883,7 @@ namespace Server.Mobiles case 3: case 2: { - m_WayPoint = reader.ReadItem() as WayPoint; + WayPoint = reader.ReadItem() as WayPoint; goto case 1; } @@ -921,16 +913,16 @@ namespace Server.Mobiles { int size = reader.ReadInt(); - bool addentries = m_Entries.Count == 0; + bool addentries = Entries.Count == 0; for ( int i = 0; i < size; ++i ) { string typeName = reader.ReadString(); if ( addentries ) - m_Entries.Add( new SpawnerEntry( typeName, 100, 1 ) ); + Entries.Add( new SpawnerEntry( typeName, 100, 1 ) ); else - m_Entries[i].SpawnedName = typeName; + Entries[i].SpawnedName = typeName; if ( SpawnerType.GetType( typeName ) == null ) { @@ -952,12 +944,12 @@ namespace Server.Mobiles e.Spawner = this; - for ( int j = 0;j < m_Entries.Count; j++ ) + for ( int j = 0;j < Entries.Count; j++ ) { - if ( SpawnerType.GetType( m_Entries[j].SpawnedName ) == e.GetType() ) + if ( SpawnerType.GetType( Entries[j].SpawnedName ) == e.GetType() ) { - m_Entries[j].Spawned.Add( e ); - m_Spawned.Add( e, m_Entries[j] ); + Entries[j].Spawned.Add( e ); + Spawned.Add( e, Entries[j] ); break; } } @@ -1062,75 +1054,46 @@ namespace Server.Mobiles public class SpawnerEntry { - private string m_SpawnedName; - private int m_SpawnedProbability; - private List m_Spawned; - private int m_SpawnedMaxCount; - private string m_Properties; - private string m_Parameters; - private EntryFlags m_Valid; + public int SpawnedProbability { get; set; } - public int SpawnedProbability - { - get => m_SpawnedProbability; - set => m_SpawnedProbability = value; - } + public int SpawnedMaxCount { get; set; } - public int SpawnedMaxCount - { - get => m_SpawnedMaxCount; - set => m_SpawnedMaxCount = value; - } + public string SpawnedName { get; set; } - public string SpawnedName - { - get => m_SpawnedName; - set => m_SpawnedName = value; - } + public string Properties { get; set; } - public string Properties - { - get => m_Properties; - set => m_Properties = value; - } + public string Parameters { get; set; } - public string Parameters - { - get => m_Parameters; - set => m_Parameters = value; - } + public EntryFlags Valid { get; set; } - public EntryFlags Valid{ get => m_Valid; - set => m_Valid = value; - } + public List Spawned { get; } - public List Spawned => m_Spawned; - public bool IsFull => m_Spawned.Count >= m_SpawnedMaxCount; + public bool IsFull => Spawned.Count >= SpawnedMaxCount; public SpawnerEntry( string name, int probability, int maxcount ) { - m_SpawnedName = name; - m_SpawnedProbability = probability; - m_SpawnedMaxCount = maxcount; - m_Spawned = new List(); + SpawnedName = name; + SpawnedProbability = probability; + SpawnedMaxCount = maxcount; + Spawned = new List(); } public void Serialize( GenericWriter writer ) { writer.Write( (int) 0 ); // version - writer.Write( m_SpawnedName ); - writer.Write( m_SpawnedProbability ); - writer.Write( m_SpawnedMaxCount ); + writer.Write( SpawnedName ); + writer.Write( SpawnedProbability ); + writer.Write( SpawnedMaxCount ); - writer.Write( m_Properties ); - writer.Write( m_Parameters ); + writer.Write( Properties ); + writer.Write( Parameters ); - writer.Write( m_Spawned.Count ); + writer.Write( Spawned.Count ); - for ( int i = 0; i < m_Spawned.Count; ++i ) + for ( int i = 0; i < Spawned.Count; ++i ) { - object o = m_Spawned[i]; + object o = Spawned[i]; if ( o is Item item ) writer.Write( item ); @@ -1145,16 +1108,16 @@ namespace Server.Mobiles { int version = reader.ReadInt(); - m_SpawnedName = reader.ReadString(); - m_SpawnedProbability = reader.ReadInt(); - m_SpawnedMaxCount = reader.ReadInt(); + SpawnedName = reader.ReadString(); + SpawnedProbability = reader.ReadInt(); + SpawnedMaxCount = reader.ReadInt(); - m_Properties = reader.ReadString(); - m_Parameters = reader.ReadString(); + Properties = reader.ReadString(); + Parameters = reader.ReadString(); int count = reader.ReadInt(); - m_Spawned = new List( count ); + Spawned = new List( count ); for ( int i = 0; i < count; ++i ) { @@ -1167,7 +1130,7 @@ namespace Server.Mobiles if ( e is BaseCreature creature ) creature.RemoveIfUntamed = true; - m_Spawned.Add( e ); + Spawned.Add( e ); if ( !parent.Spawned.ContainsKey( e ) ) parent.Spawned.Add( e, this ); @@ -1177,9 +1140,9 @@ namespace Server.Mobiles public void Defrag( Spawner parent ) { - for ( int i = 0; i < m_Spawned.Count; ++i ) + for ( int i = 0; i < Spawned.Count; ++i ) { - ISpawnable e = m_Spawned[i]; + ISpawnable e = Spawned[i]; bool remove = false; if ( e is Item item ) @@ -1214,7 +1177,7 @@ namespace Server.Mobiles if ( remove ) { - m_Spawned.RemoveAt( i-- ); + Spawned.RemoveAt( i-- ); if ( parent.Spawned.ContainsKey( e ) ) parent.Spawned.Remove( e ); } diff --git a/Scripts/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs b/Scripts/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs index 10384bcc9..60b5de556 100644 --- a/Scripts/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs +++ b/Scripts/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs @@ -68,9 +68,8 @@ namespace Server.Items #region Old Item Serialization Vars /* DO NOT USE! Only used in serialization of pigments that originally derived from Item */ - private bool m_InheritsItem; - protected bool InheritsItem => m_InheritsItem; + protected bool InheritsItem { get; private set; } #endregion @@ -220,7 +219,7 @@ namespace Server.Items } case 0: // Old pigments that inherited from item { - m_InheritsItem = true; + InheritsItem = true; if ( this is LesserPigmentsOfTokuno ) ((LesserPigmentsOfTokuno)this).Type = (LesserPigmentType)reader.ReadEncodedInt(); diff --git a/Scripts/Engines/Treasures of Tokuno/LesserArtifacts.cs b/Scripts/Engines/Treasures of Tokuno/LesserArtifacts.cs index 089fb6aed..75e1382af 100644 --- a/Scripts/Engines/Treasures of Tokuno/LesserArtifacts.cs +++ b/Scripts/Engines/Treasures of Tokuno/LesserArtifacts.cs @@ -625,45 +625,44 @@ namespace Server.Items public class AncientUrn : Item { - private static string[] m_Names = { - "Akira", - "Avaniaga", - "Aya", - "Chie", - "Emiko", - "Fumiyo", - "Gennai", - "Gennosuke", - "Genjo", - "Hamato", - "Harumi", - "Ikuyo", - "Juri", - "Kaori", - "Kaoru", - "Kiyomori", - "Mayako", - "Motoki", - "Musashi", - "Nami", - "Nobukazu", - "Roku", - "Romi", - "Ryo", - "Sanzo", - "Sakamae", - "Satoshi", - "Takamori", - "Takuro", - "Teruyo", - "Toshiro", - "Yago", - "Yeijiro", - "Yoshi", - "Zeshin" - }; - - public static string[] Names => m_Names; + public static string[] Names { get; } = + { + "Akira", + "Avaniaga", + "Aya", + "Chie", + "Emiko", + "Fumiyo", + "Gennai", + "Gennosuke", + "Genjo", + "Hamato", + "Harumi", + "Ikuyo", + "Juri", + "Kaori", + "Kaoru", + "Kiyomori", + "Mayako", + "Motoki", + "Musashi", + "Nami", + "Nobukazu", + "Roku", + "Romi", + "Ryo", + "Sanzo", + "Sakamae", + "Satoshi", + "Takamori", + "Takuro", + "Teruyo", + "Toshiro", + "Yago", + "Yeijiro", + "Yoshi", + "Zeshin" + }; private string m_UrnName; @@ -684,7 +683,7 @@ namespace Server.Items } [Constructible] - public AncientUrn() : this( m_Names[Utility.Random( m_Names.Length )] ) + public AncientUrn() : this( Names[Utility.Random( Names.Length )] ) { } diff --git a/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs b/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs index 582b29f54..72141e6e2 100644 --- a/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs +++ b/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs @@ -21,30 +21,18 @@ namespace Server.Misc { public const int ItemsPerReward = 10; - private static Type[] m_LesserArtifactsTotal = { - typeof( AncientFarmersKasa ), typeof( AncientSamuraiDo ), typeof( ArmsOfTacticalExcellence ), typeof( BlackLotusHood ), - typeof( DaimyosHelm ), typeof( DemonForks ), typeof( DragonNunchaku ), typeof( Exiler ), typeof( GlovesOfTheSun ), - typeof( HanzosBow ), typeof( LegsOfStability ), typeof( PeasantsBokuto ), typeof( PilferedDancerFans ), typeof( TheDestroyer ), - typeof( TomeOfEnlightenment ), typeof( AncientUrn ), typeof( HonorableSwords ), typeof( PigmentsOfTokuno ), typeof( FluteOfRenewal ), - typeof( LeurociansMempoOfFortune ), typeof( LesserPigmentsOfTokuno ), typeof( MetalPigmentsOfTokuno ), typeof( ChestOfHeirlooms ) - }; - - public static Type[] LesserArtifactsTotal => m_LesserArtifactsTotal; - - private static TreasuresOfTokunoEra _DropEra = TreasuresOfTokunoEra.None; - private static TreasuresOfTokunoEra _RewardEra = TreasuresOfTokunoEra.ToTOne; - - public static TreasuresOfTokunoEra DropEra + public static Type[] LesserArtifactsTotal { get; } = { - get => _DropEra; - set => _DropEra = value; - } + typeof( AncientFarmersKasa ), typeof( AncientSamuraiDo ), typeof( ArmsOfTacticalExcellence ), typeof( BlackLotusHood ), + typeof( DaimyosHelm ), typeof( DemonForks ), typeof( DragonNunchaku ), typeof( Exiler ), typeof( GlovesOfTheSun ), + typeof( HanzosBow ), typeof( LegsOfStability ), typeof( PeasantsBokuto ), typeof( PilferedDancerFans ), typeof( TheDestroyer ), + typeof( TomeOfEnlightenment ), typeof( AncientUrn ), typeof( HonorableSwords ), typeof( PigmentsOfTokuno ), typeof( FluteOfRenewal ), + typeof( LeurociansMempoOfFortune ), typeof( LesserPigmentsOfTokuno ), typeof( MetalPigmentsOfTokuno ), typeof( ChestOfHeirlooms ) + }; - public static TreasuresOfTokunoEra RewardEra - { - get => _RewardEra; - set => _RewardEra = value; - } + public static TreasuresOfTokunoEra DropEra { get; set; } = TreasuresOfTokunoEra.None; + + public static TreasuresOfTokunoEra RewardEra { get; set; } = TreasuresOfTokunoEra.ToTOne; private static Type[][] m_LesserArtifacts = { // ToT One Rewards @@ -284,17 +272,11 @@ namespace Server.Gumps { public class ItemTileButtonInfo : ImageTileButtonInfo { - private Item m_Item; - - public Item Item - { - get => m_Item; - set => m_Item = value; - } + public Item Item { get; set; } public ItemTileButtonInfo( Item i ) : base( i.ItemID, i.Hue, ((i.Name == null || i.Name.Length <= 0)? (TextDefinition)i.LabelNumber : (TextDefinition)i.Name ) ) { - m_Item = i; + Item = i; } } @@ -394,13 +376,11 @@ namespace Server.Gumps { public class TypeTileButtonInfo : ImageTileButtonInfo { - private Type m_Type; - - public Type Type => m_Type; + public Type Type { get; } public TypeTileButtonInfo( Type type, int itemID, int hue, TextDefinition label, int localizedToolTip ) : base( itemID, hue, label, localizedToolTip ) { - m_Type = type; + Type = type; } public TypeTileButtonInfo( Type type, int itemID, TextDefinition label ) : this( type, itemID, 0, label, -1 ) @@ -414,23 +394,20 @@ namespace Server.Gumps public class PigmentsTileButtonInfo : ImageTileButtonInfo { - private PigmentType m_Pigment; - - public PigmentType Pigment - { - get => m_Pigment; - - set => m_Pigment = value; - } + public PigmentType Pigment { get; set; } public PigmentsTileButtonInfo( PigmentType p ) : base( 0xEFF, PigmentsOfTokuno.GetInfo( p )[0], PigmentsOfTokuno.GetInfo( p )[1] ) { - m_Pigment = p; + Pigment = p; } } #region ToT Normal Rewards Table - private static TypeTileButtonInfo[][] m_NormalRewards = { + + #endregion + + public static TypeTileButtonInfo[][] NormalRewards { get; } = + { // ToT One Rewards new[] { new TypeTileButtonInfo( typeof( SwordsOfProsperity ), 0x27A9, 1070963, 1071002 ), @@ -470,12 +447,13 @@ namespace Server.Gumps new TypeTileButtonInfo( typeof( TomeOfLostKnowledge ), 0x0EFA, 0x530, 1070971, 1071009 ) } }; - #endregion - - public static TypeTileButtonInfo[][] NormalRewards => m_NormalRewards; #region ToT Pigment Rewards Table - private static PigmentsTileButtonInfo[][] m_PigmentRewards = { + + #endregion + + public static PigmentsTileButtonInfo[][] PigmentRewards { get; } = + { // ToT One Pigment Rewards new[] { new PigmentsTileButtonInfo( PigmentType.ParagonGold ), @@ -515,13 +493,10 @@ namespace Server.Gumps new PigmentsTileButtonInfo( PigmentType.FireOrange ) } }; - #endregion - - public static PigmentsTileButtonInfo[][] PigmentRewards => m_PigmentRewards; private Mobile m_Collector; - public ToTRedeemGump( Mobile collector, bool pigments ) : base( pigments ? 1070986 : 1070985, pigments ? (ImageTileButtonInfo[])m_PigmentRewards[(int)TreasuresOfTokuno.RewardEra-1] : (ImageTileButtonInfo[])m_NormalRewards[(int)TreasuresOfTokuno.RewardEra-1] ) + public ToTRedeemGump( Mobile collector, bool pigments ) : base( pigments ? 1070986 : 1070985, pigments ? (ImageTileButtonInfo[])PigmentRewards[(int)TreasuresOfTokuno.RewardEra-1] : (ImageTileButtonInfo[])NormalRewards[(int)TreasuresOfTokuno.RewardEra-1] ) { m_Collector = collector; } diff --git a/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokunoPersistance.cs b/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokunoPersistance.cs index 2e596d8c8..b41e213d1 100644 --- a/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokunoPersistance.cs +++ b/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokunoPersistance.cs @@ -2,15 +2,13 @@ namespace Server.Misc { public class TreasuresOfTokunoPersistance : Item { - private static TreasuresOfTokunoPersistance m_Instance; - - public static TreasuresOfTokunoPersistance Instance => m_Instance; + public static TreasuresOfTokunoPersistance Instance { get; private set; } public override string DefaultName => "TreasuresOfTokuno Persistance - Internal"; public static void Initialize() { - if ( m_Instance == null ) + if ( Instance == null ) new TreasuresOfTokunoPersistance(); } @@ -18,15 +16,15 @@ namespace Server.Misc { Movable = false; - if ( m_Instance == null || m_Instance.Deleted ) - m_Instance = this; + if ( Instance == null || Instance.Deleted ) + Instance = this; else base.Delete(); } public TreasuresOfTokunoPersistance( Serial serial ) : base( serial ) { - m_Instance = this; + Instance = this; } public override void Serialize( GenericWriter writer ) diff --git a/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs b/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs index dd0fd08b0..73bb9c8fd 100644 --- a/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs +++ b/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs @@ -66,7 +66,6 @@ namespace Server.Mobiles } private Mobile m_SculptedBy; - private DateTime m_SculptedOn; [CommandProperty( AccessLevel.GameMaster )] public Mobile SculptedBy @@ -76,28 +75,12 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public DateTime SculptedOn - { - get => m_SculptedOn; - set => m_SculptedOn = value; - } + public DateTime SculptedOn { get; set; } - private CharacterStatuePlinth m_Plinth; - - public CharacterStatuePlinth Plinth - { - get => m_Plinth; - set => m_Plinth = value; - } - - private bool m_IsRewardItem; + public CharacterStatuePlinth Plinth { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool IsRewardItem - { - get => m_IsRewardItem; - set => m_IsRewardItem = value; - } + public bool IsRewardItem { get; set; } public CharacterStatue( Mobile from, StatueType type ) { @@ -155,24 +138,24 @@ namespace Server.Mobiles { base.OnAfterDelete(); - if ( m_Plinth != null && !m_Plinth.Deleted ) - m_Plinth.Delete(); + if ( Plinth != null && !Plinth.Deleted ) + Plinth.Delete(); } protected override void OnMapChange( Map oldMap ) { InvalidatePose(); - if ( m_Plinth != null ) - m_Plinth.Map = Map; + if ( Plinth != null ) + Plinth.Map = Map; } protected override void OnLocationChange( Point3D oldLocation ) { InvalidatePose(); - if ( m_Plinth != null ) - m_Plinth.Location = new Point3D( X, Y, Z - 5 ); + if ( Plinth != null ) + Plinth.Location = new Point3D( X, Y, Z - 5 ); } public override bool CanBeRenamedBy( Mobile from ) @@ -205,10 +188,10 @@ namespace Server.Mobiles writer.Write( (int) m_Material ); writer.Write( (Mobile) m_SculptedBy ); - writer.Write( (DateTime) m_SculptedOn ); + writer.Write( (DateTime) SculptedOn ); - writer.Write( (Item) m_Plinth ); - writer.Write( (bool) m_IsRewardItem ); + writer.Write( (Item) Plinth ); + writer.Write( (bool) IsRewardItem ); } public override void Deserialize( GenericReader reader ) @@ -222,10 +205,10 @@ namespace Server.Mobiles m_Material = (StatueMaterial) reader.ReadInt(); m_SculptedBy = reader.ReadMobile(); - m_SculptedOn = reader.ReadDateTime(); + SculptedOn = reader.ReadDateTime(); - m_Plinth = reader.ReadItem() as CharacterStatuePlinth; - m_IsRewardItem = reader.ReadBool(); + Plinth = reader.ReadItem() as CharacterStatuePlinth; + IsRewardItem = reader.ReadBool(); InvalidatePose(); @@ -240,7 +223,7 @@ namespace Server.Mobiles public void Sculpt( Mobile by ) { m_SculptedBy = by; - m_SculptedOn = DateTime.UtcNow; + SculptedOn = DateTime.UtcNow; InvalidateProperties(); } @@ -255,9 +238,9 @@ namespace Server.Mobiles deed.Statue = this; deed.StatueType = m_Type; - deed.IsRewardItem = m_IsRewardItem; + deed.IsRewardItem = IsRewardItem; - m_Plinth?.Delete(); + Plinth?.Delete(); return true; } @@ -329,7 +312,7 @@ namespace Server.Mobiles for ( int i = Items.Count - 1; i >= 0; i -- ) Items[ i ].Hue = Hue; - m_Plinth?.InvalidateHue(); + Plinth?.InvalidateHue(); } private int m_Animation; @@ -416,9 +399,9 @@ namespace Server.Mobiles { StatueType t = m_Type; - if ( m_Statue != null ) + if ( Statue != null ) { - t = m_Statue.StatueType; + t = Statue.StatueType; } switch ( t ) @@ -431,24 +414,19 @@ namespace Server.Mobiles } } - private CharacterStatue m_Statue; private StatueType m_Type; private bool m_IsRewardItem; [CommandProperty( AccessLevel.GameMaster )] - public CharacterStatue Statue - { - get => m_Statue; - set => m_Statue = value; - } + public CharacterStatue Statue { get; set; } [CommandProperty( AccessLevel.GameMaster )] public StatueType StatueType { get { - if ( m_Statue != null ) - return m_Statue.StatueType; + if ( Statue != null ) + return Statue.StatueType; return m_Type; } @@ -464,7 +442,7 @@ namespace Server.Mobiles public CharacterStatueDeed( CharacterStatue statue ) : base( 0x14F0 ) { - m_Statue = statue; + Statue = statue; if ( statue != null ) { @@ -487,8 +465,8 @@ namespace Server.Mobiles if ( m_IsRewardItem ) list.Add( 1076222 ); // 6th Year Veteran Reward - if ( m_Statue != null ) - list.Add( 1076231, m_Statue.Name ); // Statue of ~1_Name~ + if ( Statue != null ) + list.Add( 1076231, Statue.Name ); // Statue of ~1_Name~ } public override void OnDoubleClick( Mobile from ) @@ -522,7 +500,7 @@ namespace Server.Mobiles { base.OnDelete(); - m_Statue?.Delete(); + Statue?.Delete(); } public override void Serialize( GenericWriter writer ) @@ -533,7 +511,7 @@ namespace Server.Mobiles writer.Write( (int) m_Type ); - writer.Write( (Mobile) m_Statue ); + writer.Write( (Mobile) Statue ); writer.Write( (bool) m_IsRewardItem ); } @@ -547,7 +525,7 @@ namespace Server.Mobiles m_Type = (StatueType) reader.ReadInt(); } - m_Statue = reader.ReadMobile() as CharacterStatue; + Statue = reader.ReadMobile() as CharacterStatue; m_IsRewardItem = reader.ReadBool(); } } diff --git a/Scripts/Engines/VeteranRewards/RewardCategory.cs b/Scripts/Engines/VeteranRewards/RewardCategory.cs index bb185c077..69d091e27 100644 --- a/Scripts/Engines/VeteranRewards/RewardCategory.cs +++ b/Scripts/Engines/VeteranRewards/RewardCategory.cs @@ -4,24 +4,22 @@ namespace Server.Engines.VeteranRewards { public class RewardCategory { - private int m_Name; - private string m_NameString; - private List m_Entries; + public int Name { get; } - public int Name => m_Name; - public string NameString => m_NameString; - public List Entries => m_Entries; + public string NameString { get; } + + public List Entries { get; } public RewardCategory( int name ) { - m_Name = name; - m_Entries = new List(); + Name = name; + Entries = new List(); } public RewardCategory( string name ) { - m_NameString = name; - m_Entries = new List(); + NameString = name; + Entries = new List(); } } } diff --git a/Scripts/Engines/VeteranRewards/RewardEntry.cs b/Scripts/Engines/VeteranRewards/RewardEntry.cs index a728aa22a..1e9e9f585 100644 --- a/Scripts/Engines/VeteranRewards/RewardEntry.cs +++ b/Scripts/Engines/VeteranRewards/RewardEntry.cs @@ -4,29 +4,25 @@ namespace Server.Engines.VeteranRewards { public class RewardEntry { - private RewardList m_List; - private RewardCategory m_Category; - private Type m_ItemType; - private Expansion m_RequiredExpansion; - private int m_Name; - private string m_NameString; - private object[] m_Args; + public RewardList List { get; set; } - public RewardList List{ get => m_List; - set => m_List = value; - } - public RewardCategory Category => m_Category; - public Type ItemType => m_ItemType; - public Expansion RequiredExpansion => m_RequiredExpansion; - public int Name => m_Name; - public string NameString => m_NameString; - public object[] Args => m_Args; + public RewardCategory Category { get; } + + public Type ItemType { get; } + + public Expansion RequiredExpansion { get; } + + public int Name { get; } + + public string NameString { get; } + + public object[] Args { get; } public Item Construct() { try { - Item item = Activator.CreateInstance( m_ItemType, m_Args ) as Item; + Item item = Activator.CreateInstance( ItemType, Args ) as Item; if ( item is IRewardItem rewardItem ) rewardItem.IsRewardItem = true; @@ -42,41 +38,41 @@ namespace Server.Engines.VeteranRewards public RewardEntry( RewardCategory category, int name, Type itemType, params object[] args ) { - m_Category = category; - m_ItemType = itemType; - m_RequiredExpansion = Expansion.None; - m_Name = name; - m_Args = args; + Category = category; + ItemType = itemType; + RequiredExpansion = Expansion.None; + Name = name; + Args = args; category.Entries.Add( this ); } public RewardEntry( RewardCategory category, string name, Type itemType, params object[] args ) { - m_Category = category; - m_ItemType = itemType; - m_RequiredExpansion = Expansion.None; - m_NameString = name; - m_Args = args; + Category = category; + ItemType = itemType; + RequiredExpansion = Expansion.None; + NameString = name; + Args = args; category.Entries.Add( this ); } public RewardEntry( RewardCategory category, int name, Type itemType, Expansion requiredExpansion, params object[] args ) { - m_Category = category; - m_ItemType = itemType; - m_RequiredExpansion = requiredExpansion; - m_Name = name; - m_Args = args; + Category = category; + ItemType = itemType; + RequiredExpansion = requiredExpansion; + Name = name; + Args = args; category.Entries.Add( this ); } public RewardEntry( RewardCategory category, string name, Type itemType, Expansion requiredExpansion, params object[] args ) { - m_Category = category; - m_ItemType = itemType; - m_RequiredExpansion = requiredExpansion; - m_NameString = name; - m_Args = args; + Category = category; + ItemType = itemType; + RequiredExpansion = requiredExpansion; + NameString = name; + Args = args; category.Entries.Add( this ); } } diff --git a/Scripts/Engines/VeteranRewards/RewardList.cs b/Scripts/Engines/VeteranRewards/RewardList.cs index 7a721b23a..6323f9f38 100644 --- a/Scripts/Engines/VeteranRewards/RewardList.cs +++ b/Scripts/Engines/VeteranRewards/RewardList.cs @@ -4,16 +4,14 @@ namespace Server.Engines.VeteranRewards { public class RewardList { - private TimeSpan m_Age; - private RewardEntry[] m_Entries; + public TimeSpan Age { get; } - public TimeSpan Age => m_Age; - public RewardEntry[] Entries => m_Entries; + public RewardEntry[] Entries { get; } public RewardList( TimeSpan interval, int index, RewardEntry[] entries ) { - m_Age = TimeSpan.FromDays( interval.TotalDays * index ); - m_Entries = entries; + Age = TimeSpan.FromDays( interval.TotalDays * index ); + Entries = entries; for ( int i = 0; i < entries.Length; ++i ) entries[i].List = this; diff --git a/Scripts/Engines/VeteranRewards/RewardOptionGump.cs b/Scripts/Engines/VeteranRewards/RewardOptionGump.cs index 55b595e1a..9d7e9a900 100644 --- a/Scripts/Engines/VeteranRewards/RewardOptionGump.cs +++ b/Scripts/Engines/VeteranRewards/RewardOptionGump.cs @@ -72,16 +72,14 @@ namespace Server.Gumps public class RewardOption { - private int m_ID; - private int m_Cliloc; + public int ID { get; } - public int ID => m_ID; - public int Cliloc => m_Cliloc; + public int Cliloc { get; } public RewardOption( int id, int cliloc ) { - m_ID = id; - m_Cliloc = cliloc; + ID = id; + Cliloc = cliloc; } } diff --git a/Scripts/Engines/Virtues/Honor.cs b/Scripts/Engines/Virtues/Honor.cs index 3cf2cae2c..9f055edb0 100644 --- a/Scripts/Engines/Virtues/Honor.cs +++ b/Scripts/Engines/Virtues/Honor.cs @@ -186,14 +186,9 @@ namespace Server public class HonorContext { - private PlayerMobile m_Source; - private Mobile m_Target; - private double m_HonorDamage; private int m_TotalDamage; - private int m_Perfection; - private enum FirstHit { NotDelivered, @@ -208,13 +203,14 @@ namespace Server private InternalTimer m_Timer; - public PlayerMobile Source => m_Source; - public Mobile Target => m_Target; + public PlayerMobile Source { get; } + + public Mobile Target { get; } public HonorContext( PlayerMobile source, Mobile target ) { - m_Source = source; - m_Target = target; + Source = source; + Target = target; m_FirstHit = FirstHit.NotDelivered; m_Poisoned = false; @@ -240,7 +236,7 @@ namespace Server public void OnSourceDamaged( Mobile from, int amount ) { - if ( from != m_Target ) + if ( from != Target ) return; if ( m_FirstHit == FirstHit.NotDelivered ) @@ -267,10 +263,10 @@ namespace Server m_TotalDamage += amount; - if ( from == m_Source ) + if ( from == Source ) { - if ( m_Target.CanSee( m_Source ) && m_Target.InLOS( m_Source ) && ( m_Source.InRange( m_Target, 1 ) - || ( m_Source.Location == m_InitialLocation && m_Source.Map == m_InitialMap ) ) ) + if ( Target.CanSee( Source ) && Target.InLOS( Source ) && ( Source.InRange( Target, 1 ) + || ( Source.Location == m_InitialLocation && Source.Map == m_InitialMap ) ) ) { m_HonorDamage += amount; } @@ -279,7 +275,7 @@ namespace Server m_HonorDamage += amount * 0.8; } } - else if ( from is BaseCreature creature && creature.GetMaster() == m_Source ) + else if ( from is BaseCreature creature && creature.GetMaster() == Source ) { m_HonorDamage += amount * 0.8; } @@ -287,53 +283,53 @@ namespace Server public void OnTargetHit( Mobile from ) { - if ( from != m_Source || m_Perfection == 100 ) + if ( from != Source || PerfectionDamageBonus == 100 ) return; int bushido = (int) from.Skills.Bushido.Value; if ( bushido < 50 ) return; - m_Perfection += bushido / 10; + PerfectionDamageBonus += bushido / 10; - if ( m_Perfection >= 100 ) + if ( PerfectionDamageBonus >= 100 ) { - m_Perfection = 100; - m_Source.SendLocalizedMessage( 1063254 ); // You have Achieved Perfection in inflicting damage to this opponent! + PerfectionDamageBonus = 100; + Source.SendLocalizedMessage( 1063254 ); // You have Achieved Perfection in inflicting damage to this opponent! } else { - m_Source.SendLocalizedMessage( 1063255 ); // You gain in Perfection as you precisely strike your opponent. + Source.SendLocalizedMessage( 1063255 ); // You gain in Perfection as you precisely strike your opponent. } } public void OnTargetMissed( Mobile from ) { - if ( from != m_Source || m_Perfection == 0 ) + if ( from != Source || PerfectionDamageBonus == 0 ) return; - m_Perfection -= 25; + PerfectionDamageBonus -= 25; - if ( m_Perfection <= 0 ) + if ( PerfectionDamageBonus <= 0 ) { - m_Perfection = 0; - m_Source.SendLocalizedMessage( 1063256 ); // You have lost all Perfection in fighting this opponent. + PerfectionDamageBonus = 0; + Source.SendLocalizedMessage( 1063256 ); // You have lost all Perfection in fighting this opponent. } else { - m_Source.SendLocalizedMessage( 1063257 ); // You have lost some Perfection in fighting this opponent. + Source.SendLocalizedMessage( 1063257 ); // You have lost some Perfection in fighting this opponent. } } public void OnSourceBeneficialAction( Mobile to ) { - if ( to != m_Target ) + if ( to != Target ) return; - if ( m_Perfection >= 0 ) + if ( PerfectionDamageBonus >= 0 ) { - m_Perfection = 0; - m_Source.SendLocalizedMessage( 1063256 ); // You have lost all Perfection in fighting this opponent. + PerfectionDamageBonus = 0; + Source.SendLocalizedMessage( 1063256 ); // You have lost all Perfection in fighting this opponent. } } @@ -346,18 +342,18 @@ namespace Server { Cancel(); - int targetFame = m_Target.Fame; + int targetFame = Target.Fame; - if ( m_Perfection > 0 ) + if ( PerfectionDamageBonus > 0 ) { - int restore = Math.Min( m_Perfection * ( targetFame + 5000 ) / 25000, 10 ); + int restore = Math.Min( PerfectionDamageBonus * ( targetFame + 5000 ) / 25000, 10 ); - m_Source.Hits += restore; - m_Source.Stam += restore; - m_Source.Mana += restore; + Source.Hits += restore; + Source.Stam += restore; + Source.Mana += restore; } - if ( m_Source.Virtues.Honor > targetFame ) + if ( Source.Virtues.Honor > targetFame ) return; double dGain = ( targetFame / 100 ) * (m_HonorDamage / m_TotalDamage ); //Initial honor gain is 100th of the monsters honor @@ -372,25 +368,25 @@ namespace Server if ( gain < 1 ) gain=1; //Minimum gain of 1 honor when the honor is under the monsters fame - if ( VirtueHelper.IsHighestPath( m_Source, VirtueName.Honor ) ) + if ( VirtueHelper.IsHighestPath( Source, VirtueName.Honor ) ) { - m_Source.SendLocalizedMessage( 1063228 ); // You cannot gain more Honor. + Source.SendLocalizedMessage( 1063228 ); // You cannot gain more Honor. return; } bool gainedPath = false; - if ( VirtueHelper.Award( m_Source, VirtueName.Honor, (int) gain, ref gainedPath ) ) + if ( VirtueHelper.Award( Source, VirtueName.Honor, (int) gain, ref gainedPath ) ) { if ( gainedPath ) - m_Source.SendLocalizedMessage( 1063226 ); // You have gained a path in Honor! + Source.SendLocalizedMessage( 1063226 ); // You have gained a path in Honor! else - m_Source.SendLocalizedMessage( 1063225 ); // You have gained in Honor. + Source.SendLocalizedMessage( 1063225 ); // You have gained in Honor. } } - public int PerfectionDamageBonus => m_Perfection; + public int PerfectionDamageBonus { get; private set; } - public int PerfectionLuckBonus => (m_Perfection * m_Perfection) / 10; + public int PerfectionLuckBonus => (PerfectionDamageBonus * PerfectionDamageBonus) / 10; public bool CheckDistance() { @@ -399,8 +395,8 @@ namespace Server public void Cancel() { - m_Source.SentHonorContext = null; - ((IHonorTarget)m_Target).ReceivedHonorContext = null; + Source.SentHonorContext = null; + ((IHonorTarget)Target).ReceivedHonorContext = null; m_Timer.Stop(); } diff --git a/Scripts/Gumps/BaseGridGump.cs b/Scripts/Gumps/BaseGridGump.cs index 743d433df..61ceb7583 100644 --- a/Scripts/Gumps/BaseGridGump.cs +++ b/Scripts/Gumps/BaseGridGump.cs @@ -4,17 +4,14 @@ namespace Server.Gumps { public abstract class BaseGridGump : Gump { - private int m_CurrentX, m_CurrentY; - private int m_CurrentPage; - protected GumpBackground m_Background; protected GumpImageTiled m_Offset; - public int CurrentPage => m_CurrentPage; + public int CurrentPage { get; private set; } - public int CurrentX => m_CurrentX; + public int CurrentX { get; private set; } - public int CurrentY => m_CurrentY; + public int CurrentY { get; private set; } public BaseGridGump( int x, int y ) : base( x, y ) { @@ -78,20 +75,20 @@ namespace Server.Gumps public void FinishPage() { if ( m_Background != null ) - m_Background.Height = m_CurrentY + EntryHeight + OffsetSize + BorderSize; + m_Background.Height = CurrentY + EntryHeight + OffsetSize + BorderSize; if ( m_Offset != null ) - m_Offset.Height = m_CurrentY + EntryHeight + OffsetSize - BorderSize; + m_Offset.Height = CurrentY + EntryHeight + OffsetSize - BorderSize; } public void AddNewPage() { FinishPage(); - m_CurrentX = BorderSize + OffsetSize; - m_CurrentY = BorderSize + OffsetSize; + CurrentX = BorderSize + OffsetSize; + CurrentY = BorderSize + OffsetSize; - AddPage( ++m_CurrentPage ); + AddPage( ++CurrentPage ); m_Background = new GumpBackground( 0, 0, 100, 100, BackGumpID ); Add( m_Background ); @@ -102,20 +99,20 @@ namespace Server.Gumps public void AddNewLine() { - m_CurrentY += EntryHeight + OffsetSize; - m_CurrentX = BorderSize + OffsetSize; + CurrentY += EntryHeight + OffsetSize; + CurrentX = BorderSize + OffsetSize; } public void IncreaseX( int width ) { - m_CurrentX += width + OffsetSize; + CurrentX += width + OffsetSize; - width = m_CurrentX + BorderSize; + width = CurrentX + BorderSize; if ( m_Background != null && width > m_Background.Width ) m_Background.Width = width; - width = m_CurrentX - BorderSize; + width = CurrentX - BorderSize; if ( m_Offset != null && width > m_Offset.Width ) m_Offset.Width = width; @@ -123,16 +120,16 @@ namespace Server.Gumps public void AddEntryLabel( int width, string text ) { - AddImageTiled( m_CurrentX, m_CurrentY, width, EntryHeight, EntryGumpID ); - AddLabelCropped( m_CurrentX + TextOffsetX, m_CurrentY, width - TextOffsetX, EntryHeight, TextHue, text ); + AddImageTiled( CurrentX, CurrentY, width, EntryHeight, EntryGumpID ); + AddLabelCropped( CurrentX + TextOffsetX, CurrentY, width - TextOffsetX, EntryHeight, TextHue, text ); IncreaseX( width ); } public void AddEntryHtml( int width, string text ) { - AddImageTiled( m_CurrentX, m_CurrentY, width, EntryHeight, EntryGumpID ); - AddHtml( m_CurrentX + TextOffsetX, m_CurrentY, width - TextOffsetX, EntryHeight, text, false, false ); + AddImageTiled( CurrentX, CurrentY, width, EntryHeight, EntryGumpID ); + AddHtml( CurrentX + TextOffsetX, CurrentY, width - TextOffsetX, EntryHeight, text, false, false ); IncreaseX( width ); } @@ -144,14 +141,14 @@ namespace Server.Gumps public void AddEntryHeader( int width, int spannedEntries ) { - AddImageTiled( m_CurrentX, m_CurrentY, width, (EntryHeight * spannedEntries) + (OffsetSize * (spannedEntries - 1)), HeaderGumpID ); + AddImageTiled( CurrentX, CurrentY, width, (EntryHeight * spannedEntries) + (OffsetSize * (spannedEntries - 1)), HeaderGumpID ); IncreaseX( width ); } public void AddBlankLine() { if ( m_Offset != null ) - AddImageTiled( m_Offset.X, m_CurrentY, m_Offset.Width, EntryHeight, BackGumpID + 4 ); + AddImageTiled( m_Offset.X, CurrentY, m_Offset.Width, EntryHeight, BackGumpID + 4 ); AddNewLine(); } @@ -163,24 +160,24 @@ namespace Server.Gumps public void AddEntryButton( int width, int normalID, int pressedID, int buttonID, int buttonWidth, int buttonHeight, int spannedEntries ) { - AddImageTiled( m_CurrentX, m_CurrentY, width, (EntryHeight * spannedEntries) + (OffsetSize * (spannedEntries - 1)), HeaderGumpID ); - AddButton( m_CurrentX + ((width - buttonWidth) / 2), m_CurrentY + (((EntryHeight * spannedEntries) + (OffsetSize * (spannedEntries - 1)) - buttonHeight) / 2), normalID, pressedID, buttonID, GumpButtonType.Reply, 0 ); + AddImageTiled( CurrentX, CurrentY, width, (EntryHeight * spannedEntries) + (OffsetSize * (spannedEntries - 1)), HeaderGumpID ); + AddButton( CurrentX + ((width - buttonWidth) / 2), CurrentY + (((EntryHeight * spannedEntries) + (OffsetSize * (spannedEntries - 1)) - buttonHeight) / 2), normalID, pressedID, buttonID, GumpButtonType.Reply, 0 ); IncreaseX( width ); } public void AddEntryPageButton( int width, int normalID, int pressedID, int page, int buttonWidth, int buttonHeight ) { - AddImageTiled( m_CurrentX, m_CurrentY, width, EntryHeight, HeaderGumpID ); - AddButton( m_CurrentX + ((width - buttonWidth) / 2), m_CurrentY + ((EntryHeight - buttonHeight) / 2), normalID, pressedID, 0, GumpButtonType.Page, page ); + AddImageTiled( CurrentX, CurrentY, width, EntryHeight, HeaderGumpID ); + AddButton( CurrentX + ((width - buttonWidth) / 2), CurrentY + ((EntryHeight - buttonHeight) / 2), normalID, pressedID, 0, GumpButtonType.Page, page ); IncreaseX( width ); } public void AddEntryText( int width, int entryID, string initialText ) { - AddImageTiled( m_CurrentX, m_CurrentY, width, EntryHeight, EntryGumpID ); - AddTextEntry( m_CurrentX + TextOffsetX, m_CurrentY, width - TextOffsetX, EntryHeight, TextHue, entryID, initialText ); + AddImageTiled( CurrentX, CurrentY, width, EntryHeight, EntryGumpID ); + AddTextEntry( CurrentX + TextOffsetX, CurrentY, width - TextOffsetX, EntryHeight, TextHue, entryID, initialText ); IncreaseX( width ); } diff --git a/Scripts/Gumps/BaseImageTileButtonsGump.cs b/Scripts/Gumps/BaseImageTileButtonsGump.cs index a3546653f..ea3622b74 100644 --- a/Scripts/Gumps/BaseImageTileButtonsGump.cs +++ b/Scripts/Gumps/BaseImageTileButtonsGump.cs @@ -47,9 +47,7 @@ namespace Server.Gumps public class BaseImageTileButtonsGump : Gump { - private ImageTileButtonInfo[] m_Buttons; - - protected ImageTileButtonInfo[] Buttons => m_Buttons; + protected ImageTileButtonInfo[] Buttons { get; } protected virtual int XItems => 2; protected virtual int YItems => 5; @@ -59,7 +57,7 @@ namespace Server.Gumps } public BaseImageTileButtonsGump( TextDefinition header, ImageTileButtonInfo[] buttons ) : base( 10, 10 ) //Coords are 0, o on OSI, intentional difference { - m_Buttons = buttons; + Buttons = buttons; AddPage( 0 ); int x = XItems * 250; diff --git a/Scripts/Gumps/CategorizedAddGump.cs b/Scripts/Gumps/CategorizedAddGump.cs index fd75c883a..7e84a7dd4 100644 --- a/Scripts/Gumps/CategorizedAddGump.cs +++ b/Scripts/Gumps/CategorizedAddGump.cs @@ -15,58 +15,54 @@ namespace Server.Gumps public class CAGObject : CAGNode { - private Type m_Type; - private int m_ItemID; - private int m_Hue; - private CAGCategory m_Parent; + public Type Type { get; } - public Type Type => m_Type; - public int ItemID => m_ItemID; - public int Hue => m_Hue; - public CAGCategory Parent => m_Parent; + public int ItemID { get; } - public override string Caption => ( m_Type == null ? "bad type" : m_Type.Name ); + public int Hue { get; } + + public CAGCategory Parent { get; } + + public override string Caption => ( Type == null ? "bad type" : Type.Name ); public override void OnClick( Mobile from, int page ) { - if ( m_Type == null ) + if ( Type == null ) { from.SendMessage( "That is an invalid type name." ); } else { - CommandSystem.Handle( from, $"{CommandSystem.Prefix}Add {m_Type.Name}"); + CommandSystem.Handle( from, $"{CommandSystem.Prefix}Add {Type.Name}"); - from.SendGump( new CategorizedAddGump( from, m_Parent, page ) ); + from.SendGump( new CategorizedAddGump( from, Parent, page ) ); } } public CAGObject( CAGCategory parent, XmlTextReader xml ) { - m_Parent = parent; + Parent = parent; if ( xml.MoveToAttribute( "type" ) ) - m_Type = ScriptCompiler.FindTypeByFullName( xml.Value, false ); + Type = ScriptCompiler.FindTypeByFullName( xml.Value, false ); if ( xml.MoveToAttribute( "gfx" ) ) - m_ItemID = XmlConvert.ToInt32( xml.Value ); + ItemID = XmlConvert.ToInt32( xml.Value ); if ( xml.MoveToAttribute( "hue" ) ) - m_Hue = XmlConvert.ToInt32( xml.Value ); + Hue = XmlConvert.ToInt32( xml.Value ); } } public class CAGCategory : CAGNode { - private string m_Title; - private CAGNode[] m_Nodes; - private CAGCategory m_Parent; + public string Title { get; } - public string Title => m_Title; - public CAGNode[] Nodes => m_Nodes; - public CAGCategory Parent => m_Parent; + public CAGNode[] Nodes { get; } - public override string Caption => m_Title; + public CAGCategory Parent { get; } + + public override string Caption => Title; public override void OnClick( Mobile from, int page ) { @@ -75,25 +71,25 @@ namespace Server.Gumps private CAGCategory() { - m_Title = "no data"; - m_Nodes = new CAGNode[0]; + Title = "no data"; + Nodes = new CAGNode[0]; } public CAGCategory( CAGCategory parent, XmlTextReader xml ) { - m_Parent = parent; + Parent = parent; if ( xml.MoveToAttribute( "title" ) ) - m_Title = xml.Value; + Title = xml.Value; else - m_Title = "empty"; + Title = "empty"; - if ( m_Title == "Docked" ) - m_Title = "Docked 2"; + if ( Title == "Docked" ) + Title = "Docked 2"; if ( xml.IsEmptyElement ) { - m_Nodes = new CAGNode[0]; + Nodes = new CAGNode[0]; } else { @@ -112,7 +108,7 @@ namespace Server.Gumps xml.Skip(); } - m_Nodes = (CAGNode[])nodes.ToArray( typeof( CAGNode ) ); + Nodes = (CAGNode[])nodes.ToArray( typeof( CAGNode ) ); } } diff --git a/Scripts/Gumps/Go/ChildNode.cs b/Scripts/Gumps/Go/ChildNode.cs index ed2e5318f..d20a90349 100644 --- a/Scripts/Gumps/Go/ChildNode.cs +++ b/Scripts/Gumps/Go/ChildNode.cs @@ -4,14 +4,9 @@ namespace Server.Gumps { public class ChildNode { - private ParentNode m_Parent; - - private string m_Name; - private Point3D m_Location; - public ChildNode( XmlTextReader xml, ParentNode parent ) { - m_Parent = parent; + Parent = parent; Parse( xml ); } @@ -19,9 +14,9 @@ namespace Server.Gumps private void Parse( XmlTextReader xml ) { if ( xml.MoveToAttribute( "name" ) ) - m_Name = xml.Value; + Name = xml.Value; else - m_Name = "empty"; + Name = "empty"; int x = 0, y = 0, z = 0; @@ -34,13 +29,13 @@ namespace Server.Gumps if ( xml.MoveToAttribute( "z" ) ) z = Utility.ToInt32( xml.Value ); - m_Location = new Point3D( x, y, z ); + Location = new Point3D( x, y, z ); } - public ParentNode Parent => m_Parent; + public ParentNode Parent { get; } - public string Name => m_Name; + public string Name { get; private set; } - public Point3D Location => m_Location; + public Point3D Location { get; private set; } } } \ No newline at end of file diff --git a/Scripts/Gumps/Go/LocationTree.cs b/Scripts/Gumps/Go/LocationTree.cs index b0ba393db..0ffa6d584 100644 --- a/Scripts/Gumps/Go/LocationTree.cs +++ b/Scripts/Gumps/Go/LocationTree.cs @@ -6,14 +6,10 @@ namespace Server.Gumps { public class LocationTree { - private Map m_Map; - private ParentNode m_Root; - private Dictionary m_LastBranch; - public LocationTree( string fileName, Map map ) { - m_LastBranch = new Dictionary(); - m_Map = map; + LastBranch = new Dictionary(); + Map = map; string path = Path.Combine( "Data/Locations/", fileName ); @@ -23,17 +19,17 @@ namespace Server.Gumps xml.WhitespaceHandling = WhitespaceHandling.None; - m_Root = Parse( xml ); + Root = Parse( xml ); xml.Close(); } } - public Dictionary LastBranch => m_LastBranch; + public Dictionary LastBranch { get; } - public Map Map => m_Map; + public Map Map { get; } - public ParentNode Root => m_Root; + public ParentNode Root { get; } private ParentNode Parse( XmlTextReader xml ) { diff --git a/Scripts/Gumps/Go/ParentNode.cs b/Scripts/Gumps/Go/ParentNode.cs index 7bb2a4335..ae37244fe 100644 --- a/Scripts/Gumps/Go/ParentNode.cs +++ b/Scripts/Gumps/Go/ParentNode.cs @@ -5,14 +5,9 @@ namespace Server.Gumps { public class ParentNode { - private ParentNode m_Parent; - private object[] m_Children; - - private string m_Name; - public ParentNode( XmlTextReader xml, ParentNode parent ) { - m_Parent = parent; + Parent = parent; Parse( xml ); } @@ -20,13 +15,13 @@ namespace Server.Gumps private void Parse( XmlTextReader xml ) { if ( xml.MoveToAttribute( "name" ) ) - m_Name = xml.Value; + Name = xml.Value; else - m_Name = "empty"; + Name = "empty"; if ( xml.IsEmptyElement ) { - m_Children = new object[0]; + Children = new object[0]; } else { @@ -49,14 +44,14 @@ namespace Server.Gumps } } - m_Children = children.ToArray(); + Children = children.ToArray(); } } - public ParentNode Parent => m_Parent; + public ParentNode Parent { get; } - public object[] Children => m_Children; + public object[] Children { get; private set; } - public string Name => m_Name; + public string Name { get; private set; } } } \ No newline at end of file diff --git a/Scripts/Gumps/Guilds/New Guild System/BaseGuildGump.cs b/Scripts/Gumps/Guilds/New Guild System/BaseGuildGump.cs index 9535445e2..43c5dc4e2 100644 --- a/Scripts/Gumps/Guilds/New Guild System/BaseGuildGump.cs +++ b/Scripts/Gumps/Guilds/New Guild System/BaseGuildGump.cs @@ -8,11 +8,9 @@ namespace Server.Guilds { public abstract class BaseGuildGump : Gump { - private Guild m_Guild; - private PlayerMobile m_Player; + protected Guild guild { get; } - protected Guild guild => m_Guild; - protected PlayerMobile player => m_Player; + protected PlayerMobile player { get; } public BaseGuildGump( PlayerMobile pm, Guild g ) : this( pm, g, 10, 10 ) { @@ -20,8 +18,8 @@ namespace Server.Guilds public BaseGuildGump( PlayerMobile pm, Guild g, int x, int y ) : base( x, y ) { - m_Guild = g; - m_Player = pm; + guild = g; + player = pm; pm.CloseGump( typeof( BaseGuildGump ) ); } diff --git a/Scripts/Gumps/Guilds/New Guild System/BaseGuildListGump.cs b/Scripts/Gumps/Guilds/New Guild System/BaseGuildListGump.cs index 3dbd5b3c1..db81f28cd 100644 --- a/Scripts/Gumps/Guilds/New Guild System/BaseGuildListGump.cs +++ b/Scripts/Gumps/Guilds/New Guild System/BaseGuildListGump.cs @@ -188,18 +188,17 @@ namespace Server.Guilds } public struct InfoField { - private TextDefinition m_Name; - private int m_Width; - private IComparer m_Comparer; + public TextDefinition Name { get; } + + public int Width { get; } + + public IComparer Comparer { get; } - public TextDefinition Name => m_Name; - public int Width => m_Width; - public IComparer Comparer => m_Comparer; public InfoField( TextDefinition name, int width, IComparer comparer ) { - m_Name = name; - m_Width = width; - m_Comparer = comparer; + Name = name; + Width = width; + Comparer = comparer; } } } diff --git a/Scripts/Gumps/PlayerVendorGumps.cs b/Scripts/Gumps/PlayerVendorGumps.cs index ebc16c37f..273c51456 100644 --- a/Scripts/Gumps/PlayerVendorGumps.cs +++ b/Scripts/Gumps/PlayerVendorGumps.cs @@ -302,12 +302,6 @@ namespace Server.Gumps private class CustomItem { - private Type m_Type; - private int m_ItemID; - private int m_LocNum; - private int m_ArtNum; - private bool m_LongText; - public CustomItem( int itemID, int loc ) : this( null, itemID, loc, 0, false ) { } @@ -326,23 +320,23 @@ namespace Server.Gumps public CustomItem( Type type, int itemID, int loc, int art, bool longText ) { - m_Type = type; - m_ItemID = itemID; - m_LocNum = loc; - m_ArtNum = art; - m_LongText = longText; + Type = type; + ItemID = itemID; + LocNumber = loc; + ArtNumber = art; + LongText = longText; } public Item Create() { - if ( m_Type == null ) + if ( Type == null ) return null; Item i = null; try { - ConstructorInfo ctor = m_Type.GetConstructor( new Type[0] ); + ConstructorInfo ctor = Type.GetConstructor( new Type[0] ); if ( ctor != null ) i = ctor.Invoke( null ) as Item; } @@ -353,32 +347,34 @@ namespace Server.Gumps return i; } - public Type Type => m_Type; - public int ItemID => m_ItemID; - public int LocNumber => m_LocNum; - public int ArtNumber => m_ArtNum; - public bool LongText => m_LongText; + public Type Type { get; } + + public int ItemID { get; } + + public int LocNumber { get; } + + public int ArtNumber { get; } + + public bool LongText { get; } } private class CustomCategory { - private CustomItem[] m_Entries; - private Layer m_Layer; - private bool m_CanDye; - private int m_LocNum; - public CustomCategory( Layer layer, int loc, bool canDye, CustomItem[] items ) { - m_Entries = items; - m_CanDye = canDye; - m_Layer = layer; - m_LocNum = loc; + Entries = items; + CanDye = canDye; + Layer = layer; + LocNumber = loc; } - public bool CanDye => m_CanDye; - public CustomItem[] Entries => m_Entries; - public Layer Layer => m_Layer; - public int LocNumber => m_LocNum; + public bool CanDye { get; } + + public CustomItem[] Entries { get; } + + public Layer Layer { get; } + + public int LocNumber { get; } } private static CustomCategory[] Categories = { @@ -783,16 +779,14 @@ namespace Server.Gumps private class HairOrBeard { - private int m_ItemID; - private int m_Name; + public int ItemID { get; } - public int ItemID => m_ItemID; - public int Name => m_Name; + public int Name { get; } public HairOrBeard( int itemID, int name ) { - m_ItemID = itemID; - m_Name = name; + ItemID = itemID; + Name = name; } } diff --git a/Scripts/Gumps/PolymorphGump.cs b/Scripts/Gumps/PolymorphGump.cs index 0a4552764..0a10ab8b3 100644 --- a/Scripts/Gumps/PolymorphGump.cs +++ b/Scripts/Gumps/PolymorphGump.cs @@ -26,22 +26,24 @@ namespace Server.Gumps public static readonly PolymorphEntry Daemon = new PolymorphEntry( 8403, 0x09, 1015253, 25, 8 ); - private int m_Art, m_Body, m_Num, m_X, m_Y; - private PolymorphEntry( int Art, int Body, int LocNum, int X, int Y ) { - m_Art = Art; - m_Body = Body; - m_Num = LocNum; - m_X = X; - m_Y = Y; + ArtID = Art; + BodyID = Body; + LocNumber = LocNum; + this.X = X; + this.Y = Y; } - public int ArtID => m_Art; - public int BodyID => m_Body; - public int LocNumber => m_Num; - public int X => m_X; - public int Y => m_Y; + public int ArtID { get; } + + public int BodyID { get; } + + public int LocNumber { get; } + + public int X { get; } + + public int Y { get; } } @@ -49,17 +51,15 @@ namespace Server.Gumps { private class PolymorphCategory { - private int m_Num; - private PolymorphEntry[] m_Entries; - public PolymorphCategory( int num, params PolymorphEntry[] entries ) { - m_Num = num; - m_Entries = entries; + LocNumber = num; + Entries = entries; } - public PolymorphEntry[] Entries => m_Entries; - public int LocNumber => m_Num; + public PolymorphEntry[] Entries { get; } + + public int LocNumber { get; } } private static PolymorphCategory[] Categories = { diff --git a/Scripts/Gumps/Props/SetBodyGump.cs b/Scripts/Gumps/Props/SetBodyGump.cs index 14cb43a8b..2cba657b0 100644 --- a/Scripts/Gumps/Props/SetBodyGump.cs +++ b/Scripts/Gumps/Props/SetBodyGump.cs @@ -228,15 +228,13 @@ namespace Server.Gumps private class InternalEntry : IComparable { - private int m_Body; - private int m_ItemID; - private string m_Name; - private string m_DisplayName; + public int Body { get; } - public int Body => m_Body; - public int ItemID => m_ItemID; - public string Name => m_Name; - public string DisplayName => m_DisplayName; + public int ItemID { get; } + + public string Name { get; } + + public string DisplayName { get; } private static string[] m_GroupNames = { "ogres_", "ettins_", "walking_dead_", "gargoyles_", @@ -258,32 +256,32 @@ namespace Server.Gumps public InternalEntry( int body, int itemID, string name ) { - m_Body = body; - m_ItemID = itemID; - m_Name = name; + Body = body; + ItemID = itemID; + Name = name; - m_DisplayName = name.ToLower(); + DisplayName = name.ToLower(); for( int i = 0; i < m_GroupNames.Length; ++i ) { - if ( m_DisplayName.StartsWith( m_GroupNames[i] ) ) + if ( DisplayName.StartsWith( m_GroupNames[i] ) ) { - m_DisplayName = m_DisplayName.Substring( m_GroupNames[i].Length ); + DisplayName = DisplayName.Substring( m_GroupNames[i].Length ); break; } } - m_DisplayName = m_DisplayName.Replace( '_', ' ' ); + DisplayName = DisplayName.Replace( '_', ' ' ); } public int CompareTo( object obj ) { InternalEntry comp = (InternalEntry)obj; - int v = m_Name.CompareTo( comp.m_Name ); + int v = Name.CompareTo( comp.Name ); if ( v == 0 ) - m_Body.CompareTo( comp.m_Body ); + Body.CompareTo( comp.Body ); return v; } diff --git a/Scripts/Gumps/RewardGump.cs b/Scripts/Gumps/RewardGump.cs index 72ecde745..ca3e56647 100644 --- a/Scripts/Gumps/RewardGump.cs +++ b/Scripts/Gumps/RewardGump.cs @@ -20,23 +20,21 @@ namespace Server.Gumps public class RewardGump : Gump { - private TextDefinition m_Title; - private IRewardEntry[] m_Rewards; - private int m_Points; - private RewardPickedHandler m_OnPicked; + public TextDefinition Title { get; } - public TextDefinition Title => m_Title; - public IRewardEntry[] Rewards => m_Rewards; - public int Points => m_Points; - public RewardPickedHandler OnPicked => m_OnPicked; + public IRewardEntry[] Rewards { get; } + + public int Points { get; } + + public RewardPickedHandler OnPicked { get; } public RewardGump( TextDefinition title, IRewardEntry[] rewards, int points, RewardPickedHandler onPicked ) : base( 250, 50 ) { - m_Title = title; - m_Rewards = rewards; - m_Points = points; - m_OnPicked = onPicked; + Title = title; + Rewards = rewards; + Points = points; + OnPicked = onPicked; AddPage( 0 ); @@ -49,13 +47,13 @@ namespace Server.Gumps AddImage( 32, 33, 0x2635 ); AddImageTiled( 70, 55, 230, 2, 0x23C5 ); - if ( m_Title.String != null ) - AddHtml( 70, 35, 270, 20, m_Title.String, false, false ); - else if ( m_Title.Number != 0 ) - AddHtmlLocalized( 70, 35, 270, 20, m_Title.Number, 1, false, false ); + if ( Title.String != null ) + AddHtml( 70, 35, 270, 20, Title.String, false, false ); + else if ( Title.Number != 0 ) + AddHtmlLocalized( 70, 35, 270, 20, Title.Number, 1, false, false ); AddHtmlLocalized( 50, 65, 150, 20, 1072843, 1, false, false ); // Your Reward Points: - AddLabel( 230, 65, 0x64, m_Points.ToString() ); + AddLabel( 230, 65, 0x64, Points.ToString() ); AddImageTiled( 35, 85, 270, 2, 0x23C5 ); AddHtmlLocalized( 35, 90, 270, 20, 1072844, 1, false, false ); // Please Choose a Reward: @@ -64,9 +62,9 @@ namespace Server.Gumps int offset = 110; int page = 1; - for ( int i = 0; i < m_Rewards.Length; ++i ) + for ( int i = 0; i < Rewards.Length; ++i ) { - IRewardEntry entry = m_Rewards[i]; + IRewardEntry entry = Rewards[i]; Rectangle2D bounds = ItemBounds.Table[entry.ItemID]; int height = Math.Max( 36, bounds.Height ); @@ -84,7 +82,7 @@ namespace Server.Gumps offset = 110; } - bool available = ( entry.Price <= m_Points ); + bool available = ( entry.Price <= Points ); int half = offset + ( height / 2 ); if ( available ) @@ -118,11 +116,11 @@ namespace Server.Gumps choice -= 100; - if ( choice >= 0 && choice < m_Rewards.Length ) + if ( choice >= 0 && choice < Rewards.Length ) { - IRewardEntry entry = m_Rewards[choice]; + IRewardEntry entry = Rewards[choice]; - if ( entry.Price <= m_Points ) + if ( entry.Price <= Points ) sender.Mobile.SendGump( new RewardConfirmGump( this, choice, entry ) ); } } diff --git a/Scripts/Gumps/RunebookGump.cs b/Scripts/Gumps/RunebookGump.cs index 0950e019a..e5485ea90 100644 --- a/Scripts/Gumps/RunebookGump.cs +++ b/Scripts/Gumps/RunebookGump.cs @@ -11,9 +11,7 @@ namespace Server.Gumps { public class RunebookGump : Gump { - private Runebook m_Book; - - public Runebook Book => m_Book; + public Runebook Book { get; } public int GetMapHue( Map map ) { @@ -70,11 +68,11 @@ namespace Server.Gumps // Charges AddHtmlLocalized( 140, 40, 80, 18, 1011296, false, false ); // Charges: - AddHtml( 220, 40, 30, 18, m_Book.CurCharges.ToString(), false, false ); + AddHtml( 220, 40, 30, 18, Book.CurCharges.ToString(), false, false ); // Max charges AddHtmlLocalized( 300, 40, 100, 18, 1011297, false, false ); // Max Charges: - AddHtml( 400, 40, 30, 18, m_Book.MaxCharges.ToString(), false, false ); + AddHtml( 400, 40, 30, 18, Book.MaxCharges.ToString(), false, false ); } private void AddIndex() @@ -87,7 +85,7 @@ namespace Server.Gumps AddHtmlLocalized( 158, 22, 100, 18, 1011299, false, false ); // Rename book // List of entries - List entries = m_Book.Entries; + List entries = Book.Entries; for ( int i = 0; i < 16; ++i ) { @@ -124,9 +122,9 @@ namespace Server.Gumps string desc; int hue; - if ( index < m_Book.Entries.Count ) + if ( index < Book.Entries.Count ) { - RunebookEntry e = (RunebookEntry)m_Book.Entries[index]; + RunebookEntry e = (RunebookEntry)Book.Entries[index]; desc = GetName( e.Description ); hue = GetMapHue( e.Map ); @@ -147,7 +145,7 @@ namespace Server.Gumps AddHtmlLocalized( 150 + (half * 160), 115, 100, 18, 1011298, false, false ); // Drop rune // Set as default button - int defButtonID = e != m_Book.Default ? 2361 : 2360; + int defButtonID = e != Book.Default ? 2361 : 2360; AddButton( 160 + (half * 140), 20, defButtonID, defButtonID, 2 + (index * 6) + 2, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 175 + (half * 140), 15, 100, 18, 1011300, false, false ); // Set default @@ -184,7 +182,7 @@ namespace Server.Gumps public RunebookGump( Mobile from, Runebook book ) : base( 150, 200 ) { - m_Book = book; + Book = book; AddBackground(); AddIndex(); @@ -257,9 +255,9 @@ namespace Server.Gumps { Mobile from = state.Mobile; - if ( m_Book.Deleted || !from.InRange( m_Book.GetWorldLocation(), (Core.ML ? 3 : 1) ) || !Multis.DesignContext.Check( from ) ) + if ( Book.Deleted || !from.InRange( Book.GetWorldLocation(), (Core.ML ? 3 : 1) ) || !Multis.DesignContext.Check( from ) ) { - m_Book.Openers.Remove( from ); + Book.Openers.Remove( from ); return; } @@ -267,14 +265,14 @@ namespace Server.Gumps if ( buttonID == 1 ) // Rename book { - if ( !m_Book.IsLockedDown || from.AccessLevel >= AccessLevel.GameMaster ) + if ( !Book.IsLockedDown || from.AccessLevel >= AccessLevel.GameMaster ) { from.SendLocalizedMessage( 502414 ); // Please enter a title for the runebook: - from.Prompt = new InternalPrompt( m_Book ); + from.Prompt = new InternalPrompt( Book ); } else { - m_Book.Openers.Remove( from ); + Book.Openers.Remove( from ); from.SendLocalizedMessage( 502413, null, 0x35 ); // That cannot be done while the book is locked down. } @@ -286,18 +284,18 @@ namespace Server.Gumps int index = buttonID / 6; int type = buttonID % 6; - if ( index >= 0 && index < m_Book.Entries.Count ) + if ( index >= 0 && index < Book.Entries.Count ) { - RunebookEntry e = (RunebookEntry)m_Book.Entries[index]; + RunebookEntry e = (RunebookEntry)Book.Entries[index]; switch ( type ) { case 0: // Use charges { - if ( m_Book.CurCharges <= 0 ) + if ( Book.CurCharges <= 0 ) { from.CloseGump( typeof( RunebookGump ) ); - from.SendGump( new RunebookGump( from, m_Book ) ); + from.SendGump( new RunebookGump( from, Book ) ); from.SendLocalizedMessage( 502412 ); // There are no charges left on that item. } @@ -314,27 +312,27 @@ namespace Server.Gumps from.SendMessage( location ); } - m_Book.OnTravel(); - new RecallSpell( from, m_Book, e, m_Book ).Cast(); + Book.OnTravel(); + new RecallSpell( from, Book, e, Book ).Cast(); - m_Book.Openers.Remove( from ); + Book.Openers.Remove( from ); } break; } case 1: // Drop rune { - if ( !m_Book.IsLockedDown || from.AccessLevel >= AccessLevel.GameMaster ) + if ( !Book.IsLockedDown || from.AccessLevel >= AccessLevel.GameMaster ) { - m_Book.DropRune( from, e, index ); + Book.DropRune( from, e, index ); from.CloseGump( typeof( RunebookGump ) ); if ( !Core.ML ) - from.SendGump( new RunebookGump( from, m_Book ) ); + from.SendGump( new RunebookGump( from, Book ) ); } else { - m_Book.Openers.Remove( from ); + Book.Openers.Remove( from ); from.SendLocalizedMessage( 502413, null, 0x35 ); // That cannot be done while the book is locked down. } @@ -343,12 +341,12 @@ namespace Server.Gumps } case 2: // Set default { - if ( m_Book.CheckAccess( from ) ) + if ( Book.CheckAccess( from ) ) { - m_Book.Default = e; + Book.Default = e; from.CloseGump( typeof( RunebookGump ) ); - from.SendGump( new RunebookGump( from, m_Book ) ); + from.SendGump( new RunebookGump( from, Book ) ); from.SendLocalizedMessage( 502417 ); // New default location set. } @@ -370,7 +368,7 @@ namespace Server.Gumps from.SendMessage( location ); } - m_Book.OnTravel(); + Book.OnTravel(); new RecallSpell( from, null, e, null ).Cast(); } else @@ -378,7 +376,7 @@ namespace Server.Gumps from.SendLocalizedMessage( 500015 ); // You do not have that spell! } - m_Book.Openers.Remove( from ); + Book.Openers.Remove( from ); break; } @@ -397,7 +395,7 @@ namespace Server.Gumps from.SendMessage( location ); } - m_Book.OnTravel(); + Book.OnTravel(); new GateTravelSpell( from, null, e ).Cast(); } else @@ -405,7 +403,7 @@ namespace Server.Gumps from.SendLocalizedMessage( 500015 ); // You do not have that spell! } - m_Book.Openers.Remove( from ); + Book.Openers.Remove( from ); break; } @@ -426,7 +424,7 @@ namespace Server.Gumps from.SendMessage( location ); } - m_Book.OnTravel(); + Book.OnTravel(); new SacredJourneySpell( from, null, e, null ).Cast(); } else @@ -435,14 +433,14 @@ namespace Server.Gumps } } - m_Book.Openers.Remove( from ); + Book.Openers.Remove( from ); break; } } } else - m_Book.Openers.Remove( from ); + Book.Openers.Remove( from ); } } } diff --git a/Scripts/Gumps/SkillsGump.cs b/Scripts/Gumps/SkillsGump.cs index e28b0813c..d290d2f7f 100644 --- a/Scripts/Gumps/SkillsGump.cs +++ b/Scripts/Gumps/SkillsGump.cs @@ -425,18 +425,16 @@ namespace Server.Gumps public class SkillsGumpGroup { - private string m_Name; - private SkillName[] m_Skills; + public string Name { get; } - public string Name => m_Name; - public SkillName[] Skills => m_Skills; + public SkillName[] Skills { get; } public SkillsGumpGroup( string name, SkillName[] skills ) { - m_Name = name; - m_Skills = skills; + Name = name; + Skills = skills; - Array.Sort( m_Skills, new SkillNameComparer() ); + Array.Sort( Skills, new SkillNameComparer() ); } private class SkillNameComparer : IComparer @@ -457,88 +455,87 @@ namespace Server.Gumps } } - private static SkillsGumpGroup[] m_Groups = { - new SkillsGumpGroup( "Crafting", new[] - { - SkillName.Alchemy, - SkillName.Blacksmith, - SkillName.Cartography, - SkillName.Carpentry, - SkillName.Cooking, - SkillName.Fletching, - SkillName.Inscribe, - SkillName.Tailoring, - SkillName.Tinkering, - SkillName.Imbuing - } ), - new SkillsGumpGroup( "Bardic", new[] - { - SkillName.Discordance, - SkillName.Musicianship, - SkillName.Peacemaking, - SkillName.Provocation - } ), - new SkillsGumpGroup( "Magical", new[] - { - SkillName.Chivalry, - SkillName.EvalInt, - SkillName.Magery, - SkillName.MagicResist, - SkillName.Meditation, - SkillName.Necromancy, - SkillName.SpiritSpeak, - SkillName.Ninjitsu, - SkillName.Bushido, - SkillName.Spellweaving, - SkillName.Mysticism - } ), - new SkillsGumpGroup( "Miscellaneous", new[] - { - SkillName.Camping, - SkillName.Fishing, - SkillName.Focus, - SkillName.Healing, - SkillName.Herding, - SkillName.Lockpicking, - SkillName.Lumberjacking, - SkillName.Mining, - SkillName.Snooping, - SkillName.Veterinary - } ), - new SkillsGumpGroup( "Combat Ratings", new[] - { - SkillName.Archery, - SkillName.Fencing, - SkillName.Macing, - SkillName.Parry, - SkillName.Swords, - SkillName.Tactics, - SkillName.Wrestling, - SkillName.Throwing - } ), - new SkillsGumpGroup( "Actions", new[] - { - SkillName.AnimalTaming, - SkillName.Begging, - SkillName.DetectHidden, - SkillName.Hiding, - SkillName.RemoveTrap, - SkillName.Poisoning, - SkillName.Stealing, - SkillName.Stealth, - SkillName.Tracking - } ), - new SkillsGumpGroup( "Lore & Knowledge", new[] - { - SkillName.Anatomy, - SkillName.AnimalLore, - SkillName.ArmsLore, - SkillName.Forensics, - SkillName.ItemID, - SkillName.TasteID - } ) - }; - - public static SkillsGumpGroup[] Groups => m_Groups; + public static SkillsGumpGroup[] Groups { get; } = + { + new SkillsGumpGroup( "Crafting", new[] + { + SkillName.Alchemy, + SkillName.Blacksmith, + SkillName.Cartography, + SkillName.Carpentry, + SkillName.Cooking, + SkillName.Fletching, + SkillName.Inscribe, + SkillName.Tailoring, + SkillName.Tinkering, + SkillName.Imbuing + } ), + new SkillsGumpGroup( "Bardic", new[] + { + SkillName.Discordance, + SkillName.Musicianship, + SkillName.Peacemaking, + SkillName.Provocation + } ), + new SkillsGumpGroup( "Magical", new[] + { + SkillName.Chivalry, + SkillName.EvalInt, + SkillName.Magery, + SkillName.MagicResist, + SkillName.Meditation, + SkillName.Necromancy, + SkillName.SpiritSpeak, + SkillName.Ninjitsu, + SkillName.Bushido, + SkillName.Spellweaving, + SkillName.Mysticism + } ), + new SkillsGumpGroup( "Miscellaneous", new[] + { + SkillName.Camping, + SkillName.Fishing, + SkillName.Focus, + SkillName.Healing, + SkillName.Herding, + SkillName.Lockpicking, + SkillName.Lumberjacking, + SkillName.Mining, + SkillName.Snooping, + SkillName.Veterinary + } ), + new SkillsGumpGroup( "Combat Ratings", new[] + { + SkillName.Archery, + SkillName.Fencing, + SkillName.Macing, + SkillName.Parry, + SkillName.Swords, + SkillName.Tactics, + SkillName.Wrestling, + SkillName.Throwing + } ), + new SkillsGumpGroup( "Actions", new[] + { + SkillName.AnimalTaming, + SkillName.Begging, + SkillName.DetectHidden, + SkillName.Hiding, + SkillName.RemoveTrap, + SkillName.Poisoning, + SkillName.Stealing, + SkillName.Stealth, + SkillName.Tracking + } ), + new SkillsGumpGroup( "Lore & Knowledge", new[] + { + SkillName.Anatomy, + SkillName.AnimalLore, + SkillName.ArmsLore, + SkillName.Forensics, + SkillName.ItemID, + SkillName.TasteID + } ) + }; } } \ No newline at end of file diff --git a/Scripts/Holiday Stuff/Halloween/2012/Engines/PlayerZombies.cs b/Scripts/Holiday Stuff/Halloween/2012/Engines/PlayerZombies.cs index d91ae92a8..fd1d2d676 100644 --- a/Scripts/Holiday Stuff/Halloween/2012/Engines/PlayerZombies.cs +++ b/Scripts/Holiday Stuff/Halloween/2012/Engines/PlayerZombies.cs @@ -8,9 +8,7 @@ namespace Server.Engines.Events { public class HalloweenHauntings { - public static Dictionary ReAnimated { get => m_ReAnimated; - set => m_ReAnimated = value; - } + public static Dictionary ReAnimated { get; set; } private static Timer m_Timer; private static Timer m_ClearTimer; @@ -20,8 +18,6 @@ namespace Server.Engines.Events private static int m_QueueDelaySeconds; private static int m_QueueClearIntervalSeconds; - private static Dictionary m_ReAnimated; - private static List m_DeathQueue; private static Rectangle2D[] m_Cemetaries = { @@ -55,7 +51,7 @@ namespace Server.Engines.Events TimeSpan tick = TimeSpan.FromSeconds( m_QueueDelaySeconds ); TimeSpan clear = TimeSpan.FromSeconds( m_QueueClearIntervalSeconds ); - m_ReAnimated = new Dictionary(); + ReAnimated = new Dictionary(); m_DeathQueue = new List(); if ( today >= HolidaySettings.StartHalloween && today <= HolidaySettings.FinishHalloween ) @@ -76,7 +72,7 @@ namespace Server.Engines.Events private static void Clear_Callback() { - m_ReAnimated.Clear(); + ReAnimated.Clear(); m_DeathQueue.Clear(); @@ -94,7 +90,7 @@ namespace Server.Engines.Events { for( int index = 0; m_DeathQueue.Count > 0 && index < m_DeathQueue.Count; index++ ) { - if ( !m_ReAnimated.ContainsKey( m_DeathQueue[ index ] ) ) + if ( !ReAnimated.ContainsKey( m_DeathQueue[ index ] ) ) { player = m_DeathQueue[ index ]; @@ -102,7 +98,7 @@ namespace Server.Engines.Events } } - if ( player != null && !player.Deleted && m_ReAnimated.Count < m_TotalZombieLimit ) + if ( player != null && !player.Deleted && ReAnimated.Count < m_TotalZombieLimit ) { Map map = Utility.RandomBool() ? Map.Trammel : Map.Felucca; @@ -112,7 +108,7 @@ namespace Server.Engines.Events { ZombieSkeleton zombieskel = new ZombieSkeleton( player ); - m_ReAnimated.Add( player, zombieskel ); + ReAnimated.Add( player, zombieskel ); zombieskel.Home = home; zombieskel.RangeHome = 10; diff --git a/Scripts/Holiday Stuff/Valentine/2011/Items/StValentinesBears.cs b/Scripts/Holiday Stuff/Valentine/2011/Items/StValentinesBears.cs index 33c93c5e4..8d2697567 100644 --- a/Scripts/Holiday Stuff/Valentine/2011/Items/StValentinesBears.cs +++ b/Scripts/Holiday Stuff/Valentine/2011/Items/StValentinesBears.cs @@ -21,8 +21,6 @@ namespace Server.Items private string m_Line2; private string m_Line3; - private DateTime m_EditLimit; - [CommandProperty( AccessLevel.GameMaster )] public string Owner { @@ -52,15 +50,11 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public DateTime EditLimit - { - get => m_EditLimit; - set => m_EditLimit = value; - } + public DateTime EditLimit { get; set; } public bool IsSigned => ( m_Line1 != null || m_Line2 != null || m_Line3 != null ); - public bool CanSign => ( !IsSigned || DateTime.UtcNow <= m_EditLimit ); + public bool CanSign => ( !IsSigned || DateTime.UtcNow <= EditLimit ); public StValentinesBear( int itemid, string name ) : base( itemid ) diff --git a/Scripts/Items/Addons/AddonComponent.cs b/Scripts/Items/Addons/AddonComponent.cs index a4ebe0ee8..d2700dd10 100644 --- a/Scripts/Items/Addons/AddonComponent.cs +++ b/Scripts/Items/Addons/AddonComponent.cs @@ -105,22 +105,11 @@ namespace Server.Items public class AddonComponent : Item, IChopable { - private Point3D m_Offset; - private BaseAddon m_Addon; + [CommandProperty( AccessLevel.GameMaster )] + public BaseAddon Addon { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public BaseAddon Addon - { - get => m_Addon; - set => m_Addon = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public Point3D Offset - { - get => m_Offset; - set => m_Offset = value; - } + public Point3D Offset { get; set; } [Hue, CommandProperty( AccessLevel.GameMaster )] public override int Hue @@ -130,8 +119,8 @@ namespace Server.Items { base.Hue = value; - if ( m_Addon != null && m_Addon.ShareHue ) - m_Addon.Hue = value; + if ( Addon != null && Addon.ShareHue ) + Addon.Hue = value; } } @@ -151,34 +140,34 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - m_Addon?.OnComponentUsed( this, from ); + Addon?.OnComponentUsed( this, from ); } public void OnChop( Mobile from ) { - if ( m_Addon != null && from.InRange( GetWorldLocation(), 3 ) ) - m_Addon.OnChop( from ); + if ( Addon != null && from.InRange( GetWorldLocation(), 3 ) ) + Addon.OnChop( from ); else from.SendLocalizedMessage( 500446 ); // That is too far away. } public override void OnLocationChange( Point3D old ) { - if ( m_Addon != null ) - m_Addon.Location = new Point3D( X - m_Offset.X, Y - m_Offset.Y, Z - m_Offset.Z ); + if ( Addon != null ) + Addon.Location = new Point3D( X - Offset.X, Y - Offset.Y, Z - Offset.Z ); } public override void OnMapChange() { - if ( m_Addon != null ) - m_Addon.Map = Map; + if ( Addon != null ) + Addon.Map = Map; } public override void OnAfterDelete() { base.OnAfterDelete(); - m_Addon?.Delete(); + Addon?.Delete(); } public override void Serialize( GenericWriter writer ) @@ -187,8 +176,8 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( m_Addon ); - writer.Write( m_Offset ); + writer.Write( Addon ); + writer.Write( Offset ); } public override void Deserialize( GenericReader reader ) @@ -202,10 +191,10 @@ namespace Server.Items case 1: case 0: { - m_Addon = reader.ReadItem() as BaseAddon; - m_Offset = reader.ReadPoint3D(); + Addon = reader.ReadItem() as BaseAddon; + Offset = reader.ReadPoint3D(); - m_Addon?.OnComponentLoaded( this ); + Addon?.OnComponentLoaded( this ); ApplyLightTo( this ); diff --git a/Scripts/Items/Addons/AddonContainerComponent.cs b/Scripts/Items/Addons/AddonContainerComponent.cs index 230cca655..e28a706eb 100644 --- a/Scripts/Items/Addons/AddonContainerComponent.cs +++ b/Scripts/Items/Addons/AddonContainerComponent.cs @@ -8,22 +8,11 @@ namespace Server.Items public virtual bool NeedsWall => false; public virtual Point3D WallPosition => Point3D.Zero; - private Point3D m_Offset; - private BaseAddonContainer m_Addon; + [CommandProperty( AccessLevel.GameMaster )] + public BaseAddonContainer Addon { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public BaseAddonContainer Addon - { - get => m_Addon; - set => m_Addon = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public Point3D Offset - { - get => m_Offset; - set => m_Offset = value; - } + public Point3D Offset { get; set; } [Hue, CommandProperty( AccessLevel.GameMaster )] public override int Hue @@ -33,8 +22,8 @@ namespace Server.Items { base.Hue = value; - if ( m_Addon != null && m_Addon.ShareHue ) - m_Addon.Hue = value; + if ( Addon != null && Addon.ShareHue ) + Addon.Hue = value; } } @@ -60,31 +49,31 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - m_Addon?.OnComponentUsed( this, from ); + Addon?.OnComponentUsed( this, from ); } public override void OnLocationChange( Point3D old ) { - if ( m_Addon != null ) - m_Addon.Location = new Point3D( X - m_Offset.X, Y - m_Offset.Y, Z - m_Offset.Z ); + if ( Addon != null ) + Addon.Location = new Point3D( X - Offset.X, Y - Offset.Y, Z - Offset.Z ); } public override void GetContextMenuEntries( Mobile from, List list ) { - m_Addon?.GetContextMenuEntries( from, list ); + Addon?.GetContextMenuEntries( from, list ); } public override void OnMapChange() { - if ( m_Addon != null ) - m_Addon.Map = Map; + if ( Addon != null ) + Addon.Map = Map; } public override void OnAfterDelete() { base.OnAfterDelete(); - m_Addon?.Delete(); + Addon?.Delete(); } public override void Serialize( GenericWriter writer ) @@ -93,8 +82,8 @@ namespace Server.Items writer.Write( (int) 0 ); // version - writer.Write( m_Addon ); - writer.Write( m_Offset ); + writer.Write( Addon ); + writer.Write( Offset ); } public override void Deserialize( GenericReader reader ) @@ -103,18 +92,18 @@ namespace Server.Items int version = reader.ReadInt(); - m_Addon = reader.ReadItem() as BaseAddonContainer; - m_Offset = reader.ReadPoint3D(); + Addon = reader.ReadItem() as BaseAddonContainer; + Offset = reader.ReadPoint3D(); - m_Addon?.OnComponentLoaded( this ); + Addon?.OnComponentLoaded( this ); AddonComponent.ApplyLightTo( this ); } public virtual void OnChop( Mobile from ) { - if ( m_Addon != null && from.InRange( GetWorldLocation(), 3 ) ) - m_Addon.OnChop( from ); + if ( Addon != null && from.InRange( GetWorldLocation(), 3 ) ) + Addon.OnChop( from ); else from.SendLocalizedMessage( 500446 ); // That is too far away. } diff --git a/Scripts/Items/Addons/ArcheryButteAddon.cs b/Scripts/Items/Addons/ArcheryButteAddon.cs index f714f531c..87376c535 100644 --- a/Scripts/Items/Addons/ArcheryButteAddon.cs +++ b/Scripts/Items/Addons/ArcheryButteAddon.cs @@ -7,33 +7,14 @@ namespace Server.Items [FlippableAttribute( 0x100A/*East*/, 0x100B/*South*/ )] public class ArcheryButte : AddonComponent { - private double m_MinSkill; - private double m_MaxSkill; - - private int m_Arrows, m_Bolts; - - private DateTime m_LastUse; + [CommandProperty( AccessLevel.GameMaster )] + public double MinSkill { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public double MinSkill - { - get => m_MinSkill; - set => m_MinSkill = value; - } + public double MaxSkill { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public double MaxSkill - { - get => m_MaxSkill; - set => m_MaxSkill = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public DateTime LastUse - { - get => m_LastUse; - set => m_LastUse = value; - } + public DateTime LastUse { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool FacingEast @@ -43,18 +24,10 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public int Arrows - { - get => m_Arrows; - set => m_Arrows = value; - } + public int Arrows { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int Bolts - { - get => m_Bolts; - set => m_Bolts = value; - } + public int Bolts { get; set; } [Constructible] public ArcheryButte() : this( 0x100A ) @@ -63,8 +36,8 @@ namespace Server.Items public ArcheryButte( int itemID ) : base( itemID ) { - m_MinSkill = -25.0; - m_MaxSkill = +25.0; + MinSkill = -25.0; + MaxSkill = +25.0; } public ArcheryButte( Serial serial ) : base( serial ) @@ -73,7 +46,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if ( (m_Arrows > 0 || m_Bolts > 0) && from.InRange( GetWorldLocation(), 1 ) ) + if ( (Arrows > 0 || Bolts > 0) && from.InRange( GetWorldLocation(), 1 ) ) Gather( from ); else Fire( from ); @@ -83,14 +56,14 @@ namespace Server.Items { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500592 ); // You gather the arrows and bolts. - if ( m_Arrows > 0 ) - from.AddToBackpack( new Arrow( m_Arrows ) ); + if ( Arrows > 0 ) + from.AddToBackpack( new Arrow( Arrows ) ); - if ( m_Bolts > 0 ) - from.AddToBackpack( new Bolt( m_Bolts ) ); + if ( Bolts > 0 ) + from.AddToBackpack( new Bolt( Bolts ) ); - m_Arrows = 0; - m_Bolts = 0; + Arrows = 0; + Bolts = 0; m_Entries = null; } @@ -99,20 +72,14 @@ namespace Server.Items private class ScoreEntry { - private int m_Total; - private int m_Count; + public int Total { get; set; } - public int Total{ get => m_Total; - set => m_Total = value; - } - public int Count{ get => m_Count; - set => m_Count = value; - } + public int Count { get; set; } public void Record( int score ) { - m_Total += score; - m_Count += 1; + Total += score; + Count += 1; } public ScoreEntry() @@ -143,7 +110,7 @@ namespace Server.Items return; } - if ( DateTime.UtcNow < (m_LastUse + UseDelay) ) + if ( DateTime.UtcNow < (LastUse + UseDelay) ) return; Point3D worldLoc = GetWorldLocation(); @@ -191,7 +158,7 @@ namespace Server.Items return; } - m_LastUse = DateTime.UtcNow; + LastUse = DateTime.UtcNow; from.Direction = from.GetDirectionTo( GetWorldLocation() ); bow.PlaySwingAnimation( from ); @@ -199,7 +166,7 @@ namespace Server.Items ScoreEntry se = GetEntryFor( from ); - if ( !from.CheckSkill( bow.Skill, m_MinSkill, m_MaxSkill ) ) + if ( !from.CheckSkill( bow.Skill, MinSkill, MaxSkill ) ) { from.PlaySound( bow.MissSound ); @@ -246,7 +213,7 @@ namespace Server.Items splitScore = 5; } - bool split = ( isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble() ); + bool split = ( isKnown && ((Arrows + Bolts) * 0.02) > Utility.RandomDouble() ); if ( split ) { @@ -258,9 +225,9 @@ namespace Server.Items PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010035 + area, from.Name ); if ( isArrow ) - ++m_Arrows; + ++Arrows; else if ( isBolt ) - ++m_Bolts; + ++Bolts; } se.Record( split ? splitScore : score ); @@ -277,10 +244,10 @@ namespace Server.Items writer.Write( (int) 0 ); - writer.Write( m_MinSkill ); - writer.Write( m_MaxSkill ); - writer.Write( m_Arrows ); - writer.Write( m_Bolts ); + writer.Write( MinSkill ); + writer.Write( MaxSkill ); + writer.Write( Arrows ); + writer.Write( Bolts ); } public override void Deserialize( GenericReader reader ) @@ -293,15 +260,15 @@ namespace Server.Items { case 0: { - m_MinSkill = reader.ReadDouble(); - m_MaxSkill = reader.ReadDouble(); - m_Arrows = reader.ReadInt(); - m_Bolts = reader.ReadInt(); + MinSkill = reader.ReadDouble(); + MaxSkill = reader.ReadDouble(); + Arrows = reader.ReadInt(); + Bolts = reader.ReadInt(); - if ( m_MinSkill == 0.0 && m_MaxSkill == 30.0 ) + if ( MinSkill == 0.0 && MaxSkill == 30.0 ) { - m_MinSkill = -25.0; - m_MaxSkill = +25.0; + MinSkill = -25.0; + MaxSkill = +25.0; } break; diff --git a/Scripts/Items/Addons/BallotBox.cs b/Scripts/Items/Addons/BallotBox.cs index 9df3316c7..763c60318 100644 --- a/Scripts/Items/Addons/BallotBox.cs +++ b/Scripts/Items/Addons/BallotBox.cs @@ -13,22 +13,18 @@ namespace Server.Items public override int LabelNumber => 1041006; // a ballot box - private string[] m_Topic; - private List m_Yes; - private List m_No; + public string[] Topic { get; private set; } - public string[] Topic => m_Topic; + public List Yes { get; private set; } - public List Yes => m_Yes; - - public List No => m_No; + public List No { get; private set; } [Constructible] public BallotBox() : base( 0x9A8 ) { - m_Topic = new string[0]; - m_Yes = new List(); - m_No = new List(); + Topic = new string[0]; + Yes = new List(); + No = new List(); } public BallotBox( Serial serial ) : base( serial ) @@ -37,21 +33,21 @@ namespace Server.Items public void ClearTopic() { - m_Topic = new string[0]; + Topic = new string[0]; ClearVotes(); } public void AddLineToTopic( string line ) { - if ( m_Topic.Length >= MaxTopicLines ) + if ( Topic.Length >= MaxTopicLines ) return; - string[] newTopic = new string[m_Topic.Length + 1]; - m_Topic.CopyTo( newTopic, 0 ); - newTopic[m_Topic.Length] = line; + string[] newTopic = new string[Topic.Length + 1]; + Topic.CopyTo( newTopic, 0 ); + newTopic[Topic.Length] = line; - m_Topic = newTopic; + Topic = newTopic; ClearVotes(); } @@ -296,13 +292,13 @@ namespace Server.Items writer.WriteEncodedInt( 0 ); // version - writer.WriteEncodedInt( m_Topic.Length ); + writer.WriteEncodedInt( Topic.Length ); - for ( int i = 0; i < m_Topic.Length; i++ ) - writer.Write( (string) m_Topic[i] ); + for ( int i = 0; i < Topic.Length; i++ ) + writer.Write( (string) Topic[i] ); - writer.Write( m_Yes, true ); - writer.Write( m_No, true ); + writer.Write( Yes, true ); + writer.Write( No, true ); } public override void Deserialize( GenericReader reader ) @@ -311,13 +307,13 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - m_Topic = new string[reader.ReadEncodedInt()]; + Topic = new string[reader.ReadEncodedInt()]; - for ( int i = 0; i < m_Topic.Length; i++ ) - m_Topic[i] = reader.ReadString(); + for ( int i = 0; i < Topic.Length; i++ ) + Topic[i] = reader.ReadString(); - m_Yes = reader.ReadStrongMobileList(); - m_No = reader.ReadStrongMobileList(); + Yes = reader.ReadStrongMobileList(); + No = reader.ReadStrongMobileList(); } } diff --git a/Scripts/Items/Addons/BaseAddon.cs b/Scripts/Items/Addons/BaseAddon.cs index 7eb52055e..580d6aa02 100644 --- a/Scripts/Items/Addons/BaseAddon.cs +++ b/Scripts/Items/Addons/BaseAddon.cs @@ -42,14 +42,13 @@ namespace Server.Items } } #endregion - private List m_Components; public void AddComponent( AddonComponent c, int x, int y, int z ) { if ( Deleted ) return; - m_Components.Add( c ); + Components.Add( c ); c.Addon = this; c.Offset = new Point3D( x, y, z ); @@ -61,7 +60,7 @@ namespace Server.Items Movable = false; Visible = false; - m_Components = new List(); + Components = new List(); } public virtual bool RetainDeedHue => false; @@ -79,9 +78,9 @@ namespace Server.Items if ( RetainDeedHue ) { - for ( int i = 0; hue == 0 && i < m_Components.Count; ++i ) + for ( int i = 0; hue == 0 && i < Components.Count; ++i ) { - AddonComponent c = m_Components[i]; + AddonComponent c = Components[i]; if ( c.Hue != 0 ) hue = c.Hue; @@ -108,7 +107,7 @@ namespace Server.Items Item IAddon.Deed => Deed; - public List Components => m_Components; + public List Components { get; private set; } public BaseAddon( Serial serial ) : base( serial ) { @@ -125,7 +124,7 @@ namespace Server.Items if ( Deleted ) return AddonFitResult.Blocked; - foreach ( AddonComponent c in m_Components ) + foreach ( AddonComponent c in Components ) { Point3D p3D = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z ); @@ -152,7 +151,7 @@ namespace Server.Items Point3D doorLoc = door.GetWorldLocation(); int doorHeight = door.ItemData.CalcHeight; - foreach ( AddonComponent c in m_Components ) + foreach ( AddonComponent c in Components ) { Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z ); int addonHeight = c.ItemData.CalcHeight; @@ -207,7 +206,7 @@ namespace Server.Items if ( Deleted ) return; - foreach ( AddonComponent c in m_Components ) + foreach ( AddonComponent c in Components ) c.Location = new Point3D( X + c.Offset.X, Y + c.Offset.Y, Z + c.Offset.Z ); } @@ -216,7 +215,7 @@ namespace Server.Items if ( Deleted ) return; - foreach ( AddonComponent c in m_Components ) + foreach ( AddonComponent c in Components ) c.Map = Map; } @@ -224,7 +223,7 @@ namespace Server.Items { base.OnAfterDelete(); - foreach ( AddonComponent c in m_Components ) + foreach ( AddonComponent c in Components ) c.Delete(); } @@ -240,9 +239,9 @@ namespace Server.Items { base.Hue = value; - if ( !Deleted && ShareHue && m_Components != null ) + if ( !Deleted && ShareHue && Components != null ) { - foreach ( AddonComponent c in m_Components ) + foreach ( AddonComponent c in Components ) c.Hue = value; } } @@ -255,7 +254,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.WriteItemList( m_Components ); + writer.WriteItemList( Components ); } public override void Deserialize( GenericReader reader ) @@ -269,7 +268,7 @@ namespace Server.Items case 1: case 0: { - m_Components = reader.ReadStrongItemList(); + Components = reader.ReadStrongItemList(); break; } } diff --git a/Scripts/Items/Addons/BaseAddonContainer.cs b/Scripts/Items/Addons/BaseAddonContainer.cs index fe22ceab5..470d7e401 100644 --- a/Scripts/Items/Addons/BaseAddonContainer.cs +++ b/Scripts/Items/Addons/BaseAddonContainer.cs @@ -18,11 +18,11 @@ namespace Server.Items { base.Hue = value; - if ( !Deleted && ShareHue && m_Components != null ) + if ( !Deleted && ShareHue && Components != null ) { Hue = value; - foreach ( AddonContainerComponent c in m_Components ) + foreach ( AddonContainerComponent c in Components ) c.Hue = value; } } @@ -55,15 +55,13 @@ namespace Server.Items public virtual Point3D WallPosition => Point3D.Zero; public virtual BaseAddonContainerDeed Deed => null; - private List m_Components; - - public List Components => m_Components; + public List Components { get; private set; } public BaseAddonContainer( int itemID ) : base( itemID ) { AddonComponent.ApplyLightTo( this ); - m_Components = new List(); + Components = new List(); } public BaseAddonContainer( Serial serial ) : base( serial ) @@ -77,7 +75,7 @@ namespace Server.Items if ( Deleted ) return; - foreach ( AddonContainerComponent c in m_Components ) + foreach ( AddonContainerComponent c in Components ) c.Location = new Point3D( X + c.Offset.X, Y + c.Offset.Y, Z + c.Offset.Z ); } @@ -88,7 +86,7 @@ namespace Server.Items if ( Deleted ) return; - foreach ( AddonContainerComponent c in m_Components ) + foreach ( AddonContainerComponent c in Components ) c.Map = Map; } @@ -113,7 +111,7 @@ namespace Server.Items { base.OnAfterDelete(); - foreach ( AddonContainerComponent c in m_Components ) + foreach ( AddonContainerComponent c in Components ) c.Delete(); } @@ -123,7 +121,7 @@ namespace Server.Items writer.Write( (int) 0 ); // version - writer.WriteItemList( m_Components ); + writer.WriteItemList( Components ); writer.Write( (int) m_Resource ); } @@ -133,7 +131,7 @@ namespace Server.Items int version = reader.ReadInt(); - m_Components = reader.ReadStrongItemList(); + Components = reader.ReadStrongItemList(); m_Resource = (CraftResource) reader.ReadInt(); AddonComponent.ApplyLightTo( this ); @@ -150,7 +148,7 @@ namespace Server.Items if ( Deleted ) return; - m_Components.Add( c ); + Components.Add( c ); c.Addon = this; c.Offset = new Point3D( x, y, z ); @@ -162,7 +160,7 @@ namespace Server.Items if ( Deleted ) return AddonFitResult.Blocked; - foreach ( AddonContainerComponent c in m_Components ) + foreach ( AddonContainerComponent c in Components ) { Point3D p3D = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z ); @@ -209,7 +207,7 @@ namespace Server.Items Point3D doorLoc = door.GetWorldLocation(); int doorHeight = door.ItemData.CalcHeight; - foreach ( AddonContainerComponent c in m_Components ) + foreach ( AddonContainerComponent c in Components ) { Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z ); int addonHeight = c.ItemData.CalcHeight; @@ -251,9 +249,9 @@ namespace Server.Items if ( RetainDeedHue ) { - for ( int i = 0; hue == 0 && i < m_Components.Count; ++i ) + for ( int i = 0; hue == 0 && i < Components.Count; ++i ) { - AddonContainerComponent c = m_Components[ i ]; + AddonContainerComponent c = Components[ i ]; if ( c.Hue != 0 ) hue = c.Hue; diff --git a/Scripts/Items/Addons/LoomEastAddon.cs b/Scripts/Items/Addons/LoomEastAddon.cs index 7767f522f..671c8fc8b 100644 --- a/Scripts/Items/Addons/LoomEastAddon.cs +++ b/Scripts/Items/Addons/LoomEastAddon.cs @@ -9,11 +9,7 @@ namespace Server.Items { public override BaseAddonDeed Deed => new LoomEastDeed(); - private int m_Phase; - - public int Phase{ get => m_Phase; - set => m_Phase = value; - } + public int Phase { get; set; } [Constructible] public LoomEastAddon() @@ -32,7 +28,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (int) m_Phase ); + writer.Write( (int) Phase ); } public override void Deserialize( GenericReader reader ) @@ -45,7 +41,7 @@ namespace Server.Items { case 1: { - m_Phase = reader.ReadInt(); + Phase = reader.ReadInt(); break; } } diff --git a/Scripts/Items/Addons/LoomSouthAddon.cs b/Scripts/Items/Addons/LoomSouthAddon.cs index 82db51cfb..ca002b7d0 100644 --- a/Scripts/Items/Addons/LoomSouthAddon.cs +++ b/Scripts/Items/Addons/LoomSouthAddon.cs @@ -4,11 +4,7 @@ namespace Server.Items { public override BaseAddonDeed Deed => new LoomSouthDeed(); - private int m_Phase; - - public int Phase{ get => m_Phase; - set => m_Phase = value; - } + public int Phase { get; set; } [Constructible] public LoomSouthAddon() @@ -27,7 +23,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (int) m_Phase ); + writer.Write( (int) Phase ); } public override void Deserialize( GenericReader reader ) @@ -40,7 +36,7 @@ namespace Server.Items { case 1: { - m_Phase = reader.ReadInt(); + Phase = reader.ReadInt(); break; } } diff --git a/Scripts/Items/Addons/PickpocketDips.cs b/Scripts/Items/Addons/PickpocketDips.cs index ccb97578a..9e3ef07a9 100644 --- a/Scripts/Items/Addons/PickpocketDips.cs +++ b/Scripts/Items/Addons/PickpocketDips.cs @@ -5,32 +5,21 @@ namespace Server.Items [Flippable( 0x1EC0, 0x1EC3 )] public class PickpocketDip : AddonComponent { - private double m_MinSkill; - private double m_MaxSkill; - private Timer m_Timer; [CommandProperty( AccessLevel.GameMaster )] - public double MinSkill - { - get => m_MinSkill; - set => m_MinSkill = value; - } + public double MinSkill { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public double MaxSkill - { - get => m_MaxSkill; - set => m_MaxSkill = value; - } + public double MaxSkill { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool Swinging => ( m_Timer != null ); public PickpocketDip( int itemID ) : base( itemID ) { - m_MinSkill = -25.0; - m_MaxSkill = +25.0; + MinSkill = -25.0; + MaxSkill = +25.0; } public void UpdateItemID() @@ -65,7 +54,7 @@ namespace Server.Items Effects.PlaySound( GetWorldLocation(), Map, 0x4F ); - if ( from.CheckSkill( SkillName.Stealing, m_MinSkill, m_MaxSkill ) ) + if ( from.CheckSkill( SkillName.Stealing, MinSkill, MaxSkill ) ) { SendLocalizedMessageTo( from, 501834 ); // You successfully avoid disturbing the dip while searching it. } @@ -85,7 +74,7 @@ namespace Server.Items SendLocalizedMessageTo( from, 501816 ); // You are too far away to do that. else if ( Swinging ) SendLocalizedMessageTo( from, 501815 ); // You have to wait until it stops swinging. - else if ( from.Skills[SkillName.Stealing].Base >= m_MaxSkill ) + else if ( from.Skills[SkillName.Stealing].Base >= MaxSkill ) SendLocalizedMessageTo( from, 501830 ); // Your ability to steal cannot improve any further by simply practicing on a dummy. else if ( from.Mounted ) SendLocalizedMessageTo( from, 501829 ); // You can't practice on this while on a mount. @@ -103,8 +92,8 @@ namespace Server.Items writer.Write( (int) 0 ); - writer.Write( m_MinSkill ); - writer.Write( m_MaxSkill ); + writer.Write( MinSkill ); + writer.Write( MaxSkill ); } public override void Deserialize( GenericReader reader ) @@ -117,13 +106,13 @@ namespace Server.Items { case 0: { - m_MinSkill = reader.ReadDouble(); - m_MaxSkill = reader.ReadDouble(); + MinSkill = reader.ReadDouble(); + MaxSkill = reader.ReadDouble(); - if ( m_MinSkill == 0.0 && m_MaxSkill == 30.0 ) + if ( MinSkill == 0.0 && MaxSkill == 30.0 ) { - m_MinSkill = -25.0; - m_MaxSkill = +25.0; + MinSkill = -25.0; + MaxSkill = +25.0; } break; diff --git a/Scripts/Items/Addons/SHTeleporter.cs b/Scripts/Items/Addons/SHTeleporter.cs index 83fa5cfb0..3eb62c7b7 100644 --- a/Scripts/Items/Addons/SHTeleporter.cs +++ b/Scripts/Items/Addons/SHTeleporter.cs @@ -7,7 +7,6 @@ namespace Server.Items { private bool m_Active; private SHTeleComponent m_TeleDest; - private Point3D m_TeleOffset; [CommandProperty( AccessLevel.GameMaster )] public bool Active @@ -23,17 +22,13 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public Point3D TeleOffset - { - get => m_TeleOffset; - set => m_TeleOffset = value; - } + public Point3D TeleOffset { get; set; } [CommandProperty(AccessLevel.GameMaster)] public Point3D TelePoint { get => new Point3D( Location.X + TeleOffset.X, Location.Y + TeleOffset.Y, Location.Z + TeleOffset.Z ); - set => m_TeleOffset = new Point3D( value.X - Location.X, value.Y - Location.Y, value.Z - Location.Z ); + set => TeleOffset = new Point3D( value.X - Location.X, value.Y - Location.Y, value.Z - Location.Z ); } [CommandProperty( AccessLevel.GameMaster )] @@ -68,7 +63,7 @@ namespace Server.Items Hue = 1; m_Active = true; - m_TeleOffset = offset; + TeleOffset = offset; } public SHTeleComponent( Serial serial ) : base( serial ) @@ -108,7 +103,7 @@ namespace Server.Items writer.Write( m_Active ); writer.Write( m_TeleDest ); - writer.Write( m_TeleOffset ); + writer.Write( TeleOffset ); } public override void Deserialize( GenericReader reader ) @@ -119,7 +114,7 @@ namespace Server.Items m_Active = reader.ReadBool(); m_TeleDest = reader.ReadItem() as SHTeleComponent; - m_TeleOffset = reader.ReadPoint3D(); + TeleOffset = reader.ReadPoint3D(); } } @@ -276,22 +271,18 @@ namespace Server.Items } } - private bool m_External; - - private SHTeleComponent m_UpTele; - private SHTeleComponent m_RightTele; - private SHTeleComponent m_DownTele; - private SHTeleComponent m_LeftTele; - private bool m_Changing; [CommandProperty( AccessLevel.GameMaster )] - public bool External => m_External; + public bool External { get; private set; } - public SHTeleComponent UpTele => m_UpTele; - public SHTeleComponent RightTele => m_RightTele; - public SHTeleComponent DownTele => m_DownTele; - public SHTeleComponent LeftTele => m_LeftTele; + public SHTeleComponent UpTele { get; private set; } + + public SHTeleComponent RightTele { get; private set; } + + public SHTeleComponent DownTele { get; private set; } + + public SHTeleComponent LeftTele { get; private set; } [Constructible] public SHTeleporter() : this( true ) @@ -302,7 +293,7 @@ namespace Server.Items public SHTeleporter( bool external ) { m_Changing = false; - m_External = external; + External = external; if ( external ) { @@ -325,20 +316,20 @@ namespace Server.Items } Point3D upOS = external ? new Point3D( -1, 0, 0 ) : new Point3D( -2, -1, 0 ); - m_UpTele = new SHTeleComponent( external ? 0x1775 : 0x495, upOS ); - AddComponent( m_UpTele, 0, 0, 0 ); + UpTele = new SHTeleComponent( external ? 0x1775 : 0x495, upOS ); + AddComponent( UpTele, 0, 0, 0 ); Point3D rightOS = external ? new Point3D( -2, 0, 0 ) : new Point3D( 2, -1, 0 ); - m_RightTele = new SHTeleComponent( external ? 0x1775 : 0x495, rightOS ); - AddComponent( m_RightTele, 1, 0, 0 ); + RightTele = new SHTeleComponent( external ? 0x1775 : 0x495, rightOS ); + AddComponent( RightTele, 1, 0, 0 ); Point3D downOS = external ? new Point3D( -2, -1, 0 ) : new Point3D( 2, 2, 0 ); - m_DownTele = new SHTeleComponent( external ? 0x1776 : 0x495, downOS ); - AddComponent( m_DownTele, 1, 1, 0 ); + DownTele = new SHTeleComponent( external ? 0x1776 : 0x495, downOS ); + AddComponent( DownTele, 1, 1, 0 ); Point3D leftOS = external ? new Point3D( -1, -1, 0 ) : new Point3D( -1, 2, 0 ); - m_LeftTele = new SHTeleComponent( external ? 0x1775 : 0x495, leftOS ); - AddComponent( m_LeftTele, 0, 1, 0 ); + LeftTele = new SHTeleComponent( external ? 0x1775 : 0x495, leftOS ); + AddComponent( LeftTele, 0, 1, 0 ); } public SHTeleporter( Serial serial ) : base( serial ) @@ -355,10 +346,10 @@ namespace Server.Items m_Changing = true; - m_UpTele.Active = active; - m_RightTele.Active = active; - m_DownTele.Active = active; - m_LeftTele.Active = active; + UpTele.Active = active; + RightTele.Active = active; + DownTele.Active = active; + LeftTele.Active = active; m_Changing = false; } @@ -372,19 +363,19 @@ namespace Server.Items if ( !(dest?.Addon is SHTeleporter) ) { - m_UpTele.TeleDest = dest; - m_RightTele.TeleDest = dest; - m_DownTele.TeleDest = dest; - m_LeftTele.TeleDest = dest; + UpTele.TeleDest = dest; + RightTele.TeleDest = dest; + DownTele.TeleDest = dest; + LeftTele.TeleDest = dest; } else { SHTeleporter destAddon = (SHTeleporter)dest.Addon; - m_UpTele.TeleDest = destAddon.UpTele; - m_RightTele.TeleDest = destAddon.RightTele; - m_DownTele.TeleDest = destAddon.DownTele; - m_LeftTele.TeleDest = destAddon.LeftTele; + UpTele.TeleDest = destAddon.UpTele; + RightTele.TeleDest = destAddon.RightTele; + DownTele.TeleDest = destAddon.DownTele; + LeftTele.TeleDest = destAddon.LeftTele; } m_Changing = false; @@ -399,17 +390,17 @@ namespace Server.Items if ( destAddon != null ) { - m_UpTele.TeleDest = destAddon.UpTele; - m_RightTele.TeleDest = destAddon.RightTele; - m_DownTele.TeleDest = destAddon.DownTele; - m_LeftTele.TeleDest = destAddon.LeftTele; + UpTele.TeleDest = destAddon.UpTele; + RightTele.TeleDest = destAddon.RightTele; + DownTele.TeleDest = destAddon.DownTele; + LeftTele.TeleDest = destAddon.LeftTele; } else { - m_UpTele.TeleDest = null; - m_RightTele.TeleDest = null; - m_DownTele.TeleDest = null; - m_LeftTele.TeleDest = null; + UpTele.TeleDest = null; + RightTele.TeleDest = null; + DownTele.TeleDest = null; + LeftTele.TeleDest = null; } m_Changing = false; @@ -421,12 +412,12 @@ namespace Server.Items writer.Write( (int)0 ); // version - writer.Write( m_External ); + writer.Write( External ); - writer.Write( m_UpTele ); - writer.Write( m_RightTele ); - writer.Write( m_DownTele ); - writer.Write( m_LeftTele ); + writer.Write( UpTele ); + writer.Write( RightTele ); + writer.Write( DownTele ); + writer.Write( LeftTele ); } public override void Deserialize( GenericReader reader ) @@ -435,12 +426,12 @@ namespace Server.Items int version = reader.ReadInt(); - m_External = reader.ReadBool(); + External = reader.ReadBool(); - m_UpTele = (SHTeleComponent)reader.ReadItem(); - m_RightTele = (SHTeleComponent)reader.ReadItem(); - m_DownTele = (SHTeleComponent)reader.ReadItem(); - m_LeftTele = (SHTeleComponent)reader.ReadItem(); + UpTele = (SHTeleComponent)reader.ReadItem(); + RightTele = (SHTeleComponent)reader.ReadItem(); + DownTele = (SHTeleComponent)reader.ReadItem(); + LeftTele = (SHTeleComponent)reader.ReadItem(); } } } diff --git a/Scripts/Items/Addons/TrainingDummies.cs b/Scripts/Items/Addons/TrainingDummies.cs index 370519f8f..5030e8947 100644 --- a/Scripts/Items/Addons/TrainingDummies.cs +++ b/Scripts/Items/Addons/TrainingDummies.cs @@ -5,24 +5,13 @@ namespace Server.Items [Flippable( 0x1070, 0x1074 )] public class TrainingDummy : AddonComponent { - private double m_MinSkill; - private double m_MaxSkill; - private Timer m_Timer; [CommandProperty( AccessLevel.GameMaster )] - public double MinSkill - { - get => m_MinSkill; - set => m_MinSkill = value; - } + public double MinSkill { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public double MaxSkill - { - get => m_MaxSkill; - set => m_MaxSkill = value; - } + public double MaxSkill { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool Swinging => ( m_Timer != null ); @@ -35,8 +24,8 @@ namespace Server.Items [Constructible] public TrainingDummy( int itemID ) : base( itemID ) { - m_MinSkill = -25.0; - m_MaxSkill = +25.0; + MinSkill = -25.0; + MaxSkill = +25.0; } public void UpdateItemID() @@ -76,7 +65,7 @@ namespace Server.Items from.Direction = from.GetDirectionTo( GetWorldLocation() ); weapon.PlaySwingAnimation( from ); - from.CheckSkill( weapon.Skill, m_MinSkill, m_MaxSkill ); + from.CheckSkill( weapon.Skill, MinSkill, MaxSkill ); } public override void OnDoubleClick( Mobile from ) @@ -89,7 +78,7 @@ namespace Server.Items SendLocalizedMessageTo( from, 501816 ); // You are too far away to do that. else if ( Swinging ) SendLocalizedMessageTo( from, 501815 ); // You have to wait until it stops swinging. - else if ( from.Skills[weapon.Skill].Base >= m_MaxSkill ) + else if ( from.Skills[weapon.Skill].Base >= MaxSkill ) SendLocalizedMessageTo( from, 501828 ); // Your skill cannot improve any further by simply practicing with a dummy. else if ( from.Mounted ) SendLocalizedMessageTo( from, 501829 ); // You can't practice on this while on a mount. @@ -107,8 +96,8 @@ namespace Server.Items writer.Write( (int) 0 ); - writer.Write( m_MinSkill ); - writer.Write( m_MaxSkill ); + writer.Write( MinSkill ); + writer.Write( MaxSkill ); } public override void Deserialize( GenericReader reader ) @@ -121,13 +110,13 @@ namespace Server.Items { case 0: { - m_MinSkill = reader.ReadDouble(); - m_MaxSkill = reader.ReadDouble(); + MinSkill = reader.ReadDouble(); + MaxSkill = reader.ReadDouble(); - if ( m_MinSkill == 0.0 && m_MaxSkill == 30.0 ) + if ( MinSkill == 0.0 && MaxSkill == 30.0 ) { - m_MinSkill = -25.0; - m_MaxSkill = +25.0; + MinSkill = -25.0; + MaxSkill = +25.0; } break; diff --git a/Scripts/Items/Aquarium/Aquarium.cs b/Scripts/Items/Aquarium/Aquarium.cs index adb0cb1ac..1a34979cb 100644 --- a/Scripts/Items/Aquarium/Aquarium.cs +++ b/Scripts/Items/Aquarium/Aquarium.cs @@ -11,10 +11,9 @@ namespace Server.Items public static readonly TimeSpan EvaluationInterval = TimeSpan.FromDays( 1 ); // items info - private int m_LiveCreatures; [CommandProperty( AccessLevel.GameMaster )] - public int LiveCreatures => m_LiveCreatures; + public int LiveCreatures { get; private set; } [CommandProperty( AccessLevel.GameMaster )] public int DeadCreatures @@ -88,11 +87,10 @@ namespace Server.Items public bool OptimalState => ( m_Food.State == (int) FoodState.Full && m_Water.State == (int) WaterState.Strong ); // events - private List m_Events; private bool m_RewardAvailable; private bool m_EvaluateDay; - public List Events => m_Events; + public List Events { get; private set; } [CommandProperty( AccessLevel.GameMaster )] public bool RewardAvailable @@ -139,7 +137,7 @@ namespace Server.Items m_Water.Maintain = Utility.RandomMinMax( 1, 3 ); - m_Events = new List(); + Events = new List(); m_Timer = Timer.DelayCall( EvaluationInterval, EvaluationInterval, Evaluate ); } @@ -293,21 +291,21 @@ namespace Server.Items if ( m_VacationLeft > 0 ) LabelTo( from, 1074430, m_VacationLeft.ToString() ); // Vacation days left: ~1_DAYS - if ( m_Events.Count > 0 ) - LabelTo( from, 1074426, m_Events.Count.ToString() ); // ~1_NUM~ event(s) to view! + if ( Events.Count > 0 ) + LabelTo( from, 1074426, Events.Count.ToString() ); // ~1_NUM~ event(s) to view! if ( m_RewardAvailable ) LabelTo( from, 1074362 ); // A reward is available! - LabelTo( from, 1074247, $"{m_LiveCreatures}\t{MaxLiveCreatures}"); // Live Creatures: ~1_NUM~ / ~2_MAX~ + LabelTo( from, 1074247, $"{LiveCreatures}\t{MaxLiveCreatures}"); // Live Creatures: ~1_NUM~ / ~2_MAX~ if ( DeadCreatures > 0 ) LabelTo( from, 1074248, DeadCreatures.ToString() ); // Dead Creatures: ~1_NUM~ - int decorations = Items.Count - m_LiveCreatures - DeadCreatures; + int decorations = Items.Count - LiveCreatures - DeadCreatures; if ( decorations > 0 ) - LabelTo( from, 1074249, (Items.Count - m_LiveCreatures - DeadCreatures).ToString() ); // Decorations: ~1_NUM~ + LabelTo( from, 1074249, (Items.Count - LiveCreatures - DeadCreatures).ToString() ); // Decorations: ~1_NUM~ LabelTo( from, 1074250, "#" + FoodNumber() ); // Food state: ~1_STATE~ LabelTo( from, 1074251, "#" + WaterNumber() ); // Water state: ~1_STATE~ @@ -334,20 +332,20 @@ namespace Server.Items if ( m_VacationLeft > 0 ) list.Add( 1074430, m_VacationLeft.ToString() ); // Vacation days left: ~1_DAYS - if ( m_Events.Count > 0 ) - list.Add( 1074426, m_Events.Count.ToString() ); // ~1_NUM~ event(s) to view! + if ( Events.Count > 0 ) + list.Add( 1074426, Events.Count.ToString() ); // ~1_NUM~ event(s) to view! if ( m_RewardAvailable ) list.Add( 1074362 ); // A reward is available! - list.Add( 1074247, "{0}\t{1}", m_LiveCreatures, MaxLiveCreatures ); // Live Creatures: ~1_NUM~ / ~2_MAX~ + list.Add( 1074247, "{0}\t{1}", LiveCreatures, MaxLiveCreatures ); // Live Creatures: ~1_NUM~ / ~2_MAX~ int dead = DeadCreatures; if ( dead > 0 ) list.Add( 1074248, dead.ToString() ); // Dead Creatures: ~1_NUM~ - int decorations = Items.Count - m_LiveCreatures - dead; + int decorations = Items.Count - LiveCreatures - dead; if ( decorations > 0 ) list.Add( 1074249, decorations.ToString() ); // Decorations: ~1_NUM~ @@ -383,7 +381,7 @@ namespace Server.Items if ( m_RewardAvailable ) list.Add( new CollectRewardEntry( this ) ); - if ( m_Events.Count > 0 ) + if ( Events.Count > 0 ) list.Add( new ViewEventEntry( this ) ); if ( m_VacationLeft > 0 ) @@ -414,16 +412,16 @@ namespace Server.Items writer.Write( DateTime.UtcNow + EvaluationInterval ); // version 0 - writer.Write( (int) m_LiveCreatures ); + writer.Write( (int) LiveCreatures ); writer.Write( (int) m_VacationLeft ); m_Food.Serialize( writer ); m_Water.Serialize( writer ); - writer.Write( (int) m_Events.Count ); + writer.Write( (int) Events.Count ); - for ( int i = 0; i < m_Events.Count; i ++ ) - writer.Write( (int) m_Events[ i ] ); + for ( int i = 0; i < Events.Count; i ++ ) + writer.Write( (int) Events[ i ] ); writer.Write( (bool) m_RewardAvailable ); } @@ -451,7 +449,7 @@ namespace Server.Items } case 0: { - m_LiveCreatures = reader.ReadInt(); + LiveCreatures = reader.ReadInt(); m_VacationLeft = reader.ReadInt(); m_Food = new AquariumState(); @@ -460,12 +458,12 @@ namespace Server.Items m_Food.Deserialize( reader ); m_Water.Deserialize( reader ); - m_Events = new List(); + Events = new List(); int count = reader.ReadInt(); for ( int i = 0; i < count; i ++ ) - m_Events.Add( reader.ReadInt() ); + Events.Add( reader.ReadInt() ); m_RewardAvailable = reader.ReadBool(); @@ -485,13 +483,13 @@ namespace Server.Items private void RecountLiveCreatures() { - m_LiveCreatures = 0; + LiveCreatures = 0; List fish = FindItemsByType(); foreach ( BaseFish f in fish ) { if ( !f.Dead ) - ++m_LiveCreatures; + ++LiveCreatures; } } @@ -543,12 +541,12 @@ namespace Server.Items toKill.RemoveAt( kill ); amount -= 1; - m_LiveCreatures -= 1; + LiveCreatures -= 1; - if ( m_LiveCreatures < 0 ) - m_LiveCreatures = 0; + if ( LiveCreatures < 0 ) + LiveCreatures = 0; - m_Events.Add( 1074366 ); // An unfortunate accident has left a creature floating upside-down. It is starting to smell. + Events.Add( 1074366 ); // An unfortunate accident has left a creature floating upside-down. It is starting to smell. } } @@ -561,41 +559,41 @@ namespace Server.Items else if ( m_EvaluateDay ) { // reset events - m_Events = new List(); + Events = new List(); // food events if ( ( m_Food.Added < m_Food.Maintain && m_Food.State != (int) FoodState.Overfed && m_Food.State != (int) FoodState.Dead ) || ( m_Food.Added >= m_Food.Improve && m_Food.State == (int) FoodState.Full ) ) - m_Events.Add( 1074368 ); // The tank looks worse than it did yesterday. + Events.Add( 1074368 ); // The tank looks worse than it did yesterday. if ( ( m_Food.Added >= m_Food.Improve && m_Food.State != (int) FoodState.Full && m_Food.State != (int) FoodState.Overfed ) || ( m_Food.Added < m_Food.Maintain && m_Food.State == (int) FoodState.Overfed ) ) - m_Events.Add( 1074367 ); // The tank looks healthier today. + Events.Add( 1074367 ); // The tank looks healthier today. // water events if ( m_Water.Added < m_Water.Maintain && m_Water.State != (int) WaterState.Dead ) - m_Events.Add( 1074370 ); // This tank can use more water. + Events.Add( 1074370 ); // This tank can use more water. if ( m_Water.Added >= m_Water.Improve && m_Water.State != (int) WaterState.Strong ) - m_Events.Add( 1074369 ); // The water looks clearer today. + Events.Add( 1074369 ); // The water looks clearer today. UpdateFoodState(); UpdateWaterState(); // reward - if ( m_LiveCreatures > 0 ) + if ( LiveCreatures > 0 ) m_RewardAvailable = true; } else { // new fish - if ( OptimalState && m_LiveCreatures < MaxLiveCreatures ) + if ( OptimalState && LiveCreatures < MaxLiveCreatures ) { - if ( Utility.RandomDouble() < 0.005 * m_LiveCreatures ) + if ( Utility.RandomDouble() < 0.005 * LiveCreatures ) { BaseFish fish = null; int message = 0; @@ -641,26 +639,26 @@ namespace Server.Items } if ( Utility.RandomDouble() < 0.05 ) - fish.Hue = m_FishHues[ Utility.Random( m_FishHues.Length ) ]; + fish.Hue = FishHues[ Utility.Random( FishHues.Length ) ]; else if ( Utility.RandomDouble() < 0.5 ) fish.Hue = Utility.RandomMinMax( 0x100, 0x3E5 ); if ( AddFish( fish ) ) - m_Events.Add( message ); + Events.Add( message ); else fish.Delete(); } } // kill fish *grins* - if ( m_LiveCreatures < MaxLiveCreatures ) + if ( LiveCreatures < MaxLiveCreatures ) { if ( Utility.RandomDouble() < 0.01 ) KillFish( 1 ); } else { - KillFish( m_LiveCreatures - MaxLiveCreatures ); + KillFish( LiveCreatures - MaxLiveCreatures ); } } @@ -673,7 +671,7 @@ namespace Server.Items if ( !m_RewardAvailable ) return; - int max = (int) ( ( (double) m_LiveCreatures / 30 ) * m_Decorations.Length ); + int max = (int) ( ( (double) LiveCreatures / 30 ) * m_Decorations.Length ); int random = ( max <= 0 ) ? 0 : Utility.Random( max ); @@ -778,7 +776,7 @@ namespace Server.Items } if ( !fish.Dead ) - m_LiveCreatures -= 1; + LiveCreatures -= 1; } else { @@ -819,7 +817,7 @@ namespace Server.Items if ( fish == null ) return false; - if ( IsFull || m_LiveCreatures >= MaxLiveCreatures || fish.Dead ) + if ( IsFull || LiveCreatures >= MaxLiveCreatures || fish.Dead ) { from?.SendLocalizedMessage( 1073633 ); // The aquarium can not hold the creature. @@ -829,7 +827,7 @@ namespace Server.Items AddItem( fish ); fish.StopTimer(); - m_LiveCreatures += 1; + LiveCreatures += 1; from?.SendLocalizedMessage( 1073632, $"#{fish.LabelNumber}"); // You add the following creature to your aquarium: ~1_FISH~ @@ -920,12 +918,11 @@ namespace Server.Items return false; } - private static int[] m_FishHues = { + public static int[] FishHues { get; } = + { 0x1C2, 0x1C3, 0x2A3, 0x47E, 0x51D }; - public static int[] FishHues => m_FishHues; - #endregion #region Context entries diff --git a/Scripts/Items/Aquarium/AquariumState.cs b/Scripts/Items/Aquarium/AquariumState.cs index bb6290b65..990de2421 100644 --- a/Scripts/Items/Aquarium/AquariumState.cs +++ b/Scripts/Items/Aquarium/AquariumState.cs @@ -22,9 +22,6 @@ namespace Server.Items public class AquariumState { private int m_State; - private int m_Maintain; - private int m_Improve; - private int m_Added; [CommandProperty( AccessLevel.GameMaster )] public int State @@ -43,25 +40,13 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public int Maintain - { - get => m_Maintain; - set => m_Maintain = value; - } + public int Maintain { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int Improve - { - get => m_Improve; - set => m_Improve = value; - } + public int Improve { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int Added - { - get => m_Added; - set => m_Added = value; - } + public int Added { get; set; } public AquariumState() { @@ -77,9 +62,9 @@ namespace Server.Items writer.Write( 0 ); // version writer.Write( m_State ); - writer.Write( m_Maintain ); - writer.Write( m_Improve ); - writer.Write( m_Added ); + writer.Write( Maintain ); + writer.Write( Improve ); + writer.Write( Added ); } public virtual void Deserialize( GenericReader reader ) @@ -87,9 +72,9 @@ namespace Server.Items int version = reader.ReadInt(); m_State = reader.ReadInt(); - m_Maintain = reader.ReadInt(); - m_Improve = reader.ReadInt(); - m_Added = reader.ReadInt(); + Maintain = reader.ReadInt(); + Improve = reader.ReadInt(); + Added = reader.ReadInt(); } } } diff --git a/Scripts/Items/Armor/BaseArmor.cs b/Scripts/Items/Armor/BaseArmor.cs index 8a1afd987..746588f9a 100644 --- a/Scripts/Items/Armor/BaseArmor.cs +++ b/Scripts/Items/Armor/BaseArmor.cs @@ -54,7 +54,7 @@ namespace Server.Items private ArmorDurabilityLevel m_Durability; private ArmorProtectionLevel m_Protection; private CraftResource m_Resource; - private bool m_Identified, m_PlayerConstructed; + private bool m_Identified; private int m_PhysicalBonus, m_FireBonus, m_ColdBonus, m_PoisonBonus, m_EnergyBonus; private AosAttributes m_AosAttributes; @@ -213,11 +213,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public bool PlayerConstructed - { - get => m_PlayerConstructed; - set => m_PlayerConstructed = value; - } + public bool PlayerConstructed { get; set; } [CommandProperty( AccessLevel.GameMaster )] public CraftResource Resource @@ -252,8 +248,8 @@ namespace Server.Items { int pos = (int)BodyPosition; - if ( pos >= 0 && pos < m_ArmorScalars.Length ) - return m_ArmorScalars[pos]; + if ( pos >= 0 && pos < ArmorScalars.Length ) + return ArmorScalars[pos]; return 1.0; } @@ -548,7 +544,7 @@ namespace Server.Items { Item res = (Item)Activator.CreateInstance( CraftResources.GetInfo( m_Resource ).ResourceTypes[0] ); - ScissorHelper( from, res, m_PlayerConstructed ? (item.Resources.GetAt( 0 ).Amount / 2) : 1 ); + ScissorHelper( from, res, PlayerConstructed ? (item.Resources.GetAt( 0 ).Amount / 2) : 1 ); return true; } catch @@ -560,13 +556,7 @@ namespace Server.Items return false; } - private static double[] m_ArmorScalars = { 0.07, 0.07, 0.14, 0.15, 0.22, 0.35 }; - - public static double[] ArmorScalars - { - get => m_ArmorScalars; - set => m_ArmorScalars = value; - } + public static double[] ArmorScalars { get; set; } = { 0.07, 0.07, 0.14, 0.15, 0.22, 0.35 }; public static void ValidateMobile( Mobile m ) { @@ -734,7 +724,7 @@ namespace Server.Items SetSaveFlag( ref flags, SaveFlag.IntReq, m_IntReq != -1 ); SetSaveFlag( ref flags, SaveFlag.MedAllowance, m_Meditate != (AMA)(-1) ); SetSaveFlag( ref flags, SaveFlag.SkillBonuses, !m_AosSkillBonuses.IsEmpty ); - SetSaveFlag( ref flags, SaveFlag.PlayerConstructed, m_PlayerConstructed != false ); + SetSaveFlag( ref flags, SaveFlag.PlayerConstructed, PlayerConstructed != false ); writer.WriteEncodedInt( (int) flags ); @@ -935,7 +925,7 @@ namespace Server.Items m_AosSkillBonuses = new AosSkillBonuses( this, reader ); if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) - m_PlayerConstructed = true; + PlayerConstructed = true; break; } @@ -1091,7 +1081,7 @@ namespace Server.Items m?.CheckStatTimers(); if ( version < 7 ) - m_PlayerConstructed = true; // we don't know, so, assume it's crafted + PlayerConstructed = true; // we don't know, so, assume it's crafted } public virtual CraftResource DefaultResource => CraftResource.Iron; diff --git a/Scripts/Items/Body Parts/Head.cs b/Scripts/Items/Body Parts/Head.cs index a1fe0c00b..1b9262db5 100644 --- a/Scripts/Items/Body Parts/Head.cs +++ b/Scripts/Items/Body Parts/Head.cs @@ -11,40 +11,29 @@ namespace Server.Items public class Head : Item { - private string m_PlayerName; - private HeadType m_HeadType; + [CommandProperty( AccessLevel.GameMaster )] + public string PlayerName { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public string PlayerName - { - get => m_PlayerName; - set => m_PlayerName = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public HeadType HeadType - { - get => m_HeadType; - set => m_HeadType = value; - } + public HeadType HeadType { get; set; } public override string DefaultName { get { - if ( m_PlayerName == null ) + if ( PlayerName == null ) return base.DefaultName; - switch ( m_HeadType ) + switch ( HeadType ) { default: - return $"the head of {m_PlayerName}"; + return $"the head of {PlayerName}"; case HeadType.Duel: - return $"the head of {m_PlayerName}, taken in a duel"; + return $"the head of {PlayerName}, taken in a duel"; case HeadType.Tournament: - return $"the head of {m_PlayerName}, taken in a tournament"; + return $"the head of {PlayerName}, taken in a tournament"; } } } @@ -65,8 +54,8 @@ namespace Server.Items public Head( HeadType headType, string playerName ) : base( 0x1DA0 ) { - m_HeadType = headType; - m_PlayerName = playerName; + HeadType = headType; + PlayerName = playerName; } public Head( Serial serial ) @@ -80,8 +69,8 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (string) m_PlayerName ); - writer.WriteEncodedInt( (int) m_HeadType ); + writer.Write( (string) PlayerName ); + writer.WriteEncodedInt( (int) HeadType ); } public override void Deserialize( GenericReader reader ) @@ -93,8 +82,8 @@ namespace Server.Items switch ( version ) { case 1: - m_PlayerName = reader.ReadString(); - m_HeadType = (HeadType) reader.ReadEncodedInt(); + PlayerName = reader.ReadString(); + HeadType = (HeadType) reader.ReadEncodedInt(); break; case 0: @@ -108,16 +97,16 @@ namespace Server.Items if ( format.EndsWith( ", taken in a duel" ) ) { format = format.Substring( 0, format.Length - ", taken in a duel".Length ); - m_HeadType = HeadType.Duel; + HeadType = HeadType.Duel; } else if ( format.EndsWith( ", taken in a tournament" ) ) { format = format.Substring( 0, format.Length - ", taken in a tournament".Length ); - m_HeadType = HeadType.Tournament; + HeadType = HeadType.Tournament; } } - m_PlayerName = format; + PlayerName = format; Name = null; break; diff --git a/Scripts/Items/Books/BaseBook.cs b/Scripts/Items/Books/BaseBook.cs index 80efe11cf..a6706c67a 100644 --- a/Scripts/Items/Books/BaseBook.cs +++ b/Scripts/Items/Books/BaseBook.cs @@ -11,40 +11,34 @@ namespace Server.Items { public class BookPageInfo { - private string[] m_Lines; - - public string[] Lines - { - get => m_Lines; - set => m_Lines = value; - } + public string[] Lines { get; set; } public BookPageInfo() { - m_Lines = new string[0]; + Lines = new string[0]; } public BookPageInfo( params string[] lines ) { - m_Lines = lines; + Lines = lines; } public BookPageInfo( GenericReader reader ) { int length = reader.ReadInt(); - m_Lines = new string[length]; + Lines = new string[length]; - for ( int i = 0; i < m_Lines.Length; ++i ) - m_Lines[i] = Utility.Intern( reader.ReadString() ); + for ( int i = 0; i < Lines.Length; ++i ) + Lines[i] = Utility.Intern( reader.ReadString() ); } public void Serialize( GenericWriter writer ) { - writer.Write( m_Lines.Length ); + writer.Write( Lines.Length ); - for ( int i = 0; i < m_Lines.Length; ++i ) - writer.Write( m_Lines[i] ); + for ( int i = 0; i < Lines.Length; ++i ) + writer.Write( Lines[i] ); } } @@ -52,9 +46,6 @@ namespace Server.Items { private string m_Title; private string m_Author; - private BookPageInfo[] m_Pages; - private bool m_Writable; - private SecureLevel m_SecureLevel; [CommandProperty( AccessLevel.GameMaster )] public string Title @@ -71,16 +62,12 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public bool Writable - { - get => m_Writable; - set => m_Writable = value; - } + public bool Writable { get; set; } [CommandProperty(AccessLevel.GameMaster)] - public int PagesCount => m_Pages.Length; + public int PagesCount => Pages.Length; - public BookPageInfo[] Pages => m_Pages; + public BookPageInfo[] Pages { get; private set; } [Constructible] public BaseBook( int itemID ) : this( itemID, 20, true ) @@ -97,39 +84,39 @@ namespace Server.Items { m_Title = title; m_Author = author; - m_Writable = writable; + Writable = writable; BookContent content = DefaultContent; if ( content == null ) { - m_Pages = new BookPageInfo[pageCount]; + Pages = new BookPageInfo[pageCount]; - for ( int i = 0; i < m_Pages.Length; ++i ) - m_Pages[i] = new BookPageInfo(); + for ( int i = 0; i < Pages.Length; ++i ) + Pages[i] = new BookPageInfo(); } else { - m_Pages = content.Copy(); + Pages = content.Copy(); } } // Intended for defined books only public BaseBook( int itemID, bool writable ) : base( itemID ) { - m_Writable = writable; + Writable = writable; BookContent content = DefaultContent; if ( content == null ) { - m_Pages = new BookPageInfo[0]; + Pages = new BookPageInfo[0]; } else { m_Title = content.Title; m_Author = content.Author; - m_Pages = content.Copy(); + Pages = content.Copy(); } } @@ -169,17 +156,17 @@ namespace Server.Items if ( m_Author != content?.Author ) flags |= SaveFlags.Author; - if ( m_Writable ) + if ( Writable ) flags |= SaveFlags.Writable; - if ( content == null || !content.IsMatch( m_Pages ) ) + if ( content == null || !content.IsMatch( Pages ) ) flags |= SaveFlags.Content; writer.Write( (int) 4 ); // version - writer.Write( (int)m_SecureLevel ); + writer.Write( (int)Level ); writer.Write( (byte) flags ); @@ -191,10 +178,10 @@ namespace Server.Items if ( (flags & SaveFlags.Content) != 0 ) { - writer.WriteEncodedInt( m_Pages.Length ); + writer.WriteEncodedInt( Pages.Length ); - for ( int i = 0; i < m_Pages.Length; ++i ) - m_Pages[i].Serialize( writer ); + for ( int i = 0; i < Pages.Length; ++i ) + Pages[i].Serialize( writer ); } } @@ -208,7 +195,7 @@ namespace Server.Items { case 4: { - m_SecureLevel = (SecureLevel)reader.ReadInt(); + Level = (SecureLevel)reader.ReadInt(); goto case 3; } case 3: @@ -228,21 +215,21 @@ namespace Server.Items else if ( content != null ) m_Author = content.Author; - m_Writable = ( flags & SaveFlags.Writable ) != 0; + Writable = ( flags & SaveFlags.Writable ) != 0; if ( (flags & SaveFlags.Content) != 0 ) { - m_Pages = new BookPageInfo[reader.ReadEncodedInt()]; + Pages = new BookPageInfo[reader.ReadEncodedInt()]; - for ( int i = 0; i < m_Pages.Length; ++i ) - m_Pages[i] = new BookPageInfo( reader ); + for ( int i = 0; i < Pages.Length; ++i ) + Pages[i] = new BookPageInfo( reader ); } else { if ( content != null ) - m_Pages = content.Copy(); + Pages = content.Copy(); else - m_Pages = new BookPageInfo[0]; + Pages = new BookPageInfo[0]; } break; @@ -252,23 +239,23 @@ namespace Server.Items { m_Title = reader.ReadString(); m_Author = reader.ReadString(); - m_Writable = reader.ReadBool(); + Writable = reader.ReadBool(); if ( version == 0 || reader.ReadBool() ) { - m_Pages = new BookPageInfo[reader.ReadInt()]; + Pages = new BookPageInfo[reader.ReadInt()]; - for ( int i = 0; i < m_Pages.Length; ++i ) - m_Pages[i] = new BookPageInfo( reader ); + for ( int i = 0; i < Pages.Length; ++i ) + Pages[i] = new BookPageInfo( reader ); } else { BookContent content = DefaultContent; if ( content != null ) - m_Pages = content.Copy(); + Pages = content.Copy(); else - m_Pages = new BookPageInfo[0]; + Pages = new BookPageInfo[0]; } break; @@ -304,12 +291,12 @@ namespace Server.Items public override void OnSingleClick ( Mobile from ) { LabelTo( from, "{0} by {1}", m_Title, m_Author ); - LabelTo( from, "[{0} pages]", m_Pages.Length ); + LabelTo( from, "[{0} pages]", Pages.Length ); } public override void OnDoubleClick ( Mobile from ) { - if ( m_Title == null && m_Author == null && m_Writable == true ) + if ( m_Title == null && m_Author == null && Writable == true ) { Title = "a book"; Author = from.Name; @@ -325,7 +312,7 @@ namespace Server.Items { StringBuilder sb = new StringBuilder(); - foreach( BookPageInfo bpi in m_Pages ) + foreach( BookPageInfo bpi in Pages ) { foreach( string line in bpi.Lines ) { @@ -343,7 +330,7 @@ namespace Server.Items { List lines = new List(); - foreach( BookPageInfo bpi in m_Pages ) + foreach( BookPageInfo bpi in Pages ) { lines.AddRange( bpi.Lines ); } @@ -449,11 +436,7 @@ namespace Server.Items #region ISecurable Members [CommandProperty( AccessLevel.GameMaster )] - public SecureLevel Level - { - get => m_SecureLevel; - set => m_SecureLevel = value; - } + public SecureLevel Level { get; set; } #endregion } diff --git a/Scripts/Items/Books/Defined/BookContent.cs b/Scripts/Items/Books/Defined/BookContent.cs index e78989159..4e5d33da8 100644 --- a/Scripts/Items/Books/Defined/BookContent.cs +++ b/Scripts/Items/Books/Defined/BookContent.cs @@ -2,41 +2,37 @@ namespace Server.Items { public class BookContent { - private string m_Title; - private string m_Author; + public string Title { get; } - private BookPageInfo[] m_Pages; + public string Author { get; } - public string Title => m_Title; - public string Author => m_Author; - - public BookPageInfo[] Pages => m_Pages; + public BookPageInfo[] Pages { get; } public BookContent( string title, string author, params BookPageInfo[] pages ) { - m_Title = title; - m_Author = author; - m_Pages = pages; + Title = title; + Author = author; + Pages = pages; } public BookPageInfo[] Copy() { - BookPageInfo[] copy = new BookPageInfo[m_Pages.Length]; + BookPageInfo[] copy = new BookPageInfo[Pages.Length]; for ( int i = 0; i < copy.Length; ++i ) - copy[i] = new BookPageInfo( m_Pages[i].Lines ); + copy[i] = new BookPageInfo( Pages[i].Lines ); return copy; } public bool IsMatch( BookPageInfo[] cmp ) { - if ( cmp.Length != m_Pages.Length ) + if ( cmp.Length != Pages.Length ) return false; for ( int i = 0; i < cmp.Length; ++i ) { - string[] a = m_Pages[i].Lines; + string[] a = Pages[i].Lines; string[] b = cmp[i].Lines; if ( a.Length != b.Length ) diff --git a/Scripts/Items/Clothing/BaseClothing.cs b/Scripts/Items/Clothing/BaseClothing.cs index 326d83f2a..dc411d68e 100644 --- a/Scripts/Items/Clothing/BaseClothing.cs +++ b/Scripts/Items/Clothing/BaseClothing.cs @@ -46,7 +46,6 @@ namespace Server.Items private int m_HitPoints; private Mobile m_Crafter; private ClothingQuality m_Quality; - private bool m_PlayerConstructed; protected CraftResource m_Resource; private int m_StrReq = -1; @@ -104,11 +103,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public bool PlayerConstructed - { - get => m_PlayerConstructed; - set => m_PlayerConstructed = value; - } + public bool PlayerConstructed { get; set; } public virtual CraftResource DefaultResource => CraftResource.None; @@ -744,7 +739,7 @@ namespace Server.Items SetSaveFlag( ref flags, SaveFlag.Resistances, !m_AosResistances.IsEmpty ); SetSaveFlag( ref flags, SaveFlag.MaxHitPoints, m_MaxHitPoints != 0 ); SetSaveFlag( ref flags, SaveFlag.HitPoints, m_HitPoints != 0 ); - SetSaveFlag( ref flags, SaveFlag.PlayerConstructed, m_PlayerConstructed != false ); + SetSaveFlag( ref flags, SaveFlag.PlayerConstructed, PlayerConstructed != false ); SetSaveFlag( ref flags, SaveFlag.Crafter, m_Crafter != null ); SetSaveFlag( ref flags, SaveFlag.Quality, m_Quality != ClothingQuality.Regular ); SetSaveFlag( ref flags, SaveFlag.StrReq, m_StrReq != -1 ); @@ -839,7 +834,7 @@ namespace Server.Items m_StrReq = -1; if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) - m_PlayerConstructed = true; + PlayerConstructed = true; break; } @@ -860,7 +855,7 @@ namespace Server.Items } case 2: { - m_PlayerConstructed = reader.ReadBool(); + PlayerConstructed = reader.ReadBool(); goto case 1; } case 1: @@ -878,7 +873,7 @@ namespace Server.Items } if ( version < 2 ) - m_PlayerConstructed = true; // we don't know, so, assume it's crafted + PlayerConstructed = true; // we don't know, so, assume it's crafted if ( version < 3 ) { @@ -951,7 +946,7 @@ namespace Server.Items Item res = (Item)Activator.CreateInstance( resourceType ); - ScissorHelper( from, res, m_PlayerConstructed ? (item.Resources.GetAt( 0 ).Amount / 2) : 1 ); + ScissorHelper( from, res, PlayerConstructed ? (item.Resources.GetAt( 0 ).Amount / 2) : 1 ); res.LootType = LootType.Regular; diff --git a/Scripts/Items/Clothing/Cloaks.cs b/Scripts/Items/Clothing/Cloaks.cs index 52fb075cd..67563cfa9 100644 --- a/Scripts/Items/Clothing/Cloaks.cs +++ b/Scripts/Items/Clothing/Cloaks.cs @@ -156,14 +156,9 @@ namespace Server.Items public class RewardCloak : BaseCloak, IRewardItem { private int m_LabelNumber; - private bool m_IsRewardItem; [CommandProperty( AccessLevel.GameMaster )] - public bool IsRewardItem - { - get => m_IsRewardItem; - set => m_IsRewardItem = value; - } + public bool IsRewardItem { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int Number @@ -211,7 +206,7 @@ namespace Server.Items { base.GetProperties( list ); - if ( Core.ML && m_IsRewardItem ) + if ( Core.ML && IsRewardItem ) list.Add( RewardSystem.GetRewardYearLabel( this, new object[]{ Hue, m_LabelNumber } ) ); // X Year Veteran Reward } @@ -220,7 +215,7 @@ namespace Server.Items if ( !base.CanEquip( m ) ) return false; - return !m_IsRewardItem || RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } ); + return !IsRewardItem || RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } ); } [Constructible] @@ -253,7 +248,7 @@ namespace Server.Items writer.Write( (int) 0 ); // version writer.Write( (int) m_LabelNumber ); - writer.Write( (bool) m_IsRewardItem ); + writer.Write( (bool) IsRewardItem ); } public override void Deserialize( GenericReader reader ) @@ -267,7 +262,7 @@ namespace Server.Items case 0: { m_LabelNumber = reader.ReadInt(); - m_IsRewardItem = reader.ReadBool(); + IsRewardItem = reader.ReadBool(); break; } } diff --git a/Scripts/Items/Clothing/Hats.cs b/Scripts/Items/Clothing/Hats.cs index 2378179bd..ab83cd35b 100644 --- a/Scripts/Items/Clothing/Hats.cs +++ b/Scripts/Items/Clothing/Hats.cs @@ -7,14 +7,8 @@ namespace Server.Items { public abstract class BaseHat : BaseClothing, IShipwreckedItem { - private bool m_IsShipwreckedItem; - [CommandProperty( AccessLevel.GameMaster )] - public bool IsShipwreckedItem - { - get => m_IsShipwreckedItem; - set => m_IsShipwreckedItem = value; - } + public bool IsShipwreckedItem { get; set; } public BaseHat( int itemID ) : this( itemID, 0 ) { @@ -34,7 +28,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( m_IsShipwreckedItem ); + writer.Write( IsShipwreckedItem ); } public override void Deserialize( GenericReader reader ) @@ -47,7 +41,7 @@ namespace Server.Items { case 1: { - m_IsShipwreckedItem = reader.ReadBool(); + IsShipwreckedItem = reader.ReadBool(); break; } } @@ -57,7 +51,7 @@ namespace Server.Items { base.AddEquipInfoAttributes( from, attrs ); - if ( m_IsShipwreckedItem ) + if ( IsShipwreckedItem ) attrs.Add( new EquipInfoAttribute( 1041645 ) ); // recovered from a shipwreck } @@ -65,7 +59,7 @@ namespace Server.Items { base.AddNameProperties( list ); - if ( m_IsShipwreckedItem ) + if ( IsShipwreckedItem ) list.Add( 1041645 ); // recovered from a shipwreck } diff --git a/Scripts/Items/Clothing/OuterTorso.cs b/Scripts/Items/Clothing/OuterTorso.cs index f65d97544..1b7a61eb3 100644 --- a/Scripts/Items/Clothing/OuterTorso.cs +++ b/Scripts/Items/Clothing/OuterTorso.cs @@ -231,14 +231,9 @@ namespace Server.Items public class RewardRobe : BaseOuterTorso, IRewardItem { private int m_LabelNumber; - private bool m_IsRewardItem; [CommandProperty( AccessLevel.GameMaster )] - public bool IsRewardItem - { - get => m_IsRewardItem; - set => m_IsRewardItem = value; - } + public bool IsRewardItem { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int Number @@ -286,7 +281,7 @@ namespace Server.Items { base.GetProperties( list ); - if ( Core.ML && m_IsRewardItem ) + if ( Core.ML && IsRewardItem ) list.Add( RewardSystem.GetRewardYearLabel( this, new object[]{ Hue, m_LabelNumber } ) ); // X Year Veteran Reward } @@ -295,7 +290,7 @@ namespace Server.Items if ( !base.CanEquip( m ) ) return false; - return !m_IsRewardItem || RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } ); + return !IsRewardItem || RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } ); } [Constructible] @@ -328,7 +323,7 @@ namespace Server.Items writer.Write( (int) 0 ); // version writer.Write( (int) m_LabelNumber ); - writer.Write( (bool) m_IsRewardItem ); + writer.Write( (bool) IsRewardItem ); } public override void Deserialize( GenericReader reader ) @@ -342,7 +337,7 @@ namespace Server.Items case 0: { m_LabelNumber = reader.ReadInt(); - m_IsRewardItem = reader.ReadBool(); + IsRewardItem = reader.ReadBool(); break; } } @@ -356,14 +351,9 @@ namespace Server.Items public class RewardDress : BaseOuterTorso, IRewardItem { private int m_LabelNumber; - private bool m_IsRewardItem; [CommandProperty( AccessLevel.GameMaster )] - public bool IsRewardItem - { - get => m_IsRewardItem; - set => m_IsRewardItem = value; - } + public bool IsRewardItem { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int Number @@ -411,7 +401,7 @@ namespace Server.Items { base.GetProperties( list ); - if ( m_IsRewardItem ) + if ( IsRewardItem ) list.Add( RewardSystem.GetRewardYearLabel( this, new object[]{ Hue, m_LabelNumber } ) ); // X Year Veteran Reward } @@ -420,7 +410,7 @@ namespace Server.Items if ( !base.CanEquip( m ) ) return false; - return !m_IsRewardItem || RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } ); + return !IsRewardItem || RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } ); } [Constructible] @@ -453,7 +443,7 @@ namespace Server.Items writer.Write( (int) 0 ); // version writer.Write( (int) m_LabelNumber ); - writer.Write( (bool) m_IsRewardItem ); + writer.Write( (bool) IsRewardItem ); } public override void Deserialize( GenericReader reader ) @@ -467,7 +457,7 @@ namespace Server.Items case 0: { m_LabelNumber = reader.ReadInt(); - m_IsRewardItem = reader.ReadBool(); + IsRewardItem = reader.ReadBool(); break; } } diff --git a/Scripts/Items/Construction/Doors/BaseDoor.cs b/Scripts/Items/Construction/Doors/BaseDoor.cs index 1c54c35f7..5cdb93479 100644 --- a/Scripts/Items/Construction/Doors/BaseDoor.cs +++ b/Scripts/Items/Construction/Doors/BaseDoor.cs @@ -8,12 +8,8 @@ namespace Server.Items { public abstract class BaseDoor : Item, ILockable, ITelekinesisable { - private bool m_Open, m_Locked; - private int m_OpenedID, m_OpenedSound; - private int m_ClosedID, m_ClosedSound; - private Point3D m_Offset; + private bool m_Open; private BaseDoor m_Link; - private uint m_KeyValue; private Timer m_Timer; @@ -195,18 +191,10 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public bool Locked - { - get => m_Locked; - set => m_Locked = value; - } + public bool Locked { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public uint KeyValue - { - get => m_KeyValue; - set => m_KeyValue = value; - } + public uint KeyValue { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool Open @@ -218,14 +206,14 @@ namespace Server.Items { m_Open = value; - ItemID = m_Open ? m_OpenedID : m_ClosedID; + ItemID = m_Open ? OpenedID : ClosedID; if ( m_Open ) - Location = new Point3D( X + m_Offset.X, Y + m_Offset.Y, Z + m_Offset.Z ); + Location = new Point3D( X + Offset.X, Y + Offset.Y, Z + Offset.Z ); else - Location = new Point3D( X - m_Offset.X, Y - m_Offset.Y, Z - m_Offset.Z ); + Location = new Point3D( X - Offset.X, Y - Offset.Y, Z - Offset.Z ); - Effects.PlaySound( this, Map, m_Open ? m_OpenedSound : m_ClosedSound ); + Effects.PlaySound( this, Map, m_Open ? OpenedSound : ClosedSound ); if ( m_Open ) m_Timer.Start(); @@ -245,7 +233,7 @@ namespace Server.Items if ( map == null ) return false; - Point3D p = new Point3D( X - m_Offset.X, Y - m_Offset.Y, Z - m_Offset.Z ); + Point3D p = new Point3D( X - Offset.X, Y - Offset.Y, Z - Offset.Z ); return CheckFit( map, p, 16 ); } @@ -299,39 +287,19 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public int OpenedID - { - get => m_OpenedID; - set => m_OpenedID = value; - } + public int OpenedID { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int ClosedID - { - get => m_ClosedID; - set => m_ClosedID = value; - } + public int ClosedID { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int OpenedSound - { - get => m_OpenedSound; - set => m_OpenedSound = value; - } + public int OpenedSound { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int ClosedSound - { - get => m_ClosedSound; - set => m_ClosedSound = value; - } + public int ClosedSound { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D Offset - { - get => m_Offset; - set => m_Offset = value; - } + public Point3D Offset { get; set; } [CommandProperty( AccessLevel.GameMaster )] public BaseDoor Link @@ -397,7 +365,7 @@ namespace Server.Items public virtual void Use( Mobile from ) { - if ( m_Locked && !m_Open && UseLocks() ) + if ( Locked && !m_Open && UseLocks() ) { if ( from.AccessLevel >= AccessLevel.GameMaster ) { @@ -469,11 +437,11 @@ namespace Server.Items public BaseDoor( int closedID, int openedID, int openedSound, int closedSound, Point3D offset ) : base( closedID ) { - m_OpenedID = openedID; - m_ClosedID = closedID; - m_OpenedSound = openedSound; - m_ClosedSound = closedSound; - m_Offset = offset; + OpenedID = openedID; + ClosedID = closedID; + OpenedSound = openedSound; + ClosedSound = closedSound; + Offset = offset; m_Timer = new InternalTimer( this ); @@ -490,15 +458,15 @@ namespace Server.Items writer.Write( (int) 0 ); // version - writer.Write( m_KeyValue ); + writer.Write( KeyValue ); writer.Write( m_Open ); - writer.Write( m_Locked ); - writer.Write( m_OpenedID ); - writer.Write( m_ClosedID ); - writer.Write( m_OpenedSound ); - writer.Write( m_ClosedSound ); - writer.Write( m_Offset ); + writer.Write( Locked ); + writer.Write( OpenedID ); + writer.Write( ClosedID ); + writer.Write( OpenedSound ); + writer.Write( ClosedSound ); + writer.Write( Offset ); writer.Write( m_Link ); } @@ -512,14 +480,14 @@ namespace Server.Items { case 0: { - m_KeyValue = reader.ReadUInt(); + KeyValue = reader.ReadUInt(); m_Open = reader.ReadBool(); - m_Locked = reader.ReadBool(); - m_OpenedID = reader.ReadInt(); - m_ClosedID = reader.ReadInt(); - m_OpenedSound = reader.ReadInt(); - m_ClosedSound = reader.ReadInt(); - m_Offset = reader.ReadPoint3D(); + Locked = reader.ReadBool(); + OpenedID = reader.ReadInt(); + ClosedID = reader.ReadInt(); + OpenedSound = reader.ReadInt(); + ClosedSound = reader.ReadInt(); + Offset = reader.ReadPoint3D(); m_Link = reader.ReadItem() as BaseDoor; m_Timer = new InternalTimer( this ); diff --git a/Scripts/Items/Construction/Doors/HouseDoors.cs b/Scripts/Items/Construction/Doors/HouseDoors.cs index 67b7457d2..588a61711 100644 --- a/Scripts/Items/Construction/Doors/HouseDoors.cs +++ b/Scripts/Items/Construction/Doors/HouseDoors.cs @@ -92,22 +92,11 @@ namespace Server.Items public abstract class BaseHouseDoor : BaseDoor, ISecurable { - private DoorFacing m_Facing; - private SecureLevel m_Level; + [CommandProperty( AccessLevel.GameMaster )] + public DoorFacing Facing { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DoorFacing Facing - { - get => m_Facing; - set => m_Facing = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public SecureLevel Level - { - get => m_Level; - set => m_Level = value; - } + public SecureLevel Level { get; set; } public override void GetContextMenuEntries( Mobile from, List list ) { @@ -117,8 +106,8 @@ namespace Server.Items public BaseHouseDoor( DoorFacing facing, int closedID, int openedID, int openedSound, int closedSound, Point3D offset ) : base( closedID, openedID, openedSound, closedSound, offset ) { - m_Facing = facing; - m_Level = SecureLevel.Anyone; + Facing = facing; + Level = SecureLevel.Anyone; } public BaseHouse FindHouse() @@ -146,7 +135,7 @@ namespace Server.Items if ( house.Public ? house.IsBanned( m ) : !house.HasAccess( m ) ) return false; - return house.HasSecureAccess( m, m_Level ); + return house.HasSecureAccess( m, Level ); } public override void OnOpened( Mobile from ) @@ -185,9 +174,9 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (int) m_Level ); + writer.Write( (int) Level ); - writer.Write( (int) m_Facing ); + writer.Write( (int) Facing ); } public override void Deserialize( GenericReader reader ) @@ -200,15 +189,15 @@ namespace Server.Items { case 1: { - m_Level = (SecureLevel)reader.ReadInt(); + Level = (SecureLevel)reader.ReadInt(); goto case 0; } case 0: { if ( version < 1 ) - m_Level = SecureLevel.Anyone; + Level = SecureLevel.Anyone; - m_Facing = (DoorFacing)reader.ReadInt(); + Facing = (DoorFacing)reader.ReadInt(); break; } } @@ -222,7 +211,7 @@ namespace Server.Items const int bs = r*2+1; const int ss = r+1; - switch ( m_Facing ) + switch ( Facing ) { case DoorFacing.WestCW: case DoorFacing.EastCCW: x = -r; y = -r; w = bs; h = ss; break; diff --git a/Scripts/Items/Containers/BaseTreasureChest.cs b/Scripts/Items/Containers/BaseTreasureChest.cs index 10f68e926..3899d1cee 100644 --- a/Scripts/Items/Containers/BaseTreasureChest.cs +++ b/Scripts/Items/Containers/BaseTreasureChest.cs @@ -4,31 +4,16 @@ namespace Server.Items { public class BaseTreasureChest : LockableContainer { - private TreasureLevel m_TreasureLevel; - private short m_MaxSpawnTime = 60; - private short m_MinSpawnTime = 10; private TreasureResetTimer m_ResetTimer; [CommandProperty( AccessLevel.GameMaster )] - public TreasureLevel Level - { - get => m_TreasureLevel; - set => m_TreasureLevel = value; - } + public TreasureLevel Level { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public short MaxSpawnTime - { - get => m_MaxSpawnTime; - set => m_MaxSpawnTime = value; - } + public short MaxSpawnTime { get; set; } = 60; [CommandProperty( AccessLevel.GameMaster )] - public short MinSpawnTime - { - get => m_MinSpawnTime; - set => m_MinSpawnTime = value; - } + public short MinSpawnTime { get; set; } = 10; [CommandProperty( AccessLevel.GameMaster )] public override bool Locked { @@ -51,7 +36,7 @@ namespace Server.Items public BaseTreasureChest( int itemID, TreasureLevel level ) : base( itemID ) { - m_TreasureLevel = level; + Level = level; Locked = true; Movable = false; @@ -79,9 +64,9 @@ namespace Server.Items base.Serialize( writer ); writer.Write( (int) 0 ); - writer.Write( (byte) m_TreasureLevel ); - writer.Write( m_MinSpawnTime ); - writer.Write( m_MaxSpawnTime ); + writer.Write( (byte) Level ); + writer.Write( MinSpawnTime ); + writer.Write( MaxSpawnTime ); } public override void Deserialize( GenericReader reader ) @@ -90,9 +75,9 @@ namespace Server.Items int version = reader.ReadInt(); - m_TreasureLevel = (TreasureLevel)reader.ReadByte(); - m_MinSpawnTime = reader.ReadShort(); - m_MaxSpawnTime = reader.ReadShort(); + Level = (TreasureLevel)reader.ReadByte(); + MinSpawnTime = reader.ReadShort(); + MaxSpawnTime = reader.ReadShort(); if ( !Locked ) StartResetTimer(); @@ -100,7 +85,7 @@ namespace Server.Items protected virtual void SetLockLevel() { - switch( m_TreasureLevel ) + switch( Level ) { case TreasureLevel.Level1: RequiredSkill = LockLevel = 5; @@ -133,7 +118,7 @@ namespace Server.Items if ( m_ResetTimer == null ) m_ResetTimer = new TreasureResetTimer( this ); else - m_ResetTimer.Delay = TimeSpan.FromMinutes( Utility.Random( m_MinSpawnTime, m_MaxSpawnTime )); + m_ResetTimer.Delay = TimeSpan.FromMinutes( Utility.Random( MinSpawnTime, MaxSpawnTime )); m_ResetTimer.Start(); } @@ -143,7 +128,7 @@ namespace Server.Items int MinGold = 1; int MaxGold = 2; - switch( m_TreasureLevel ) + switch( Level ) { case TreasureLevel.Level1: MinGold = 100; diff --git a/Scripts/Items/Containers/FillableContainers.cs b/Scripts/Items/Containers/FillableContainers.cs index 734714367..57321144f 100644 --- a/Scripts/Items/Containers/FillableContainers.cs +++ b/Scripts/Items/Containers/FillableContainers.cs @@ -629,9 +629,7 @@ namespace Server.Items public class FillableBvrge : FillableEntry { - private BeverageType m_Content; - - public BeverageType Content => m_Content; + public BeverageType Content { get; } public FillableBvrge( Type type, BeverageType content ) : this( 1, type, content ) @@ -641,7 +639,7 @@ namespace Server.Items public FillableBvrge( int weight, Type type, BeverageType content ) : base( weight, type ) { - m_Content = content; + Content = content; } public override Item Construct() @@ -652,11 +650,11 @@ namespace Server.Items if ( m_Types[ index ] == typeof( BeverageBottle ) ) { - item = new BeverageBottle( m_Content ); + item = new BeverageBottle( Content ); } else if ( m_Types[ index ] == typeof( Jug ) ) { - item = new Jug( m_Content ); + item = new Jug( Content ); } else { @@ -664,7 +662,7 @@ namespace Server.Items if ( item is BaseBeverage bev ) { - bev.Content = m_Content; + bev.Content = Content; bev.Quantity = bev.MaxQuantity; } } @@ -692,21 +690,19 @@ namespace Server.Items public class FillableContent { - private int m_Level; - private Type[] m_Vendors; - private FillableEntry[] m_Entries; private int m_Weight; - public int Level => m_Level; - public Type[] Vendors => m_Vendors; + public int Level { get; } + + public Type[] Vendors { get; } public FillableContentType TypeID => Lookup( this ); public FillableContent( int level, Type[] vendors, FillableEntry[] entries ) { - m_Level = level; - m_Vendors = vendors; + Level = level; + Vendors = vendors; m_Entries = entries; for( int i = 0; i < entries.Length; ++i ) @@ -1498,8 +1494,8 @@ namespace Server.Items { FillableContent fill = m_ContentTypes[ i ]; - for( int j = 0; j < fill.m_Vendors.Length; ++j ) - m_AcquireTable[ fill.m_Vendors[ j ] ] = fill; + for( int j = 0; j < fill.Vendors.Length; ++j ) + m_AcquireTable[ fill.Vendors[ j ] ] = fill; } } diff --git a/Scripts/Items/Containers/LockableContainer.cs b/Scripts/Items/Containers/LockableContainer.cs index b67877399..82cc60c96 100644 --- a/Scripts/Items/Containers/LockableContainer.cs +++ b/Scripts/Items/Containers/LockableContainer.cs @@ -7,38 +7,18 @@ namespace Server.Items public abstract class LockableContainer : TrappableContainer, ILockable, ILockpickable, ICraftable, IShipwreckedItem { private bool m_Locked; - private int m_LockLevel, m_MaxLockLevel, m_RequiredSkill; - private uint m_KeyValue; - private Mobile m_Picker; - private bool m_TrapOnLockpick; [CommandProperty( AccessLevel.GameMaster )] - public Mobile Picker - { - get => m_Picker; - set => m_Picker = value; - } + public Mobile Picker { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int MaxLockLevel - { - get => m_MaxLockLevel; - set => m_MaxLockLevel = value; - } + public int MaxLockLevel { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int LockLevel - { - get => m_LockLevel; - set => m_LockLevel = value; - } + public int LockLevel { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int RequiredSkill - { - get => m_RequiredSkill; - set => m_RequiredSkill = value; - } + public int RequiredSkill { get; set; } [CommandProperty( AccessLevel.GameMaster )] public virtual bool Locked @@ -49,27 +29,19 @@ namespace Server.Items m_Locked = value; if ( m_Locked ) - m_Picker = null; + Picker = null; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] - public uint KeyValue - { - get => m_KeyValue; - set => m_KeyValue = value; - } + public uint KeyValue { get; set; } - public override bool TrapOnOpen => !m_TrapOnLockpick; + public override bool TrapOnOpen => !TrapOnLockpick; [CommandProperty( AccessLevel.GameMaster )] - public bool TrapOnLockpick - { - get => m_TrapOnLockpick; - set => m_TrapOnLockpick = value; - } + public bool TrapOnLockpick { get; set; } public override void Serialize( GenericWriter writer ) { @@ -77,16 +49,16 @@ namespace Server.Items writer.Write( (int) 6 ); // version - writer.Write( m_IsShipwreckedItem ); + writer.Write( IsShipwreckedItem ); - writer.Write( (bool) m_TrapOnLockpick ); + writer.Write( (bool) TrapOnLockpick ); - writer.Write( (int) m_RequiredSkill ); + writer.Write( (int) RequiredSkill ); - writer.Write( (int) m_MaxLockLevel ); + writer.Write( (int) MaxLockLevel ); - writer.Write( m_KeyValue ); - writer.Write( (int) m_LockLevel ); + writer.Write( KeyValue ); + writer.Write( (int) LockLevel ); writer.Write( (bool) m_Locked ); } @@ -100,56 +72,56 @@ namespace Server.Items { case 6: { - m_IsShipwreckedItem = reader.ReadBool(); + IsShipwreckedItem = reader.ReadBool(); goto case 5; } case 5: { - m_TrapOnLockpick = reader.ReadBool(); + TrapOnLockpick = reader.ReadBool(); goto case 4; } case 4: { - m_RequiredSkill = reader.ReadInt(); + RequiredSkill = reader.ReadInt(); goto case 3; } case 3: { - m_MaxLockLevel = reader.ReadInt(); + MaxLockLevel = reader.ReadInt(); goto case 2; } case 2: { - m_KeyValue = reader.ReadUInt(); + KeyValue = reader.ReadUInt(); goto case 1; } case 1: { - m_LockLevel = reader.ReadInt(); + LockLevel = reader.ReadInt(); goto case 0; } case 0: { if ( version < 3 ) - m_MaxLockLevel = 100; + MaxLockLevel = 100; if ( version < 4 ) { - if ( (m_MaxLockLevel - m_LockLevel) == 40 ) + if ( (MaxLockLevel - LockLevel) == 40 ) { - m_RequiredSkill = m_LockLevel + 6; - m_LockLevel = m_RequiredSkill - 10; - m_MaxLockLevel = m_RequiredSkill + 39; + RequiredSkill = LockLevel + 6; + LockLevel = RequiredSkill - 10; + MaxLockLevel = RequiredSkill + 39; } else { - m_RequiredSkill = m_LockLevel; + RequiredSkill = LockLevel; } } @@ -162,7 +134,7 @@ namespace Server.Items public LockableContainer( int itemID ) : base( itemID ) { - m_MaxLockLevel = 100; + MaxLockLevel = 100; } public LockableContainer( Serial serial ) : base( serial ) @@ -298,7 +270,7 @@ namespace Server.Items { base.AddNameProperties( list ); - if ( m_IsShipwreckedItem ) + if ( IsShipwreckedItem ) list.Add( 1041645 ); // recovered from a shipwreck } @@ -306,7 +278,7 @@ namespace Server.Items { base.OnSingleClick( from ); - if ( m_IsShipwreckedItem ) + if ( IsShipwreckedItem ) LabelTo( from, 1041645 ); //recovered from a shipwreck } @@ -353,14 +325,9 @@ namespace Server.Items #region IShipwreckedItem Members - private bool m_IsShipwreckedItem; - [CommandProperty( AccessLevel.GameMaster )] - public bool IsShipwreckedItem - { - get => m_IsShipwreckedItem; - set => m_IsShipwreckedItem = value; - } + public bool IsShipwreckedItem { get; set; } + #endregion } diff --git a/Scripts/Items/Containers/MarkContainer.cs b/Scripts/Items/Containers/MarkContainer.cs index ea78f0e95..143055c47 100644 --- a/Scripts/Items/Containers/MarkContainer.cs +++ b/Scripts/Items/Containers/MarkContainer.cs @@ -61,9 +61,6 @@ namespace Server.Items private bool m_AutoLock; private InternalTimer m_RelockTimer; - private Map m_TargetMap; - private Point3D m_Target; - private string m_Description; [CommandProperty( AccessLevel.GameMaster )] public bool AutoLock @@ -81,14 +78,10 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public Map TargetMap { get => m_TargetMap; - set => m_TargetMap = value; - } + public Map TargetMap { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D Target { get => m_Target; - set => m_Target = value; - } + public Point3D Target { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool Bone @@ -102,9 +95,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public string Description { get => m_Description; - set => m_Description = value; - } + public string Description { get; set; } public override bool IsDecoContainer => false; @@ -164,11 +155,9 @@ namespace Server.Items private class InternalTimer : Timer { - private MarkContainer m_Container; - private DateTime m_RelockTime; + public MarkContainer Container { get; } - public MarkContainer Container => m_Container; - public DateTime RelockTime => m_RelockTime; + public DateTime RelockTime { get; } public InternalTimer( MarkContainer container ) : this( container, TimeSpan.FromMinutes( 5.0 ) ) { @@ -176,16 +165,16 @@ namespace Server.Items public InternalTimer( MarkContainer container, TimeSpan delay ) : base( delay ) { - m_Container = container; - m_RelockTime = DateTime.UtcNow + delay; + Container = container; + RelockTime = DateTime.UtcNow + delay; Start(); } protected override void OnTick() { - m_Container.Locked = true; - m_Container.LockLevel = -255; + Container.Locked = true; + Container.LockLevel = -255; } } @@ -194,9 +183,9 @@ namespace Server.Items if ( TargetMap != null ) { rune.Marked = true; - rune.TargetMap = m_TargetMap; - rune.Target = m_Target; - rune.Description = m_Description; + rune.TargetMap = TargetMap; + rune.Target = Target; + rune.Description = Description; rune.House = null; } } @@ -234,9 +223,9 @@ namespace Server.Items if ( !Locked && m_AutoLock ) writer.WriteDeltaTime( m_RelockTimer.RelockTime ); - writer.Write( m_TargetMap ); - writer.Write( m_Target ); - writer.Write( m_Description ); + writer.Write( TargetMap ); + writer.Write( Target ); + writer.Write( Description ); } public override void Deserialize( GenericReader reader ) @@ -250,9 +239,9 @@ namespace Server.Items if ( !Locked && m_AutoLock ) m_RelockTimer = new InternalTimer( this, reader.ReadDeltaTime() - DateTime.UtcNow ); - m_TargetMap = reader.ReadMap(); - m_Target = reader.ReadPoint3D(); - m_Description = reader.ReadString(); + TargetMap = reader.ReadMap(); + Target = reader.ReadPoint3D(); + Description = reader.ReadString(); } } } diff --git a/Scripts/Items/Containers/TrappableContainer.cs b/Scripts/Items/Containers/TrappableContainer.cs index 02d529025..a79b19890 100644 --- a/Scripts/Items/Containers/TrappableContainer.cs +++ b/Scripts/Items/Containers/TrappableContainer.cs @@ -13,30 +13,14 @@ namespace Server.Items public abstract class TrappableContainer : BaseContainer, ITelekinesisable { - private TrapType m_TrapType; - private int m_TrapPower; - private int m_TrapLevel; + [CommandProperty( AccessLevel.GameMaster )] + public TrapType TrapType { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TrapType TrapType - { - get => m_TrapType; - set => m_TrapType = value; - } + public int TrapPower { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int TrapPower - { - get => m_TrapPower; - set => m_TrapPower = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public int TrapLevel - { - get => m_TrapLevel; - set => m_TrapLevel = value; - } + public int TrapLevel { get; set; } public virtual bool TrapOnOpen => true; @@ -66,7 +50,7 @@ namespace Server.Items public virtual bool ExecuteTrap( Mobile from ) { - if ( m_TrapType != TrapType.None ) + if ( TrapType != TrapType.None ) { Point3D loc = GetWorldLocation(); Map facet = Map; @@ -77,7 +61,7 @@ namespace Server.Items return false; } - switch ( m_TrapType ) + switch ( TrapType ) { case TrapType.ExplosionTrap: { @@ -87,10 +71,10 @@ namespace Server.Items { int damage; - if ( m_TrapLevel > 0 ) - damage = Utility.RandomMinMax( 10, 30 ) * m_TrapLevel; + if ( TrapLevel > 0 ) + damage = Utility.RandomMinMax( 10, 30 ) * TrapLevel; else - damage = m_TrapPower; + damage = TrapPower; AOS.Damage( from, damage, 0, 100, 0, 0, 0 ); @@ -106,7 +90,7 @@ namespace Server.Items case TrapType.MagicTrap: { if ( from.InRange( loc, 1 ) ) - from.Damage( m_TrapPower ); + from.Damage( TrapPower ); //AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 ); Effects.PlaySound( loc, Map, 0x307 ); @@ -129,10 +113,10 @@ namespace Server.Items { int damage; - if ( m_TrapLevel > 0 ) - damage = Utility.RandomMinMax( 5, 15 ) * m_TrapLevel; + if ( TrapLevel > 0 ) + damage = Utility.RandomMinMax( 5, 15 ) * TrapLevel; else - damage = m_TrapPower; + damage = TrapPower; AOS.Damage( from, damage, 100, 0, 0, 0, 0 ); @@ -152,13 +136,13 @@ namespace Server.Items { Poison poison; - if ( m_TrapLevel > 0 ) + if ( TrapLevel > 0 ) { - poison = Poison.GetPoison( Math.Max( 0, Math.Min( 4, m_TrapLevel - 1 ) ) ); + poison = Poison.GetPoison( Math.Max( 0, Math.Min( 4, TrapLevel - 1 ) ) ); } else { - AOS.Damage( from, m_TrapPower, 0, 0, 0, 100, 0 ); + AOS.Damage( from, TrapPower, 0, 0, 0, 100, 0 ); poison = Poison.Greater; } @@ -175,9 +159,9 @@ namespace Server.Items } } - m_TrapType = TrapType.None; - m_TrapPower = 0; - m_TrapLevel = 0; + TrapType = TrapType.None; + TrapPower = 0; + TrapLevel = 0; return true; } @@ -207,10 +191,10 @@ namespace Server.Items writer.Write( (int) 2 ); // version - writer.Write( (int) m_TrapLevel ); + writer.Write( (int) TrapLevel ); - writer.Write( (int) m_TrapPower ); - writer.Write( (int) m_TrapType ); + writer.Write( (int) TrapPower ); + writer.Write( (int) TrapType ); } public override void Deserialize( GenericReader reader ) @@ -223,17 +207,17 @@ namespace Server.Items { case 2: { - m_TrapLevel = reader.ReadInt(); + TrapLevel = reader.ReadInt(); goto case 1; } case 1: { - m_TrapPower = reader.ReadInt(); + TrapPower = reader.ReadInt(); goto case 0; } case 0: { - m_TrapType = (TrapType)reader.ReadInt(); + TrapType = (TrapType)reader.ReadInt(); break; } } diff --git a/Scripts/Items/Containers/TreasureMapChest.cs b/Scripts/Items/Containers/TreasureMapChest.cs index 0efd15eb6..8e9e3429a 100644 --- a/Scripts/Items/Containers/TreasureMapChest.cs +++ b/Scripts/Items/Containers/TreasureMapChest.cs @@ -11,9 +11,8 @@ namespace Server.Items { public override int LabelNumber => 3000541; - public static Type[] Artifacts => m_Artifacts; - - private static Type[] m_Artifacts = { + public static Type[] Artifacts { get; } = + { typeof( CandelabraOfSouls ), typeof( GoldBricks ), typeof( PhillipsWoodenSteed ), typeof( ArcticDeathDealer ), typeof( BlazeOfDeath ), typeof( BurglarsBandana ), typeof( CavortingClub ), typeof( DreadPirateHat ), @@ -23,33 +22,21 @@ namespace Server.Items typeof( ColdBlood ), typeof( AlchemistsBauble ) }; - private int m_Level; - private DateTime m_DeleteTime; private Timer m_Timer; - private Mobile m_Owner; - private bool m_Temporary; - - private List m_Guardians; [CommandProperty( AccessLevel.GameMaster )] - public int Level{ get => m_Level; - set => m_Level = value; - } + public int Level { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Mobile Owner{ get => m_Owner; - set => m_Owner = value; - } + public Mobile Owner { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime DeleteTime => m_DeleteTime; + public DateTime DeleteTime { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public bool Temporary{ get => m_Temporary; - set => m_Temporary = value; - } + public bool Temporary { get; set; } - public List Guardians => m_Guardians; + public List Guardians { get; private set; } [Constructible] public TreasureMapChest( int level ) : this( null, level, false ) @@ -58,14 +45,14 @@ namespace Server.Items public TreasureMapChest( Mobile owner, int level, bool temporary ) : base( 0xE40 ) { - m_Owner = owner; - m_Level = level; - m_DeleteTime = DateTime.UtcNow + TimeSpan.FromHours( 3.0 ); + Owner = owner; + Level = level; + DeleteTime = DateTime.UtcNow + TimeSpan.FromHours( 3.0 ); - m_Temporary = temporary; - m_Guardians = new List(); + Temporary = temporary; + Guardians = new List(); - m_Timer = new DeleteTimer( this, m_DeleteTime ); + m_Timer = new DeleteTimer( this, DeleteTime ); m_Timer.Start(); Fill( this, level ); @@ -278,7 +265,7 @@ namespace Server.Items } if ( level == 6 && Core.AOS ) - cont.DropItem( (Item)Activator.CreateInstance( m_Artifacts[Utility.Random(m_Artifacts.Length)] ) ); + cont.DropItem( (Item)Activator.CreateInstance( Artifacts[Utility.Random(Artifacts.Length)] ) ); } public override bool CheckLocked( Mobile from ) @@ -308,13 +295,13 @@ namespace Server.Items private bool CheckLoot( Mobile m, bool criminalAction ) { - if ( m_Temporary ) + if ( Temporary ) return false; - if ( m.AccessLevel >= AccessLevel.GameMaster || m_Owner == null || m == m_Owner ) + if ( m.AccessLevel >= AccessLevel.GameMaster || Owner == null || m == Owner ) return true; - Party p = Party.Get( m_Owner ); + Party p = Party.Get( Owner ); if ( p != null && p.Contains( m ) ) return true; @@ -358,7 +345,7 @@ namespace Server.Items m_Lifted.Add( item ); if ( 0.1 >= Utility.RandomDouble() ) // 10% chance to spawn a new monster - TreasureMap.Spawn( m_Level, GetWorldLocation(), Map, from, false ); + TreasureMap.Spawn( Level, GetWorldLocation(), Map, from, false ); } base.OnItemLifted( from, item ); @@ -385,13 +372,13 @@ namespace Server.Items writer.Write( (int) 2 ); // version - writer.Write( m_Guardians, true ); - writer.Write( (bool) m_Temporary ); + writer.Write( Guardians, true ); + writer.Write( (bool) Temporary ); - writer.Write( m_Owner ); + writer.Write( Owner ); - writer.Write( (int) m_Level ); - writer.WriteDeltaTime( m_DeleteTime ); + writer.Write( (int) Level ); + writer.WriteDeltaTime( DeleteTime ); writer.Write( m_Lifted, true ); } @@ -405,33 +392,33 @@ namespace Server.Items { case 2: { - m_Guardians = reader.ReadStrongMobileList(); - m_Temporary = reader.ReadBool(); + Guardians = reader.ReadStrongMobileList(); + Temporary = reader.ReadBool(); goto case 1; } case 1: { - m_Owner = reader.ReadMobile(); + Owner = reader.ReadMobile(); goto case 0; } case 0: { - m_Level = reader.ReadInt(); - m_DeleteTime = reader.ReadDeltaTime(); + Level = reader.ReadInt(); + DeleteTime = reader.ReadDeltaTime(); m_Lifted = reader.ReadStrongItemList(); if ( version < 2 ) - m_Guardians = new List(); + Guardians = new List(); break; } } - if ( !m_Temporary ) + if ( !Temporary ) { - m_Timer = new DeleteTimer( this, m_DeleteTime ); + m_Timer = new DeleteTimer( this, DeleteTime ); m_Timer.Start(); } else @@ -468,7 +455,7 @@ namespace Server.Items public void EndRemove( Mobile from ) { - if ( Deleted || from != m_Owner || !from.InRange( GetWorldLocation(), 3 ) ) + if ( Deleted || from != Owner || !from.InRange( GetWorldLocation(), 3 ) ) return; from.SendLocalizedMessage( 1048124, "", 0x8A5 ); // The old, rusted chest crumbles when you hit it. diff --git a/Scripts/Items/Decoration Artifacts/StealableArtifactsSpawner.cs b/Scripts/Items/Decoration Artifacts/StealableArtifactsSpawner.cs index bfbe2c93a..f5fa88566 100644 --- a/Scripts/Items/Decoration Artifacts/StealableArtifactsSpawner.cs +++ b/Scripts/Items/Decoration Artifacts/StealableArtifactsSpawner.cs @@ -8,19 +8,17 @@ namespace Server.Items { public class StealableEntry { - private Map m_Map; - private Point3D m_Location; - private int m_MinDelay; - private int m_MaxDelay; - private Type m_Type; - private int m_Hue; + public Map Map { get; } - public Map Map => m_Map; - public Point3D Location => m_Location; - public int MinDelay => m_MinDelay; - public int MaxDelay => m_MaxDelay; - public Type Type => m_Type; - public int Hue => m_Hue; + public Point3D Location { get; } + + public int MinDelay { get; } + + public int MaxDelay { get; } + + public Type Type { get; } + + public int Hue { get; } public StealableEntry( Map map, Point3D location, int minDelay, int maxDelay, Type type ) : this( map, location, minDelay, maxDelay, type, 0 ) { @@ -28,20 +26,20 @@ namespace Server.Items public StealableEntry( Map map, Point3D location, int minDelay, int maxDelay, Type type, int hue ) { - m_Map = map; - m_Location = location; - m_MinDelay = minDelay; - m_MaxDelay = maxDelay; - m_Type = type; - m_Hue = hue; + Map = map; + Location = location; + MinDelay = minDelay; + MaxDelay = maxDelay; + Type = type; + Hue = hue; } public Item CreateInstance() { - Item item = (Item) Activator.CreateInstance( m_Type ); + Item item = (Item) Activator.CreateInstance( Type ); - if ( m_Hue > 0 ) - item.Hue = m_Hue; + if ( Hue > 0 ) + item.Hue = Hue; item.Movable = false; item.MoveToWorld( Location, Map ); @@ -50,114 +48,113 @@ namespace Server.Items } } - private static StealableEntry[] m_Entries = { - // Doom - Artifact rarity 1 - new StealableEntry( Map.Malas, new Point3D( 317, 56, -1 ), 72, 108, typeof( RockArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 360, 31, 8 ), 72, 108, typeof( SkullCandleArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 369, 372, -1 ), 72, 108, typeof( BottleArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 378, 372, 0 ), 72, 108, typeof( DamagedBooksArtifact ) ), - // Doom - Artifact rarity 2 - new StealableEntry( Map.Malas, new Point3D( 432, 16, -1 ), 144, 216, typeof( StretchedHideArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 489, 9, 0 ), 144, 216, typeof( BrazierArtifact ) ), - // Doom - Artifact rarity 3 - new StealableEntry( Map.Malas, new Point3D( 471, 96, -1 ), 288, 432, typeof( LampPostArtifact ), GetLampPostHue() ), - new StealableEntry( Map.Malas, new Point3D( 421, 198, 2 ), 288, 432, typeof( BooksNorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 431, 189, -1 ), 288, 432, typeof( BooksWestArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 435, 196, -1 ), 288, 432, typeof( BooksFaceDownArtifact ) ), - // Doom - Artifact rarity 5 - new StealableEntry( Map.Malas, new Point3D( 447, 9, 8 ), 1152, 1728, typeof( StuddedLeggingsArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 423, 28, 0 ), 1152, 1728, typeof( EggCaseArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 347, 44, 4 ), 1152, 1728, typeof( SkinnedGoatArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 497, 57, -1 ), 1152, 1728, typeof( GruesomeStandardArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 381, 375, 11 ), 1152, 1728, typeof( BloodyWaterArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 489, 369, 2 ), 1152, 1728, typeof( TarotCardsArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 497, 369, 5 ), 1152, 1728, typeof( BackpackArtifact ) ), - // Doom - Artifact rarity 7 - new StealableEntry( Map.Malas, new Point3D( 475, 23, 4 ), 4608, 6912, typeof( StuddedTunicArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 423, 28, 0 ), 4608, 6912, typeof( CocoonArtifact ) ), - // Doom - Artifact rarity 8 - new StealableEntry( Map.Malas, new Point3D( 354, 36, -1 ), 9216, 13824, typeof( SkinnedDeerArtifact ) ), - // Doom - Artifact rarity 9 - new StealableEntry( Map.Malas, new Point3D( 433, 11, -1 ), 18432, 27648, typeof( SaddleArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 403, 31, 4 ), 18432, 27648, typeof( LeatherTunicArtifact ) ), - // Doom - Artifact rarity 10 - new StealableEntry( Map.Malas, new Point3D( 257, 70, -2 ), 36864, 55296, typeof( ZyronicClaw ) ), - new StealableEntry( Map.Malas, new Point3D( 354, 176, 7 ), 36864, 55296, typeof( TitansHammer ) ), - new StealableEntry( Map.Malas, new Point3D( 369, 389, -1 ), 36864, 55296, typeof( BladeOfTheRighteous ) ), - new StealableEntry( Map.Malas, new Point3D( 467, 92, 4 ), 36864, 55296, typeof( InquisitorsResolution ) ), - // Doom - Artifact rarity 12 - new StealableEntry( Map.Malas, new Point3D( 487, 364, -1 ), 147456, 221184, typeof( RuinedPaintingArtifact ) ), + public static StealableEntry[] Entries { get; } = + { + // Doom - Artifact rarity 1 + new StealableEntry( Map.Malas, new Point3D( 317, 56, -1 ), 72, 108, typeof( RockArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 360, 31, 8 ), 72, 108, typeof( SkullCandleArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 369, 372, -1 ), 72, 108, typeof( BottleArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 378, 372, 0 ), 72, 108, typeof( DamagedBooksArtifact ) ), + // Doom - Artifact rarity 2 + new StealableEntry( Map.Malas, new Point3D( 432, 16, -1 ), 144, 216, typeof( StretchedHideArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 489, 9, 0 ), 144, 216, typeof( BrazierArtifact ) ), + // Doom - Artifact rarity 3 + new StealableEntry( Map.Malas, new Point3D( 471, 96, -1 ), 288, 432, typeof( LampPostArtifact ), GetLampPostHue() ), + new StealableEntry( Map.Malas, new Point3D( 421, 198, 2 ), 288, 432, typeof( BooksNorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 431, 189, -1 ), 288, 432, typeof( BooksWestArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 435, 196, -1 ), 288, 432, typeof( BooksFaceDownArtifact ) ), + // Doom - Artifact rarity 5 + new StealableEntry( Map.Malas, new Point3D( 447, 9, 8 ), 1152, 1728, typeof( StuddedLeggingsArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 423, 28, 0 ), 1152, 1728, typeof( EggCaseArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 347, 44, 4 ), 1152, 1728, typeof( SkinnedGoatArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 497, 57, -1 ), 1152, 1728, typeof( GruesomeStandardArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 381, 375, 11 ), 1152, 1728, typeof( BloodyWaterArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 489, 369, 2 ), 1152, 1728, typeof( TarotCardsArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 497, 369, 5 ), 1152, 1728, typeof( BackpackArtifact ) ), + // Doom - Artifact rarity 7 + new StealableEntry( Map.Malas, new Point3D( 475, 23, 4 ), 4608, 6912, typeof( StuddedTunicArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 423, 28, 0 ), 4608, 6912, typeof( CocoonArtifact ) ), + // Doom - Artifact rarity 8 + new StealableEntry( Map.Malas, new Point3D( 354, 36, -1 ), 9216, 13824, typeof( SkinnedDeerArtifact ) ), + // Doom - Artifact rarity 9 + new StealableEntry( Map.Malas, new Point3D( 433, 11, -1 ), 18432, 27648, typeof( SaddleArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 403, 31, 4 ), 18432, 27648, typeof( LeatherTunicArtifact ) ), + // Doom - Artifact rarity 10 + new StealableEntry( Map.Malas, new Point3D( 257, 70, -2 ), 36864, 55296, typeof( ZyronicClaw ) ), + new StealableEntry( Map.Malas, new Point3D( 354, 176, 7 ), 36864, 55296, typeof( TitansHammer ) ), + new StealableEntry( Map.Malas, new Point3D( 369, 389, -1 ), 36864, 55296, typeof( BladeOfTheRighteous ) ), + new StealableEntry( Map.Malas, new Point3D( 467, 92, 4 ), 36864, 55296, typeof( InquisitorsResolution ) ), + // Doom - Artifact rarity 12 + new StealableEntry( Map.Malas, new Point3D( 487, 364, -1 ), 147456, 221184, typeof( RuinedPaintingArtifact ) ), - // Yomotsu Mines - Artifact rarity 1 - new StealableEntry( Map.Malas, new Point3D( 18, 110, -1 ), 72, 108, typeof( Basket1Artifact ) ), - new StealableEntry( Map.Malas, new Point3D( 66, 114, -1 ), 72, 108, typeof( Basket2Artifact ) ), - // Yomotsu Mines - Artifact rarity 2 - new StealableEntry( Map.Malas, new Point3D( 63, 12, 11 ), 144, 216, typeof( Basket4Artifact ) ), - new StealableEntry( Map.Malas, new Point3D( 5, 29, -1 ), 144, 216, typeof( Basket5NorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 30, 81, 3 ), 144, 216, typeof( Basket5WestArtifact ) ), - // Yomotsu Mines - Artifact rarity 3 - new StealableEntry( Map.Malas, new Point3D( 115, 7, -1 ), 288, 432, typeof( Urn1Artifact ) ), - new StealableEntry( Map.Malas, new Point3D( 85, 13, -1 ), 288, 432, typeof( Urn2Artifact ) ), - new StealableEntry( Map.Malas, new Point3D( 110, 53, -1 ), 288, 432, typeof( Sculpture1Artifact ) ), - new StealableEntry( Map.Malas, new Point3D( 108, 37, -1 ), 288, 432, typeof( Sculpture2Artifact ) ), - new StealableEntry( Map.Malas, new Point3D( 121, 14, -1 ), 288, 432, typeof( TeapotNorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 121, 115, -1 ), 288, 432, typeof( TeapotWestArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 84, 40, -1 ), 288, 432, typeof( TowerLanternArtifact ) ), - // Yomotsu Mines - Artifact rarity 9 - new StealableEntry( Map.Malas, new Point3D( 94, 7, -1 ), 18432, 27648, typeof( ManStatuetteSouthArtifact ) ), + // Yomotsu Mines - Artifact rarity 1 + new StealableEntry( Map.Malas, new Point3D( 18, 110, -1 ), 72, 108, typeof( Basket1Artifact ) ), + new StealableEntry( Map.Malas, new Point3D( 66, 114, -1 ), 72, 108, typeof( Basket2Artifact ) ), + // Yomotsu Mines - Artifact rarity 2 + new StealableEntry( Map.Malas, new Point3D( 63, 12, 11 ), 144, 216, typeof( Basket4Artifact ) ), + new StealableEntry( Map.Malas, new Point3D( 5, 29, -1 ), 144, 216, typeof( Basket5NorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 30, 81, 3 ), 144, 216, typeof( Basket5WestArtifact ) ), + // Yomotsu Mines - Artifact rarity 3 + new StealableEntry( Map.Malas, new Point3D( 115, 7, -1 ), 288, 432, typeof( Urn1Artifact ) ), + new StealableEntry( Map.Malas, new Point3D( 85, 13, -1 ), 288, 432, typeof( Urn2Artifact ) ), + new StealableEntry( Map.Malas, new Point3D( 110, 53, -1 ), 288, 432, typeof( Sculpture1Artifact ) ), + new StealableEntry( Map.Malas, new Point3D( 108, 37, -1 ), 288, 432, typeof( Sculpture2Artifact ) ), + new StealableEntry( Map.Malas, new Point3D( 121, 14, -1 ), 288, 432, typeof( TeapotNorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 121, 115, -1 ), 288, 432, typeof( TeapotWestArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 84, 40, -1 ), 288, 432, typeof( TowerLanternArtifact ) ), + // Yomotsu Mines - Artifact rarity 9 + new StealableEntry( Map.Malas, new Point3D( 94, 7, -1 ), 18432, 27648, typeof( ManStatuetteSouthArtifact ) ), - // Fan Dancer's Dojo - Artifact rarity 1 - new StealableEntry( Map.Malas, new Point3D( 113, 640, -2 ), 72, 108, typeof( Basket3NorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 102, 355, -1 ), 72, 108, typeof( Basket3WestArtifact ) ), - // Fan Dancer's Dojo - Artifact rarity 2 - new StealableEntry( Map.Malas, new Point3D( 99, 370, -1 ), 144, 216, typeof( Basket6Artifact ) ), - new StealableEntry( Map.Malas, new Point3D( 100, 357, -1 ), 144, 216, typeof( ZenRock1Artifact ) ), - // Fan Dancer's Dojo - Artifact rarity 3 - new StealableEntry( Map.Malas, new Point3D( 73, 473, -1 ), 288, 432, typeof( FanNorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 99, 372, -1 ), 288, 432, typeof( FanWestArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 92, 326, -1 ), 288, 432, typeof( BowlsVerticalArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 97, 470, -1 ), 288, 432, typeof( ZenRock2Artifact ) ), - new StealableEntry( Map.Malas, new Point3D( 103, 691, -1 ), 288, 432, typeof( ZenRock3Artifact ) ), - // Fan Dancer's Dojo - Artifact rarity 4 - new StealableEntry( Map.Malas, new Point3D( 103, 336, 4 ), 576, 864, typeof( Painting1NorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 59, 381, 4 ), 576, 864, typeof( Painting1WestArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 84, 401, 2 ), 576, 864, typeof( Painting2NorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 59, 392, 2 ), 576, 864, typeof( Painting2WestArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 107, 483, -1 ), 576, 864, typeof( TripleFanNorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 50, 475, -1 ), 576, 864, typeof( TripleFanWestArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 107, 460, -1 ), 576, 864, typeof( BowlArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 90, 502, -1 ), 576, 864, typeof( CupsArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 107, 688, -1 ), 576, 864, typeof( BowlsHorizontalArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 112, 676, -1 ), 576, 864, typeof( SakeArtifact ) ), - // Fan Dancer's Dojo - Artifact rarity 5 - new StealableEntry( Map.Malas, new Point3D( 135, 614, -1 ), 1152, 1728, typeof( SwordDisplay1NorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 50, 482, -1 ), 1152, 1728, typeof( SwordDisplay1WestArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 119, 672, -1 ), 1152, 1728, typeof( Painting3Artifact ) ), - // Fan Dancer's Dojo - Artifact rarity 6 - new StealableEntry( Map.Malas, new Point3D( 90, 326, -1 ), 2304, 3456, typeof( Painting4NorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 99, 354, -1 ), 2304, 3456, typeof( Painting4WestArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 179, 652, -1 ), 2304, 3456, typeof( SwordDisplay2NorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 118, 627, -1 ), 2304, 3456, typeof( SwordDisplay2WestArtifact ) ), - // Fan Dancer's Dojo - Artifact rarity 7 - new StealableEntry( Map.Malas, new Point3D( 90, 483, -1 ), 4608, 6912, typeof( FlowersArtifact ) ), - // Fan Dancer's Dojo - Artifact rarity 8 - new StealableEntry( Map.Malas, new Point3D( 71, 562, -1 ), 9216, 13824, typeof( DolphinLeftArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 102, 677, -1 ), 9216, 13824, typeof( DolphinRightArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 61, 499, 0 ), 9216, 13824, typeof( SwordDisplay3SouthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 182, 669, -1 ), 9216, 13824, typeof( SwordDisplay3EastArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 162, 647, -1 ), 9216, 13824, typeof( SwordDisplay4WestArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 124, 624, 0 ), 9216, 13824, typeof( Painting5NorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 146, 649, 2 ), 9216, 13824, typeof( Painting5WestArtifact ) ), - // Fan Dancer's Dojo - Artifact rarity 9 - new StealableEntry( Map.Malas, new Point3D( 100, 488, -1 ), 18432, 27648, typeof( SwordDisplay4NorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 175, 606, 0 ), 18432, 27648, typeof( SwordDisplay5NorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 157, 608, -1 ), 18432, 27648, typeof( SwordDisplay5WestArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 187, 643, 1 ), 18432, 27648, typeof( Painting6NorthArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 146, 623, 1 ), 18432, 27648, typeof( Painting6WestArtifact ) ), - new StealableEntry( Map.Malas, new Point3D( 178, 629, -1 ), 18432, 27648, typeof( ManStatuetteEastArtifact ) ) - }; - - public static StealableEntry[] Entries => m_Entries; + // Fan Dancer's Dojo - Artifact rarity 1 + new StealableEntry( Map.Malas, new Point3D( 113, 640, -2 ), 72, 108, typeof( Basket3NorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 102, 355, -1 ), 72, 108, typeof( Basket3WestArtifact ) ), + // Fan Dancer's Dojo - Artifact rarity 2 + new StealableEntry( Map.Malas, new Point3D( 99, 370, -1 ), 144, 216, typeof( Basket6Artifact ) ), + new StealableEntry( Map.Malas, new Point3D( 100, 357, -1 ), 144, 216, typeof( ZenRock1Artifact ) ), + // Fan Dancer's Dojo - Artifact rarity 3 + new StealableEntry( Map.Malas, new Point3D( 73, 473, -1 ), 288, 432, typeof( FanNorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 99, 372, -1 ), 288, 432, typeof( FanWestArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 92, 326, -1 ), 288, 432, typeof( BowlsVerticalArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 97, 470, -1 ), 288, 432, typeof( ZenRock2Artifact ) ), + new StealableEntry( Map.Malas, new Point3D( 103, 691, -1 ), 288, 432, typeof( ZenRock3Artifact ) ), + // Fan Dancer's Dojo - Artifact rarity 4 + new StealableEntry( Map.Malas, new Point3D( 103, 336, 4 ), 576, 864, typeof( Painting1NorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 59, 381, 4 ), 576, 864, typeof( Painting1WestArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 84, 401, 2 ), 576, 864, typeof( Painting2NorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 59, 392, 2 ), 576, 864, typeof( Painting2WestArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 107, 483, -1 ), 576, 864, typeof( TripleFanNorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 50, 475, -1 ), 576, 864, typeof( TripleFanWestArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 107, 460, -1 ), 576, 864, typeof( BowlArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 90, 502, -1 ), 576, 864, typeof( CupsArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 107, 688, -1 ), 576, 864, typeof( BowlsHorizontalArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 112, 676, -1 ), 576, 864, typeof( SakeArtifact ) ), + // Fan Dancer's Dojo - Artifact rarity 5 + new StealableEntry( Map.Malas, new Point3D( 135, 614, -1 ), 1152, 1728, typeof( SwordDisplay1NorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 50, 482, -1 ), 1152, 1728, typeof( SwordDisplay1WestArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 119, 672, -1 ), 1152, 1728, typeof( Painting3Artifact ) ), + // Fan Dancer's Dojo - Artifact rarity 6 + new StealableEntry( Map.Malas, new Point3D( 90, 326, -1 ), 2304, 3456, typeof( Painting4NorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 99, 354, -1 ), 2304, 3456, typeof( Painting4WestArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 179, 652, -1 ), 2304, 3456, typeof( SwordDisplay2NorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 118, 627, -1 ), 2304, 3456, typeof( SwordDisplay2WestArtifact ) ), + // Fan Dancer's Dojo - Artifact rarity 7 + new StealableEntry( Map.Malas, new Point3D( 90, 483, -1 ), 4608, 6912, typeof( FlowersArtifact ) ), + // Fan Dancer's Dojo - Artifact rarity 8 + new StealableEntry( Map.Malas, new Point3D( 71, 562, -1 ), 9216, 13824, typeof( DolphinLeftArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 102, 677, -1 ), 9216, 13824, typeof( DolphinRightArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 61, 499, 0 ), 9216, 13824, typeof( SwordDisplay3SouthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 182, 669, -1 ), 9216, 13824, typeof( SwordDisplay3EastArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 162, 647, -1 ), 9216, 13824, typeof( SwordDisplay4WestArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 124, 624, 0 ), 9216, 13824, typeof( Painting5NorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 146, 649, 2 ), 9216, 13824, typeof( Painting5WestArtifact ) ), + // Fan Dancer's Dojo - Artifact rarity 9 + new StealableEntry( Map.Malas, new Point3D( 100, 488, -1 ), 18432, 27648, typeof( SwordDisplay4NorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 175, 606, 0 ), 18432, 27648, typeof( SwordDisplay5NorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 157, 608, -1 ), 18432, 27648, typeof( SwordDisplay5WestArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 187, 643, 1 ), 18432, 27648, typeof( Painting6NorthArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 146, 623, 1 ), 18432, 27648, typeof( Painting6WestArtifact ) ), + new StealableEntry( Map.Malas, new Point3D( 178, 629, -1 ), 18432, 27648, typeof( ManStatuetteEastArtifact ) ) + }; private static Type[] m_TypesOfEntries; public static Type[] TypesOfEntires @@ -166,19 +163,17 @@ namespace Server.Items { if ( m_TypesOfEntries == null ) { - m_TypesOfEntries = new Type[m_Entries.Length]; + m_TypesOfEntries = new Type[Entries.Length]; - for( int i = 0; i < m_Entries.Length; i++ ) - m_TypesOfEntries[i] = m_Entries[i].Type; + for( int i = 0; i < Entries.Length; i++ ) + m_TypesOfEntries[i] = Entries[i].Type; } return m_TypesOfEntries; } } - private static StealableArtifactsSpawner m_Instance; - - public static StealableArtifactsSpawner Instance => m_Instance; + public static StealableArtifactsSpawner Instance { get; private set; } private static int GetLampPostHue() { @@ -221,20 +216,20 @@ namespace Server.Items public static bool Create() { - if ( m_Instance != null && !m_Instance.Deleted ) + if ( Instance != null && !Instance.Deleted ) return false; - m_Instance = new StealableArtifactsSpawner(); + Instance = new StealableArtifactsSpawner(); return true; } public static bool Remove() { - if ( m_Instance == null ) + if ( Instance == null ) return false; - m_Instance.Delete(); - m_Instance = null; + Instance.Delete(); + Instance = null; return true; } @@ -246,11 +241,9 @@ namespace Server.Items public class StealableInstance { - private StealableEntry m_Entry; private Item m_Item; - private DateTime m_NextRespawn; - public StealableEntry Entry => m_Entry; + public StealableEntry Entry { get; } public Item Item { @@ -276,11 +269,7 @@ namespace Server.Items } } - public DateTime NextRespawn - { - get => m_NextRespawn; - set => m_NextRespawn = value; - } + public DateTime NextRespawn { get; set; } public StealableInstance( StealableEntry entry ) : this( entry, null, DateTime.UtcNow ) { @@ -289,8 +278,8 @@ namespace Server.Items public StealableInstance( StealableEntry entry, Item item, DateTime nextRespawn ) { m_Item = item; - m_NextRespawn = nextRespawn; - m_Entry = entry; + NextRespawn = nextRespawn; + Entry = entry; } public void CheckRespawn() @@ -315,12 +304,12 @@ namespace Server.Items { Movable = false; - m_Artifacts = new StealableInstance[m_Entries.Length]; - m_Table = new Hashtable( m_Entries.Length ); + m_Artifacts = new StealableInstance[Entries.Length]; + m_Table = new Hashtable( Entries.Length ); - for ( int i = 0; i < m_Entries.Length; i++ ) + for ( int i = 0; i < Entries.Length; i++ ) { - m_Artifacts[i] = new StealableInstance( m_Entries[i] ); + m_Artifacts[i] = new StealableInstance( Entries[i] ); } m_RespawnTimer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromMinutes( 15.0 ), CheckRespawn ); @@ -341,7 +330,7 @@ namespace Server.Items si.Item?.Delete(); } - m_Instance = null; + Instance = null; } public void CheckRespawn() @@ -354,7 +343,7 @@ namespace Server.Items public StealableArtifactsSpawner( Serial serial ) : base( serial ) { - m_Instance = this; + Instance = this; } public override void Serialize( GenericWriter writer ) @@ -380,8 +369,8 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - m_Artifacts = new StealableInstance[m_Entries.Length]; - m_Table = new Hashtable( m_Entries.Length ); + m_Artifacts = new StealableInstance[Entries.Length]; + m_Table = new Hashtable( Entries.Length ); int length = reader.ReadEncodedInt(); @@ -392,7 +381,7 @@ namespace Server.Items if ( i < m_Artifacts.Length ) { - StealableInstance si = new StealableInstance( m_Entries[i], item, nextRespawn ); + StealableInstance si = new StealableInstance( Entries[i], item, nextRespawn ); m_Artifacts[i] = si; if ( si.Item != null ) @@ -400,9 +389,9 @@ namespace Server.Items } } - for ( int i = length; i < m_Entries.Length; i++ ) + for ( int i = length; i < Entries.Length; i++ ) { - m_Artifacts[i] = new StealableInstance( m_Entries[i] ); + m_Artifacts[i] = new StealableInstance( Entries[i] ); } m_RespawnTimer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromMinutes( 15.0 ), CheckRespawn ); diff --git a/Scripts/Items/Deeds/CommodityDeed.cs b/Scripts/Items/Deeds/CommodityDeed.cs index bbaba3a90..3514eef5e 100644 --- a/Scripts/Items/Deeds/CommodityDeed.cs +++ b/Scripts/Items/Deeds/CommodityDeed.cs @@ -11,19 +11,17 @@ namespace Server.Items public class CommodityDeed : Item { - private Item m_Commodity; - [CommandProperty( AccessLevel.GameMaster )] - public Item Commodity => m_Commodity; + public Item Commodity { get; private set; } public bool SetCommodity( Item item ) { InvalidateProperties(); - if ( m_Commodity == null && (item as ICommodity)?.IsDeedable == true ) + if ( Commodity == null && (item as ICommodity)?.IsDeedable == true ) { - m_Commodity = item; - m_Commodity.Internalize(); + Commodity = item; + Commodity.Internalize(); InvalidateProperties(); return true; @@ -38,7 +36,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( m_Commodity ); + writer.Write( Commodity ); } public override void Deserialize( GenericReader reader ) @@ -47,13 +45,13 @@ namespace Server.Items int version = reader.ReadInt(); - m_Commodity = reader.ReadItem(); + Commodity = reader.ReadItem(); switch ( version ) { case 0: { - if (m_Commodity != null) + if (Commodity != null) { Hue = 0x592; } @@ -67,7 +65,7 @@ namespace Server.Items Weight = 1.0; Hue = 0x47; - m_Commodity = commodity; + Commodity = commodity; LootType = LootType.Blessed; } @@ -83,26 +81,26 @@ namespace Server.Items public override void OnDelete() { - m_Commodity?.Delete(); + Commodity?.Delete(); base.OnDelete(); } - public override int LabelNumber => m_Commodity == null ? 1047016 : 1047017; + public override int LabelNumber => Commodity == null ? 1047016 : 1047017; public override void GetProperties( ObjectPropertyList list ) { base.GetProperties( list ); - if ( m_Commodity != null ) + if ( Commodity != null ) { string args; - if ( m_Commodity.Name == null ) + if ( Commodity.Name == null ) args = - $"#{((m_Commodity is ICommodity commodity) ? commodity.DescriptionNumber : m_Commodity.LabelNumber)}\t{m_Commodity.Amount}"; + $"#{((Commodity is ICommodity commodity) ? commodity.DescriptionNumber : Commodity.LabelNumber)}\t{Commodity.Amount}"; else - args = $"{m_Commodity.Name}\t{m_Commodity.Amount}"; + args = $"{Commodity.Name}\t{Commodity.Amount}"; list.Add( 1060658, args ); // ~1_val~: ~2_val~ } @@ -116,15 +114,15 @@ namespace Server.Items { base.OnSingleClick( from ); - if ( m_Commodity != null ) + if ( Commodity != null ) { string args; - if ( m_Commodity.Name == null ) + if ( Commodity.Name == null ) args = - $"#{((m_Commodity is ICommodity commodity) ? commodity.DescriptionNumber : m_Commodity.LabelNumber)}\t{m_Commodity.Amount}"; + $"#{((Commodity is ICommodity commodity) ? commodity.DescriptionNumber : Commodity.LabelNumber)}\t{Commodity.Amount}"; else - args = $"{m_Commodity.Name}\t{m_Commodity.Amount}"; + args = $"{Commodity.Name}\t{Commodity.Amount}"; LabelTo( from, 1060658, args ); // ~1_val~: ~2_val~ } @@ -138,15 +136,15 @@ namespace Server.Items CommodityDeedBox cox = CommodityDeedBox.Find( this ); // Veteran Rewards mods - if ( m_Commodity != null ) + if ( Commodity != null ) { if ( box != null && IsChildOf( box ) ) { number = 1047031; // The commodity has been redeemed. - box.DropItem( m_Commodity ); + box.DropItem( Commodity ); - m_Commodity = null; + Commodity = null; Delete(); } else if ( cox != null ) @@ -155,9 +153,9 @@ namespace Server.Items { number = 1047031; // The commodity has been redeemed. - cox.DropItem( m_Commodity ); + cox.DropItem( Commodity ); - m_Commodity = null; + Commodity = null; Delete(); } else diff --git a/Scripts/Items/Deeds/NewPlayerTicket.cs b/Scripts/Items/Deeds/NewPlayerTicket.cs index 25be54ead..2d917ecdc 100644 --- a/Scripts/Items/Deeds/NewPlayerTicket.cs +++ b/Scripts/Items/Deeds/NewPlayerTicket.cs @@ -6,14 +6,8 @@ namespace Server.Items { public class NewPlayerTicket : Item { - private Mobile m_Owner; - [CommandProperty( AccessLevel.GameMaster )] - public Mobile Owner - { - get => m_Owner; - set => m_Owner = value; - } + public Mobile Owner { get; set; } public override int LabelNumber => 1062094; // a young player ticket @@ -43,7 +37,7 @@ namespace Server.Items writer.Write( (int) 0 ); // version - writer.Write( (Mobile) m_Owner ); + writer.Write( (Mobile) Owner ); } public override void Deserialize( GenericReader reader ) @@ -56,7 +50,7 @@ namespace Server.Items { case 0: { - m_Owner = reader.ReadMobile(); + Owner = reader.ReadMobile(); break; } } @@ -67,7 +61,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if ( from != m_Owner ) + if ( from != Owner ) { from.SendLocalizedMessage( 501926 ); // This isn't your ticket! Shame on you! You have to use YOUR ticket. } @@ -99,7 +93,7 @@ namespace Server.Items } else if ( targeted is NewPlayerTicket theirTicket ) { - Mobile them = theirTicket.m_Owner; + Mobile them = theirTicket.Owner; if ( them == null || them.Deleted ) { diff --git a/Scripts/Items/Deeds/VendorRentalContract.cs b/Scripts/Items/Deeds/VendorRentalContract.cs index 48775384e..5f7eeead2 100644 --- a/Scripts/Items/Deeds/VendorRentalContract.cs +++ b/Scripts/Items/Deeds/VendorRentalContract.cs @@ -13,8 +13,6 @@ namespace Server.Items public override int LabelNumber => 1062332; // a vendor rental contract private VendorRentalDuration m_Duration; - private int m_Price; - private bool m_LandlordRenew; private Mobile m_Offeree; private Timer m_OfferExpireTimer; @@ -30,18 +28,10 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public int Price - { - get => m_Price; - set => m_Price = value; - } + public int Price { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool LandlordRenew - { - get => m_LandlordRenew; - set => m_LandlordRenew = value; - } + public bool LandlordRenew { get; set; } public Mobile Offeree { @@ -73,7 +63,7 @@ namespace Server.Items Hue = 0x672; m_Duration = VendorRentalDuration.Instances[0]; - m_Price = 1500; + Price = 1500; } public VendorRentalContract( Serial serial ) : base( serial ) @@ -338,8 +328,8 @@ namespace Server.Items writer.WriteEncodedInt( m_Duration.ID ); - writer.Write( (int) m_Price ); - writer.Write( (bool) m_LandlordRenew ); + writer.Write( (int) Price ); + writer.Write( (bool) LandlordRenew ); } public override void Deserialize( GenericReader reader ) @@ -354,8 +344,8 @@ namespace Server.Items else m_Duration = VendorRentalDuration.Instances[0]; - m_Price = reader.ReadInt(); - m_LandlordRenew = reader.ReadBool(); + Price = reader.ReadInt(); + LandlordRenew = reader.ReadBool(); } } } diff --git a/Scripts/Items/Food/Beverage.cs b/Scripts/Items/Food/Beverage.cs index 514245422..44f8cd9f2 100644 --- a/Scripts/Items/Food/Beverage.cs +++ b/Scripts/Items/Food/Beverage.cs @@ -549,8 +549,6 @@ namespace Server.Items { private BeverageType m_Content; private int m_Quantity; - private Mobile m_Poisoner; - private Poison m_Poison; public override int LabelNumber { @@ -586,18 +584,10 @@ namespace Server.Items public bool IsFull => ( m_Quantity >= MaxQuantity ); [CommandProperty( AccessLevel.GameMaster )] - public Poison Poison - { - get => m_Poison; - set => m_Poison = value; - } + public Poison Poison { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Mobile Poisoner - { - get => m_Poisoner; - set => m_Poisoner = value; - } + public Mobile Poisoner { get; set; } [CommandProperty( AccessLevel.GameMaster )] public BeverageType Content @@ -992,8 +982,8 @@ namespace Server.Items from.PlaySound( Utility.RandomList( 0x30, 0x2D6 ) ); - if ( m_Poison != null ) - from.ApplyPoison( m_Poisoner, m_Poison ); + if ( Poison != null ) + from.ApplyPoison( Poisoner, Poison ); --Quantity; } @@ -1151,9 +1141,9 @@ namespace Server.Items writer.Write( (int)1 ); // version - writer.Write( (Mobile)m_Poisoner ); + writer.Write( (Mobile)Poisoner ); - Poison.Serialize( m_Poison, writer ); + Poison.Serialize( Poison, writer ); writer.Write( (int)m_Content ); writer.Write( (int)m_Quantity ); } @@ -1181,12 +1171,12 @@ namespace Server.Items { case 1: { - m_Poisoner = reader.ReadMobile(); + Poisoner = reader.ReadMobile(); goto case 0; } case 0: { - m_Poison = Poison.Deserialize( reader ); + Poison = Poison.Deserialize( reader ); m_Content = (BeverageType)reader.ReadInt(); m_Quantity = reader.ReadInt(); break; diff --git a/Scripts/Items/Food/CookableFood.cs b/Scripts/Items/Food/CookableFood.cs index e3def4abd..8abaa2357 100644 --- a/Scripts/Items/Food/CookableFood.cs +++ b/Scripts/Items/Food/CookableFood.cs @@ -5,18 +5,12 @@ namespace Server.Items { public abstract class CookableFood : Item { - private int m_CookingLevel; - [CommandProperty( AccessLevel.GameMaster )] - public int CookingLevel - { - get => m_CookingLevel; - set => m_CookingLevel = value; - } + public int CookingLevel { get; set; } public CookableFood( int itemID, int cookingLevel ) : base( itemID ) { - m_CookingLevel = cookingLevel; + CookingLevel = cookingLevel; } public CookableFood( Serial serial ) : base( serial ) @@ -31,7 +25,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version // Version 1 - writer.Write( (int) m_CookingLevel ); + writer.Write( (int) CookingLevel ); } @@ -45,7 +39,7 @@ namespace Server.Items { case 1: { - m_CookingLevel = reader.ReadInt(); + CookingLevel = reader.ReadInt(); break; } diff --git a/Scripts/Items/Food/Food.cs b/Scripts/Items/Food/Food.cs index 0d6f6fcae..d33ce5b3c 100644 --- a/Scripts/Items/Food/Food.cs +++ b/Scripts/Items/Food/Food.cs @@ -5,30 +5,14 @@ namespace Server.Items { public abstract class Food : Item { - private Mobile m_Poisoner; - private Poison m_Poison; - private int m_FillFactor; + [CommandProperty( AccessLevel.GameMaster )] + public Mobile Poisoner { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Mobile Poisoner - { - get => m_Poisoner; - set => m_Poisoner = value; - } + public Poison Poison { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Poison Poison - { - get => m_Poison; - set => m_Poison = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public int FillFactor - { - get => m_FillFactor; - set => m_FillFactor = value; - } + public int FillFactor { get; set; } public Food( int itemID ) : this( 1, itemID ) { @@ -38,7 +22,7 @@ namespace Server.Items { Stackable = true; Amount = amount; - m_FillFactor = 1; + FillFactor = 1; } public Food( Serial serial ) : base( serial ) @@ -75,8 +59,8 @@ namespace Server.Items if ( from.Body.IsHuman && !from.Mounted ) from.Animate( 34, 5, 1, true, false, 0 ); - if ( m_Poison != null ) - from.ApplyPoison( m_Poisoner, m_Poison ); + if ( Poison != null ) + from.ApplyPoison( Poisoner, Poison ); Consume(); @@ -88,7 +72,7 @@ namespace Server.Items public virtual bool CheckHunger( Mobile from ) { - return FillHunger( from, m_FillFactor ); + return FillHunger( from, FillFactor ); } public static bool FillHunger( Mobile from, int fillFactor ) @@ -132,10 +116,10 @@ namespace Server.Items writer.Write( (int) 4 ); // version - writer.Write( m_Poisoner ); + writer.Write( Poisoner ); - Poison.Serialize( m_Poison, writer ); - writer.Write( m_FillFactor ); + Poison.Serialize( Poison, writer ); + writer.Write( FillFactor ); } public override void Deserialize( GenericReader reader ) @@ -150,29 +134,29 @@ namespace Server.Items { switch ( reader.ReadInt() ) { - case 0: m_Poison = null; break; - case 1: m_Poison = Poison.Lesser; break; - case 2: m_Poison = Poison.Regular; break; - case 3: m_Poison = Poison.Greater; break; - case 4: m_Poison = Poison.Deadly; break; + case 0: Poison = null; break; + case 1: Poison = Poison.Lesser; break; + case 2: Poison = Poison.Regular; break; + case 3: Poison = Poison.Greater; break; + case 4: Poison = Poison.Deadly; break; } break; } case 2: { - m_Poison = Poison.Deserialize( reader ); + Poison = Poison.Deserialize( reader ); break; } case 3: { - m_Poison = Poison.Deserialize( reader ); - m_FillFactor = reader.ReadInt(); + Poison = Poison.Deserialize( reader ); + FillFactor = reader.ReadInt(); break; } case 4: { - m_Poisoner = reader.ReadMobile(); + Poisoner = reader.ReadMobile(); goto case 3; } } diff --git a/Scripts/Items/Games/BaseBoard.cs b/Scripts/Items/Games/BaseBoard.cs index 8fecd6392..89eaa1583 100644 --- a/Scripts/Items/Games/BaseBoard.cs +++ b/Scripts/Items/Games/BaseBoard.cs @@ -9,14 +9,8 @@ namespace Server.Items { public abstract class BaseBoard : Container, ISecurable { - private SecureLevel m_Level; - [CommandProperty( AccessLevel.GameMaster )] - public SecureLevel Level - { - get => m_Level; - set => m_Level = value; - } + public SecureLevel Level { get; set; } public BaseBoard( int itemID ) : base( itemID ) { @@ -57,7 +51,7 @@ namespace Server.Items base.Serialize( writer ); writer.Write( (int) 1 ); // version - writer.Write( (int)m_Level ); + writer.Write( (int)Level ); } public override void Deserialize( GenericReader reader ) @@ -66,7 +60,7 @@ namespace Server.Items int version = reader.ReadInt(); if ( version == 1 ) - m_Level = (SecureLevel)reader.ReadInt(); + Level = (SecureLevel)reader.ReadInt(); if ( Weight == 1.0 ) Weight = 5.0; diff --git a/Scripts/Items/Games/BasePiece.cs b/Scripts/Items/Games/BasePiece.cs index 88c5a44c8..0351fe2f5 100644 --- a/Scripts/Items/Games/BasePiece.cs +++ b/Scripts/Items/Games/BasePiece.cs @@ -2,19 +2,13 @@ namespace Server.Items { public class BasePiece : Item { - private BaseBoard m_Board; - - public BaseBoard Board - { - get => m_Board; - set => m_Board = value; - } + public BaseBoard Board { get; set; } public override bool IsVirtualItem => true; public BasePiece( int itemID, BaseBoard board ) : base( itemID ) { - m_Board = board; + Board = board; } public BasePiece( Serial serial ) : base( serial ) @@ -26,7 +20,7 @@ namespace Server.Items base.Serialize( writer ); writer.Write( (int) 0 ); - writer.Write( m_Board ); + writer.Write( Board ); } public override void Deserialize( GenericReader reader ) @@ -39,9 +33,9 @@ namespace Server.Items { case 0: { - m_Board = (BaseBoard)reader.ReadItem(); + Board = (BaseBoard)reader.ReadItem(); - if ( m_Board == null || Parent == null ) + if ( Board == null || Parent == null ) Delete(); break; @@ -51,25 +45,25 @@ namespace Server.Items public override void OnSingleClick( Mobile from ) { - if ( m_Board == null || m_Board.Deleted ) + if ( Board == null || Board.Deleted ) Delete(); - else if ( !IsChildOf( m_Board ) ) - m_Board.DropItem( this ); + else if ( !IsChildOf( Board ) ) + Board.DropItem( this ); else base.OnSingleClick( from ); } public override bool OnDragLift( Mobile from ) { - if ( m_Board == null || m_Board.Deleted ) + if ( Board == null || Board.Deleted ) { Delete(); return false; } - if ( !IsChildOf( m_Board ) ) + if ( !IsChildOf( Board ) ) { - m_Board.DropItem( this ); + Board.DropItem( this ); return false; } return true; @@ -84,7 +78,7 @@ namespace Server.Items public override bool DropToItem( Mobile from, Item target, Point3D p ) { - return ( target == m_Board && p.X != -1 && p.Y != -1 && base.DropToItem( from, target, p ) ); + return ( target == Board && p.X != -1 && p.Y != -1 && base.DropToItem( from, target, p ) ); } public override bool DropToWorld( Mobile from, Point3D p ) diff --git a/Scripts/Items/Games/Mahjong/MahjongDealerIndicator.cs b/Scripts/Items/Games/Mahjong/MahjongDealerIndicator.cs index 04142363c..eec181f5f 100644 --- a/Scripts/Items/Games/Mahjong/MahjongDealerIndicator.cs +++ b/Scripts/Items/Games/Mahjong/MahjongDealerIndicator.cs @@ -9,25 +9,23 @@ namespace Server.Engines.Mahjong return new MahjongPieceDim( position, 20, 40 ); } - private MahjongGame m_Game; - private Point2D m_Position; - private MahjongPieceDirection m_Direction; - private MahjongWind m_Wind; + public MahjongGame Game { get; } - public MahjongGame Game => m_Game; - public Point2D Position => m_Position; - public MahjongPieceDirection Direction => m_Direction; - public MahjongWind Wind => m_Wind; + public Point2D Position { get; private set; } + + public MahjongPieceDirection Direction { get; private set; } + + public MahjongWind Wind { get; private set; } public MahjongDealerIndicator( MahjongGame game, Point2D position, MahjongPieceDirection direction, MahjongWind wind ) { - m_Game = game; - m_Position = position; - m_Direction = direction; - m_Wind = wind; + Game = game; + Position = position; + Direction = direction; + Wind = wind; } - public MahjongPieceDim Dimensions => GetDimensions( m_Position, m_Direction ); + public MahjongPieceDim Dimensions => GetDimensions( Position, Direction ); public void Move( Point2D position, MahjongPieceDirection direction, MahjongWind wind ) { @@ -36,31 +34,31 @@ namespace Server.Engines.Mahjong if ( !dim.IsValid() ) return; - m_Position = position; - m_Direction = direction; - m_Wind = wind; + Position = position; + Direction = direction; + Wind = wind; - m_Game.Players.SendGeneralPacket( true, true ); + Game.Players.SendGeneralPacket( true, true ); } public void Save( GenericWriter writer ) { writer.Write( (int) 0 ); // version - writer.Write( m_Position ); - writer.Write( (int) m_Direction ); - writer.Write( (int) m_Wind ); + writer.Write( Position ); + writer.Write( (int) Direction ); + writer.Write( (int) Wind ); } public MahjongDealerIndicator( MahjongGame game, GenericReader reader ) { - m_Game = game; + Game = game; int version = reader.ReadInt(); - m_Position = reader.ReadPoint2D(); - m_Direction = (MahjongPieceDirection) reader.ReadInt(); - m_Wind = (MahjongWind) reader.ReadInt(); + Position = reader.ReadPoint2D(); + Direction = (MahjongPieceDirection) reader.ReadInt(); + Wind = (MahjongWind) reader.ReadInt(); } } } diff --git a/Scripts/Items/Games/Mahjong/MahjongDices.cs b/Scripts/Items/Games/Mahjong/MahjongDices.cs index 5c8490981..5a61fe601 100644 --- a/Scripts/Items/Games/Mahjong/MahjongDices.cs +++ b/Scripts/Items/Games/Mahjong/MahjongDices.cs @@ -2,48 +2,46 @@ namespace Server.Engines.Mahjong { public class MahjongDices { - private MahjongGame m_Game; - private int m_First; - private int m_Second; + public MahjongGame Game { get; } - public MahjongGame Game => m_Game; - public int First => m_First; - public int Second => m_Second; + public int First { get; private set; } + + public int Second { get; private set; } public MahjongDices( MahjongGame game ) { - m_Game = game; - m_First = Utility.Random( 1, 6 ); - m_Second = Utility.Random( 1, 6 ); + Game = game; + First = Utility.Random( 1, 6 ); + Second = Utility.Random( 1, 6 ); } public void RollDices( Mobile from ) { - m_First = Utility.Random( 1, 6 ); - m_Second = Utility.Random( 1, 6 ); + First = Utility.Random( 1, 6 ); + Second = Utility.Random( 1, 6 ); - m_Game.Players.SendGeneralPacket( true, true ); + Game.Players.SendGeneralPacket( true, true ); if ( from != null ) - m_Game.Players.SendLocalizedMessage( 1062695, $"{from.Name}\t{m_First}\t{m_Second}"); // ~1_name~ rolls the dice and gets a ~2_number~ and a ~3_number~! + Game.Players.SendLocalizedMessage( 1062695, $"{from.Name}\t{First}\t{Second}"); // ~1_name~ rolls the dice and gets a ~2_number~ and a ~3_number~! } public void Save( GenericWriter writer ) { writer.Write( (int) 0 ); // version - writer.Write( m_First ); - writer.Write( m_Second ); + writer.Write( First ); + writer.Write( Second ); } public MahjongDices( MahjongGame game, GenericReader reader ) { - m_Game = game; + Game = game; int version = reader.ReadInt(); - m_First = reader.ReadInt(); - m_Second = reader.ReadInt(); + First = reader.ReadInt(); + Second = reader.ReadInt(); } } } diff --git a/Scripts/Items/Games/Mahjong/MahjongGame.cs b/Scripts/Items/Games/Mahjong/MahjongGame.cs index 353ec2d7d..c3db296d5 100644 --- a/Scripts/Items/Games/Mahjong/MahjongGame.cs +++ b/Scripts/Items/Games/Mahjong/MahjongGame.cs @@ -11,29 +11,22 @@ namespace Server.Engines.Mahjong public const int MaxPlayers = 4; public const int BaseScore = 30000; - private MahjongTile[] m_Tiles; - private MahjongDealerIndicator m_DealerIndicator; - private MahjongWallBreakIndicator m_WallBreakIndicator; - private MahjongDices m_Dices; - private MahjongPlayers m_Players; private bool m_ShowScores; private bool m_SpectatorVision; private DateTime m_LastReset; - public MahjongTile[] Tiles => m_Tiles; - public MahjongDealerIndicator DealerIndicator => m_DealerIndicator; - public MahjongWallBreakIndicator WallBreakIndicator => m_WallBreakIndicator; - public MahjongDices Dices => m_Dices; - public MahjongPlayers Players => m_Players; + public MahjongTile[] Tiles { get; private set; } - private SecureLevel m_Level; + public MahjongDealerIndicator DealerIndicator { get; private set; } + + public MahjongWallBreakIndicator WallBreakIndicator { get; private set; } + + public MahjongDices Dices { get; private set; } + + public MahjongPlayers Players { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public SecureLevel Level - { - get => m_Level; - set => m_Level = value; - } + public SecureLevel Level { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool ShowScores @@ -47,11 +40,11 @@ namespace Server.Engines.Mahjong m_ShowScores = value; if ( value ) - m_Players.SendPlayersPacket( true, true ); + Players.SendPlayersPacket( true, true ); - m_Players.SendGeneralPacket( true, true ); + Players.SendGeneralPacket( true, true ); - m_Players.SendLocalizedMessage( value ? 1062777 : 1062778 ); // The dealer has enabled/disabled score display. + Players.SendLocalizedMessage( value ? 1062777 : 1062778 ); // The dealer has enabled/disabled score display. } } @@ -66,12 +59,12 @@ namespace Server.Engines.Mahjong m_SpectatorVision = value; - if ( m_Players.IsInGamePlayer( m_Players.DealerPosition ) ) - m_Players.Dealer.Send( new MahjongGeneralInfo( this ) ); + if ( Players.IsInGamePlayer( Players.DealerPosition ) ) + Players.Dealer.Send( new MahjongGeneralInfo( this ) ); - m_Players.SendTilesPacket( false, true ); + Players.SendTilesPacket( false, true ); - m_Players.SendLocalizedMessage( value ? 1062715 : 1062716 ); // The dealer has enabled/disabled Spectator Vision. + Players.SendLocalizedMessage( value ? 1062715 : 1062716 ); // The dealer has enabled/disabled Spectator Vision. InvalidateProperties(); } @@ -83,12 +76,12 @@ namespace Server.Engines.Mahjong Weight = 5.0; BuildWalls(); - m_DealerIndicator = new MahjongDealerIndicator( this, new Point2D( 300, 300 ), MahjongPieceDirection.Up, MahjongWind.North ); - m_WallBreakIndicator = new MahjongWallBreakIndicator( this, new Point2D( 335, 335 ) ); - m_Dices = new MahjongDices( this ); - m_Players = new MahjongPlayers( this, MaxPlayers, BaseScore ); + DealerIndicator = new MahjongDealerIndicator( this, new Point2D( 300, 300 ), MahjongPieceDirection.Up, MahjongWind.North ); + WallBreakIndicator = new MahjongWallBreakIndicator( this, new Point2D( 335, 335 ) ); + Dices = new MahjongDices( this ); + Players = new MahjongPlayers( this, MaxPlayers, BaseScore ); m_LastReset = DateTime.UtcNow; - m_Level = SecureLevel.CoOwners; + Level = SecureLevel.CoOwners; } public MahjongGame( Serial serial ) : base( serial ) @@ -100,7 +93,7 @@ namespace Server.Engines.Mahjong for ( int i = 0; i < 17; i++ ) { Point2D position = new Point2D( x + i*20, y ); - m_Tiles[index + i] = new MahjongTile( this, index + i, typeGenerator.Next(), position, stackLevel, direction, false ); + Tiles[index + i] = new MahjongTile( this, index + i, typeGenerator.Next(), position, stackLevel, direction, false ); } index += 17; @@ -111,7 +104,7 @@ namespace Server.Engines.Mahjong for ( int i = 0; i < 17; i++ ) { Point2D position = new Point2D( x, y + i*20 ); - m_Tiles[index + i] = new MahjongTile( this, index + i, typeGenerator.Next(), position, stackLevel, direction, false ); + Tiles[index + i] = new MahjongTile( this, index + i, typeGenerator.Next(), position, stackLevel, direction, false ); } index += 17; @@ -119,7 +112,7 @@ namespace Server.Engines.Mahjong private void BuildWalls() { - m_Tiles = new MahjongTile[17 * 8]; + Tiles = new MahjongTile[17 * 8]; MahjongTileTypeGenerator typeGenerator = new MahjongTileTypeGenerator( 4 ); @@ -152,9 +145,9 @@ namespace Server.Engines.Mahjong { base.GetContextMenuEntries( from, list ); - m_Players.CheckPlayers(); + Players.CheckPlayers(); - if ( from.Alive && IsAccessibleTo( from ) && m_Players.GetInGameMobiles( true, false ).Count == 0 ) + if ( from.Alive && IsAccessibleTo( from ) && Players.GetInGameMobiles( true, false ).Count == 0 ) list.Add( new ResetGameEntry( this ) ); SetSecureLevelEntry.AddTo( from, this, list ); @@ -180,9 +173,9 @@ namespace Server.Engines.Mahjong public override void OnDoubleClick( Mobile from ) { - m_Players.CheckPlayers(); + Players.CheckPlayers(); - m_Players.Join( from ); + Players.Join( from ); } public void ResetGame( Mobile from ) @@ -193,14 +186,14 @@ namespace Server.Engines.Mahjong m_LastReset = DateTime.UtcNow; if ( from != null ) - m_Players.SendLocalizedMessage( 1062771, from.Name ); // ~1_name~ has reset the game. + Players.SendLocalizedMessage( 1062771, from.Name ); // ~1_name~ has reset the game. - m_Players.SendRelievePacket( true, true ); + Players.SendRelievePacket( true, true ); BuildWalls(); - m_DealerIndicator = new MahjongDealerIndicator( this, new Point2D( 300, 300 ), MahjongPieceDirection.Up, MahjongWind.North ); - m_WallBreakIndicator = new MahjongWallBreakIndicator( this, new Point2D( 335, 335 ) ); - m_Players = new MahjongPlayers( this, MaxPlayers, BaseScore ); + DealerIndicator = new MahjongDealerIndicator( this, new Point2D( 300, 300 ), MahjongPieceDirection.Up, MahjongWind.North ); + WallBreakIndicator = new MahjongWallBreakIndicator( this, new Point2D( 335, 335 ) ); + Players = new MahjongPlayers( this, MaxPlayers, BaseScore ); } public void ResetWalls( Mobile from ) @@ -212,16 +205,16 @@ namespace Server.Engines.Mahjong BuildWalls(); - m_Players.SendTilesPacket( true, true ); + Players.SendTilesPacket( true, true ); if ( from != null ) - m_Players.SendLocalizedMessage( 1062696 ); // The dealer rebuilds the wall. + Players.SendLocalizedMessage( 1062696 ); // The dealer rebuilds the wall. } public int GetStackLevel( MahjongPieceDim dim ) { int level = -1; - foreach ( MahjongTile tile in m_Tiles ) + foreach ( MahjongTile tile in Tiles ) { if ( tile.StackLevel > level && dim.IsOverlapping( tile.Dimensions ) ) level = tile.StackLevel; @@ -235,20 +228,20 @@ namespace Server.Engines.Mahjong writer.Write( (int) 1 ); // version - writer.Write( (int) m_Level ); + writer.Write( (int) Level ); - writer.Write( m_Tiles.Length ); + writer.Write( Tiles.Length ); - for ( int i = 0; i < m_Tiles.Length; i++ ) - m_Tiles[i].Save( writer ); + for ( int i = 0; i < Tiles.Length; i++ ) + Tiles[i].Save( writer ); - m_DealerIndicator.Save( writer ); + DealerIndicator.Save( writer ); - m_WallBreakIndicator.Save( writer ); + WallBreakIndicator.Save( writer ); - m_Dices.Save( writer ); + Dices.Save( writer ); - m_Players.Save( writer ); + Players.Save( writer ); writer.Write( m_ShowScores ); writer.Write( m_SpectatorVision ); @@ -264,28 +257,28 @@ namespace Server.Engines.Mahjong { case 1: { - m_Level = (SecureLevel)reader.ReadInt(); + Level = (SecureLevel)reader.ReadInt(); goto case 0; } case 0: { if ( version < 1 ) - m_Level = SecureLevel.CoOwners; + Level = SecureLevel.CoOwners; int length = reader.ReadInt(); - m_Tiles = new MahjongTile[length]; + Tiles = new MahjongTile[length]; for ( int i = 0; i < length; i++ ) - m_Tiles[i] = new MahjongTile( this, reader ); + Tiles[i] = new MahjongTile( this, reader ); - m_DealerIndicator = new MahjongDealerIndicator( this, reader ); + DealerIndicator = new MahjongDealerIndicator( this, reader ); - m_WallBreakIndicator = new MahjongWallBreakIndicator( this, reader ); + WallBreakIndicator = new MahjongWallBreakIndicator( this, reader ); - m_Dices = new MahjongDices( this, reader ); + Dices = new MahjongDices( this, reader ); - m_Players = new MahjongPlayers( this, reader ); + Players = new MahjongPlayers( this, reader ); m_ShowScores = reader.ReadBool(); m_SpectatorVision = reader.ReadBool(); diff --git a/Scripts/Items/Games/Mahjong/MahjongPieceDim.cs b/Scripts/Items/Games/Mahjong/MahjongPieceDim.cs index 7d8ecda75..aed1b149a 100644 --- a/Scripts/Items/Games/Mahjong/MahjongPieceDim.cs +++ b/Scripts/Items/Games/Mahjong/MahjongPieceDim.cs @@ -2,43 +2,41 @@ namespace Server.Engines.Mahjong { public struct MahjongPieceDim { - private Point2D m_Position; - private int m_Width; - private int m_Height; + public Point2D Position { get; } - public Point2D Position => m_Position; - public int Width => m_Width; - public int Height => m_Height; + public int Width { get; } + + public int Height { get; } public MahjongPieceDim( Point2D position, int width, int height ) { - m_Position = position; - m_Width = width; - m_Height = height; + Position = position; + Width = width; + Height = height; } public bool IsValid() { - return m_Position.X >= 0 && m_Position.Y >= 0 && m_Position.X + m_Width <= 670 && m_Position.Y + m_Height <= 670; + return Position.X >= 0 && Position.Y >= 0 && Position.X + Width <= 670 && Position.Y + Height <= 670; } public bool IsOverlapping( MahjongPieceDim dim ) { - return m_Position.X < dim.m_Position.X + dim.m_Width && m_Position.Y < dim.m_Position.Y + dim.m_Height && m_Position.X + m_Width > dim.m_Position.X && m_Position.Y + m_Height > dim.m_Position.Y; + return Position.X < dim.Position.X + dim.Width && Position.Y < dim.Position.Y + dim.Height && Position.X + Width > dim.Position.X && Position.Y + Height > dim.Position.Y; } public int GetHandArea() { - if ( m_Position.X + m_Width > 150 && m_Position.X < 520 && m_Position.Y < 35 ) + if ( Position.X + Width > 150 && Position.X < 520 && Position.Y < 35 ) return 0; - if ( m_Position.X + m_Width > 635 && m_Position.Y + m_Height > 150 && m_Position.Y < 520 ) + if ( Position.X + Width > 635 && Position.Y + Height > 150 && Position.Y < 520 ) return 1; - if ( m_Position.X + m_Width > 150 && m_Position.X < 520 && m_Position.Y + m_Height > 635 ) + if ( Position.X + Width > 150 && Position.X < 520 && Position.Y + Height > 635 ) return 2; - if ( m_Position.X < 35 && m_Position.Y + m_Height > 150 && m_Position.Y < 520 ) + if ( Position.X < 35 && Position.Y + Height > 150 && Position.Y < 520 ) return 3; return -1; diff --git a/Scripts/Items/Games/Mahjong/MahjongPlayers.cs b/Scripts/Items/Games/Mahjong/MahjongPlayers.cs index 2690018c0..0886b95d5 100644 --- a/Scripts/Items/Games/Mahjong/MahjongPlayers.cs +++ b/Scripts/Items/Games/Mahjong/MahjongPlayers.cs @@ -4,22 +4,21 @@ namespace Server.Engines.Mahjong { public class MahjongPlayers { - private MahjongGame m_Game; private Mobile[] m_Players; private bool[] m_InGame; private bool[] m_PublicHand; private int[] m_Scores; - private int m_DealerPosition; private ArrayList m_Spectators; - public MahjongGame Game => m_Game; + public MahjongGame Game { get; } + public int Seats => m_Players.Length; - public Mobile Dealer => m_Players[m_DealerPosition]; - public int DealerPosition => m_DealerPosition; + public Mobile Dealer => m_Players[DealerPosition]; + public int DealerPosition { get; private set; } public MahjongPlayers( MahjongGame game, int maxPlayers, int baseScore ) { - m_Game = game; + Game = game; m_Spectators = new ArrayList(); m_Players = new Mobile[maxPlayers]; @@ -52,7 +51,7 @@ namespace Server.Engines.Mahjong { if ( Dealer != mobile ) return false; - return m_InGame[m_DealerPosition]; + return m_InGame[DealerPosition]; } public bool IsInGamePlayer( int index ) @@ -95,7 +94,7 @@ namespace Server.Engines.Mahjong m_PublicHand[index] = value; - SendTilesPacket( true, !m_Game.SpectatorVision ); + SendTilesPacket( true, !Game.SpectatorVision ); if ( IsInGamePlayer( index ) ) m_Players[index].SendLocalizedMessage( value ? 1062775 : 1062776 ); // Your hand is [not] publicly viewable. @@ -152,11 +151,11 @@ namespace Server.Engines.Mahjong removed = true; } - else if ( !m_Game.IsAccessibleTo( player ) || player.Map != m_Game.Map || !player.InRange( m_Game.GetWorldLocation(), 5 ) ) + else if ( !Game.IsAccessibleTo( player ) || player.Map != Game.Map || !player.InRange( Game.GetWorldLocation(), 5 ) ) { m_InGame[i] = false; - player.Send( new MahjongRelieve( m_Game ) ); + player.Send( new MahjongRelieve( Game ) ); SendPlayerExitMessage( player ); UpdateDealer( true ); @@ -175,11 +174,11 @@ namespace Server.Engines.Mahjong { m_Spectators.RemoveAt( i ); } - else if ( !m_Game.IsAccessibleTo( mobile ) || mobile.Map != m_Game.Map || !mobile.InRange( m_Game.GetWorldLocation(), 5 ) ) + else if ( !Game.IsAccessibleTo( mobile ) || mobile.Map != Game.Map || !mobile.InRange( Game.GetWorldLocation(), 5 ) ) { m_Spectators.RemoveAt( i ); - mobile.Send( new MahjongRelieve( m_Game ) ); + mobile.Send( new MahjongRelieve( Game ) ); } else { @@ -193,14 +192,14 @@ namespace Server.Engines.Mahjong private void UpdateDealer( bool message ) { - if ( IsInGamePlayer( m_DealerPosition ) ) + if ( IsInGamePlayer( DealerPosition ) ) return; - for ( int i = m_DealerPosition + 1; i < m_Players.Length; i++ ) + for ( int i = DealerPosition + 1; i < m_Players.Length; i++ ) { if ( IsInGamePlayer( i ) ) { - m_DealerPosition = i; + DealerPosition = i; if ( message ) SendDealerChangedMessage(); @@ -209,11 +208,11 @@ namespace Server.Engines.Mahjong } } - for ( int i = 0; i < m_DealerPosition; i++ ) + for ( int i = 0; i < DealerPosition; i++ ) { if ( IsInGamePlayer( i ) ) { - m_DealerPosition = i; + DealerPosition = i; if ( message ) SendDealerChangedMessage(); @@ -225,13 +224,13 @@ namespace Server.Engines.Mahjong private int GetNextSeat() { - for ( int i = m_DealerPosition; i < m_Players.Length; i++ ) + for ( int i = DealerPosition; i < m_Players.Length; i++ ) { if ( m_Players[i] == null ) return i; } - for ( int i = 0; i < m_DealerPosition; i++ ) + for ( int i = 0; i < DealerPosition; i++ ) { if ( m_Players[i] == null ) return i; @@ -271,14 +270,14 @@ namespace Server.Engines.Mahjong UpdateDealer( false ); if ( sendJoinGame ) - player.Send( new MahjongJoinGame( m_Game ) ); + player.Send( new MahjongJoinGame( Game ) ); SendPlayersPacket( true, true ); - player.Send( new MahjongGeneralInfo( m_Game ) ); - player.Send( new MahjongTilesInfo( m_Game, player ) ); + player.Send( new MahjongGeneralInfo( Game ) ); + player.Send( new MahjongTilesInfo( Game, player ) ); - if ( m_DealerPosition == index ) + if ( DealerPosition == index ) SendLocalizedMessage( 1062773, player.Name ); // ~1_name~ has entered the game as the dealer. else SendLocalizedMessage( 1062772, player.Name ); // ~1_name~ has entered the game as a player. @@ -291,10 +290,10 @@ namespace Server.Engines.Mahjong m_Spectators.Add( mobile ); } - mobile.Send( new MahjongJoinGame( m_Game ) ); - mobile.Send( new MahjongPlayersInfo( m_Game, mobile ) ); - mobile.Send( new MahjongGeneralInfo( m_Game ) ); - mobile.Send( new MahjongTilesInfo( m_Game, mobile ) ); + mobile.Send( new MahjongJoinGame( Game ) ); + mobile.Send( new MahjongPlayersInfo( Game, mobile ) ); + mobile.Send( new MahjongGeneralInfo( Game ) ); + mobile.Send( new MahjongTilesInfo( Game, mobile ) ); } public void Join( Mobile mobile ) @@ -345,7 +344,7 @@ namespace Server.Engines.Mahjong m_Scores[i] = value; } - SendPlayersPacket( true, m_Game.ShowScores ); + SendPlayersPacket( true, Game.ShowScores ); SendLocalizedMessage( 1062697 ); // The dealer redistributes the score sticks evenly. } @@ -361,14 +360,14 @@ namespace Server.Engines.Mahjong m_Scores[fromPosition] -= amount; m_Scores[toPosition] += amount; - if ( m_Game.ShowScores ) + if ( Game.ShowScores ) { SendPlayersPacket( true, true ); } else { - from.Send( new MahjongPlayersInfo( m_Game, from ) ); - to.Send( new MahjongPlayersInfo( m_Game, to ) ); + from.Send( new MahjongPlayersInfo( Game, from ) ); + to.Send( new MahjongPlayersInfo( Game, to ) ); } SendLocalizedMessage( 1062774, $"{from.Name}\t{to.Name}\t{amount}"); // ~1_giver~ gives ~2_receiver~ ~3_number~ points. @@ -381,7 +380,7 @@ namespace Server.Engines.Mahjong return; if ( m_InGame[index] ) - player.Send( new MahjongRelieve( m_Game ) ); + player.Send( new MahjongRelieve( Game ) ); m_Players[index] = null; @@ -400,14 +399,14 @@ namespace Server.Engines.Mahjong if ( to == null || !m_InGame[index] ) return; - int oldDealer = m_DealerPosition; + int oldDealer = DealerPosition; - m_DealerPosition = index; + DealerPosition = index; if ( IsInGamePlayer( oldDealer ) ) - m_Players[oldDealer].Send( new MahjongPlayersInfo( m_Game, m_Players[oldDealer] ) ); + m_Players[oldDealer].Send( new MahjongPlayersInfo( Game, m_Players[oldDealer] ) ); - to.Send( new MahjongPlayersInfo( m_Game, to ) ); + to.Send( new MahjongPlayersInfo( Game, to ) ); SendDealerChangedMessage(); } @@ -427,7 +426,7 @@ namespace Server.Engines.Mahjong { foreach ( Mobile mobile in GetInGameMobiles( players, spectators ) ) { - mobile.Send( new MahjongPlayersInfo( m_Game, mobile ) ); + mobile.Send( new MahjongPlayersInfo( Game, mobile ) ); } } @@ -438,7 +437,7 @@ namespace Server.Engines.Mahjong if ( mobiles.Count == 0 ) return; - MahjongGeneralInfo generalInfo = new MahjongGeneralInfo( m_Game ); + MahjongGeneralInfo generalInfo = new MahjongGeneralInfo( Game ); generalInfo.Acquire(); @@ -454,7 +453,7 @@ namespace Server.Engines.Mahjong { foreach ( Mobile mobile in GetInGameMobiles( players, spectators ) ) { - mobile.Send( new MahjongTilesInfo( m_Game, mobile ) ); + mobile.Send( new MahjongTilesInfo( Game, mobile ) ); } } @@ -473,7 +472,7 @@ namespace Server.Engines.Mahjong if ( mobiles.Count == 0 ) return; - MahjongRelieve relieve = new MahjongRelieve( m_Game ); + MahjongRelieve relieve = new MahjongRelieve( Game ); relieve.Acquire(); @@ -514,12 +513,12 @@ namespace Server.Engines.Mahjong writer.Write( m_Scores[i] ); } - writer.Write( m_DealerPosition ); + writer.Write( DealerPosition ); } public MahjongPlayers( MahjongGame game, GenericReader reader ) { - m_Game = game; + Game = game; m_Spectators = new ArrayList(); int version = reader.ReadInt(); @@ -537,7 +536,7 @@ namespace Server.Engines.Mahjong m_Scores[i] = reader.ReadInt(); } - m_DealerPosition = reader.ReadInt(); + DealerPosition = reader.ReadInt(); } } } diff --git a/Scripts/Items/Games/Mahjong/MahjongTile.cs b/Scripts/Items/Games/Mahjong/MahjongTile.cs index 34179704b..9ab4d8482 100644 --- a/Scripts/Items/Games/Mahjong/MahjongTile.cs +++ b/Scripts/Items/Games/Mahjong/MahjongTile.cs @@ -9,36 +9,35 @@ namespace Server.Engines.Mahjong return new MahjongPieceDim( position, 30, 20 ); } - private MahjongGame m_Game; - private int m_Number; - private MahjongTileType m_Value; protected Point2D m_Position; - private int m_StackLevel; - private MahjongPieceDirection m_Direction; - private bool m_Flipped; - public MahjongGame Game => m_Game; - public int Number => m_Number; - public MahjongTileType Value => m_Value; + public MahjongGame Game { get; } + + public int Number { get; } + + public MahjongTileType Value { get; } + public Point2D Position => m_Position; - public int StackLevel => m_StackLevel; - public MahjongPieceDirection Direction => m_Direction; - public bool Flipped => m_Flipped; + public int StackLevel { get; private set; } + + public MahjongPieceDirection Direction { get; private set; } + + public bool Flipped { get; private set; } public MahjongTile( MahjongGame game, int number, MahjongTileType value, Point2D position, int stackLevel, MahjongPieceDirection direction, bool flipped ) { - m_Game = game; - m_Number = number; - m_Value = value; + Game = game; + Number = number; + Value = value; m_Position = position; - m_StackLevel = stackLevel; - m_Direction = direction; - m_Flipped = flipped; + StackLevel = stackLevel; + Direction = direction; + Flipped = flipped; } - public MahjongPieceDim Dimensions => GetDimensions( m_Position, m_Direction ); + public MahjongPieceDim Dimensions => GetDimensions( m_Position, Direction ); - public bool IsMovable => m_Game.GetStackLevel( Dimensions ) <= m_StackLevel; + public bool IsMovable => Game.GetStackLevel( Dimensions ) <= StackLevel; public void Move( Point2D position, MahjongPieceDirection direction, bool flip, int validHandArea ) { @@ -50,38 +49,38 @@ namespace Server.Engines.Mahjong return; m_Position = position; - m_Direction = direction; - m_StackLevel = -1; // Avoid self interference - m_StackLevel = m_Game.GetStackLevel( dim ) + 1; - m_Flipped = flip; + Direction = direction; + StackLevel = -1; // Avoid self interference + StackLevel = Game.GetStackLevel( dim ) + 1; + Flipped = flip; - m_Game.Players.SendTilePacket( this, true, true ); + Game.Players.SendTilePacket( this, true, true ); } public void Save( GenericWriter writer ) { writer.Write( (int) 0 ); // version - writer.Write( m_Number ); - writer.Write( (int) m_Value ); + writer.Write( Number ); + writer.Write( (int) Value ); writer.Write( m_Position ); - writer.Write( m_StackLevel ); - writer.Write( (int) m_Direction ); - writer.Write( m_Flipped ); + writer.Write( StackLevel ); + writer.Write( (int) Direction ); + writer.Write( Flipped ); } public MahjongTile( MahjongGame game, GenericReader reader ) { - m_Game = game; + Game = game; int version = reader.ReadInt(); - m_Number = reader.ReadInt(); - m_Value = (MahjongTileType) reader.ReadInt(); + Number = reader.ReadInt(); + Value = (MahjongTileType) reader.ReadInt(); m_Position = reader.ReadPoint2D(); - m_StackLevel = reader.ReadInt(); - m_Direction = (MahjongPieceDirection) reader.ReadInt(); - m_Flipped = reader.ReadBool(); + StackLevel = reader.ReadInt(); + Direction = (MahjongPieceDirection) reader.ReadInt(); + Flipped = reader.ReadBool(); } } } diff --git a/Scripts/Items/Games/Mahjong/MahjongTileTypeGenerator.cs b/Scripts/Items/Games/Mahjong/MahjongTileTypeGenerator.cs index e8536a0da..394d17e83 100644 --- a/Scripts/Items/Games/Mahjong/MahjongTileTypeGenerator.cs +++ b/Scripts/Items/Games/Mahjong/MahjongTileTypeGenerator.cs @@ -4,28 +4,26 @@ namespace Server.Engines.Mahjong { public class MahjongTileTypeGenerator { - private ArrayList m_LeftTileTypes; - - public ArrayList LeftTileTypes => m_LeftTileTypes; + public ArrayList LeftTileTypes { get; } public MahjongTileTypeGenerator( int count ) { - m_LeftTileTypes = new ArrayList( 34 * count ); + LeftTileTypes = new ArrayList( 34 * count ); for ( int i = 1; i <= 34; i++ ) { for ( int j = 0; j < count; j++ ) { - m_LeftTileTypes.Add( (MahjongTileType)i ); + LeftTileTypes.Add( (MahjongTileType)i ); } } } public MahjongTileType Next() { - int random = Utility.Random( m_LeftTileTypes.Count ); - MahjongTileType next = (MahjongTileType)m_LeftTileTypes[random]; - m_LeftTileTypes.RemoveAt( random ); + int random = Utility.Random( LeftTileTypes.Count ); + MahjongTileType next = (MahjongTileType)LeftTileTypes[random]; + LeftTileTypes.RemoveAt( random ); return next; } diff --git a/Scripts/Items/Games/Mahjong/MahjongWallBreakIndicator.cs b/Scripts/Items/Games/Mahjong/MahjongWallBreakIndicator.cs index b4aa34847..29e8e12dc 100644 --- a/Scripts/Items/Games/Mahjong/MahjongWallBreakIndicator.cs +++ b/Scripts/Items/Games/Mahjong/MahjongWallBreakIndicator.cs @@ -7,19 +7,17 @@ namespace Server.Engines.Mahjong return new MahjongPieceDim( position, 20, 20 ); } - private MahjongGame m_Game; - private Point2D m_Position; + public MahjongGame Game { get; } - public MahjongGame Game => m_Game; - public Point2D Position => m_Position; + public Point2D Position { get; private set; } public MahjongWallBreakIndicator( MahjongGame game, Point2D position ) { - m_Game = game; - m_Position = position; + Game = game; + Position = position; } - public MahjongPieceDim Dimensions => GetDimensions( m_Position ); + public MahjongPieceDim Dimensions => GetDimensions( Position ); public void Move( Point2D position ) { @@ -28,25 +26,25 @@ namespace Server.Engines.Mahjong if ( !dim.IsValid() ) return; - m_Position = position; + Position = position; - m_Game.Players.SendGeneralPacket( true, true ); + Game.Players.SendGeneralPacket( true, true ); } public void Save( GenericWriter writer ) { writer.Write( (int) 0 ); // version - writer.Write( m_Position ); + writer.Write( Position ); } public MahjongWallBreakIndicator( MahjongGame game, GenericReader reader ) { - m_Game = game; + Game = game; int version = reader.ReadInt(); - m_Position = reader.ReadPoint2D(); + Position = reader.ReadPoint2D(); } } } diff --git a/Scripts/Items/Guilds/Guildstone.cs b/Scripts/Items/Guilds/Guildstone.cs index 6a1418821..80e997d2d 100644 --- a/Scripts/Items/Guilds/Guildstone.cs +++ b/Scripts/Items/Guilds/Guildstone.cs @@ -9,7 +9,6 @@ namespace Server.Items { public class Guildstone : Item, IAddon, IChopable { - private Guild m_Guild; private string m_GuildName; private string m_GuildAbbrev; @@ -28,7 +27,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public Guild Guild => m_Guild; + public Guild Guild { get; private set; } public override int LabelNumber => 1041429; // a guildstone @@ -38,7 +37,7 @@ namespace Server.Items public Guildstone( Guild g, string guildName, string abbrev ) : base( Guild.NewGuildSystem ? 0xED6 : 0xED4 ) { - m_Guild = g; + Guild = g; m_GuildName = guildName; m_GuildAbbrev = abbrev; @@ -53,10 +52,10 @@ namespace Server.Items { base.Serialize( writer ); - if ( m_Guild != null && !m_Guild.Disbanded ) + if ( Guild != null && !Guild.Disbanded ) { - m_GuildName = m_Guild.Name; - m_GuildAbbrev = m_Guild.Abbreviation; + m_GuildName = Guild.Name; + m_GuildAbbrev = Guild.Abbreviation; } writer.Write( (int)3 ); // version @@ -66,7 +65,7 @@ namespace Server.Items writer.Write( m_GuildName ); writer.Write( m_GuildAbbrev ); - writer.Write( m_Guild ); + writer.Write( Guild ); } private bool m_BeforeChangeover; @@ -92,7 +91,7 @@ namespace Server.Items } case 1: { - m_Guild = reader.ReadGuild() as Guild; + Guild = reader.ReadGuild() as Guild; goto case 0; } @@ -111,7 +110,7 @@ namespace Server.Items if ( Guild.NewGuildSystem && m_BeforeChangeover ) Timer.DelayCall( TimeSpan.Zero, AddToHouse ); - if ( !Guild.NewGuildSystem && m_Guild == null ) + if ( !Guild.NewGuildSystem && Guild == null ) Delete(); } @@ -130,15 +129,15 @@ namespace Server.Items { base.GetProperties( list ); - if ( m_Guild != null && !m_Guild.Disbanded ) + if ( Guild != null && !Guild.Disbanded ) { string name; string abbr; - if ( (name = m_Guild.Name) == null || (name = name.Trim()).Length <= 0 ) + if ( (name = Guild.Name) == null || (name = name.Trim()).Length <= 0 ) name = "(unnamed)"; - if ( (abbr = m_Guild.Abbreviation) == null || (abbr = abbr.Trim()).Length <= 0 ) + if ( (abbr = Guild.Abbreviation) == null || (abbr = abbr.Trim()).Length <= 0 ) abbr = ""; //list.Add( 1060802, Utility.FixHtml( name ) ); // Guild name: ~1_val~ @@ -154,11 +153,11 @@ namespace Server.Items { base.OnSingleClick( from ); - if ( m_Guild != null && !m_Guild.Disbanded ) + if ( Guild != null && !Guild.Disbanded ) { string name; - if ( (name = m_Guild.Name) == null || (name = name.Trim()).Length <= 0 ) + if ( (name = Guild.Name) == null || (name = name.Trim()).Length <= 0 ) name = "(unnamed)"; LabelTo( from, name ); @@ -171,8 +170,8 @@ namespace Server.Items public override void OnAfterDelete() { - if ( !Guild.NewGuildSystem && m_Guild != null && !m_Guild.Disbanded ) - m_Guild.Disband(); + if ( !Guild.NewGuildSystem && Guild != null && !Guild.Disbanded ) + Guild.Disband(); } public override void OnDoubleClick( Mobile from ) @@ -180,7 +179,7 @@ namespace Server.Items if ( Guild.NewGuildSystem ) return; - if ( m_Guild == null || m_Guild.Disbanded ) + if ( Guild == null || Guild.Disbanded ) { Delete(); } @@ -188,10 +187,10 @@ namespace Server.Items { from.SendLocalizedMessage( 500446 ); // That is too far away. } - else if ( m_Guild.Accepted.Contains( from ) ) + else if ( Guild.Accepted.Contains( from ) ) { #region Factions - PlayerState guildState = PlayerState.Find( m_Guild.Leader ); + PlayerState guildState = PlayerState.Find( Guild.Leader ); PlayerState targetState = PlayerState.Find( from ); Faction guildFaction = guildState?.Faction; @@ -204,25 +203,25 @@ namespace Server.Items targetState.Leaving = guildState.Leaving; #endregion - m_Guild.Accepted.Remove( from ); - m_Guild.AddMember( from ); + Guild.Accepted.Remove( from ); + Guild.AddMember( from ); GuildGump.EnsureClosed( from ); - from.SendGump( new GuildGump( from, m_Guild ) ); + from.SendGump( new GuildGump( from, Guild ) ); } - else if ( from.AccessLevel < AccessLevel.GameMaster && !m_Guild.IsMember( from ) ) + else if ( from.AccessLevel < AccessLevel.GameMaster && !Guild.IsMember( from ) ) { from.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, 0x3B2, 3, 501158, "", "" ) ); // You are not a member ... } else { GuildGump.EnsureClosed( from ); - from.SendGump( new GuildGump( from, m_Guild ) ); + from.SendGump( new GuildGump( from, Guild ) ); } } #region IAddon Members - public Item Deed => new GuildstoneDeed( m_Guild, m_GuildName, m_GuildAbbrev ); + public Item Deed => new GuildstoneDeed( Guild, m_GuildName, m_GuildAbbrev ); public bool CouldFit( IPoint3D p, Map map ) { @@ -267,7 +266,6 @@ namespace Server.Items { public override int LabelNumber => 1041233; // deed to a guildstone - private Guild m_Guild; private string m_GuildName; private string m_GuildAbbrev; @@ -286,7 +284,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public Guild Guild => m_Guild; + public Guild Guild { get; private set; } [Constructible] public GuildstoneDeed() : this( null, null ) @@ -300,7 +298,7 @@ namespace Server.Items public GuildstoneDeed( Guild g, string guildName, string abbrev ) : base( 0x14F0 ) { - m_Guild = g; + Guild = g; m_GuildName = guildName; m_GuildAbbrev = abbrev; @@ -315,10 +313,10 @@ namespace Server.Items { base.Serialize( writer ); - if ( m_Guild != null && !m_Guild.Disbanded ) + if ( Guild != null && !Guild.Disbanded ) { - m_GuildName = m_Guild.Name; - m_GuildAbbrev = m_Guild.Abbreviation; + m_GuildName = Guild.Name; + m_GuildAbbrev = Guild.Abbreviation; } writer.Write( (int)1 ); // version @@ -326,7 +324,7 @@ namespace Server.Items writer.Write( m_GuildName ); writer.Write( m_GuildAbbrev ); - writer.Write( m_Guild ); + writer.Write( Guild ); } public override void Deserialize( GenericReader reader ) @@ -342,7 +340,7 @@ namespace Server.Items m_GuildName = reader.ReadString(); m_GuildAbbrev = reader.ReadString(); - m_Guild = reader.ReadGuild() as Guild; + Guild = reader.ReadGuild() as Guild; break; } @@ -353,15 +351,15 @@ namespace Server.Items { base.GetProperties( list ); - if ( m_Guild != null && !m_Guild.Disbanded ) + if ( Guild != null && !Guild.Disbanded ) { string name; string abbr; - if ( (name = m_Guild.Name) == null || (name = name.Trim()).Length <= 0 ) + if ( (name = Guild.Name) == null || (name = name.Trim()).Length <= 0 ) name = "(unnamed)"; - if ( (abbr = m_Guild.Abbreviation) == null || (abbr = abbr.Trim()).Length <= 0 ) + if ( (abbr = Guild.Abbreviation) == null || (abbr = abbr.Trim()).Length <= 0 ) abbr = ""; //list.Add( 1060802, Utility.FixHtml( name ) ); // Guild name: ~1_val~ @@ -408,7 +406,7 @@ namespace Server.Items { if ( house != null && house.IsOwner( from ) ) { - Item addon = new Guildstone( m_Guild, m_GuildName, m_GuildAbbrev ); + Item addon = new Guildstone( Guild, m_GuildName, m_GuildAbbrev ); addon.MoveToWorld( loc, from.Map ); diff --git a/Scripts/Items/Lights/BaseLight.cs b/Scripts/Items/Lights/BaseLight.cs index 9eca51302..1f6b5bea0 100644 --- a/Scripts/Items/Lights/BaseLight.cs +++ b/Scripts/Items/Lights/BaseLight.cs @@ -6,9 +6,7 @@ namespace Server.Items { private Timer m_Timer; private DateTime m_End; - private bool m_BurntOut; private bool m_Burning; - private bool m_Protected; private TimeSpan m_Duration = TimeSpan.Zero; public abstract int LitItemID{ get; } @@ -37,18 +35,10 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public bool BurntOut - { - get => m_BurntOut; - set => m_BurntOut = value; - } + public bool BurntOut { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool Protected - { - get => m_Protected; - set => m_Protected = value; - } + public bool Protected { get; set; } [CommandProperty( AccessLevel.GameMaster )] public TimeSpan Duration @@ -88,7 +78,7 @@ namespace Server.Items { int sound = UnlitSound; - if ( m_BurntOut && BurntOutSound != 0 ) + if ( BurntOut && BurntOutSound != 0 ) sound = BurntOutSound; @@ -101,7 +91,7 @@ namespace Server.Items public virtual void Ignite() { - if ( !m_BurntOut ) + if ( !BurntOut ) { PlayLitSound(); @@ -115,12 +105,12 @@ namespace Server.Items { m_Burning = false; - if ( m_BurntOut && BurntOutItemID != 0 ) + if ( BurntOut && BurntOutItemID != 0 ) ItemID = BurntOutItemID; else ItemID = UnlitItemID; - if ( m_BurntOut ) + if ( BurntOut ) m_Duration = TimeSpan.Zero; else if ( m_Duration != TimeSpan.Zero ) m_Duration = m_End - DateTime.UtcNow; @@ -132,7 +122,7 @@ namespace Server.Items public virtual void Burn() { - m_BurntOut = true; + BurntOut = true; Douse(); } @@ -153,10 +143,10 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if ( m_BurntOut ) + if ( BurntOut ) return; - if ( m_Protected && from.AccessLevel == AccessLevel.Player ) + if ( Protected && from.AccessLevel == AccessLevel.Player ) return; if ( !from.InRange( GetWorldLocation(), 2 ) ) @@ -178,10 +168,10 @@ namespace Server.Items base.Serialize( writer ); writer.Write( (int) 0 ); - writer.Write( m_BurntOut ); + writer.Write( BurntOut ); writer.Write( m_Burning ); writer.Write( m_Duration ); - writer.Write( m_Protected ); + writer.Write( Protected ); if ( m_Burning && m_Duration != TimeSpan.Zero ) writer.WriteDeltaTime( m_End ); @@ -197,10 +187,10 @@ namespace Server.Items { case 0: { - m_BurntOut = reader.ReadBool(); + BurntOut = reader.ReadBool(); m_Burning = reader.ReadBool(); m_Duration = reader.ReadTimeSpan(); - m_Protected = reader.ReadBool(); + Protected = reader.ReadBool(); if ( m_Burning && m_Duration != TimeSpan.Zero ) DoTimer( reader.ReadDeltaTime() - DateTime.UtcNow ); diff --git a/Scripts/Items/Lights/Candelabra.cs b/Scripts/Items/Lights/Candelabra.cs index ce25fda4f..9d2ee4e97 100644 --- a/Scripts/Items/Lights/Candelabra.cs +++ b/Scripts/Items/Lights/Candelabra.cs @@ -25,7 +25,7 @@ namespace Server.Items base.Serialize( writer ); writer.Write( (int) 1 ); - writer.Write( m_IsShipwreckedItem ); + writer.Write( IsShipwreckedItem ); } public override void Deserialize( GenericReader reader ) @@ -37,7 +37,7 @@ namespace Server.Items { case 1: { - m_IsShipwreckedItem = reader.ReadBool(); + IsShipwreckedItem = reader.ReadBool(); break; } } @@ -47,7 +47,7 @@ namespace Server.Items { base.AddNameProperties( list ); - if ( m_IsShipwreckedItem ) + if ( IsShipwreckedItem ) list.Add( 1041645 ); // recovered from a shipwreck } @@ -55,20 +55,15 @@ namespace Server.Items { base.OnSingleClick( from ); - if ( m_IsShipwreckedItem ) + if ( IsShipwreckedItem ) LabelTo( from, 1041645 ); //recovered from a shipwreck } #region IShipwreckedItem Members - private bool m_IsShipwreckedItem; - [CommandProperty( AccessLevel.GameMaster )] - public bool IsShipwreckedItem - { - get => m_IsShipwreckedItem; - set => m_IsShipwreckedItem = value; - } + public bool IsShipwreckedItem { get; set; } + #endregion } } diff --git a/Scripts/Items/Maps/MapItem.cs b/Scripts/Items/Maps/MapItem.cs index ecccf5b87..1e34e67ec 100644 --- a/Scripts/Items/Maps/MapItem.cs +++ b/Scripts/Items/Maps/MapItem.cs @@ -8,54 +8,31 @@ namespace Server.Items [Flippable( 0x14EB, 0x14EC )] public class MapItem : Item, ICraftable { - private Rectangle2D m_Bounds; - - private int m_Width, m_Height; - - private bool m_Protected; private bool m_Editable; - private List m_Pins = new List(); - private const int MaxUserPins = 50; [CommandProperty( AccessLevel.GameMaster )] - public bool Protected - { - get => m_Protected; - set => m_Protected = value; - } + public bool Protected { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Rectangle2D Bounds - { - get => m_Bounds; - set => m_Bounds = value; - } + public Rectangle2D Bounds { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int Width - { - get => m_Width; - set => m_Width = value; - } + public int Width { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int Height - { - get => m_Height; - set => m_Height = value; - } + public int Height { get; set; } - public List Pins => m_Pins; + public List Pins { get; } = new List(); [Constructible] public MapItem() : base( 0x14EC ) { Weight = 1.0; - m_Width = 200; - m_Height = 200; + Width = 200; + Height = 200; } public virtual void CraftInit( Mobile from ) @@ -99,8 +76,8 @@ namespace Server.Items from.Send( new MapDetails( this ) ); from.Send( new MapDisplay( this ) ); - for ( int i = 0; i < m_Pins.Count; ++i ) - from.Send( new MapAddPin( this, m_Pins[i] ) ); + for ( int i = 0; i < Pins.Count; ++i ) + from.Send( new MapAddPin( this, Pins[i] ) ); from.Send( new MapSetEditable( this, ValidateEdit( from ) ) ); } @@ -109,7 +86,7 @@ namespace Server.Items { if ( !ValidateEdit( from ) ) return; - if ( m_Pins.Count >= MaxUserPins ) + if ( Pins.Count >= MaxUserPins ) return; Validate( ref x, ref y ); @@ -137,7 +114,7 @@ namespace Server.Items { if ( !ValidateEdit( from ) ) return; - if ( m_Pins.Count >= MaxUserPins ) + if ( Pins.Count >= MaxUserPins ) return; Validate( ref x, ref y ); @@ -164,13 +141,13 @@ namespace Server.Items { if ( x < 0 ) x = 0; - else if ( x >= m_Width ) - x = m_Width - 1; + else if ( x >= Width ) + x = Width - 1; if ( y < 0 ) y = 0; - else if ( y >= m_Height ) - y = m_Height - 1; + else if ( y >= Height ) + y = Height - 1; } public virtual bool ValidateEdit( Mobile from ) @@ -184,7 +161,7 @@ namespace Server.Items return false; if ( from.AccessLevel >= AccessLevel.GameMaster ) return true; - if ( !Movable || m_Protected || !from.InRange( GetWorldLocation(), 2 ) ) + if ( !Movable || Protected || !from.InRange( GetWorldLocation(), 2 ) ) return false; object root = RootParent; @@ -197,14 +174,14 @@ namespace Server.Items public void ConvertToWorld( int x, int y, out int worldX, out int worldY ) { - worldX = ( ( m_Bounds.Width * x ) / Width ) + m_Bounds.X; - worldY = ( ( m_Bounds.Height * y ) / Height ) + m_Bounds.Y; + worldX = ( ( Bounds.Width * x ) / Width ) + Bounds.X; + worldY = ( ( Bounds.Height * y ) / Height ) + Bounds.Y; } public void ConvertToMap( int x, int y, out int mapX, out int mapY ) { - mapX = ( ( x - m_Bounds.X ) * Width ) / m_Bounds.Width; - mapY = ( ( y - m_Bounds.Y ) * Width ) / m_Bounds.Height; + mapX = ( ( x - Bounds.X ) * Width ) / Bounds.Width; + mapY = ( ( y - Bounds.Y ) * Width ) / Bounds.Height; } public virtual void AddWorldPin( int x, int y ) @@ -217,32 +194,32 @@ namespace Server.Items public virtual void AddPin( int x, int y ) { - m_Pins.Add( new Point2D( x, y ) ); + Pins.Add( new Point2D( x, y ) ); } public virtual void RemovePin( int index ) { - if ( index > 0 && index < m_Pins.Count ) - m_Pins.RemoveAt( index ); + if ( index > 0 && index < Pins.Count ) + Pins.RemoveAt( index ); } public virtual void InsertPin( int index, int x, int y ) { - if ( index < 0 || index >= m_Pins.Count ) - m_Pins.Add( new Point2D( x, y ) ); + if ( index < 0 || index >= Pins.Count ) + Pins.Add( new Point2D( x, y ) ); else - m_Pins.Insert( index, new Point2D( x, y ) ); + Pins.Insert( index, new Point2D( x, y ) ); } public virtual void ChangePin( int index, int x, int y ) { - if ( index >= 0 && index < m_Pins.Count ) - m_Pins[index] = new Point2D( x, y ); + if ( index >= 0 && index < Pins.Count ) + Pins[index] = new Point2D( x, y ); } public virtual void ClearPins() { - m_Pins.Clear(); + Pins.Clear(); } public override void Serialize( GenericWriter writer ) @@ -251,16 +228,16 @@ namespace Server.Items writer.Write( (int) 0 ); - writer.Write( m_Bounds ); + writer.Write( Bounds ); - writer.Write( m_Width ); - writer.Write( m_Height ); + writer.Write( Width ); + writer.Write( Height ); - writer.Write( m_Protected ); + writer.Write( Protected ); - writer.Write( m_Pins.Count ); - for ( int i = 0; i < m_Pins.Count; ++i ) - writer.Write( m_Pins[i] ); + writer.Write( Pins.Count ); + for ( int i = 0; i < Pins.Count; ++i ) + writer.Write( Pins[i] ); } public override void Deserialize( GenericReader reader ) @@ -273,16 +250,16 @@ namespace Server.Items { case 0: { - m_Bounds = reader.ReadRect2D(); + Bounds = reader.ReadRect2D(); - m_Width = reader.ReadInt(); - m_Height = reader.ReadInt(); + Width = reader.ReadInt(); + Height = reader.ReadInt(); - m_Protected = reader.ReadBool(); + Protected = reader.ReadBool(); int count = reader.ReadInt(); for ( int i = 0; i < count; i++ ) - m_Pins.Add( reader.ReadPoint2D() ); + Pins.Add( reader.ReadPoint2D() ); break; } diff --git a/Scripts/Items/Maps/PresetMap.cs b/Scripts/Items/Maps/PresetMap.cs index c2f66484e..a580c6c65 100644 --- a/Scripts/Items/Maps/PresetMap.cs +++ b/Scripts/Items/Maps/PresetMap.cs @@ -62,55 +62,53 @@ namespace Server.Items public class PresetMapEntry { - private int m_Name; - private int m_Width, m_Height; - private Rectangle2D m_Bounds; + public int Name { get; } - public int Name => m_Name; - public int Width => m_Width; - public int Height => m_Height; - public Rectangle2D Bounds => m_Bounds; + public int Width { get; } + + public int Height { get; } + + public Rectangle2D Bounds { get; } public PresetMapEntry( int name, int width, int height, int xLeft, int yTop, int xRight, int yBottom ) { - m_Name = name; - m_Width = width; - m_Height = height; - m_Bounds = new Rectangle2D( xLeft, yTop, xRight - xLeft, yBottom - yTop ); + Name = name; + Width = width; + Height = height; + Bounds = new Rectangle2D( xLeft, yTop, xRight - xLeft, yBottom - yTop ); } - private static PresetMapEntry[] m_Table = { - new PresetMapEntry( 1041189, 200, 200, 1092, 1396, 1736, 1924 ), // map of Britain - new PresetMapEntry( 1041203, 200, 200, 0256, 1792, 1736, 2560 ), // map of Britain to Skara Brae - new PresetMapEntry( 1041192, 200, 200, 1024, 1280, 2304, 3072 ), // map of Britain to Trinsic - new PresetMapEntry( 1041183, 200, 200, 2500, 1900, 3000, 2400 ), // map of Buccaneer's Den - new PresetMapEntry( 1041198, 200, 200, 2560, 1792, 3840, 2560 ), // map of Buccaneer's Den to Magincia - new PresetMapEntry( 1041194, 200, 200, 2560, 1792, 3840, 3072 ), // map of Buccaneer's Den to Ocllo - new PresetMapEntry( 1041181, 200, 200, 1088, 3572, 1528, 4056 ), // map of Jhelom - new PresetMapEntry( 1041186, 200, 200, 3530, 2022, 3818, 2298 ), // map of Magincia - new PresetMapEntry( 1041199, 200, 200, 3328, 1792, 3840, 2304 ), // map of Magincia to Ocllo - new PresetMapEntry( 1041182, 200, 200, 2360, 0356, 2706, 0702 ), // map of Minoc - new PresetMapEntry( 1041190, 200, 200, 0000, 0256, 2304, 3072 ), // map of Minoc to Yew - new PresetMapEntry( 1041191, 200, 200, 2467, 0572, 2878, 0746 ), // map of Minoc to Vesper - new PresetMapEntry( 1041188, 200, 200, 4156, 0808, 4732, 1528 ), // map of Moonglow - new PresetMapEntry( 1041201, 200, 200, 3328, 0768, 4864, 1536 ), // map of Moonglow to Nujelm - new PresetMapEntry( 1041185, 200, 200, 3446, 1030, 3832, 1424 ), // map of Nujelm - new PresetMapEntry( 1041197, 200, 200, 3328, 1024, 3840, 2304 ), // map of Nujelm to Magincia - new PresetMapEntry( 1041187, 200, 200, 3582, 2456, 3770, 2742 ), // map of Ocllo - new PresetMapEntry( 1041184, 200, 200, 2714, 3329, 3100, 3639 ), // map of Serpent's Hold - new PresetMapEntry( 1041200, 200, 200, 2560, 2560, 3840, 3840 ), // map of Serpent's Hold to Ocllo - new PresetMapEntry( 1041180, 200, 200, 0524, 2064, 0960, 2452 ), // map of Skara Brae - new PresetMapEntry( 1041204, 200, 200, 0000, 0000, 5199, 4095 ), // map of The World - new PresetMapEntry( 1041177, 200, 200, 1792, 2630, 2118, 2952 ), // map of Trinsic - new PresetMapEntry( 1041193, 200, 200, 1792, 1792, 3072, 3072 ), // map of Trinsic to Buccaneer's Den - new PresetMapEntry( 1041195, 200, 200, 0256, 1792, 2304, 4095 ), // map of Trinsic to Jhelom - new PresetMapEntry( 1041178, 200, 200, 2636, 0592, 3064, 1012 ), // map of Vesper - new PresetMapEntry( 1041196, 200, 200, 2636, 0592, 3840, 1536 ), // map of Vesper to Nujelm - new PresetMapEntry( 1041179, 200, 200, 0236, 0741, 0766, 1269 ), // map of Yew - new PresetMapEntry( 1041202, 200, 200, 0000, 0512, 1792, 2048 ) // map of Yew to Britain - }; - - public static PresetMapEntry[] Table => m_Table; + public static PresetMapEntry[] Table { get; } = + { + new PresetMapEntry( 1041189, 200, 200, 1092, 1396, 1736, 1924 ), // map of Britain + new PresetMapEntry( 1041203, 200, 200, 0256, 1792, 1736, 2560 ), // map of Britain to Skara Brae + new PresetMapEntry( 1041192, 200, 200, 1024, 1280, 2304, 3072 ), // map of Britain to Trinsic + new PresetMapEntry( 1041183, 200, 200, 2500, 1900, 3000, 2400 ), // map of Buccaneer's Den + new PresetMapEntry( 1041198, 200, 200, 2560, 1792, 3840, 2560 ), // map of Buccaneer's Den to Magincia + new PresetMapEntry( 1041194, 200, 200, 2560, 1792, 3840, 3072 ), // map of Buccaneer's Den to Ocllo + new PresetMapEntry( 1041181, 200, 200, 1088, 3572, 1528, 4056 ), // map of Jhelom + new PresetMapEntry( 1041186, 200, 200, 3530, 2022, 3818, 2298 ), // map of Magincia + new PresetMapEntry( 1041199, 200, 200, 3328, 1792, 3840, 2304 ), // map of Magincia to Ocllo + new PresetMapEntry( 1041182, 200, 200, 2360, 0356, 2706, 0702 ), // map of Minoc + new PresetMapEntry( 1041190, 200, 200, 0000, 0256, 2304, 3072 ), // map of Minoc to Yew + new PresetMapEntry( 1041191, 200, 200, 2467, 0572, 2878, 0746 ), // map of Minoc to Vesper + new PresetMapEntry( 1041188, 200, 200, 4156, 0808, 4732, 1528 ), // map of Moonglow + new PresetMapEntry( 1041201, 200, 200, 3328, 0768, 4864, 1536 ), // map of Moonglow to Nujelm + new PresetMapEntry( 1041185, 200, 200, 3446, 1030, 3832, 1424 ), // map of Nujelm + new PresetMapEntry( 1041197, 200, 200, 3328, 1024, 3840, 2304 ), // map of Nujelm to Magincia + new PresetMapEntry( 1041187, 200, 200, 3582, 2456, 3770, 2742 ), // map of Ocllo + new PresetMapEntry( 1041184, 200, 200, 2714, 3329, 3100, 3639 ), // map of Serpent's Hold + new PresetMapEntry( 1041200, 200, 200, 2560, 2560, 3840, 3840 ), // map of Serpent's Hold to Ocllo + new PresetMapEntry( 1041180, 200, 200, 0524, 2064, 0960, 2452 ), // map of Skara Brae + new PresetMapEntry( 1041204, 200, 200, 0000, 0000, 5199, 4095 ), // map of The World + new PresetMapEntry( 1041177, 200, 200, 1792, 2630, 2118, 2952 ), // map of Trinsic + new PresetMapEntry( 1041193, 200, 200, 1792, 1792, 3072, 3072 ), // map of Trinsic to Buccaneer's Den + new PresetMapEntry( 1041195, 200, 200, 0256, 1792, 2304, 4095 ), // map of Trinsic to Jhelom + new PresetMapEntry( 1041178, 200, 200, 2636, 0592, 3064, 1012 ), // map of Vesper + new PresetMapEntry( 1041196, 200, 200, 2636, 0592, 3840, 1536 ), // map of Vesper to Nujelm + new PresetMapEntry( 1041179, 200, 200, 0236, 0741, 0766, 1269 ), // map of Yew + new PresetMapEntry( 1041202, 200, 200, 0000, 0512, 1792, 2048 ) // map of Yew to Britain + }; } public enum PresetMapType diff --git a/Scripts/Items/Maps/TreasureMap.cs b/Scripts/Items/Maps/TreasureMap.cs index f41e18399..a3688c950 100644 --- a/Scripts/Items/Maps/TreasureMap.cs +++ b/Scripts/Items/Maps/TreasureMap.cs @@ -15,7 +15,6 @@ namespace Server.Items private Mobile m_CompletedBy; private Mobile m_Decoder; private Map m_Map; - private Point2D m_Location; [CommandProperty( AccessLevel.GameMaster )] public int Level{ get => m_Level; @@ -38,9 +37,7 @@ namespace Server.Items set{ m_Map = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] - public Point2D ChestLocation{ get => m_Location; - set => m_Location = value; - } + public Point2D ChestLocation { get; set; } private static Point2D[] m_Locations; private static Point2D[] m_HavenLocations; @@ -207,9 +204,9 @@ namespace Server.Items m_Map = map; if ( level == 0 ) - m_Location = GetRandomHavenLocation(); + ChestLocation = GetRandomHavenLocation(); else - m_Location = GetRandomLocation(); + ChestLocation = GetRandomLocation(); Width = 300; Height = 300; @@ -217,8 +214,8 @@ namespace Server.Items int width = 600; int height = 600; - int x1 = m_Location.X - Utility.RandomMinMax( width / 4, (width / 4) * 3 ); - int y1 = m_Location.Y - Utility.RandomMinMax( height / 4, (height / 4) * 3 ); + int x1 = ChestLocation.X - Utility.RandomMinMax( width / 4, (width / 4) * 3 ); + int y1 = ChestLocation.Y - Utility.RandomMinMax( height / 4, (height / 4) * 3 ); if ( x1 < 0 ) x1 = 0; @@ -241,7 +238,7 @@ namespace Server.Items Bounds = new Rectangle2D( x1, y1, width, height ); Protected = true; - AddWorldPin( m_Location.X, m_Location.Y ); + AddWorldPin( ChestLocation.X, ChestLocation.Y ); } public TreasureMap( Serial serial ) : base( serial ) @@ -360,7 +357,7 @@ namespace Server.Items else maxRange = 1; - Point2D loc = m_Map.m_Location; + Point2D loc = m_Map.ChestLocation; int x = loc.X, y = loc.Y; Point3D chest3D0 = new Point3D( loc, 0 ); @@ -858,7 +855,7 @@ namespace Server.Items writer.Write( m_Completed ); writer.Write( m_Decoder ); writer.Write( m_Map ); - writer.Write( m_Location ); + writer.Write( ChestLocation ); } public override void Deserialize( GenericReader reader ) @@ -881,7 +878,7 @@ namespace Server.Items m_Completed = reader.ReadBool(); m_Decoder = reader.ReadMobile(); m_Map = reader.ReadMap(); - m_Location = reader.ReadPoint2D(); + ChestLocation = reader.ReadPoint2D(); if ( version == 0 && m_Completed ) m_CompletedBy = m_Decoder; diff --git a/Scripts/Items/Misc/BulletinBoards.cs b/Scripts/Items/Misc/BulletinBoards.cs index ed0b03193..afbbc0eac 100644 --- a/Scripts/Items/Misc/BulletinBoards.cs +++ b/Scripts/Items/Misc/BulletinBoards.cs @@ -33,18 +33,12 @@ namespace Server.Items public abstract class BaseBulletinBoard : Item { - private string m_BoardName; - [CommandProperty( AccessLevel.GameMaster )] - public string BoardName - { - get => m_BoardName; - set => m_BoardName = value; - } + public string BoardName { get; set; } public BaseBulletinBoard( int itemID ) : base( itemID ) { - m_BoardName = "bulletin board"; + BoardName = "bulletin board"; Movable = false; } @@ -188,7 +182,7 @@ namespace Server.Items writer.Write( (int) 0 ); // version - writer.Write( (string) m_BoardName ); + writer.Write( (string) BoardName ); } public override void Deserialize( GenericReader reader ) @@ -201,7 +195,7 @@ namespace Server.Items { case 0: { - m_BoardName = reader.ReadString(); + BoardName = reader.ReadString(); break; } } @@ -315,19 +309,9 @@ namespace Server.Items public class BulletinMessage : Item { - private Mobile m_Poster; - private string m_Subject; - private DateTime m_Time, m_LastPostTime; - private BulletinMessage m_Thread; - private string m_PostedName; - private int m_PostedBody; - private int m_PostedHue; - private BulletinEquip[] m_PostedEquip; - private string[] m_Lines; - public string GetTimeAsString() { - return m_Time.ToString( "MMM dd, yyyy" ); + return Time.ToString( "MMM dd, yyyy" ); } public override bool CheckTarget( Mobile from, Targeting.Target targ, object targeted ) @@ -344,15 +328,15 @@ namespace Server.Items { Movable = false; - m_Poster = poster; - m_Subject = subject; - m_Time = DateTime.UtcNow; - m_LastPostTime = m_Time; - m_Thread = thread; - m_PostedName = m_Poster.Name; - m_PostedBody = m_Poster.Body; - m_PostedHue = m_Poster.Hue; - m_Lines = lines; + Poster = poster; + Subject = subject; + Time = DateTime.UtcNow; + LastPostTime = Time; + Thread = thread; + PostedName = Poster.Name; + PostedBody = Poster.Body; + PostedHue = Poster.Hue; + Lines = lines; List list = new List(); @@ -364,21 +348,28 @@ namespace Server.Items list.Add( new BulletinEquip( item.ItemID, item.Hue ) ); } - m_PostedEquip = list.ToArray(); + PostedEquip = list.ToArray(); } - public Mobile Poster => m_Poster; - public BulletinMessage Thread => m_Thread; - public string Subject => m_Subject; - public DateTime Time => m_Time; - public DateTime LastPostTime{ get => m_LastPostTime; - set => m_LastPostTime = value; - } - public string PostedName => m_PostedName; - public int PostedBody => m_PostedBody; - public int PostedHue => m_PostedHue; - public BulletinEquip[] PostedEquip => m_PostedEquip; - public string[] Lines => m_Lines; + public Mobile Poster { get; private set; } + + public BulletinMessage Thread { get; private set; } + + public string Subject { get; private set; } + + public DateTime Time { get; private set; } + + public DateTime LastPostTime { get; set; } + + public string PostedName { get; private set; } + + public int PostedBody { get; private set; } + + public int PostedHue { get; private set; } + + public BulletinEquip[] PostedEquip { get; private set; } + + public string[] Lines { get; private set; } public BulletinMessage( Serial serial ) : base( serial ) { @@ -390,28 +381,28 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (Mobile) m_Poster ); - writer.Write( (string) m_Subject ); - writer.Write( (DateTime) m_Time ); - writer.Write( (DateTime) m_LastPostTime ); - writer.Write( (bool) (m_Thread != null) ); - writer.Write( (Item) m_Thread ); - writer.Write( (string) m_PostedName ); - writer.Write( (int) m_PostedBody ); - writer.Write( (int) m_PostedHue ); + writer.Write( (Mobile) Poster ); + writer.Write( (string) Subject ); + writer.Write( (DateTime) Time ); + writer.Write( (DateTime) LastPostTime ); + writer.Write( (bool) (Thread != null) ); + writer.Write( (Item) Thread ); + writer.Write( (string) PostedName ); + writer.Write( (int) PostedBody ); + writer.Write( (int) PostedHue ); - writer.Write( (int) m_PostedEquip.Length ); + writer.Write( (int) PostedEquip.Length ); - for ( int i = 0; i < m_PostedEquip.Length; ++i ) + for ( int i = 0; i < PostedEquip.Length; ++i ) { - writer.Write( (int) m_PostedEquip[i].itemID ); - writer.Write( (int) m_PostedEquip[i].hue ); + writer.Write( (int) PostedEquip[i].itemID ); + writer.Write( (int) PostedEquip[i].hue ); } - writer.Write( (int) m_Lines.Length ); + writer.Write( (int) Lines.Length ); - for ( int i = 0; i < m_Lines.Length; ++i ) - writer.Write( (string) m_Lines[i] ); + for ( int i = 0; i < Lines.Length; ++i ) + writer.Write( (string) Lines[i] ); } public override void Deserialize( GenericReader reader ) @@ -425,30 +416,30 @@ namespace Server.Items case 1: case 0: { - m_Poster = reader.ReadMobile(); - m_Subject = reader.ReadString(); - m_Time = reader.ReadDateTime(); - m_LastPostTime = reader.ReadDateTime(); + Poster = reader.ReadMobile(); + Subject = reader.ReadString(); + Time = reader.ReadDateTime(); + LastPostTime = reader.ReadDateTime(); bool hasThread = reader.ReadBool(); - m_Thread = reader.ReadItem() as BulletinMessage; - m_PostedName = reader.ReadString(); - m_PostedBody = reader.ReadInt(); - m_PostedHue = reader.ReadInt(); + Thread = reader.ReadItem() as BulletinMessage; + PostedName = reader.ReadString(); + PostedBody = reader.ReadInt(); + PostedHue = reader.ReadInt(); - m_PostedEquip = new BulletinEquip[reader.ReadInt()]; + PostedEquip = new BulletinEquip[reader.ReadInt()]; - for ( int i = 0; i < m_PostedEquip.Length; ++i ) + for ( int i = 0; i < PostedEquip.Length; ++i ) { - m_PostedEquip[i].itemID = reader.ReadInt(); - m_PostedEquip[i].hue = reader.ReadInt(); + PostedEquip[i].itemID = reader.ReadInt(); + PostedEquip[i].hue = reader.ReadInt(); } - m_Lines = new string[reader.ReadInt()]; + Lines = new string[reader.ReadInt()]; - for ( int i = 0; i < m_Lines.Length; ++i ) - m_Lines[i] = reader.ReadString(); + for ( int i = 0; i < Lines.Length; ++i ) + Lines[i] = reader.ReadString(); - if ( hasThread && m_Thread == null ) + if ( hasThread && Thread == null ) Delete(); if ( version == 0 ) diff --git a/Scripts/Items/Misc/CommunicationCrystals.cs b/Scripts/Items/Misc/CommunicationCrystals.cs index 2cce3ff0f..345d452c7 100644 --- a/Scripts/Items/Misc/CommunicationCrystals.cs +++ b/Scripts/Items/Misc/CommunicationCrystals.cs @@ -29,16 +29,14 @@ namespace Server.Items return null; } - private Type m_Type; - private int m_Amount; + public Type Type { get; } - public Type Type => m_Type; - public int Amount => m_Amount; + public int Amount { get; } private CrystalRechargeInfo( Type type, int amount ) { - m_Type = type; - m_Amount = amount; + Type = type; + Amount = amount; } } @@ -49,7 +47,6 @@ namespace Server.Items public override int LabelNumber => 1060740; // communication crystal private int m_Charges; - private List m_Receivers; [CommandProperty( AccessLevel.GameMaster )] public bool Active @@ -73,7 +70,7 @@ namespace Server.Items } } - public List Receivers => m_Receivers; + public List Receivers { get; private set; } [Constructible] public BroadcastCrystal() : this( 2000 ) @@ -87,7 +84,7 @@ namespace Server.Items m_Charges = charges; - m_Receivers = new List(); + Receivers = new List(); } public BroadcastCrystal( Serial serial ) : base( serial ) @@ -274,7 +271,7 @@ namespace Server.Items writer.WriteEncodedInt( 0 ); // version writer.WriteEncodedInt( m_Charges ); - writer.WriteItemList( m_Receivers ); + writer.WriteItemList( Receivers ); } public override void Deserialize( GenericReader reader ) @@ -284,7 +281,7 @@ namespace Server.Items int version = reader.ReadEncodedInt(); m_Charges = reader.ReadEncodedInt(); - m_Receivers = reader.ReadStrongItemList(); + Receivers = reader.ReadStrongItemList(); } } diff --git a/Scripts/Items/Misc/Corpses/Corpse.cs b/Scripts/Items/Misc/Corpses/Corpse.cs index fa5bcf971..64bf1e63d 100644 --- a/Scripts/Items/Misc/Corpses/Corpse.cs +++ b/Scripts/Items/Misc/Corpses/Corpse.cs @@ -65,27 +65,12 @@ namespace Server.Items public class Corpse : Container, ICarvable { - private Mobile m_Owner; // Whos corpse is this? - private Mobile m_Killer; // Who killed the owner? private CorpseFlag m_Flags; // @see CorpseFlag - private List m_Looters; // Who's looted this corpse? - private List m_EquipItems; // List of dropped equipment when the owner died. Ingame, these items display /on/ the corpse, not just inside - private List m_RestoreEquip; // List of items equipped when the owner died. Includes insured and blessed items. - private List m_Aggressors; // Anyone from this list will be able to loot this corpse; we attacked them, or they attacked us when we were freely attackable - private string m_CorpseName; // Value of the CorpseNameAttribute attached to the owner when he died -or- null if the owner had no CorpseNameAttribute; use "the remains of ~name~" private IDevourer m_Devourer; // The creature that devoured this corpse // For notoriety: - private AccessLevel m_AccessLevel; // Which AccessLevel the owner had when he died - private Guild m_Guild; // Which Guild the owner was in when he died - private int m_Kills; // How many kills the owner had when he died - - private DateTime m_TimeOfDeath; // What time was this corpse created? - - private HairInfo m_Hair; // This contains the hair of the owner - private FacialHairInfo m_FacialHair; // This contains the facial hair of the owner // For Forensics Evaluation public string m_Forensicist; // Name of the first PlayerMobile who used Forensic Evaluation on the corpse @@ -102,7 +87,7 @@ namespace Server.Items if ( !Core.SE ) return false; - return ( DateTime.UtcNow < (m_TimeOfDeath + InstancedCorpseTime) ); + return ( DateTime.UtcNow < (TimeOfDeath + InstancedCorpseTime) ); } } @@ -113,10 +98,7 @@ namespace Server.Items private Mobile m_Mobile; private Item m_Item; - private bool m_Perpetual; //Needed for Rummaged stuff. CONTRARY to the Patchlog, cause a later FoF contradicts it. Verify on OSI. - public bool Perpetual { get => m_Perpetual; - set => m_Perpetual = value; - } + public bool Perpetual { get; set; } public InstancedItemInfo( Item i, Mobile m ) { @@ -159,7 +141,7 @@ namespace Server.Items private void AssignInstancedLoot() { - if ( m_Aggressors.Count == 0 || Items.Count == 0 ) + if ( Aggressors.Count == 0 || Items.Count == 0 ) return; if ( m_InstancedItems == null ) @@ -181,7 +163,7 @@ namespace Server.Items } } - List attackers = new List( m_Aggressors ); + List attackers = new List( Aggressors ); for ( int i = 1; i < attackers.Count -1; i++ ) //randomize { @@ -254,16 +236,13 @@ namespace Server.Items public override bool IsDecoContainer => false; [CommandProperty( AccessLevel.GameMaster )] - public DateTime TimeOfDeath - { - get => m_TimeOfDeath; - set => m_TimeOfDeath = value; - } + public DateTime TimeOfDeath { get; set; } public override bool DisplayWeight => false; - public HairInfo Hair => m_Hair; - public FacialHairInfo FacialHair => m_FacialHair; + public HairInfo Hair { get; } + + public FacialHairInfo FacialHair { get; } [CommandProperty( AccessLevel.GameMaster )] public bool IsBones => GetFlag( CorpseFlag.IsBones ); @@ -307,31 +286,23 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public AccessLevel AccessLevel => m_AccessLevel; + public AccessLevel AccessLevel { get; private set; } - public List Aggressors => m_Aggressors; + public List Aggressors { get; private set; } - public List Looters => m_Looters; + public List Looters { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public Mobile Killer => m_Killer; + public Mobile Killer { get; private set; } - public List EquipItems => m_EquipItems; + public List EquipItems { get; private set; } - public List RestoreEquip - { - get => m_RestoreEquip; - set => m_RestoreEquip = value; - } + public List RestoreEquip { get; set; } - public Guild Guild => m_Guild; + public Guild Guild { get; } [CommandProperty( AccessLevel.GameMaster )] - public int Kills - { - get => m_Kills; - set => m_Kills = value; - } + public int Kills { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool Criminal @@ -341,7 +312,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public Mobile Owner => m_Owner; + public Mobile Owner { get; private set; } public void TurnToBones() { @@ -488,27 +459,27 @@ namespace Server.Items Direction = owner.Direction; Name = owner.Name; - m_Owner = owner; + Owner = owner; m_CorpseName = GetCorpseName( owner ); - m_TimeOfDeath = DateTime.UtcNow; + TimeOfDeath = DateTime.UtcNow; - m_AccessLevel = owner.AccessLevel; - m_Guild = owner.Guild as Guild; - m_Kills = owner.Kills; + AccessLevel = owner.AccessLevel; + Guild = owner.Guild as Guild; + Kills = owner.Kills; SetFlag( CorpseFlag.Criminal, owner.Criminal ); - m_Hair = hair; - m_FacialHair = facialhair; + Hair = hair; + FacialHair = facialhair; // This corpse does not turn to bones if: the owner is not a player SetFlag( CorpseFlag.NoBones, !owner.Player ); - m_Looters = new List(); - m_EquipItems = equipItems; + Looters = new List(); + EquipItems = equipItems; - m_Aggressors = new List( owner.Aggressors.Count + owner.Aggressed.Count ); + Aggressors = new List( owner.Aggressors.Count + owner.Aggressed.Count ); //bool addToAggressors = !( owner is BaseCreature ); bool isBaseCreature = (owner is BaseCreature); @@ -521,12 +492,12 @@ namespace Server.Items if ( (DateTime.UtcNow - info.LastCombatTime) < lastTime ) { - m_Killer = info.Attacker; + Killer = info.Attacker; lastTime = (DateTime.UtcNow - info.LastCombatTime); } if ( !isBaseCreature && !info.CriminalAggression ) - m_Aggressors.Add( info.Attacker ); + Aggressors.Add( info.Attacker ); } for ( int i = 0; i < owner.Aggressed.Count; ++i ) @@ -535,12 +506,12 @@ namespace Server.Items if ( (DateTime.UtcNow - info.LastCombatTime) < lastTime ) { - m_Killer = info.Defender; + Killer = info.Defender; lastTime = (DateTime.UtcNow - info.LastCombatTime); } if ( !isBaseCreature ) - m_Aggressors.Add( info.Defender ); + Aggressors.Add( info.Defender ); } if ( isBaseCreature ) @@ -549,7 +520,7 @@ namespace Server.Items Mobile master = bc.GetMaster(); if ( master != null ) - m_Aggressors.Add( master ); + Aggressors.Add( master ); List rights = BaseCreature.GetLootingRights( bc.DamageEntries, bc.HitsMax ); for ( int i = 0; i < rights.Count; ++i ) @@ -557,7 +528,7 @@ namespace Server.Items DamageStore ds = rights[i]; if ( ds.m_HasRight ) - m_Aggressors.Add( ds.m_Mobile ); + Aggressors.Add( ds.m_Mobile ); } } @@ -586,19 +557,19 @@ namespace Server.Items writer.Write( (int) 12 ); // version - if ( m_RestoreEquip == null ) + if ( RestoreEquip == null ) { writer.Write( false ); } else { writer.Write( true ); - writer.Write( m_RestoreEquip ); + writer.Write( RestoreEquip ); } writer.Write( (int)m_Flags ); - writer.WriteDeltaTime( m_TimeOfDeath ); + writer.WriteDeltaTime( TimeOfDeath ); List> list = ( m_RestoreTable == null ? null : new List>( m_RestoreTable ) ); int count = list?.Count ?? 0; @@ -629,20 +600,20 @@ namespace Server.Items if ( m_DecayTimer != null ) writer.WriteDeltaTime( m_DecayTime ); - writer.Write( m_Looters ); - writer.Write( m_Killer ); + writer.Write( Looters ); + writer.Write( Killer ); - writer.Write( m_Aggressors ); + writer.Write( Aggressors ); - writer.Write( m_Owner ); + writer.Write( Owner ); writer.Write( (string) m_CorpseName ); - writer.Write( (int) m_AccessLevel ); - writer.Write( (Guild) m_Guild ); - writer.Write( (int) m_Kills ); + writer.Write( (int) AccessLevel ); + writer.Write( (Guild) Guild ); + writer.Write( (int) Kills ); - writer.Write( m_EquipItems ); + writer.Write( EquipItems ); } public override void Deserialize( GenericReader reader ) @@ -656,7 +627,7 @@ namespace Server.Items case 12: { if ( reader.ReadBool() ) - m_RestoreEquip = reader.ReadStrongItemList(); + RestoreEquip = reader.ReadStrongItemList(); goto case 11; } @@ -665,7 +636,7 @@ namespace Server.Items // Version 11, we move all bools to a CorpseFlag m_Flags = (CorpseFlag)reader.ReadInt(); - m_TimeOfDeath = reader.ReadDeltaTime(); + TimeOfDeath = reader.ReadDeltaTime(); int count = reader.ReadInt(); @@ -682,24 +653,24 @@ namespace Server.Items if ( reader.ReadBool() ) BeginDecay( reader.ReadDeltaTime() - DateTime.UtcNow ); - m_Looters = reader.ReadStrongMobileList(); - m_Killer = reader.ReadMobile(); + Looters = reader.ReadStrongMobileList(); + Killer = reader.ReadMobile(); - m_Aggressors = reader.ReadStrongMobileList(); - m_Owner = reader.ReadMobile(); + Aggressors = reader.ReadStrongMobileList(); + Owner = reader.ReadMobile(); m_CorpseName = reader.ReadString(); - m_AccessLevel = (AccessLevel)reader.ReadInt(); + AccessLevel = (AccessLevel)reader.ReadInt(); reader.ReadInt(); // guild reserve - m_Kills = reader.ReadInt(); + Kills = reader.ReadInt(); - m_EquipItems = reader.ReadStrongItemList(); + EquipItems = reader.ReadStrongItemList(); break; } case 10: { - m_TimeOfDeath = reader.ReadDeltaTime(); + TimeOfDeath = reader.ReadDeltaTime(); goto case 9; } @@ -734,8 +705,8 @@ namespace Server.Items } case 6: { - m_Looters = reader.ReadStrongMobileList(); - m_Killer = reader.ReadMobile(); + Looters = reader.ReadStrongMobileList(); + Killer = reader.ReadMobile(); goto case 5; } @@ -747,13 +718,13 @@ namespace Server.Items } case 4: { - m_Aggressors = reader.ReadStrongMobileList(); + Aggressors = reader.ReadStrongMobileList(); goto case 3; } case 3: { - m_Owner = reader.ReadMobile(); + Owner = reader.ReadMobile(); goto case 2; } @@ -772,23 +743,23 @@ namespace Server.Items case 0: { if ( version < 10 ) - m_TimeOfDeath = DateTime.UtcNow; + TimeOfDeath = DateTime.UtcNow; if ( version < 7 ) BeginDecay( m_DefaultDecayTime ); if ( version < 6 ) - m_Looters = new List(); + Looters = new List(); if ( version < 4 ) - m_Aggressors = new List(); + Aggressors = new List(); - m_AccessLevel = (AccessLevel)reader.ReadInt(); + AccessLevel = (AccessLevel)reader.ReadInt(); reader.ReadInt(); // guild reserve - m_Kills = reader.ReadInt(); + Kills = reader.ReadInt(); SetFlag( CorpseFlag.Criminal, reader.ReadBool() ); - m_EquipItems = reader.ReadStrongItemList(); + EquipItems = reader.ReadStrongItemList(); break; } @@ -797,10 +768,10 @@ namespace Server.Items public bool DevourCorpse() { - if ( Devoured || Deleted || m_Killer == null || m_Killer.Deleted || !m_Killer.Alive || !(m_Killer is IDevourer) || m_Owner == null || m_Owner.Deleted ) + if ( Devoured || Deleted || Killer == null || Killer.Deleted || !Killer.Alive || !(Killer is IDevourer) || Owner == null || Owner.Deleted ) return false; - m_Devourer = (IDevourer)m_Killer; // Set the devourer the killer + m_Devourer = (IDevourer)Killer; // Set the devourer the killer return m_Devourer.Devour( this ); // Devour the corpse if it hasn't } @@ -825,14 +796,14 @@ namespace Server.Items public bool IsCriminalAction( Mobile from ) { - if ( from == m_Owner || from.AccessLevel >= AccessLevel.GameMaster ) + if ( from == Owner || from.AccessLevel >= AccessLevel.GameMaster ) return false; - Party p = Party.Get( m_Owner ); + Party p = Party.Get( Owner ); if ( p != null && p.Contains( from ) ) { - PartyMemberInfo pmi = p[m_Owner]; + PartyMemberInfo pmi = p[Owner]; if ( pmi != null && pmi.CanLoot ) return false; @@ -870,8 +841,8 @@ namespace Server.Items if ( item != this && IsCriminalAction( from ) ) from.CriminalAction( true ); - if ( !m_Looters.Contains( from ) ) - m_Looters.Add( from ); + if ( !Looters.Contains( from ) ) + Looters.Add( from ); if ( m_InstancedItems != null && m_InstancedItems.ContainsKey( item ) ) m_InstancedItems.Remove( item ); @@ -881,14 +852,14 @@ namespace Server.Items { base.OnItemLifted( from, item ); - if ( item != this && from != m_Owner ) + if ( item != this && from != Owner ) from.RevealingAction(); if ( item != this && IsCriminalAction( from ) ) from.CriminalAction( true ); - if ( !m_Looters.Contains( from ) ) - m_Looters.Add( from ); + if ( !Looters.Contains( from ) ) + Looters.Add( from ); if ( m_InstancedItems != null && m_InstancedItems.ContainsKey( item ) ) m_InstancedItems.Remove( item ); @@ -911,7 +882,7 @@ namespace Server.Items { base.GetContextMenuEntries( from, list ); - if ( Core.AOS && m_Owner == from && from.Alive ) + if ( Core.AOS && Owner == from && from.Alive ) list.Add( new OpenCorpseEntry() ); } @@ -964,7 +935,7 @@ namespace Server.Items { if ( !CanLoot( from, item ) ) { - if ( m_Owner == null || !m_Owner.Player ) + if ( Owner == null || !Owner.Player ) from.SendLocalizedMessage( 1005035 ); // You did not earn the right to loot this creature! else from.SendLocalizedMessage( 1010049 ); // You may not loot this corpse. @@ -974,7 +945,7 @@ namespace Server.Items if ( IsCriminalAction( from ) ) { - if ( m_Owner == null || !m_Owner.Player ) + if ( Owner == null || !Owner.Player ) from.SendLocalizedMessage( 1005036 ); // Looting this monster corpse will be a criminal act! else from.SendLocalizedMessage( 1005038 ); // Looting this corpse will be a criminal act! @@ -988,7 +959,7 @@ namespace Server.Items if ( from.AccessLevel > AccessLevel.Player || from.InRange( GetWorldLocation(), 2 ) ) { #region Self Looting - if ( checkSelfLoot && from == m_Owner && !GetFlag( CorpseFlag.SelfLooted ) && Items.Count != 0 ) + if ( checkSelfLoot && from == Owner && !GetFlag( CorpseFlag.SelfLooted ) && Items.Count != 0 ) { if ( from.FindItemOnLayer( Layer.OuterTorso ) is DeathRobe robe ) { @@ -1003,7 +974,7 @@ namespace Server.Items Container pack = from.Backpack; - if ( m_RestoreEquip != null && pack != null ) + if ( RestoreEquip != null && pack != null ) { List packItems = new List( pack.Items ); // Only items in the top-level pack are re-equipped @@ -1011,7 +982,7 @@ namespace Server.Items { Item packItem = packItems[i]; - if ( m_RestoreEquip.Contains( packItem ) && packItem.Movable ) + if ( RestoreEquip.Contains( packItem ) && packItem.Movable ) from.EquipItem( packItem ); } } @@ -1033,7 +1004,7 @@ namespace Server.Items item.Location = loc; pack.AddItem( item ); - if ( m_RestoreEquip != null && m_RestoreEquip.Contains( item ) ) + if ( RestoreEquip != null && RestoreEquip.Contains( item ) ) from.EquipItem( item ); } else @@ -1189,7 +1160,7 @@ namespace Server.Items { if ( IsCriminalAction( from ) && Map != null && (Map.Rules & MapRules.HarmfulRestrictions) != 0 ) { - if ( m_Owner == null || !m_Owner.Player ) + if ( Owner == null || !Owner.Player ) from.SendLocalizedMessage( 1005035 ); // You did not earn the right to loot this creature! else from.SendLocalizedMessage( 1010049 ); // You may not loot this corpse. @@ -1197,7 +1168,7 @@ namespace Server.Items return; } - Mobile dead = m_Owner; + Mobile dead = Owner; if ( GetFlag( CorpseFlag.Carved ) || dead == null ) { diff --git a/Scripts/Items/Misc/Corpses/CorpseNameAttribute.cs b/Scripts/Items/Misc/Corpses/CorpseNameAttribute.cs index 1d317a4f9..f8ea5fcf6 100644 --- a/Scripts/Items/Misc/Corpses/CorpseNameAttribute.cs +++ b/Scripts/Items/Misc/Corpses/CorpseNameAttribute.cs @@ -5,13 +5,11 @@ namespace Server [AttributeUsage( AttributeTargets.Class )] public class CorpseNameAttribute : Attribute { - private string m_Name; - - public string Name => m_Name; + public string Name { get; } public CorpseNameAttribute( string name ) { - m_Name = name; + Name = name; } } } \ No newline at end of file diff --git a/Scripts/Items/Misc/DeceitBrazier.cs b/Scripts/Items/Misc/DeceitBrazier.cs index 5ffa2397e..ce42943c3 100644 --- a/Scripts/Items/Misc/DeceitBrazier.cs +++ b/Scripts/Items/Misc/DeceitBrazier.cs @@ -6,84 +6,76 @@ namespace Server.Items { public class DeceitBrazier : Item { - private static Type[] m_Creatures = { - #region Animals - typeof( FireSteed ), //Set the tents up people! - #endregion + public static Type[] Creatures { get; } = + { + #region Animals + typeof( FireSteed ), //Set the tents up people! + #endregion - #region Undead - typeof( Skeleton ), typeof( SkeletalKnight ), typeof( SkeletalMage ), typeof( Mummy ), - typeof( BoneKnight ), typeof( Lich ), typeof( LichLord ), typeof( BoneMagi ), - typeof( Wraith ), typeof( Shade ), typeof( Spectre ), typeof( Zombie ), - typeof( RottingCorpse ), typeof( Ghoul ), - #endregion + #region Undead + typeof( Skeleton ), typeof( SkeletalKnight ), typeof( SkeletalMage ), typeof( Mummy ), + typeof( BoneKnight ), typeof( Lich ), typeof( LichLord ), typeof( BoneMagi ), + typeof( Wraith ), typeof( Shade ), typeof( Spectre ), typeof( Zombie ), + typeof( RottingCorpse ), typeof( Ghoul ), + #endregion - #region Demons - typeof( Balron ), typeof( Daemon ), typeof( Imp ), typeof( GreaterMongbat ), - typeof( Mongbat ), typeof( IceFiend ), typeof( Gargoyle ), typeof( StoneGargoyle ), - typeof( FireGargoyle ), typeof( HordeMinion ), - #endregion + #region Demons + typeof( Balron ), typeof( Daemon ), typeof( Imp ), typeof( GreaterMongbat ), + typeof( Mongbat ), typeof( IceFiend ), typeof( Gargoyle ), typeof( StoneGargoyle ), + typeof( FireGargoyle ), typeof( HordeMinion ), + #endregion - #region Gazers - typeof( Gazer ), typeof( ElderGazer ), typeof( GazerLarva ), - #endregion + #region Gazers + typeof( Gazer ), typeof( ElderGazer ), typeof( GazerLarva ), + #endregion - #region Uncategorized - typeof( Harpy ), typeof( StoneHarpy ), typeof( HeadlessOne ), typeof( HellHound ), - typeof( HellCat ), typeof( Phoenix ), typeof( LavaLizard ), typeof( SandVortex ), - typeof( ShadowWisp ), typeof( SwampTentacle ), typeof( PredatorHellCat ), typeof( Wisp ), - #endregion + #region Uncategorized + typeof( Harpy ), typeof( StoneHarpy ), typeof( HeadlessOne ), typeof( HellHound ), + typeof( HellCat ), typeof( Phoenix ), typeof( LavaLizard ), typeof( SandVortex ), + typeof( ShadowWisp ), typeof( SwampTentacle ), typeof( PredatorHellCat ), typeof( Wisp ), + #endregion - #region Arachnid - typeof( GiantSpider ), typeof( DreadSpider ), typeof( FrostSpider ), typeof( Scorpion ), - #endregion + #region Arachnid + typeof( GiantSpider ), typeof( DreadSpider ), typeof( FrostSpider ), typeof( Scorpion ), + #endregion - #region Repond - typeof( ArcticOgreLord ), typeof( Cyclops ), typeof( Ettin ), typeof( EvilMage ), - typeof( FrostTroll ), typeof( Ogre ), typeof( OgreLord ), typeof( Orc ), - typeof( OrcishLord ), typeof( OrcishMage ), typeof( OrcBrute ), typeof( Ratman ), - typeof( RatmanMage ), typeof( OrcCaptain ), typeof( Troll ), typeof( Titan ), - typeof( EvilMageLord ), typeof( OrcBomber ), typeof( RatmanArcher ), - #endregion + #region Repond + typeof( ArcticOgreLord ), typeof( Cyclops ), typeof( Ettin ), typeof( EvilMage ), + typeof( FrostTroll ), typeof( Ogre ), typeof( OgreLord ), typeof( Orc ), + typeof( OrcishLord ), typeof( OrcishMage ), typeof( OrcBrute ), typeof( Ratman ), + typeof( RatmanMage ), typeof( OrcCaptain ), typeof( Troll ), typeof( Titan ), + typeof( EvilMageLord ), typeof( OrcBomber ), typeof( RatmanArcher ), + #endregion - #region Reptilian - typeof( Dragon ), typeof( Drake ), typeof( Snake ), typeof( GreaterDragon ), - typeof( IceSerpent ), typeof( GiantSerpent ), typeof( IceSnake ), typeof( LavaSerpent ), - typeof( Lizardman ), typeof( Wyvern ), typeof( WhiteWyrm ), - typeof( ShadowWyrm ), typeof( SilverSerpent ), typeof( LavaSnake ), - #endregion + #region Reptilian + typeof( Dragon ), typeof( Drake ), typeof( Snake ), typeof( GreaterDragon ), + typeof( IceSerpent ), typeof( GiantSerpent ), typeof( IceSnake ), typeof( LavaSerpent ), + typeof( Lizardman ), typeof( Wyvern ), typeof( WhiteWyrm ), + typeof( ShadowWyrm ), typeof( SilverSerpent ), typeof( LavaSnake ), + #endregion - #region Elementals - typeof( EarthElemental ), typeof( PoisonElemental ), typeof( FireElemental ), typeof( SnowElemental ), - typeof( IceElemental ), typeof( AcidElemental ), typeof( WaterElemental ), typeof( Efreet ), - typeof( AirElemental ), typeof( Golem ), - #endregion + #region Elementals + typeof( EarthElemental ), typeof( PoisonElemental ), typeof( FireElemental ), typeof( SnowElemental ), + typeof( IceElemental ), typeof( AcidElemental ), typeof( WaterElemental ), typeof( Efreet ), + typeof( AirElemental ), typeof( Golem ), + #endregion - #region Random Critters - typeof( SewerRat ), typeof( GiantRat ), typeof( DireWolf ), typeof( TimberWolf ), - typeof( Cougar ), typeof( Alligator ) - #endregion - }; - - public static Type[] Creatures => m_Creatures; + #region Random Critters + typeof( SewerRat ), typeof( GiantRat ), typeof( DireWolf ), typeof( TimberWolf ), + typeof( Cougar ), typeof( Alligator ) + #endregion + }; private Timer m_Timer; - private DateTime m_NextSpawn; - private int m_SpawnRange; - private TimeSpan m_NextSpawnDelay; [CommandProperty( AccessLevel.GameMaster )] - public DateTime NextSpawn => m_NextSpawn; + public DateTime NextSpawn { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int SpawnRange { get => m_SpawnRange; - set => m_SpawnRange = value; - } + public int SpawnRange { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan NextSpawnDelay { get => m_NextSpawnDelay; - set => m_NextSpawnDelay = value; - } + public TimeSpan NextSpawnDelay { get; set; } public override int LabelNumber => 1023633; // Brazier @@ -92,9 +84,9 @@ namespace Server.Items { Movable = false; Light = LightType.Circle225; - m_NextSpawn = DateTime.UtcNow; - m_NextSpawnDelay = TimeSpan.FromMinutes( 15.0 ); - m_SpawnRange = 5; + NextSpawn = DateTime.UtcNow; + NextSpawnDelay = TimeSpan.FromMinutes( 15.0 ); + SpawnRange = 5; } public DeceitBrazier( Serial serial ) : base( serial ) @@ -107,8 +99,8 @@ namespace Server.Items writer.Write( (int)0 ); // version - writer.Write( (int)m_SpawnRange ); - writer.Write( m_NextSpawnDelay ); + writer.Write( (int)SpawnRange ); + writer.Write( NextSpawnDelay ); } public override void Deserialize( GenericReader reader ) @@ -119,11 +111,11 @@ namespace Server.Items if ( version >= 0 ) { - m_SpawnRange = reader.ReadInt(); - m_NextSpawnDelay = reader.ReadTimeSpan(); + SpawnRange = reader.ReadInt(); + NextSpawnDelay = reader.ReadTimeSpan(); } - m_NextSpawn = DateTime.UtcNow; + NextSpawn = DateTime.UtcNow; } public virtual void HeedWarning() @@ -135,7 +127,7 @@ namespace Server.Items public override void OnMovement( Mobile m, Point3D oldLocation ) { - if ( m_NextSpawn < DateTime.UtcNow ) // means we haven't spawned anything if the next spawn is below + if ( NextSpawn < DateTime.UtcNow ) // means we haven't spawned anything if the next spawn is below { if ( Utility.InRange( m.Location, Location, 1 ) && !Utility.InRange( oldLocation, Location, 1 ) && m.Player && !(m.AccessLevel > AccessLevel.Player || m.Hidden) ) { @@ -157,8 +149,8 @@ namespace Server.Items // Try 10 times to find a Spawnable location. for( int i = 0; i < 10; i++ ) { - int x = Location.X + (Utility.Random( (m_SpawnRange * 2) + 1 ) - m_SpawnRange); - int y = Location.Y + (Utility.Random( (m_SpawnRange * 2) + 1 ) - m_SpawnRange); + int x = Location.X + (Utility.Random( (SpawnRange * 2) + 1 ) - SpawnRange); + int y = Location.Y + (Utility.Random( (SpawnRange * 2) + 1 ) - SpawnRange); int z = Map.GetAverageZ( x, y ); if ( Map.CanSpawnMobile( new Point2D( x, y ), Z ) ) @@ -182,10 +174,10 @@ namespace Server.Items { try { - if ( m_NextSpawn < DateTime.UtcNow ) + if ( NextSpawn < DateTime.UtcNow ) { Map map = Map; - BaseCreature bc = (BaseCreature)Activator.CreateInstance( m_Creatures[Utility.Random( m_Creatures.Length )] ); + BaseCreature bc = (BaseCreature)Activator.CreateInstance( Creatures[Utility.Random( Creatures.Length )] ); if ( bc != null ) { @@ -196,7 +188,7 @@ namespace Server.Items Timer.DelayCall( TimeSpan.FromSeconds( 1 ), delegate { bc.Home = Location; - bc.RangeHome = m_SpawnRange; + bc.RangeHome = SpawnRange; bc.FightMode = FightMode.Closest; bc.MoveToWorld( spawnLoc, map ); @@ -206,7 +198,7 @@ namespace Server.Items bc.ForceReacquire(); } ); - m_NextSpawn = DateTime.UtcNow + m_NextSpawnDelay; + NextSpawn = DateTime.UtcNow + NextSpawnDelay; } } else diff --git a/Scripts/Items/Misc/EffectController.cs b/Scripts/Items/Misc/EffectController.cs index aa6135b3d..57ee575b7 100644 --- a/Scripts/Items/Misc/EffectController.cs +++ b/Scripts/Items/Misc/EffectController.cs @@ -21,69 +21,26 @@ namespace Server.Items public class EffectController : Item { - private TimeSpan m_EffectDelay; - - private ECEffectType m_EffectType; - private EffectTriggerType m_TriggerType; - private IEntity m_Source; private IEntity m_Target; - private TimeSpan m_TriggerDelay; - private EffectController m_Trigger; - - private int m_ItemID; - private int m_Hue; - private int m_RenderMode; - - private int m_Speed; - private int m_Duration; - - private bool m_FixedDirection; - private bool m_Explodes; - - private int m_ParticleEffect; - private int m_ExplodeParticleEffect; - private int m_ExplodeSound; - - private EffectLayer m_EffectLayer; - private int m_Unknown; - - private TimeSpan m_SoundDelay; - private int m_SoundID; - private bool m_PlaySoundAtTrigger; - - private int m_TriggerRange; + [CommandProperty( AccessLevel.GameMaster )] + public ECEffectType EffectType { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public ECEffectType EffectType{ get => m_EffectType; - set => m_EffectType = value; - } + public EffectTriggerType TriggerType { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public EffectTriggerType TriggerType{ get => m_TriggerType; - set => m_TriggerType = value; - } + public EffectLayer EffectLayer { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public EffectLayer EffectLayer{ get => m_EffectLayer; - set => m_EffectLayer = value; - } + public TimeSpan EffectDelay { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan EffectDelay{ get => m_EffectDelay; - set => m_EffectDelay = value; - } + public TimeSpan TriggerDelay { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan TriggerDelay{ get => m_TriggerDelay; - set => m_TriggerDelay = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan SoundDelay{ get => m_SoundDelay; - set => m_SoundDelay = value; - } + public TimeSpan SoundDelay { get; set; } [CommandProperty( AccessLevel.GameMaster )] @@ -117,81 +74,51 @@ namespace Server.Items [CommandProperty( AccessLevel.GameMaster )] - public EffectController Sequence{ get => m_Trigger; - set => m_Trigger = value; - } + public EffectController Sequence { get; set; } [CommandProperty( AccessLevel.GameMaster )] - private bool FixedDirection{ get => m_FixedDirection; - set => m_FixedDirection = value; - } + private bool FixedDirection { get; set; } [CommandProperty( AccessLevel.GameMaster )] - private bool Explodes{ get => m_Explodes; - set => m_Explodes = value; - } + private bool Explodes { get; set; } [CommandProperty( AccessLevel.GameMaster )] - private bool PlaySoundAtTrigger{ get => m_PlaySoundAtTrigger; - set => m_PlaySoundAtTrigger = value; - } + private bool PlaySoundAtTrigger { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int EffectItemID{ get => m_ItemID; - set => m_ItemID = value; - } + public int EffectItemID { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int EffectHue{ get => m_Hue; - set => m_Hue = value; - } + public int EffectHue { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int RenderMode{ get => m_RenderMode; - set => m_RenderMode = value; - } + public int RenderMode { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int Speed{ get => m_Speed; - set => m_Speed = value; - } + public int Speed { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int Duration{ get => m_Duration; - set => m_Duration = value; - } + public int Duration { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int ParticleEffect{ get => m_ParticleEffect; - set => m_ParticleEffect = value; - } + public int ParticleEffect { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int ExplodeParticleEffect{ get => m_ExplodeParticleEffect; - set => m_ExplodeParticleEffect = value; - } + public int ExplodeParticleEffect { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int ExplodeSound{ get => m_ExplodeSound; - set => m_ExplodeSound = value; - } + public int ExplodeSound { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int Unknown{ get => m_Unknown; - set => m_Unknown = value; - } + public int Unknown { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int SoundID{ get => m_SoundID; - set => m_SoundID = value; - } + public int SoundID { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int TriggerRange{ get => m_TriggerRange; - set => m_TriggerRange = value; - } + public int TriggerRange { get; set; } public override string DefaultName => "Effect Controller"; @@ -200,21 +127,21 @@ namespace Server.Items { Movable = false; Visible = false; - m_TriggerType = EffectTriggerType.Sequenced; - m_EffectLayer = (EffectLayer)255; + TriggerType = EffectTriggerType.Sequenced; + EffectLayer = (EffectLayer)255; } public override void OnDoubleClick( Mobile from ) { - if ( m_TriggerType == EffectTriggerType.DoubleClick ) + if ( TriggerType == EffectTriggerType.DoubleClick ) DoEffect( from ); } - public override bool HandlesOnMovement => ( m_TriggerType == EffectTriggerType.InRange ); + public override bool HandlesOnMovement => ( TriggerType == EffectTriggerType.InRange ); public override void OnMovement( Mobile m, Point3D oldLocation ) { - if ( m.Location != oldLocation && m_TriggerType == EffectTriggerType.InRange && Utility.InRange( GetWorldLocation(), m.Location, m_TriggerRange ) && !Utility.InRange( GetWorldLocation(), oldLocation, m_TriggerRange ) ) + if ( m.Location != oldLocation && TriggerType == EffectTriggerType.InRange && Utility.InRange( GetWorldLocation(), m.Location, TriggerRange ) && !Utility.InRange( GetWorldLocation(), oldLocation, TriggerRange ) ) DoEffect( m ); } @@ -228,9 +155,9 @@ namespace Server.Items writer.Write( (int) 0 ); // version - writer.Write( m_EffectDelay ); - writer.Write( m_TriggerDelay ); - writer.Write( m_SoundDelay ); + writer.Write( EffectDelay ); + writer.Write( TriggerDelay ); + writer.Write( SoundDelay ); if ( m_Source is Item srcItem ) writer.Write( srcItem ); @@ -242,27 +169,27 @@ namespace Server.Items else writer.Write( m_Target as Mobile ); - writer.Write( m_Trigger as Item ); + writer.Write( Sequence as Item ); - writer.Write( m_FixedDirection ); - writer.Write( m_Explodes ); - writer.Write( m_PlaySoundAtTrigger ); + writer.Write( FixedDirection ); + writer.Write( Explodes ); + writer.Write( PlaySoundAtTrigger ); - writer.WriteEncodedInt( (int) m_EffectType ); - writer.WriteEncodedInt( (int) m_EffectLayer ); - writer.WriteEncodedInt( (int) m_TriggerType ); + writer.WriteEncodedInt( (int) EffectType ); + writer.WriteEncodedInt( (int) EffectLayer ); + writer.WriteEncodedInt( (int) TriggerType ); - writer.WriteEncodedInt( m_ItemID ); - writer.WriteEncodedInt( m_Hue ); - writer.WriteEncodedInt( m_RenderMode ); - writer.WriteEncodedInt( m_Speed ); - writer.WriteEncodedInt( m_Duration ); - writer.WriteEncodedInt( m_ParticleEffect ); - writer.WriteEncodedInt( m_ExplodeParticleEffect ); - writer.WriteEncodedInt( m_ExplodeSound ); - writer.WriteEncodedInt( m_Unknown ); - writer.WriteEncodedInt( m_SoundID ); - writer.WriteEncodedInt( m_TriggerRange ); + writer.WriteEncodedInt( EffectItemID ); + writer.WriteEncodedInt( EffectHue ); + writer.WriteEncodedInt( RenderMode ); + writer.WriteEncodedInt( Speed ); + writer.WriteEncodedInt( Duration ); + writer.WriteEncodedInt( ParticleEffect ); + writer.WriteEncodedInt( ExplodeParticleEffect ); + writer.WriteEncodedInt( ExplodeSound ); + writer.WriteEncodedInt( Unknown ); + writer.WriteEncodedInt( SoundID ); + writer.WriteEncodedInt( TriggerRange ); } private IEntity ReadEntity( GenericReader reader ) @@ -280,33 +207,33 @@ namespace Server.Items { case 0: { - m_EffectDelay = reader.ReadTimeSpan(); - m_TriggerDelay = reader.ReadTimeSpan(); - m_SoundDelay = reader.ReadTimeSpan(); + EffectDelay = reader.ReadTimeSpan(); + TriggerDelay = reader.ReadTimeSpan(); + SoundDelay = reader.ReadTimeSpan(); m_Source = ReadEntity( reader ); m_Target = ReadEntity( reader ); - m_Trigger = reader.ReadItem() as EffectController; + Sequence = reader.ReadItem() as EffectController; - m_FixedDirection = reader.ReadBool(); - m_Explodes = reader.ReadBool(); - m_PlaySoundAtTrigger = reader.ReadBool(); + FixedDirection = reader.ReadBool(); + Explodes = reader.ReadBool(); + PlaySoundAtTrigger = reader.ReadBool(); - m_EffectType = (ECEffectType)reader.ReadEncodedInt(); - m_EffectLayer = (EffectLayer)reader.ReadEncodedInt(); - m_TriggerType = (EffectTriggerType)reader.ReadEncodedInt(); + EffectType = (ECEffectType)reader.ReadEncodedInt(); + EffectLayer = (EffectLayer)reader.ReadEncodedInt(); + TriggerType = (EffectTriggerType)reader.ReadEncodedInt(); - m_ItemID = reader.ReadEncodedInt(); - m_Hue = reader.ReadEncodedInt(); - m_RenderMode = reader.ReadEncodedInt(); - m_Speed = reader.ReadEncodedInt(); - m_Duration = reader.ReadEncodedInt(); - m_ParticleEffect = reader.ReadEncodedInt(); - m_ExplodeParticleEffect = reader.ReadEncodedInt(); - m_ExplodeSound = reader.ReadEncodedInt(); - m_Unknown = reader.ReadEncodedInt(); - m_SoundID = reader.ReadEncodedInt(); - m_TriggerRange = reader.ReadEncodedInt(); + EffectItemID = reader.ReadEncodedInt(); + EffectHue = reader.ReadEncodedInt(); + RenderMode = reader.ReadEncodedInt(); + Speed = reader.ReadEncodedInt(); + Duration = reader.ReadEncodedInt(); + ParticleEffect = reader.ReadEncodedInt(); + ExplodeParticleEffect = reader.ReadEncodedInt(); + ExplodeSound = reader.ReadEncodedInt(); + Unknown = reader.ReadEncodedInt(); + SoundID = reader.ReadEncodedInt(); + TriggerRange = reader.ReadEncodedInt(); break; } @@ -317,31 +244,31 @@ namespace Server.Items { IEntity ent = null; - if (m_PlaySoundAtTrigger) + if (PlaySoundAtTrigger) ent = trigger; if (ent == null) ent = this; - Effects.PlaySound((ent as Item)?.GetWorldLocation() ?? ent.Location, ent.Map, m_SoundID); + Effects.PlaySound((ent as Item)?.GetWorldLocation() ?? ent.Location, ent.Map, SoundID); } public void DoEffect(IEntity trigger) { - if (Deleted || m_TriggerType == EffectTriggerType.None) + if (Deleted || TriggerType == EffectTriggerType.None) return; if (trigger is Mobile mobile && mobile.Hidden && mobile.AccessLevel > AccessLevel.Player) return; - if (m_SoundID > 0) - Timer.DelayCall(m_SoundDelay, PlaySound, trigger); + if (SoundID > 0) + Timer.DelayCall(SoundDelay, PlaySound, trigger); - if (m_Trigger != null) - Timer.DelayCall(m_TriggerDelay, m_Trigger.DoEffect, trigger); + if (Sequence != null) + Timer.DelayCall(TriggerDelay, Sequence.DoEffect, trigger); - if (m_EffectType != ECEffectType.None) - Timer.DelayCall(m_EffectDelay, InternalDoEffect, trigger); + if (EffectType != ECEffectType.None) + Timer.DelayCall(EffectDelay, InternalDoEffect, trigger); } public void InternalDoEffect(IEntity trigger) @@ -354,16 +281,16 @@ namespace Server.Items if (to == null) to = trigger; - switch (m_EffectType) + switch (EffectType) { case ECEffectType.Lightning: { - Effects.SendBoltEffect(from, false, m_Hue); + Effects.SendBoltEffect(from, false, EffectHue); break; } case ECEffectType.Location: { - Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), m_ItemID, m_Speed, m_Duration, m_Hue, m_RenderMode, m_ParticleEffect, m_Unknown); + Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), EffectItemID, Speed, Duration, EffectHue, RenderMode, ParticleEffect, Unknown); break; } case ECEffectType.Moving: @@ -374,12 +301,12 @@ namespace Server.Items if (to == this) to = EffectItem.Create(to.Location, to.Map, EffectItem.DefaultDuration); - Effects.SendMovingParticles(from, to, m_ItemID, m_Speed, m_Duration, m_FixedDirection, m_Explodes, m_Hue, m_RenderMode, m_ParticleEffect, m_ExplodeParticleEffect, m_ExplodeSound, m_EffectLayer, m_Unknown); + Effects.SendMovingParticles(from, to, EffectItemID, Speed, Duration, FixedDirection, Explodes, EffectHue, RenderMode, ParticleEffect, ExplodeParticleEffect, ExplodeSound, EffectLayer, Unknown); break; } case ECEffectType.Target: { - Effects.SendTargetParticles(from, m_ItemID, m_Speed, m_Duration, m_Hue, m_RenderMode, m_ParticleEffect, m_EffectLayer, m_Unknown); + Effects.SendTargetParticles(from, EffectItemID, Speed, Duration, EffectHue, RenderMode, ParticleEffect, EffectLayer, Unknown); break; } } diff --git a/Scripts/Items/Misc/Firebomb.cs b/Scripts/Items/Misc/Firebomb.cs index e56f230af..8d6b4174e 100644 --- a/Scripts/Items/Misc/Firebomb.cs +++ b/Scripts/Items/Misc/Firebomb.cs @@ -191,19 +191,17 @@ namespace Server.Items private class ThrowTarget : Target { - private Firebomb m_Bomb; - - public Firebomb Bomb => m_Bomb; + public Firebomb Bomb { get; } public ThrowTarget( Firebomb bomb ) : base( 12, true, TargetFlags.None ) { - m_Bomb = bomb; + Bomb = bomb; } protected override void OnTarget( Mobile from, object targeted ) { - m_Bomb.OnFirebombTarget( from, targeted ); + Bomb.OnFirebombTarget( from, targeted ); } } } diff --git a/Scripts/Items/Misc/FlippableAddonAttribute.cs b/Scripts/Items/Misc/FlippableAddonAttribute.cs index 85b4beca2..f39fc93be 100644 --- a/Scripts/Items/Misc/FlippableAddonAttribute.cs +++ b/Scripts/Items/Misc/FlippableAddonAttribute.cs @@ -13,18 +13,16 @@ namespace Server.Items typeof( Mobile ), typeof( Direction ) }; - private Direction[] m_Directions; - - public Direction[] Directions => m_Directions; + public Direction[] Directions { get; } public FlippableAddonAttribute( params Direction[] directions ) { - m_Directions = directions; + Directions = directions; } public virtual void Flip( Mobile from, Item addon ) { - if ( m_Directions != null && m_Directions.Length > 1 ) + if ( Directions != null && Directions.Length > 1 ) { try { @@ -34,21 +32,21 @@ namespace Server.Items { int index = 0; - for ( int i = 0; i < m_Directions.Length; i++ ) + for ( int i = 0; i < Directions.Length; i++ ) { - if ( addon.Direction == m_Directions[ i ] ) + if ( addon.Direction == Directions[ i ] ) { index = i + 1; break; } } - if ( index >= m_Directions.Length ) + if ( index >= Directions.Length ) index = 0; ClearComponents( addon ); - flipMethod.Invoke( addon, new object[ 2 ] { from, m_Directions[ index ] } ); + flipMethod.Invoke( addon, new object[ 2 ] { from, Directions[ index ] } ); BaseHouse house = null; AddonFitResult result = AddonFitResult.Valid; @@ -65,13 +63,13 @@ namespace Server.Items if ( result != AddonFitResult.Valid ) { if ( index == 0 ) - index = m_Directions.Length - 1; + index = Directions.Length - 1; else index -= 1; ClearComponents( addon ); - flipMethod.Invoke( addon, new object[ 2 ] { from, m_Directions[ index ] } ); + flipMethod.Invoke( addon, new object[ 2 ] { from, Directions[ index ] } ); if ( result == AddonFitResult.Blocked ) from.SendLocalizedMessage( 500269 ); // You cannot build that there. @@ -85,7 +83,7 @@ namespace Server.Items from.SendLocalizedMessage( 500268 ); // This object needs to be mounted on something. } - addon.Direction = m_Directions[ index ]; + addon.Direction = Directions[ index ]; } } catch diff --git a/Scripts/Items/Misc/FlippableAttribute.cs b/Scripts/Items/Misc/FlippableAttribute.cs index 72810ad19..d28c5caef 100644 --- a/Scripts/Items/Misc/FlippableAttribute.cs +++ b/Scripts/Items/Misc/FlippableAttribute.cs @@ -61,9 +61,7 @@ namespace Server.Items [AttributeUsage( AttributeTargets.Class )] public class FlippableAttribute : Attribute { - private int[] m_ItemIDs; - - public int[] ItemIDs => m_ItemIDs; + public int[] ItemIDs { get; } public FlippableAttribute() : this( null ) @@ -72,12 +70,12 @@ namespace Server.Items public FlippableAttribute( params int[] itemIDs ) { - m_ItemIDs = itemIDs; + ItemIDs = itemIDs; } public virtual void Flip( Item item ) { - if ( m_ItemIDs == null ) + if ( ItemIDs == null ) { try { @@ -93,19 +91,19 @@ namespace Server.Items else { int index = 0; - for( int i = 0; i < m_ItemIDs.Length; i++ ) + for( int i = 0; i < ItemIDs.Length; i++ ) { - if ( item.ItemID == m_ItemIDs[i] ) + if ( item.ItemID == ItemIDs[i] ) { index = i + 1; break; } } - if ( index > m_ItemIDs.Length - 1 ) + if ( index > ItemIDs.Length - 1 ) index = 0; - item.ItemID = m_ItemIDs[index]; + item.ItemID = ItemIDs[index]; } } } diff --git a/Scripts/Items/Misc/HairDye.cs b/Scripts/Items/Misc/HairDye.cs index ffb1bacc7..ad68162cb 100644 --- a/Scripts/Items/Misc/HairDye.cs +++ b/Scripts/Items/Misc/HairDye.cs @@ -51,21 +51,17 @@ namespace Server.Items private class HairDyeEntry { - private string m_Name; - private int m_HueStart; - private int m_HueCount; + public string Name { get; } - public string Name => m_Name; + public int HueStart { get; } - public int HueStart => m_HueStart; - - public int HueCount => m_HueCount; + public int HueCount { get; } public HairDyeEntry( string name, int hueStart, int hueCount ) { - m_Name = name; - m_HueStart = hueStart; - m_HueCount = hueCount; + Name = name; + HueStart = hueStart; + HueCount = hueCount; } } diff --git a/Scripts/Items/Misc/Key.cs b/Scripts/Items/Misc/Key.cs index 9aaa06e7a..36d395536 100644 --- a/Scripts/Items/Misc/Key.cs +++ b/Scripts/Items/Misc/Key.cs @@ -23,8 +23,6 @@ namespace Server.Items { private string m_Description; private uint m_KeyVal; - private Item m_Link; - private int m_MaxRange; public static uint RandomValue() { @@ -101,12 +99,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public int MaxRange - { - get => m_MaxRange; - - set => m_MaxRange = value; - } + public int MaxRange { get; set; } [CommandProperty( AccessLevel.GameMaster )] public uint KeyValue @@ -121,12 +114,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public Item Link - { - get => m_Link; - - set => m_Link = value; - } + public Item Link { get; set; } public override void Serialize( GenericWriter writer ) { @@ -134,9 +122,9 @@ namespace Server.Items writer.Write( (int) 2 ); // version - writer.Write( (int) m_MaxRange ); + writer.Write( (int) MaxRange ); - writer.Write( (Item) m_Link ); + writer.Write( (Item) Link ); writer.Write( (string) m_Description ); writer.Write( (uint) m_KeyVal ); @@ -152,20 +140,20 @@ namespace Server.Items { case 2: { - m_MaxRange = reader.ReadInt(); + MaxRange = reader.ReadInt(); goto case 1; } case 1: { - m_Link = reader.ReadItem(); + Link = reader.ReadItem(); goto case 0; } case 0: { - if ( version < 2 || m_MaxRange == 0 ) - m_MaxRange = 3; + if ( version < 2 || MaxRange == 0 ) + MaxRange = 3; m_Description = reader.ReadString(); @@ -201,9 +189,9 @@ namespace Server.Items { Weight = 1.0; - m_MaxRange = 3; + MaxRange = 3; m_KeyVal = LockVal; - m_Link = link; + Link = link; } public Key( Serial serial ) : base( serial ) diff --git a/Scripts/Items/Misc/KeyRing.cs b/Scripts/Items/Misc/KeyRing.cs index 1c624573f..f919bb55d 100644 --- a/Scripts/Items/Misc/KeyRing.cs +++ b/Scripts/Items/Misc/KeyRing.cs @@ -7,16 +7,14 @@ namespace Server.Items { public static readonly int MaxKeys = 20; - private List m_Keys; - - public List Keys => m_Keys; + public List Keys { get; private set; } [Constructible] public KeyRing() : base( 0x1011 ) { Weight = 1.0; // They seem to have no weight on OSI ?! - m_Keys = new List(); + Keys = new List(); } public override bool OnDragDrop( Mobile from, Item dropped ) @@ -98,18 +96,18 @@ namespace Server.Items { base.OnDelete(); - foreach ( Key key in m_Keys ) + foreach ( Key key in Keys ) { key.Delete(); } - m_Keys.Clear(); + Keys.Clear(); } public void Add( Key key ) { key.Internalize(); - m_Keys.Add( key ); + Keys.Add( key ); UpdateItemID(); } @@ -119,14 +117,14 @@ namespace Server.Items if ( !(Parent is Container cont) ) return; - for ( int i = m_Keys.Count - 1; i >= 0; i-- ) + for ( int i = Keys.Count - 1; i >= 0; i-- ) { - Key key = m_Keys[i]; + Key key = Keys[i]; if ( !key.Deleted && !cont.TryDropItem( from, key, true ) ) break; - m_Keys.RemoveAt( i ); + Keys.RemoveAt( i ); } UpdateItemID(); @@ -134,14 +132,14 @@ namespace Server.Items public void RemoveKeys( uint keyValue ) { - for ( int i = m_Keys.Count - 1; i >= 0; i-- ) + for ( int i = Keys.Count - 1; i >= 0; i-- ) { - Key key = m_Keys[i]; + Key key = Keys[i]; if ( key.KeyValue == keyValue ) { key.Delete(); - m_Keys.RemoveAt( i ); + Keys.RemoveAt( i ); } } @@ -150,7 +148,7 @@ namespace Server.Items public bool ContainsKey( uint keyValue ) { - foreach ( Key key in m_Keys ) + foreach ( Key key in Keys ) { if ( key.KeyValue == keyValue ) return true; @@ -181,7 +179,7 @@ namespace Server.Items writer.WriteEncodedInt( 0 ); // version - writer.WriteItemList( m_Keys ); + writer.WriteItemList( Keys ); } public override void Deserialize( GenericReader reader ) @@ -190,7 +188,7 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - m_Keys = reader.ReadStrongItemList(); + Keys = reader.ReadStrongItemList(); } } } diff --git a/Scripts/Items/Misc/MorphItem.cs b/Scripts/Items/Misc/MorphItem.cs index 8f2e70bc3..dc8296076 100644 --- a/Scripts/Items/Misc/MorphItem.cs +++ b/Scripts/Items/Misc/MorphItem.cs @@ -4,24 +4,14 @@ namespace Server.Items { public class MorphItem : Item { - private int m_InactiveItemID; - private int m_ActiveItemID; private int m_InRange; private int m_OutRange; [CommandProperty( AccessLevel.GameMaster )] - public int InactiveItemID - { - get => m_InactiveItemID; - set => m_InactiveItemID = value; - } + public int InactiveItemID { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int ActiveItemID - { - get => m_ActiveItemID; - set => m_ActiveItemID = value; - } + public int ActiveItemID { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int InRange @@ -109,8 +99,8 @@ namespace Server.Items writer.Write( (int) m_OutRange ); - writer.Write( (int) m_InactiveItemID ); - writer.Write( (int) m_ActiveItemID ); + writer.Write( (int) InactiveItemID ); + writer.Write( (int) ActiveItemID ); writer.Write( (int) m_InRange ); } @@ -129,8 +119,8 @@ namespace Server.Items } case 0: { - m_InactiveItemID = reader.ReadInt(); - m_ActiveItemID = reader.ReadInt(); + InactiveItemID = reader.ReadInt(); + ActiveItemID = reader.ReadInt(); m_InRange = reader.ReadInt(); if ( version < 1 ) diff --git a/Scripts/Items/Misc/PlayerBulletinBoards.cs b/Scripts/Items/Misc/PlayerBulletinBoards.cs index f65abea3c..97dcdd38c 100644 --- a/Scripts/Items/Misc/PlayerBulletinBoards.cs +++ b/Scripts/Items/Misc/PlayerBulletinBoards.cs @@ -69,37 +69,20 @@ namespace Server.Items public abstract class BasePlayerBB : Item, ISecurable { - private PlayerBBMessage m_Greeting; - private List m_Messages; - private string m_Title; - private SecureLevel m_Level; + public List Messages { get; private set; } - public List Messages => m_Messages; - - public PlayerBBMessage Greeting - { - get => m_Greeting; - set => m_Greeting = value; - } + public PlayerBBMessage Greeting { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public string Title - { - get => m_Title; - set => m_Title = value; - } + public string Title { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public SecureLevel Level - { - get => m_Level; - set => m_Level = value; - } + public SecureLevel Level { get; set; } public BasePlayerBB( int itemID ) : base( itemID ) { - m_Messages = new List(); - m_Level = SecureLevel.Anyone; + Messages = new List(); + Level = SecureLevel.Anyone; } public BasePlayerBB( Serial serial ) : base( serial ) @@ -118,24 +101,24 @@ namespace Server.Items writer.Write( (int) 1 ); - writer.Write( (int) m_Level ); + writer.Write( (int) Level ); - writer.Write( m_Title ); + writer.Write( Title ); - if ( m_Greeting != null ) + if ( Greeting != null ) { writer.Write( true ); - m_Greeting.Serialize( writer ); + Greeting.Serialize( writer ); } else { writer.Write( false ); } - writer.WriteEncodedInt( m_Messages.Count ); + writer.WriteEncodedInt( Messages.Count ); - for ( int i = 0; i < m_Messages.Count; ++i ) - m_Messages[i].Serialize( writer ); + for ( int i = 0; i < Messages.Count; ++i ) + Messages[i].Serialize( writer ); } public override void Deserialize( GenericReader reader ) @@ -148,25 +131,25 @@ namespace Server.Items { case 1: { - m_Level = (SecureLevel)reader.ReadInt(); + Level = (SecureLevel)reader.ReadInt(); goto case 0; } case 0: { if ( version < 1 ) - m_Level = SecureLevel.Anyone; + Level = SecureLevel.Anyone; - m_Title = reader.ReadString(); + Title = reader.ReadString(); if ( reader.ReadBool() ) - m_Greeting = new PlayerBBMessage( reader ); + Greeting = new PlayerBBMessage( reader ); int count = reader.ReadEncodedInt(); - m_Messages = new List( count ); + Messages = new List( count ); for ( int i = 0; i < count; ++i ) - m_Messages.Add( new PlayerBBMessage( reader ) ); + Messages.Add( new PlayerBBMessage( reader ) ); break; } @@ -327,36 +310,20 @@ namespace Server.Items public class PlayerBBMessage { - private DateTime m_Time; - private Mobile m_Poster; - private string m_Message; + [CommandProperty( AccessLevel.GameMaster )] + public DateTime Time { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime Time - { - get => m_Time; - set => m_Time = value; - } + public Mobile Poster { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Mobile Poster - { - get => m_Poster; - set => m_Poster = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public string Message - { - get => m_Message; - set => m_Message = value; - } + public string Message { get; set; } public PlayerBBMessage( DateTime time, Mobile poster, string message ) { - m_Time = time; - m_Poster = poster; - m_Message = message; + Time = time; + Poster = poster; + Message = message; } public PlayerBBMessage( GenericReader reader ) @@ -367,9 +334,9 @@ namespace Server.Items { case 0: { - m_Time = reader.ReadDateTime(); - m_Poster = reader.ReadMobile(); - m_Message = reader.ReadString(); + Time = reader.ReadDateTime(); + Poster = reader.ReadMobile(); + Message = reader.ReadString(); break; } } @@ -379,9 +346,9 @@ namespace Server.Items { writer.WriteEncodedInt( 0 ); // version - writer.Write( m_Time ); - writer.Write( m_Poster ); - writer.Write( m_Message ); + writer.Write( Time ); + writer.Write( Poster ); + writer.Write( Message ); } } diff --git a/Scripts/Items/Misc/PowerGenerator.cs b/Scripts/Items/Misc/PowerGenerator.cs index 4519c918b..2728f609b 100644 --- a/Scripts/Items/Misc/PowerGenerator.cs +++ b/Scripts/Items/Misc/PowerGenerator.cs @@ -59,25 +59,18 @@ namespace Server.Items public struct Node { - private int m_X; - private int m_Y; + public int X { get; set; } - public int X{ get => m_X; - set => m_X = value; - } - public int Y{ get => m_Y; - set => m_Y = value; - } + public int Y { get; set; } public Node( int x, int y ) { - m_X = x; - m_Y = y; + X = x; + Y = y; } } private int m_SideLength; - private Node[] m_Path; [CommandProperty( AccessLevel.GameMaster )] public int SideLength @@ -98,7 +91,7 @@ namespace Server.Items } } - public Node[] Path => m_Path; + public Node[] Path { get; private set; } public override string DefaultName => "a control panel"; @@ -180,11 +173,11 @@ namespace Server.Items } } - m_Path = new Node[stackSize]; + Path = new Node[stackSize]; for ( int i = 0; i < stackSize; i++ ) { - m_Path[i] = stack[i]; + Path[i] = stack[i]; } if ( m_User != null ) @@ -544,10 +537,10 @@ namespace Server.Items writer.WriteEncodedInt( (int) m_SideLength ); - writer.WriteEncodedInt( (int) m_Path.Length ); - for ( int i = 0; i < m_Path.Length; i++ ) + writer.WriteEncodedInt( (int) Path.Length ); + for ( int i = 0; i < Path.Length; i++ ) { - Node cur = m_Path[i]; + Node cur = Path[i]; writer.WriteEncodedInt( cur.X ); writer.WriteEncodedInt( cur.Y ); @@ -562,10 +555,10 @@ namespace Server.Items m_SideLength = reader.ReadEncodedInt(); - m_Path = new Node[reader.ReadEncodedInt()]; - for ( int i = 0; i < m_Path.Length; i++ ) + Path = new Node[reader.ReadEncodedInt()]; + for ( int i = 0; i < Path.Length; i++ ) { - m_Path[i] = new Node( reader.ReadEncodedInt(), reader.ReadEncodedInt() ); + Path[i] = new Node( reader.ReadEncodedInt(), reader.ReadEncodedInt() ); } } } diff --git a/Scripts/Items/Misc/PublicMoongate.cs b/Scripts/Items/Misc/PublicMoongate.cs index dffe0aa59..4d13a381e 100644 --- a/Scripts/Items/Misc/PublicMoongate.cs +++ b/Scripts/Items/Misc/PublicMoongate.cs @@ -152,40 +152,33 @@ namespace Server.Items public class PMEntry { - private Point3D m_Location; - private int m_Number; + public Point3D Location { get; } - public Point3D Location => m_Location; - - public int Number => m_Number; + public int Number { get; } public PMEntry( Point3D loc, int number ) { - m_Location = loc; - m_Number = number; + Location = loc; + Number = number; } } public class PMList { - private int m_Number, m_SelNumber; - private Map m_Map; - private PMEntry[] m_Entries; + public int Number { get; } - public int Number => m_Number; + public int SelNumber { get; } - public int SelNumber => m_SelNumber; + public Map Map { get; } - public Map Map => m_Map; - - public PMEntry[] Entries => m_Entries; + public PMEntry[] Entries { get; } public PMList( int number, int selNumber, Map map, PMEntry[] entries ) { - m_Number = number; - m_SelNumber = selNumber; - m_Map = map; - m_Entries = entries; + Number = number; + SelNumber = selNumber; + Map = map; + Entries = entries; } public static readonly PMList Trammel = diff --git a/Scripts/Items/Misc/SerpentPillar.cs b/Scripts/Items/Misc/SerpentPillar.cs index d6692158b..5590c3f50 100644 --- a/Scripts/Items/Misc/SerpentPillar.cs +++ b/Scripts/Items/Misc/SerpentPillar.cs @@ -4,30 +4,14 @@ namespace Server.Items { public class SerpentPillar : Item { - private bool m_Active; - private string m_Word; - private Rectangle2D m_Destination; + [CommandProperty( AccessLevel.GameMaster )] + public bool Active { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool Active - { - get => m_Active; - set => m_Active = value; - } + public string Word { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public string Word - { - get => m_Word; - set => m_Word = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public Rectangle2D Destination - { - get => m_Destination; - set => m_Destination = value; - } + public Rectangle2D Destination { get; set; } [Constructible] public SerpentPillar() : this( null, new Rectangle2D(), false ) @@ -42,9 +26,9 @@ namespace Server.Items { Movable = false; - m_Active = active; - m_Word = word; - m_Destination = destination; + Active = active; + Word = word; + Destination = destination; } public override bool HandlesOnSpeech => true; @@ -103,9 +87,9 @@ namespace Server.Items writer.WriteEncodedInt( 0 ); // version - writer.Write( (bool) m_Active ); - writer.Write( (string) m_Word ); - writer.Write( (Rectangle2D) m_Destination ); + writer.Write( (bool) Active ); + writer.Write( (string) Word ); + writer.Write( (Rectangle2D) Destination ); } public override void Deserialize( GenericReader reader ) @@ -114,9 +98,9 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - m_Active = reader.ReadBool(); - m_Word = reader.ReadString(); - m_Destination = reader.ReadRect2D(); + Active = reader.ReadBool(); + Word = reader.ReadString(); + Destination = reader.ReadRect2D(); } } } diff --git a/Scripts/Items/Misc/SpecialBeardDye.cs b/Scripts/Items/Misc/SpecialBeardDye.cs index 50d35afa9..f367a6450 100644 --- a/Scripts/Items/Misc/SpecialBeardDye.cs +++ b/Scripts/Items/Misc/SpecialBeardDye.cs @@ -52,21 +52,17 @@ namespace Server.Items private class SpecialBeardDyeEntry { - private string m_Name; - private int m_HueStart; - private int m_HueCount; + public string Name { get; } - public string Name => m_Name; + public int HueStart { get; } - public int HueStart => m_HueStart; - - public int HueCount => m_HueCount; + public int HueCount { get; } public SpecialBeardDyeEntry( string name, int hueStart, int hueCount ) { - m_Name = name; - m_HueStart = hueStart; - m_HueCount = hueCount; + Name = name; + HueStart = hueStart; + HueCount = hueCount; } } diff --git a/Scripts/Items/Misc/SpecialHairDye.cs b/Scripts/Items/Misc/SpecialHairDye.cs index c86b5f5b4..bf9d1f091 100644 --- a/Scripts/Items/Misc/SpecialHairDye.cs +++ b/Scripts/Items/Misc/SpecialHairDye.cs @@ -53,21 +53,17 @@ namespace Server.Items private class SpecialHairDyeEntry { - private string m_Name; - private int m_HueStart; - private int m_HueCount; + public string Name { get; } - public string Name => m_Name; + public int HueStart { get; } - public int HueStart => m_HueStart; - - public int HueCount => m_HueCount; + public int HueCount { get; } public SpecialHairDyeEntry( string name, int hueStart, int hueCount ) { - m_Name = name; - m_HueStart = hueStart; - m_HueCount = hueCount; + Name = name; + HueStart = hueStart; + HueCount = hueCount; } } diff --git a/Scripts/Items/Misc/Teleporter.cs b/Scripts/Items/Misc/Teleporter.cs index c5c3cdf2e..a8c0541e3 100644 --- a/Scripts/Items/Misc/Teleporter.cs +++ b/Scripts/Items/Misc/Teleporter.cs @@ -565,46 +565,20 @@ namespace Server.Items m_Table.Remove(from); } - private int m_StartNumber; - private string m_StartMessage; - private int m_ProgressNumber; - private string m_ProgressMessage; - private bool m_ShowTimeRemaining; + [CommandProperty(AccessLevel.GameMaster)] + public int StartNumber { get; set; } [CommandProperty(AccessLevel.GameMaster)] - public int StartNumber - { - get => m_StartNumber; - set => m_StartNumber = value; - } + public string StartMessage { get; set; } [CommandProperty(AccessLevel.GameMaster)] - public string StartMessage - { - get => m_StartMessage; - set => m_StartMessage = value; - } + public int ProgressNumber { get; set; } [CommandProperty(AccessLevel.GameMaster)] - public int ProgressNumber - { - get => m_ProgressNumber; - set => m_ProgressNumber = value; - } + public string ProgressMessage { get; set; } [CommandProperty(AccessLevel.GameMaster)] - public string ProgressMessage - { - get => m_ProgressMessage; - set => m_ProgressMessage = value; - } - - [CommandProperty(AccessLevel.GameMaster)] - public bool ShowTimeRemaining - { - get => m_ShowTimeRemaining; - set => m_ShowTimeRemaining = value; - } + public bool ShowTimeRemaining { get; set; } [Constructible] public WaitTeleporter() @@ -642,12 +616,12 @@ namespace Server.Items { if (m.BeginAction(this)) { - if (m_ProgressMessage != null) - m.SendMessage(m_ProgressMessage); - else if (m_ProgressNumber != 0) - m.SendLocalizedMessage(m_ProgressNumber); + if (ProgressMessage != null) + m.SendMessage(ProgressMessage); + else if (ProgressNumber != 0) + m.SendLocalizedMessage(ProgressNumber); - if (m_ShowTimeRemaining) + if (ShowTimeRemaining) m.SendMessage("Time remaining: {0}", FormatTime(m_Table[m].Timer.Next - DateTime.UtcNow)); Timer.DelayCall(TimeSpan.FromSeconds(5), EndLock, m); @@ -659,10 +633,10 @@ namespace Server.Items info.Timer.Stop(); } - if (m_StartMessage != null) - m.SendMessage(m_StartMessage); - else if (m_StartNumber != 0) - m.SendLocalizedMessage(m_StartNumber); + if (StartMessage != null) + m.SendMessage(StartMessage); + else if (StartNumber != 0) + m.SendLocalizedMessage(StartNumber); if (Delay == TimeSpan.Zero) DoTeleport(m); @@ -688,11 +662,11 @@ namespace Server.Items writer.Write((int)0); // version - writer.Write(m_StartNumber); - writer.Write(m_StartMessage); - writer.Write(m_ProgressNumber); - writer.Write(m_ProgressMessage); - writer.Write(m_ShowTimeRemaining); + writer.Write(StartNumber); + writer.Write(StartMessage); + writer.Write(ProgressNumber); + writer.Write(ProgressMessage); + writer.Write(ShowTimeRemaining); } public override void Deserialize(GenericReader reader) @@ -701,40 +675,33 @@ namespace Server.Items int version = reader.ReadInt(); - m_StartNumber = reader.ReadInt(); - m_StartMessage = reader.ReadString(); - m_ProgressNumber = reader.ReadInt(); - m_ProgressMessage = reader.ReadString(); - m_ShowTimeRemaining = reader.ReadBool(); + StartNumber = reader.ReadInt(); + StartMessage = reader.ReadString(); + ProgressNumber = reader.ReadInt(); + ProgressMessage = reader.ReadString(); + ShowTimeRemaining = reader.ReadBool(); } private class TeleportingInfo { - private WaitTeleporter m_Teleporter; - private Timer m_Timer; + public WaitTeleporter Teleporter { get; } - public WaitTeleporter Teleporter => m_Teleporter; - public Timer Timer => m_Timer; + public Timer Timer { get; } public TeleportingInfo(WaitTeleporter tele, Timer t) { - m_Teleporter = tele; - m_Timer = t; + Teleporter = tele; + Timer = t; } } } public class TimeoutTeleporter : Teleporter { - private TimeSpan m_TimeoutDelay; private Dictionary m_Teleporting; [CommandProperty(AccessLevel.GameMaster)] - public TimeSpan TimeoutDelay - { - get => m_TimeoutDelay; - set => m_TimeoutDelay = value; - } + public TimeSpan TimeoutDelay { get; set; } [Constructible] public TimeoutTeleporter() @@ -757,7 +724,7 @@ namespace Server.Items public void StartTimer(Mobile m) { - StartTimer(m, m_TimeoutDelay); + StartTimer(m, TimeoutDelay); } private void StartTimer(Mobile m, TimeSpan delay) @@ -808,7 +775,7 @@ namespace Server.Items writer.Write((int)0); // version - writer.Write(m_TimeoutDelay); + writer.Write(TimeoutDelay); writer.Write(m_Teleporting.Count); foreach (KeyValuePair kvp in m_Teleporting) @@ -824,7 +791,7 @@ namespace Server.Items int version = reader.ReadInt(); - m_TimeoutDelay = reader.ReadTimeSpan(); + TimeoutDelay = reader.ReadTimeSpan(); m_Teleporting = new Dictionary(); int count = reader.ReadInt(); @@ -841,14 +808,8 @@ namespace Server.Items public class TimeoutGoal : Item { - private TimeoutTeleporter m_Teleporter; - [CommandProperty(AccessLevel.GameMaster)] - public TimeoutTeleporter Teleporter - { - get => m_Teleporter; - set => m_Teleporter = value; - } + public TimeoutTeleporter Teleporter { get; set; } [Constructible] public TimeoutGoal() @@ -862,7 +823,7 @@ namespace Server.Items public override bool OnMoveOver(Mobile m) { - m_Teleporter?.StopTimer(m); + Teleporter?.StopTimer(m); return true; } @@ -880,7 +841,7 @@ namespace Server.Items writer.Write((int)0); // version - writer.WriteItem(m_Teleporter); + writer.WriteItem(Teleporter); } public override void Deserialize(GenericReader reader) @@ -889,7 +850,7 @@ namespace Server.Items int version = reader.ReadInt(); - m_Teleporter = reader.ReadItem(); + Teleporter = reader.ReadItem(); } } diff --git a/Scripts/Items/Misc/WarningItem.cs b/Scripts/Items/Misc/WarningItem.cs index d87464fca..502dbfb57 100644 --- a/Scripts/Items/Misc/WarningItem.cs +++ b/Scripts/Items/Misc/WarningItem.cs @@ -6,24 +6,13 @@ namespace Server.Items { public class WarningItem : Item { - private string m_WarningString; - private int m_WarningNumber; private int m_Range; - private TimeSpan m_ResetDelay; [CommandProperty( AccessLevel.GameMaster )] - public string WarningString - { - get => m_WarningString; - set => m_WarningString = value; - } + public string WarningString { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int WarningNumber - { - get => m_WarningNumber; - set => m_WarningNumber = value; - } + public int WarningNumber { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int Range @@ -33,11 +22,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan ResetDelay - { - get => m_ResetDelay; - set => m_ResetDelay = value; - } + public TimeSpan ResetDelay { get; set; } [Constructible] public WarningItem( int itemID, int range, int warning ) : base( itemID ) @@ -47,7 +32,7 @@ namespace Server.Items Movable = false; - m_WarningNumber = warning; + WarningNumber = warning; m_Range = range; } @@ -59,7 +44,7 @@ namespace Server.Items Movable = false; - m_WarningString = warning; + WarningString = warning; m_Range = range; } @@ -94,14 +79,14 @@ namespace Server.Items public virtual void Broadcast( Mobile triggerer ) { - if ( m_Broadcasting || (DateTime.UtcNow < (m_LastBroadcast + m_ResetDelay)) ) + if ( m_Broadcasting || (DateTime.UtcNow < (m_LastBroadcast + ResetDelay)) ) return; m_LastBroadcast = DateTime.UtcNow; m_Broadcasting = true; - SendMessage( triggerer, OnlyToTriggerer, m_WarningString, m_WarningNumber ); + SendMessage( triggerer, OnlyToTriggerer, WarningString, WarningNumber ); if ( NeighborRange >= 0 ) { @@ -139,11 +124,11 @@ namespace Server.Items writer.Write( (int) 0 ); - writer.Write( (string) m_WarningString ); - writer.Write( (int) m_WarningNumber ); + writer.Write( (string) WarningString ); + writer.Write( (int) WarningNumber ); writer.Write( (int) m_Range ); - writer.Write( (TimeSpan) m_ResetDelay ); + writer.Write( (TimeSpan) ResetDelay ); } public override void Deserialize( GenericReader reader ) @@ -156,10 +141,10 @@ namespace Server.Items { case 0: { - m_WarningString = reader.ReadString(); - m_WarningNumber = reader.ReadInt(); + WarningString = reader.ReadString(); + WarningNumber = reader.ReadInt(); m_Range = reader.ReadInt(); - m_ResetDelay = reader.ReadTimeSpan(); + ResetDelay = reader.ReadTimeSpan(); break; } @@ -169,35 +154,24 @@ namespace Server.Items public class HintItem : WarningItem { - private string m_HintString; - private int m_HintNumber; + [CommandProperty( AccessLevel.GameMaster )] + public string HintString { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public string HintString - { - get => m_HintString; - set => m_HintString = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public int HintNumber - { - get => m_HintNumber; - set => m_HintNumber = value; - } + public int HintNumber { get; set; } public override bool OnlyToTriggerer => true; [Constructible] public HintItem( int itemID, int range, int warning, int hint ) : base( itemID, range, warning ) { - m_HintNumber = hint; + HintNumber = hint; } [Constructible] public HintItem( int itemID, int range, string warning, string hint ) : base( itemID, range, warning ) { - m_HintString = hint; + HintString = hint; } public HintItem( Serial serial ) : base( serial ) @@ -206,7 +180,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - SendMessage( from, true, m_HintString, m_HintNumber ); + SendMessage( from, true, HintString, HintNumber ); } public override void Serialize( GenericWriter writer ) @@ -215,8 +189,8 @@ namespace Server.Items writer.Write( (int) 0 ); - writer.Write( (string) m_HintString ); - writer.Write( (int) m_HintNumber ); + writer.Write( (string) HintString ); + writer.Write( (int) HintNumber ); } public override void Deserialize( GenericReader reader ) @@ -229,8 +203,8 @@ namespace Server.Items { case 0: { - m_HintString = reader.ReadString(); - m_HintNumber = reader.ReadInt(); + HintString = reader.ReadString(); + HintNumber = reader.ReadInt(); break; } diff --git a/Scripts/Items/Misc/WindChimes.cs b/Scripts/Items/Misc/WindChimes.cs index 9f9828e95..8972caeb0 100644 --- a/Scripts/Items/Misc/WindChimes.cs +++ b/Scripts/Items/Misc/WindChimes.cs @@ -19,16 +19,14 @@ namespace Server.Items { } - private static int[] m_Sounds = { 0x505, 0x506, 0x507 }; - - public static int[] Sounds => m_Sounds; + public static int[] Sounds { get; } = { 0x505, 0x506, 0x507 }; public override bool HandlesOnMovement => m_TurnedOn && IsLockedDown; public override void OnMovement( Mobile m, Point3D oldLocation ) { if ( m_TurnedOn && IsLockedDown && (!m.Hidden || m.AccessLevel == AccessLevel.Player) && Utility.InRange( m.Location, Location, 2 ) && !Utility.InRange( oldLocation, Location, 2 ) ) - Effects.PlaySound( Location, Map, m_Sounds[Utility.Random( m_Sounds.Length )] ); + Effects.PlaySound( Location, Map, Sounds[Utility.Random( Sounds.Length )] ); base.OnMovement( m, oldLocation ); } diff --git a/Scripts/Items/Skill Items/Camping/Campfire.cs b/Scripts/Items/Skill Items/Camping/Campfire.cs index 923dcda1c..ccc83fc9a 100644 --- a/Scripts/Items/Skill Items/Camping/Campfire.cs +++ b/Scripts/Items/Skill Items/Camping/Campfire.cs @@ -30,7 +30,6 @@ namespace Server.Items } private Timer m_Timer; - private DateTime m_Created; private ArrayList m_Entries; @@ -41,7 +40,7 @@ namespace Server.Items m_Entries = new ArrayList(); - m_Created = DateTime.UtcNow; + Created = DateTime.UtcNow; m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ), OnTick ); } @@ -50,7 +49,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public DateTime Created => m_Created; + public DateTime Created { get; } [CommandProperty( AccessLevel.GameMaster )] public CampfireStatus Status @@ -178,14 +177,13 @@ namespace Server.Items public class CampfireEntry { - private PlayerMobile m_Player; - private Campfire m_Fire; - private DateTime m_Start; private bool m_Safe; - public PlayerMobile Player => m_Player; - public Campfire Fire => m_Fire; - public DateTime Start => m_Start; + public PlayerMobile Player { get; } + + public Campfire Fire { get; } + + public DateTime Start { get; } public bool Valid => !Fire.Deleted && Fire.Status != CampfireStatus.Off && Player.Map == Fire.Map && Player.InRange( Fire, Campfire.SecureRange ); @@ -197,9 +195,9 @@ namespace Server.Items public CampfireEntry( PlayerMobile player, Campfire fire ) { - m_Player = player; - m_Fire = fire; - m_Start = DateTime.UtcNow; + Player = player; + Fire = fire; + Start = DateTime.UtcNow; m_Safe = false; } } diff --git a/Scripts/Items/Skill Items/Carpenter Items/TaxidermyKit.cs b/Scripts/Items/Skill Items/Carpenter Items/TaxidermyKit.cs index cea98a5bc..2c34f93f6 100644 --- a/Scripts/Items/Skill Items/Carpenter Items/TaxidermyKit.cs +++ b/Scripts/Items/Skill Items/Carpenter Items/TaxidermyKit.cs @@ -65,21 +65,19 @@ namespace Server.Items { public TrophyInfo( Type type, int id, int deedNum, int addonNum ) { - m_CreatureType = type; - m_NorthID = id; - m_DeedNumber = deedNum; - m_AddonNumber = addonNum; + CreatureType = type; + NorthID = id; + DeedNumber = deedNum; + AddonNumber = addonNum; } - private Type m_CreatureType; - private int m_NorthID; - private int m_DeedNumber; - private int m_AddonNumber; + public Type CreatureType { get; } - public Type CreatureType => m_CreatureType; - public int NorthID => m_NorthID; - public int DeedNumber => m_DeedNumber; - public int AddonNumber => m_AddonNumber; + public int NorthID { get; } + + public int DeedNumber { get; } + + public int AddonNumber { get; } } @@ -170,28 +168,19 @@ namespace Server.Items { public override bool ForceShowProperties => ObjectPropertyList.Enabled; - private int m_WestID; - private int m_NorthID; - private int m_DeedNumber; private int m_AddonNumber; private Mobile m_Hunter; private int m_AnimalWeight; [CommandProperty( AccessLevel.GameMaster )] - public int WestID{ get => m_WestID; - set => m_WestID = value; - } + public int WestID { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int NorthID{ get => m_NorthID; - set => m_NorthID = value; - } + public int NorthID { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int DeedNumber{ get => m_DeedNumber; - set => m_DeedNumber = value; - } + public int DeedNumber { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int AddonNumber{ get => m_AddonNumber; @@ -214,9 +203,9 @@ namespace Server.Items public TrophyAddon( Mobile from, int itemID, int westID, int northID, int deedNumber, int addonNumber, Mobile hunter, int animalWeight ) : base( itemID ) { - m_WestID = westID; - m_NorthID = northID; - m_DeedNumber = deedNumber; + WestID = westID; + NorthID = northID; + DeedNumber = deedNumber; m_AddonNumber = addonNumber; m_Hunter = hunter; @@ -249,7 +238,7 @@ namespace Server.Items if ( !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) ) return false; - if ( ItemID == m_NorthID ) + if ( ItemID == NorthID ) return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // North wall return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // West wall } @@ -263,9 +252,9 @@ namespace Server.Items writer.Write( (Mobile) m_Hunter ); writer.Write( (int) m_AnimalWeight ); - writer.Write( (int) m_WestID ); - writer.Write( (int) m_NorthID ); - writer.Write( (int) m_DeedNumber ); + writer.Write( (int) WestID ); + writer.Write( (int) NorthID ); + writer.Write( (int) DeedNumber ); writer.Write( (int) m_AddonNumber ); } @@ -285,9 +274,9 @@ namespace Server.Items } case 0: { - m_WestID = reader.ReadInt(); - m_NorthID = reader.ReadInt(); - m_DeedNumber = reader.ReadInt(); + WestID = reader.ReadInt(); + NorthID = reader.ReadInt(); + DeedNumber = reader.ReadInt(); m_AddonNumber = reader.ReadInt(); break; } @@ -319,7 +308,7 @@ namespace Server.Items } } - public Item Deed => new TrophyDeed( m_WestID, m_NorthID, m_DeedNumber, m_AddonNumber, m_Hunter, m_AnimalWeight ); + public Item Deed => new TrophyDeed( WestID, NorthID, DeedNumber, m_AddonNumber, m_Hunter, m_AnimalWeight ); public override void OnDoubleClick( Mobile from ) { @@ -343,32 +332,23 @@ namespace Server.Items [Flippable( 0x14F0, 0x14EF )] public class TrophyDeed : Item { - private int m_WestID; - private int m_NorthID; private int m_DeedNumber; - private int m_AddonNumber; private Mobile m_Hunter; private int m_AnimalWeight; [CommandProperty( AccessLevel.GameMaster )] - public int WestID{ get => m_WestID; - set => m_WestID = value; - } + public int WestID { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int NorthID{ get => m_NorthID; - set => m_NorthID = value; - } + public int NorthID { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int DeedNumber{ get => m_DeedNumber; set{ m_DeedNumber = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] - public int AddonNumber{ get => m_AddonNumber; - set => m_AddonNumber = value; - } + public int AddonNumber { get; set; } [CommandProperty( AccessLevel.GameMaster )] public Mobile Hunter{ get => m_Hunter; @@ -387,10 +367,10 @@ namespace Server.Items public TrophyDeed( int westID, int northID, int deedNumber, int addonNumber, Mobile hunter, int animalWeight ) : base( 0x14F0 ) { - m_WestID = westID; - m_NorthID = northID; + WestID = westID; + NorthID = northID; m_DeedNumber = deedNumber; - m_AddonNumber = addonNumber; + AddonNumber = addonNumber; m_Hunter = hunter; m_AnimalWeight = animalWeight; } @@ -425,10 +405,10 @@ namespace Server.Items writer.Write( (Mobile) m_Hunter ); writer.Write( (int) m_AnimalWeight ); - writer.Write( (int) m_WestID ); - writer.Write( (int) m_NorthID ); + writer.Write( (int) WestID ); + writer.Write( (int) NorthID ); writer.Write( (int) m_DeedNumber ); - writer.Write( (int) m_AddonNumber ); + writer.Write( (int) AddonNumber ); } public override void Deserialize( GenericReader reader ) @@ -447,10 +427,10 @@ namespace Server.Items } case 0: { - m_WestID = reader.ReadInt(); - m_NorthID = reader.ReadInt(); + WestID = reader.ReadInt(); + NorthID = reader.ReadInt(); m_DeedNumber = reader.ReadInt(); - m_AddonNumber = reader.ReadInt(); + AddonNumber = reader.ReadInt(); break; } } @@ -484,15 +464,15 @@ namespace Server.Items int itemID = 0; if ( northWall ) - itemID = m_NorthID; + itemID = NorthID; else if ( westWall ) - itemID = m_WestID; + itemID = WestID; else from.SendLocalizedMessage( 1042626 ); // The trophy must be placed next to a wall. if ( itemID > 0 ) { - house.Addons.Add( new TrophyAddon( from, itemID, m_WestID, m_NorthID, m_DeedNumber, m_AddonNumber, m_Hunter, m_AnimalWeight ) ); + house.Addons.Add( new TrophyAddon( from, itemID, WestID, NorthID, m_DeedNumber, AddonNumber, m_Hunter, m_AnimalWeight ) ); Delete(); } } diff --git a/Scripts/Items/Skill Items/Fishing/Misc/MessageInABottle.cs b/Scripts/Items/Skill Items/Fishing/Misc/MessageInABottle.cs index 722829027..5b9f72945 100644 --- a/Scripts/Items/Skill Items/Fishing/Misc/MessageInABottle.cs +++ b/Scripts/Items/Skill Items/Fishing/Misc/MessageInABottle.cs @@ -14,15 +14,10 @@ namespace Server.Items public override int LabelNumber => 1041080; // a message in a bottle - private Map m_TargetMap; private int m_Level; [CommandProperty( AccessLevel.GameMaster )] - public Map TargetMap - { - get => m_TargetMap; - set => m_TargetMap = value; - } + public Map TargetMap { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int Level @@ -44,7 +39,7 @@ namespace Server.Items public MessageInABottle( Map map, int level ) : base( 0x099F ) { Weight = 1.0; - m_TargetMap = map; + TargetMap = map; m_Level = level; } @@ -60,7 +55,7 @@ namespace Server.Items writer.Write( (int) m_Level ); - writer.Write( m_TargetMap ); + writer.Write( TargetMap ); } public override void Deserialize( GenericReader reader ) @@ -79,12 +74,12 @@ namespace Server.Items } case 1: { - m_TargetMap = reader.ReadMap(); + TargetMap = reader.ReadMap(); break; } case 0: { - m_TargetMap = Map.Trammel; + TargetMap = Map.Trammel; break; } } @@ -92,15 +87,15 @@ namespace Server.Items if ( version < 2 ) m_Level = GetRandomLevel(); - if ( version < 3 && m_TargetMap == Map.Tokuno ) - m_TargetMap = Map.Trammel; + if ( version < 3 && TargetMap == Map.Tokuno ) + TargetMap = Map.Trammel; } public override void OnDoubleClick( Mobile from ) { if ( IsChildOf( from.Backpack ) ) { - ReplaceWith( new SOS( m_TargetMap, m_Level ) ); + ReplaceWith( new SOS( TargetMap, m_Level ) ); from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 501891 ); // You extract the message from the bottle. } else diff --git a/Scripts/Items/Skill Items/Fishing/Misc/SOS.cs b/Scripts/Items/Skill Items/Fishing/Misc/SOS.cs index 0aef7a07c..9f03d5d4a 100644 --- a/Scripts/Items/Skill Items/Fishing/Misc/SOS.cs +++ b/Scripts/Items/Skill Items/Fishing/Misc/SOS.cs @@ -18,9 +18,6 @@ namespace Server.Items } private int m_Level; - private Map m_TargetMap; - private Point3D m_TargetLocation; - private int m_MessageIndex; [CommandProperty( AccessLevel.GameMaster )] public bool IsAncient => ( m_Level >= 4 ); @@ -38,25 +35,13 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public Map TargetMap - { - get => m_TargetMap; - set => m_TargetMap = value; - } + public Map TargetMap { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D TargetLocation - { - get => m_TargetLocation; - set => m_TargetLocation = value; - } + public Point3D TargetLocation { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int MessageIndex - { - get => m_MessageIndex; - set => m_MessageIndex = value; - } + public int MessageIndex { get; set; } public void UpdateHue() { @@ -82,9 +67,9 @@ namespace Server.Items Weight = 1.0; m_Level = level; - m_MessageIndex = Utility.Random( MessageEntry.Entries.Length ); - m_TargetMap = map; - m_TargetLocation = FindLocation( m_TargetMap ); + MessageIndex = Utility.Random( MessageEntry.Entries.Length ); + TargetMap = map; + TargetLocation = FindLocation( TargetMap ); UpdateHue(); } @@ -101,9 +86,9 @@ namespace Server.Items writer.Write( m_Level ); - writer.Write( m_TargetMap ); - writer.Write( m_TargetLocation ); - writer.Write( m_MessageIndex ); + writer.Write( TargetMap ); + writer.Write( TargetLocation ); + writer.Write( MessageIndex ); } public override void Deserialize( GenericReader reader ) @@ -123,21 +108,21 @@ namespace Server.Items } case 1: { - m_TargetMap = reader.ReadMap(); - m_TargetLocation = reader.ReadPoint3D(); - m_MessageIndex = reader.ReadInt(); + TargetMap = reader.ReadMap(); + TargetLocation = reader.ReadPoint3D(); + MessageIndex = reader.ReadInt(); break; } case 0: { - m_TargetMap = Map; + TargetMap = Map; - if ( m_TargetMap == null || m_TargetMap == Map.Internal ) - m_TargetMap = Map.Trammel; + if ( TargetMap == null || TargetMap == Map.Internal ) + TargetMap = Map.Trammel; - m_TargetLocation = FindLocation( m_TargetMap ); - m_MessageIndex = Utility.Random( MessageEntry.Entries.Length ); + TargetLocation = FindLocation( TargetMap ); + MessageIndex = Utility.Random( MessageEntry.Entries.Length ); break; } @@ -149,8 +134,8 @@ namespace Server.Items if ( version < 3 ) UpdateHue(); - if ( version < 4 && m_TargetMap == Map.Tokuno ) - m_TargetMap = Map.Trammel; + if ( version < 4 && TargetMap == Map.Tokuno ) + TargetMap = Map.Trammel; } public override void OnDoubleClick( Mobile from ) @@ -159,13 +144,13 @@ namespace Server.Items { MessageEntry entry; - if ( m_MessageIndex >= 0 && m_MessageIndex < MessageEntry.Entries.Length ) - entry = MessageEntry.Entries[m_MessageIndex]; + if ( MessageIndex >= 0 && MessageIndex < MessageEntry.Entries.Length ) + entry = MessageEntry.Entries[MessageIndex]; else - entry = MessageEntry.Entries[m_MessageIndex = Utility.Random( MessageEntry.Entries.Length )]; + entry = MessageEntry.Entries[MessageIndex = Utility.Random( MessageEntry.Entries.Length )]; //from.CloseGump( typeof( MessageGump ) ); - from.SendGump( new MessageGump( entry, m_TargetMap, m_TargetLocation ) ); + from.SendGump( new MessageGump( entry, TargetMap, TargetLocation ) ); } else { @@ -297,36 +282,34 @@ namespace Server.Items private class MessageEntry { - private int m_Width, m_Height; - private string m_Message; + public int Width { get; } - public int Width => m_Width; - public int Height => m_Height; - public string Message => m_Message; + public int Height { get; } + + public string Message { get; } public MessageEntry( int width, int height, string message ) { - m_Width = width; - m_Height = height; - m_Message = message; + Width = width; + Height = height; + Message = message; } - private static MessageEntry[] m_Entries = { - new MessageEntry( 280, 180, "...Ar! {0} and a fair wind! No chance... storms, though--ar! Is that a sea serp...

uh oh." ), - new MessageEntry( 280, 215, "...been inside this whale for three days now. I've run out of food I can pick out of his teeth. I took a sextant reading through the blowhole: {0}. I'll never see my treasure again..." ), - new MessageEntry( 280, 285, "...grand adventure! Captain Quacklebush had me swab down the decks daily...
...pirates came, I was in the rigging practicing with my sextant. {0} if I am not mistaken...
....scuttled the ship, and our precious cargo went with her and the screaming pirates, down to the bottom of the sea..." ), - new MessageEntry( 280, 180, "Help! Ship going dow...n heavy storms...precious cargo...st reach dest...current coordinates {0}...ve any survivors... ease!" ), - new MessageEntry( 280, 215, "...know that the wreck is near {0} but have not found it. Could the message passed down in my family for generations be wrong? No... I swear on the soul of my grandfather, I will find..." ), - new MessageEntry( 280, 195, "...never expected an iceberg...silly woman on bow crushed instantly...send help to {0}...ey'll never forget the tragedy of the sinking of the Miniscule..." ), - new MessageEntry( 280, 265, "...nobody knew I was a girl. They just assumed I was another sailor...then we met the undine. {0}. It was demanded sacrifice...I was youngset, they figured...
...grabbed the captain's treasure, screamed, 'It'll go down with me!'
...they took me up on it." ), - new MessageEntry( 280, 230, "...so I threw the treasure overboard, before the curse could get me too. But I was too late. Now I am doomed to wander these seas, a ghost forever. Join me: seek ye at {0} if thou wishest my company..." ), - new MessageEntry( 280, 285, "...then the ship exploded. A dragon swooped by. The slime swallowed Bertie whole--he screamed, it was amazing. The sky glowed orange. A sextant reading put us at {0}. Norma was chattering about sailing over the edge of the world. I looked at my hands and saw through them..." ), - new MessageEntry( 280, 285, "...trapped on a deserted island, with a magic fountain supplying wood, fresh water springs, gorgeous scenery, and my lovely young wife. I know the ship with all our life's earnings sank at {0} but I don't know what our coordinates are... someone has GOT to rescue me before Sunday's finals game or I'll go mad..." ), - new MessageEntry( 280, 160, "WANTED: divers exp...d in shipwre...overy. Must have own vess...pply at {0}
...good benefits, flexible hours..." ), - new MessageEntry( 280, 250, "...was a cad and a boor, no matter what momma s...rew him overboard! Oh, Anna, 'twas so exciting!
Unfort...y he grabbe...est, and all his riches went with him!
...sked the captain, and he says we're at {0}
...so maybe..." ) - }; - - public static MessageEntry[] Entries => m_Entries; + public static MessageEntry[] Entries { get; } = + { + new MessageEntry( 280, 180, "...Ar! {0} and a fair wind! No chance... storms, though--ar! Is that a sea serp...

uh oh." ), + new MessageEntry( 280, 215, "...been inside this whale for three days now. I've run out of food I can pick out of his teeth. I took a sextant reading through the blowhole: {0}. I'll never see my treasure again..." ), + new MessageEntry( 280, 285, "...grand adventure! Captain Quacklebush had me swab down the decks daily...
...pirates came, I was in the rigging practicing with my sextant. {0} if I am not mistaken...
....scuttled the ship, and our precious cargo went with her and the screaming pirates, down to the bottom of the sea..." ), + new MessageEntry( 280, 180, "Help! Ship going dow...n heavy storms...precious cargo...st reach dest...current coordinates {0}...ve any survivors... ease!" ), + new MessageEntry( 280, 215, "...know that the wreck is near {0} but have not found it. Could the message passed down in my family for generations be wrong? No... I swear on the soul of my grandfather, I will find..." ), + new MessageEntry( 280, 195, "...never expected an iceberg...silly woman on bow crushed instantly...send help to {0}...ey'll never forget the tragedy of the sinking of the Miniscule..." ), + new MessageEntry( 280, 265, "...nobody knew I was a girl. They just assumed I was another sailor...then we met the undine. {0}. It was demanded sacrifice...I was youngset, they figured...
...grabbed the captain's treasure, screamed, 'It'll go down with me!'
...they took me up on it." ), + new MessageEntry( 280, 230, "...so I threw the treasure overboard, before the curse could get me too. But I was too late. Now I am doomed to wander these seas, a ghost forever. Join me: seek ye at {0} if thou wishest my company..." ), + new MessageEntry( 280, 285, "...then the ship exploded. A dragon swooped by. The slime swallowed Bertie whole--he screamed, it was amazing. The sky glowed orange. A sextant reading put us at {0}. Norma was chattering about sailing over the edge of the world. I looked at my hands and saw through them..." ), + new MessageEntry( 280, 285, "...trapped on a deserted island, with a magic fountain supplying wood, fresh water springs, gorgeous scenery, and my lovely young wife. I know the ship with all our life's earnings sank at {0} but I don't know what our coordinates are... someone has GOT to rescue me before Sunday's finals game or I'll go mad..." ), + new MessageEntry( 280, 160, "WANTED: divers exp...d in shipwre...overy. Must have own vess...pply at {0}
...good benefits, flexible hours..." ), + new MessageEntry( 280, 250, "...was a cad and a boor, no matter what momma s...rew him overboard! Oh, Anna, 'twas so exciting!
Unfort...y he grabbe...est, and all his riches went with him!
...sked the captain, and he says we're at {0}
...so maybe..." ) + }; } } } diff --git a/Scripts/Items/Skill Items/Fishing/Misc/SpecialFishingNet.cs b/Scripts/Items/Skill Items/Fishing/Misc/SpecialFishingNet.cs index ae16a20c5..8635e6373 100644 --- a/Scripts/Items/Skill Items/Fishing/Misc/SpecialFishingNet.cs +++ b/Scripts/Items/Skill Items/Fishing/Misc/SpecialFishingNet.cs @@ -10,14 +10,8 @@ namespace Server.Items { public override int LabelNumber => 1041079; // a special fishing net - private bool m_InUse; - [CommandProperty( AccessLevel.GameMaster )] - public bool InUse - { - get => m_InUse; - set => m_InUse = value; - } + public bool InUse { get; set; } [Constructible] public SpecialFishingNet() : base( 0x0DCA ) @@ -70,7 +64,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( m_InUse ); + writer.Write( InUse ); } public override void Deserialize( GenericReader reader ) @@ -83,9 +77,9 @@ namespace Server.Items { case 1: { - m_InUse = reader.ReadBool(); + InUse = reader.ReadBool(); - if ( m_InUse ) + if ( InUse ) Delete(); break; @@ -97,7 +91,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if ( m_InUse ) + if ( InUse ) { from.SendLocalizedMessage( 1010483 ); // Someone is already using that net! } @@ -116,7 +110,7 @@ namespace Server.Items public void OnTarget( Mobile from, object obj ) { - if ( Deleted || m_InUse ) + if ( Deleted || InUse ) return; if ( !(obj is IPoint3D p3D) ) @@ -147,7 +141,7 @@ namespace Server.Items from.AddToBackpack( new SpecialFishingNet() ); } - m_InUse = true; + InUse = true; Movable = false; MoveToWorld( p, map ); diff --git a/Scripts/Items/Skill Items/Magical/Misc/Moongate.cs b/Scripts/Items/Skill Items/Magical/Misc/Moongate.cs index 6e76629f8..355368aab 100644 --- a/Scripts/Items/Skill Items/Magical/Misc/Moongate.cs +++ b/Scripts/Items/Skill Items/Magical/Misc/Moongate.cs @@ -10,43 +10,27 @@ namespace Server.Items [DispellableFieldAttribute] public class Moongate : Item { - private Point3D m_Target; - private Map m_TargetMap; - private bool m_bDispellable; + [CommandProperty( AccessLevel.GameMaster )] + public Point3D Target { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D Target - { - get => m_Target; - set => m_Target = value; - } + public Map TargetMap { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Map TargetMap - { - get => m_TargetMap; - set => m_TargetMap = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public bool Dispellable - { - get => m_bDispellable; - set => m_bDispellable = value; - } + public bool Dispellable { get; set; } public virtual bool ShowFeluccaWarning => false; [Constructible] public Moongate() : this( Point3D.Zero, null ) { - m_bDispellable = true; + Dispellable = true; } [Constructible] public Moongate(bool bDispellable) : this( Point3D.Zero, null ) { - m_bDispellable = bDispellable; + Dispellable = bDispellable; } [Constructible] @@ -55,8 +39,8 @@ namespace Server.Items Movable = false; Light = LightType.Circle300; - m_Target = target; - m_TargetMap = targetMap; + Target = target; + TargetMap = targetMap; } public Moongate( Serial serial ) : base( serial ) @@ -104,11 +88,11 @@ namespace Server.Items { m.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil. } - else if ( m_TargetMap == Map.Felucca && m is PlayerMobile mobile && mobile.Young ) + else if ( TargetMap == Map.Felucca && m is PlayerMobile mobile && mobile.Young ) { mobile.SendLocalizedMessage( 1049543 ); // You decide against traveling to Felucca while you are still young. } - else if ( (m.Kills >= 5 && m_TargetMap != Map.Felucca) || ( m_TargetMap == Map.Tokuno && (flags & ClientFlags.Tokuno) == 0 ) || ( m_TargetMap == Map.Malas && (flags & ClientFlags.Malas) == 0 ) || ( m_TargetMap == Map.Ilshenar && (flags & ClientFlags.Ilshenar) == 0 ) ) + else if ( (m.Kills >= 5 && TargetMap != Map.Felucca) || ( TargetMap == Map.Tokuno && (flags & ClientFlags.Tokuno) == 0 ) || ( TargetMap == Map.Malas && (flags & ClientFlags.Malas) == 0 ) || ( TargetMap == Map.Ilshenar && (flags & ClientFlags.Ilshenar) == 0 ) ) { m.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there. } @@ -116,11 +100,11 @@ namespace Server.Items { m.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment. } - else if ( m_TargetMap != null && m_TargetMap != Map.Internal ) + else if ( TargetMap != null && TargetMap != Map.Internal ) { - BaseCreature.TeleportPets( m, m_Target, m_TargetMap ); + BaseCreature.TeleportPets( m, Target, TargetMap ); - m.MoveToWorld( m_Target, m_TargetMap ); + m.MoveToWorld( Target, TargetMap ); if ( m.AccessLevel == AccessLevel.Player || !m.Hidden ) m.PlaySound( 0x1FE ); @@ -139,11 +123,11 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( m_Target ); - writer.Write( m_TargetMap ); + writer.Write( Target ); + writer.Write( TargetMap ); // Version 1 - writer.Write( m_bDispellable ); + writer.Write( Dispellable ); } public override void Deserialize( GenericReader reader ) @@ -152,11 +136,11 @@ namespace Server.Items int version = reader.ReadInt(); - m_Target = reader.ReadPoint3D(); - m_TargetMap = reader.ReadMap(); + Target = reader.ReadPoint3D(); + TargetMap = reader.ReadMap(); if ( version >= 1 ) - m_bDispellable = reader.ReadBool(); + Dispellable = reader.ReadBool(); } public virtual bool ValidateUse( Mobile from, bool message ) @@ -177,7 +161,7 @@ namespace Server.Items public virtual void BeginConfirmation( Mobile from ) { - if ( IsInTown( from.Location, from.Map ) && !IsInTown( m_Target, m_TargetMap ) || (from.Map != Map.Felucca && TargetMap == Map.Felucca && ShowFeluccaWarning) ) + if ( IsInTown( from.Location, from.Map ) && !IsInTown( Target, TargetMap ) || (from.Map != Map.Felucca && TargetMap == Map.Felucca && ShowFeluccaWarning) ) { if ( from.AccessLevel == AccessLevel.Player || !from.Hidden ) from.Send( new PlaySound( 0x20E, from.Location ) ); @@ -203,7 +187,7 @@ namespace Server.Items if ( !ValidateUse( from, false ) || !from.InRange( this, range ) ) return; - if ( m_TargetMap != null ) + if ( TargetMap != null ) BeginConfirmation( from ); else from.SendMessage( "This moongate does not seem to go anywhere." ); @@ -241,65 +225,26 @@ namespace Server.Items public class ConfirmationMoongate : Moongate { - private int m_GumpWidth; - private int m_GumpHeight; - - private int m_TitleColor; - private int m_MessageColor; - - private int m_TitleNumber; - private int m_MessageNumber; - - private string m_MessageString; + [CommandProperty( AccessLevel.GameMaster )] + public int GumpWidth { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int GumpWidth - { - get => m_GumpWidth; - set => m_GumpWidth = value; - } + public int GumpHeight { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int GumpHeight - { - get => m_GumpHeight; - set => m_GumpHeight = value; - } + public int TitleColor { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int TitleColor - { - get => m_TitleColor; - set => m_TitleColor = value; - } + public int MessageColor { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int MessageColor - { - get => m_MessageColor; - set => m_MessageColor = value; - } + public int TitleNumber { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int TitleNumber - { - get => m_TitleNumber; - set => m_TitleNumber = value; - } + public int MessageNumber { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int MessageNumber - { - get => m_MessageNumber; - set => m_MessageNumber = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public string MessageString - { - get => m_MessageString; - set => m_MessageString = value; - } + public string MessageString { get; set; } [Constructible] public ConfirmationMoongate() : this( Point3D.Zero, null ) @@ -323,10 +268,10 @@ namespace Server.Items public override void BeginConfirmation( Mobile from ) { - if ( m_GumpWidth > 0 && m_GumpHeight > 0 && m_TitleNumber > 0 && (m_MessageNumber > 0 || m_MessageString != null) ) + if ( GumpWidth > 0 && GumpHeight > 0 && TitleNumber > 0 && (MessageNumber > 0 || MessageString != null) ) { from.CloseGump( typeof( WarningGump ) ); - from.SendGump( new WarningGump( m_TitleNumber, m_TitleColor, m_MessageString == null ? (object)m_MessageNumber : (object)m_MessageString, m_MessageColor, m_GumpWidth, m_GumpHeight, Warning_Callback, from ) ); + from.SendGump( new WarningGump( TitleNumber, TitleColor, MessageString == null ? (object)MessageNumber : (object)MessageString, MessageColor, GumpWidth, GumpHeight, Warning_Callback, from ) ); } else { @@ -340,16 +285,16 @@ namespace Server.Items writer.Write( (int) 0 ); // version - writer.WriteEncodedInt( m_GumpWidth ); - writer.WriteEncodedInt( m_GumpHeight ); + writer.WriteEncodedInt( GumpWidth ); + writer.WriteEncodedInt( GumpHeight ); - writer.WriteEncodedInt( m_TitleColor ); - writer.WriteEncodedInt( m_MessageColor ); + writer.WriteEncodedInt( TitleColor ); + writer.WriteEncodedInt( MessageColor ); - writer.WriteEncodedInt( m_TitleNumber ); - writer.WriteEncodedInt( m_MessageNumber ); + writer.WriteEncodedInt( TitleNumber ); + writer.WriteEncodedInt( MessageNumber ); - writer.Write( m_MessageString ); + writer.Write( MessageString ); } public override void Deserialize( GenericReader reader ) @@ -362,16 +307,16 @@ namespace Server.Items { case 0: { - m_GumpWidth = reader.ReadEncodedInt(); - m_GumpHeight = reader.ReadEncodedInt(); + GumpWidth = reader.ReadEncodedInt(); + GumpHeight = reader.ReadEncodedInt(); - m_TitleColor = reader.ReadEncodedInt(); - m_MessageColor = reader.ReadEncodedInt(); + TitleColor = reader.ReadEncodedInt(); + MessageColor = reader.ReadEncodedInt(); - m_TitleNumber = reader.ReadEncodedInt(); - m_MessageNumber = reader.ReadEncodedInt(); + TitleNumber = reader.ReadEncodedInt(); + MessageNumber = reader.ReadEncodedInt(); - m_MessageString = reader.ReadString(); + MessageString = reader.ReadString(); break; } diff --git a/Scripts/Items/Skill Items/Magical/Misc/RecallRune.cs b/Scripts/Items/Skill Items/Magical/Misc/RecallRune.cs index fafc6fb4d..33f5e12c8 100644 --- a/Scripts/Items/Skill Items/Magical/Misc/RecallRune.cs +++ b/Scripts/Items/Skill Items/Magical/Misc/RecallRune.cs @@ -10,7 +10,6 @@ namespace Server.Items { private string m_Description; private bool m_Marked; - private Point3D m_Target; private Map m_TargetMap; private BaseHouse m_House; @@ -31,7 +30,7 @@ namespace Server.Items writer.Write( (string) m_Description ); writer.Write( (bool) m_Marked ); - writer.Write( (Point3D) m_Target ); + writer.Write( (Point3D) Target ); writer.Write( (Map) m_TargetMap ); } @@ -52,7 +51,7 @@ namespace Server.Items { m_Description = reader.ReadString(); m_Marked = reader.ReadBool(); - m_Target = reader.ReadPoint3D(); + Target = reader.ReadPoint3D(); m_TargetMap = reader.ReadMap(); CalculateHue(); @@ -102,11 +101,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.Counselor, AccessLevel.GameMaster )] - public Point3D Target - { - get => m_Target; - set => m_Target = value; - } + public Point3D Target { get; set; } [CommandProperty( AccessLevel.Counselor, AccessLevel.GameMaster )] public Map TargetMap @@ -150,7 +145,7 @@ namespace Server.Items if ( m_House == null ) { - m_Target = m.Location; + Target = m.Location; m_TargetMap = m.Map; } else @@ -176,19 +171,19 @@ namespace Server.Items if ( map != null && !map.CanFit( x, y, z, 16, false, false ) ) z = map.GetAverageZ( x, y ); - m_Target = new Point3D( x, y, z ); + Target = new Point3D( x, y, z ); m_TargetMap = map; } } else { m_House = null; - m_Target = m.Location; + Target = m.Location; m_TargetMap = m.Map; } if ( !setDesc ) - m_Description = BaseRegion.GetRuneNameFor( Region.Find( m_Target, m_TargetMap ) ); + m_Description = BaseRegion.GetRuneNameFor( Region.Find( Target, m_TargetMap ) ); CalculateHue(); InvalidateProperties(); diff --git a/Scripts/Items/Skill Items/Magical/Potions/Conflagration Potions/BaseConflagrationPotion.cs b/Scripts/Items/Skill Items/Magical/Potions/Conflagration Potions/BaseConflagrationPotion.cs index b85c93658..f3a15bbad 100644 --- a/Scripts/Items/Skill Items/Magical/Potions/Conflagration Potions/BaseConflagrationPotion.cs +++ b/Scripts/Items/Skill Items/Magical/Potions/Conflagration Potions/BaseConflagrationPotion.cs @@ -138,18 +138,16 @@ namespace Server.Items private class ThrowTarget : Target { - private BaseConflagrationPotion m_Potion; - - public BaseConflagrationPotion Potion => m_Potion; + public BaseConflagrationPotion Potion { get; } public ThrowTarget( BaseConflagrationPotion potion ) : base( 12, true, TargetFlags.None ) { - m_Potion = potion; + Potion = potion; } protected override void OnTarget( Mobile from, object targeted ) { - if ( m_Potion.Deleted || m_Potion.Map == Map.Internal ) + if ( Potion.Deleted || Potion.Map == Map.Internal ) return; if ( !(targeted is IPoint3D p) || from.Map == null ) @@ -169,20 +167,19 @@ namespace Server.Items else to = new Entity( Serial.Zero, new Point3D( p ), from.Map ); - Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, m_Potion.Hue, 0 ); - Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ), new TimerStateCallback( m_Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } ); + Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, Potion.Hue, 0 ); + Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ), new TimerStateCallback( Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } ); } } public class InternalItem : Item { - private Mobile m_From; private int m_MinDamage; private int m_MaxDamage; private DateTime m_End; private Timer m_Timer; - public Mobile From => m_From; + public Mobile From { get; private set; } public override bool BlocksFit => true; @@ -193,7 +190,7 @@ namespace Server.Items MoveToWorld( loc, map ); - m_From = from; + From = from; m_End = DateTime.UtcNow + TimeSpan.FromSeconds( 10 ); SetDamage( min, max ); @@ -224,14 +221,14 @@ namespace Server.Items m_MinDamage = min; m_MaxDamage = max; - if ( m_From == null ) + if ( From == null ) return; - int alchemySkill = m_From.Skills.Alchemy.Fixed; + int alchemySkill = From.Skills.Alchemy.Fixed; int alchemyBonus = alchemySkill / 125 + alchemySkill / 250 ; - m_MinDamage = Scale( m_From, m_MinDamage + alchemyBonus ); - m_MaxDamage = Scale( m_From, m_MaxDamage + alchemyBonus ); + m_MinDamage = Scale( From, m_MinDamage + alchemyBonus ); + m_MaxDamage = Scale( From, m_MaxDamage + alchemyBonus ); } public override void Serialize( GenericWriter writer ) @@ -240,7 +237,7 @@ namespace Server.Items writer.Write( (int) 0 ); // version - writer.Write( (Mobile) m_From ); + writer.Write( (Mobile) From ); writer.Write( (DateTime) m_End ); writer.Write( (int) m_MinDamage ); writer.Write( (int) m_MaxDamage ); @@ -252,7 +249,7 @@ namespace Server.Items int version = reader.ReadInt(); - m_From = reader.ReadMobile(); + From = reader.ReadMobile(); m_End = reader.ReadDateTime(); m_MinDamage = reader.ReadInt(); m_MaxDamage = reader.ReadInt(); @@ -263,11 +260,11 @@ namespace Server.Items public override bool OnMoveOver( Mobile m ) { - if ( Visible && m_From != null && (!Core.AOS || m != m_From) && SpellHelper.ValidIndirectTarget( m_From, m ) && m_From.CanBeHarmful( m, false ) ) + if ( Visible && From != null && (!Core.AOS || m != From) && SpellHelper.ValidIndirectTarget( From, m ) && From.CanBeHarmful( m, false ) ) { - m_From.DoHarmful( m ); + From.DoHarmful( m ); - AOS.Damage( m, m_From, GetDamage(), 0, 100, 0, 0, 0 ); + AOS.Damage( m, From, GetDamage(), 0, 100, 0, 0, 0 ); m.PlaySound( 0x208 ); } diff --git a/Scripts/Items/Skill Items/Magical/Potions/Confusion Blast Potions/BaseConfusionBlastPotion.cs b/Scripts/Items/Skill Items/Magical/Potions/Confusion Blast Potions/BaseConfusionBlastPotion.cs index a3b41cbe5..e53b8712c 100644 --- a/Scripts/Items/Skill Items/Magical/Potions/Confusion Blast Potions/BaseConfusionBlastPotion.cs +++ b/Scripts/Items/Skill Items/Magical/Potions/Confusion Blast Potions/BaseConfusionBlastPotion.cs @@ -158,18 +158,16 @@ namespace Server.Items private class ThrowTarget : Target { - private BaseConfusionBlastPotion m_Potion; - - public BaseConfusionBlastPotion Potion => m_Potion; + public BaseConfusionBlastPotion Potion { get; } public ThrowTarget( BaseConfusionBlastPotion potion ) : base( 12, true, TargetFlags.None ) { - m_Potion = potion; + Potion = potion; } protected override void OnTarget( Mobile from, object targeted ) { - if ( m_Potion.Deleted || m_Potion.Map == Map.Internal ) + if ( Potion.Deleted || Potion.Map == Map.Internal ) return; if ( !(targeted is IPoint3D p) || from.Map == null ) @@ -189,8 +187,8 @@ namespace Server.Items else to = new Entity( Serial.Zero, new Point3D( p ), from.Map ); - Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, m_Potion.Hue, 0 ); - Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( m_Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } ); + Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, Potion.Hue, 0 ); + Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } ); } } } diff --git a/Scripts/Items/Skill Items/Magical/Potions/Cure Potions/BaseCurePotion.cs b/Scripts/Items/Skill Items/Magical/Potions/Cure Potions/BaseCurePotion.cs index 17d5bc8b9..66c3e276d 100644 --- a/Scripts/Items/Skill Items/Magical/Potions/Cure Potions/BaseCurePotion.cs +++ b/Scripts/Items/Skill Items/Magical/Potions/Cure Potions/BaseCurePotion.cs @@ -4,17 +4,14 @@ namespace Server.Items { public class CureLevelInfo { - private Poison m_Poison; - private double m_Chance; + public Poison Poison { get; } - public Poison Poison => m_Poison; - - public double Chance => m_Chance; + public double Chance { get; } public CureLevelInfo( Poison poison, double chance ) { - m_Poison = poison; - m_Chance = chance; + Poison = poison; + Chance = chance; } } diff --git a/Scripts/Items/Skill Items/Magical/Potions/Explosion Potions/BaseExplosionPotion.cs b/Scripts/Items/Skill Items/Magical/Potions/Explosion Potions/BaseExplosionPotion.cs index d509e2883..487fc69f0 100644 --- a/Scripts/Items/Skill Items/Magical/Potions/Explosion Potions/BaseExplosionPotion.cs +++ b/Scripts/Items/Skill Items/Magical/Potions/Explosion Potions/BaseExplosionPotion.cs @@ -60,9 +60,7 @@ namespace Server.Items private Timer m_Timer; - public List Users => m_Users; - - private List m_Users; + public List Users { get; private set; } public override void Drink( Mobile from ) { @@ -80,11 +78,11 @@ namespace Server.Items from.RevealingAction(); - if ( m_Users == null ) - m_Users = new List(); + if ( Users == null ) + Users = new List(); - if ( !m_Users.Contains( from ) ) - m_Users.Add( from ); + if ( !Users.Contains( from ) ) + Users.Add( from ); from.Target = new ThrowTarget( this ); @@ -164,18 +162,16 @@ namespace Server.Items private class ThrowTarget : Target { - private BaseExplosionPotion m_Potion; - - public BaseExplosionPotion Potion => m_Potion; + public BaseExplosionPotion Potion { get; } public ThrowTarget( BaseExplosionPotion potion ) : base( 12, true, TargetFlags.None ) { - m_Potion = potion; + Potion = potion; } protected override void OnTarget( Mobile from, object targeted ) { - if ( m_Potion.Deleted || m_Potion.Map == Map.Internal ) + if ( Potion.Deleted || Potion.Map == Map.Internal ) return; if ( !(targeted is IPoint3D p) ) @@ -200,15 +196,15 @@ namespace Server.Items to = m; } - Effects.SendMovingEffect( from, to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0 ); + Effects.SendMovingEffect( from, to, Potion.ItemID, 7, 0, false, false, Potion.Hue, 0 ); - if ( m_Potion.Amount > 1 ) + if ( Potion.Amount > 1 ) { - Mobile.LiftItemDupe( m_Potion, 1 ); + Mobile.LiftItemDupe( Potion, 1 ); } - m_Potion.Internalize(); - Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( m_Potion.Reposition_OnTick ), new object[]{ from, p, map } ); + Potion.Internalize(); + Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Potion.Reposition_OnTick ), new object[]{ from, p, map } ); } } @@ -219,9 +215,9 @@ namespace Server.Items Consume(); - for ( int i = 0; m_Users != null && i < m_Users.Count; ++i ) + for ( int i = 0; Users != null && i < Users.Count; ++i ) { - Mobile m = m_Users[i]; + Mobile m = Users[i]; if ( m.Target is ThrowTarget targ && targ.Potion == this ) Target.Cancel( m ); diff --git a/Scripts/Items/Skill Items/Magical/Runebook.cs b/Scripts/Items/Skill Items/Magical/Runebook.cs index a80026a11..24521e5a2 100644 --- a/Scripts/Items/Skill Items/Magical/Runebook.cs +++ b/Scripts/Items/Skill Items/Magical/Runebook.cs @@ -22,23 +22,12 @@ namespace Server.Items set{ m_Quality = value; InvalidateProperties(); } } - private List m_Entries; private string m_Description; - private int m_CurCharges, m_MaxCharges; private int m_DefaultIndex; - private SecureLevel m_Level; private Mobile m_Crafter; - private DateTime m_NextUse; - - private List m_Openers = new List(); - [CommandProperty( AccessLevel.GameMaster )] - public DateTime NextUse - { - get => m_NextUse; - set => m_NextUse = value; - } + public DateTime NextUse { get; set; } [CommandProperty( AccessLevel.GameMaster )] public Mobile Crafter @@ -48,11 +37,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public SecureLevel Level - { - get => m_Level; - set => m_Level = value; - } + public SecureLevel Level { get; set; } [CommandProperty( AccessLevel.GameMaster )] public string Description @@ -66,24 +51,12 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public int CurCharges - { - get => m_CurCharges; - set => m_CurCharges = value; - } + public int CurCharges { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int MaxCharges - { - get => m_MaxCharges; - set => m_MaxCharges = value; - } + public int MaxCharges { get; set; } - public List Openers - { - get => m_Openers; - set => m_Openers = value; - } + public List Openers { get; set; } = new List(); public override int LabelNumber => 1041267; // runebook @@ -96,13 +69,13 @@ namespace Server.Items Layer = (Core.AOS ? Layer.Invalid : Layer.OneHanded); - m_Entries = new List(); + Entries = new List(); - m_MaxCharges = maxCharges; + MaxCharges = maxCharges; m_DefaultIndex = -1; - m_Level = SecureLevel.CoOwners; + Level = SecureLevel.CoOwners; } [Constructible] @@ -110,14 +83,14 @@ namespace Server.Items { } - public List Entries => m_Entries; + public List Entries { get; private set; } public RunebookEntry Default { get { - if ( m_DefaultIndex >= 0 && m_DefaultIndex < m_Entries.Count ) - return m_Entries[m_DefaultIndex]; + if ( m_DefaultIndex >= 0 && m_DefaultIndex < Entries.Count ) + return Entries[m_DefaultIndex]; return null; } @@ -126,7 +99,7 @@ namespace Server.Items if ( value == null ) m_DefaultIndex = -1; else - m_DefaultIndex = m_Entries.IndexOf( value ); + m_DefaultIndex = Entries.IndexOf( value ); } } @@ -155,16 +128,16 @@ namespace Server.Items writer.Write( m_Crafter ); - writer.Write( (int) m_Level ); + writer.Write( (int) Level ); - writer.Write( m_Entries.Count ); + writer.Write( Entries.Count ); - for ( int i = 0; i < m_Entries.Count; ++i ) - m_Entries[i].Serialize( writer ); + for ( int i = 0; i < Entries.Count; ++i ) + Entries[i].Serialize( writer ); writer.Write( m_Description ); - writer.Write( m_CurCharges ); - writer.Write( m_MaxCharges ); + writer.Write( CurCharges ); + writer.Write( MaxCharges ); writer.Write( m_DefaultIndex ); } @@ -193,21 +166,21 @@ namespace Server.Items } case 1: { - m_Level = (SecureLevel)reader.ReadInt(); + Level = (SecureLevel)reader.ReadInt(); goto case 0; } case 0: { int count = reader.ReadInt(); - m_Entries = new List( count ); + Entries = new List( count ); for ( int i = 0; i < count; ++i ) - m_Entries.Add( new RunebookEntry( reader ) ); + Entries.Add( new RunebookEntry( reader ) ); m_Description = reader.ReadString(); - m_CurCharges = reader.ReadInt(); - m_MaxCharges = reader.ReadInt(); + CurCharges = reader.ReadInt(); + MaxCharges = reader.ReadInt(); m_DefaultIndex = reader.ReadInt(); break; @@ -222,7 +195,7 @@ namespace Server.Items else if ( m_DefaultIndex == index ) m_DefaultIndex = -1; - m_Entries.RemoveAt( index ); + Entries.RemoveAt( index ); RecallRune rune = new RecallRune(); @@ -279,11 +252,11 @@ namespace Server.Items return false; } - foreach ( Mobile m in m_Openers ) + foreach ( Mobile m in Openers ) if ( IsOpen( m ) ) m.CloseGump( typeof( RunebookGump ) ); - m_Openers.Clear(); + Openers.Clear(); return true; } @@ -309,7 +282,7 @@ namespace Server.Items return; } - if ( DateTime.UtcNow < m_NextUse ) + if ( DateTime.UtcNow < NextUse ) { from.SendLocalizedMessage( 502406 ); // This book needs time to recharge. return; @@ -318,14 +291,14 @@ namespace Server.Items from.CloseGump( typeof( RunebookGump ) ); from.SendGump( new RunebookGump( from, this ) ); - m_Openers.Add( from ); + Openers.Add( from ); } } public virtual void OnTravel() { if ( !Core.SA ) - m_NextUse = DateTime.UtcNow + UseDelay; + NextUse = DateTime.UtcNow + UseDelay; } public override void OnAfterDuped( Item newItem ) @@ -333,13 +306,13 @@ namespace Server.Items if ( !(newItem is Runebook book) ) return; - book.m_Entries = new List(); + book.Entries = new List(); - for ( int i = 0; i < m_Entries.Count; i++ ) + for ( int i = 0; i < Entries.Count; i++ ) { - RunebookEntry entry = m_Entries[i]; + RunebookEntry entry = Entries[i]; - book.m_Entries.Add( new RunebookEntry( entry.Location, entry.Map, entry.Description, entry.House ) ); + book.Entries.Add( new RunebookEntry( entry.Location, entry.Map, entry.Description, entry.House ) ); } } @@ -353,7 +326,7 @@ namespace Server.Items if ( house != null && house.IsAosRules && (house.Public ? house.IsBanned( m ) : !house.HasAccess( m )) ) return false; - return ( house != null && house.HasSecureAccess( m, m_Level ) ); + return ( house != null && house.HasSecureAccess( m, Level ) ); } public override bool OnDragDrop( Mobile from, Item dropped ) @@ -368,11 +341,11 @@ namespace Server.Items { from.SendLocalizedMessage( 1005571 ); // You cannot place objects in the book while viewing the contents. } - else if ( m_Entries.Count < 16 ) + else if ( Entries.Count < 16 ) { if ( rune.Marked && rune.TargetMap != null ) { - m_Entries.Add( new RunebookEntry( rune.Target, rune.TargetMap, rune.Description, rune.House ) ); + Entries.Add( new RunebookEntry( rune.Target, rune.TargetMap, rune.Description, rune.House ) ); rune.Delete(); @@ -397,20 +370,20 @@ namespace Server.Items } else if ( dropped is RecallScroll ) { - if ( m_CurCharges < m_MaxCharges ) + if ( CurCharges < MaxCharges ) { from.Send( new PlaySound( 0x249, GetWorldLocation() ) ); int amount = dropped.Amount; - if ( amount > (m_MaxCharges - m_CurCharges) ) + if ( amount > (MaxCharges - CurCharges) ) { - dropped.Consume( m_MaxCharges - m_CurCharges ); - m_CurCharges = m_MaxCharges; + dropped.Consume( MaxCharges - CurCharges ); + CurCharges = MaxCharges; } else { - m_CurCharges += amount; + CurCharges += amount; dropped.Delete(); return true; @@ -448,25 +421,20 @@ namespace Server.Items public class RunebookEntry { - private Point3D m_Location; - private Map m_Map; - private string m_Description; - private BaseHouse m_House; + public Point3D Location { get; } - public Point3D Location => m_Location; + public Map Map { get; } - public Map Map => m_Map; + public string Description { get; } - public string Description => m_Description; - - public BaseHouse House => m_House; + public BaseHouse House { get; } public RunebookEntry( Point3D loc, Map map, string desc, BaseHouse house ) { - m_Location = loc; - m_Map = map; - m_Description = desc; - m_House = house; + Location = loc; + Map = map; + Description = desc; + House = house; } public RunebookEntry( GenericReader reader ) @@ -477,14 +445,14 @@ namespace Server.Items { case 1: { - m_House = reader.ReadItem() as BaseHouse; + House = reader.ReadItem() as BaseHouse; goto case 0; } case 0: { - m_Location = reader.ReadPoint3D(); - m_Map = reader.ReadMap(); - m_Description = reader.ReadString(); + Location = reader.ReadPoint3D(); + Map = reader.ReadMap(); + Description = reader.ReadString(); break; } @@ -493,20 +461,20 @@ namespace Server.Items public void Serialize( GenericWriter writer ) { - if ( m_House != null && !m_House.Deleted ) + if ( House != null && !House.Deleted ) { writer.Write( (byte) 1 ); // version - writer.Write( m_House ); + writer.Write( House ); } else { writer.Write( (byte) 0 ); // version } - writer.Write( m_Location ); - writer.Write( m_Map ); - writer.Write( m_Description ); + writer.Write( Location ); + writer.Write( Map ); + writer.Write( Description ); } } } diff --git a/Scripts/Items/Skill Items/Magical/Scrolls/SpellScroll.cs b/Scripts/Items/Skill Items/Magical/Scrolls/SpellScroll.cs index c9893361d..32d300ae0 100644 --- a/Scripts/Items/Skill Items/Magical/Scrolls/SpellScroll.cs +++ b/Scripts/Items/Skill Items/Magical/Scrolls/SpellScroll.cs @@ -6,9 +6,7 @@ namespace Server.Items { public class SpellScroll : Item, ICommodity { - private int m_SpellID; - - public int SpellID => m_SpellID; + public int SpellID { get; private set; } int ICommodity.DescriptionNumber => LabelNumber; bool ICommodity.IsDeedable => (Core.ML); @@ -29,7 +27,7 @@ namespace Server.Items Weight = 1.0; Amount = amount; - m_SpellID = spellID; + SpellID = spellID; } public override void Serialize( GenericWriter writer ) @@ -38,7 +36,7 @@ namespace Server.Items writer.Write( (int) 0 ); // version - writer.Write( (int) m_SpellID ); + writer.Write( (int) SpellID ); } public override void Deserialize( GenericReader reader ) @@ -51,7 +49,7 @@ namespace Server.Items { case 0: { - m_SpellID = reader.ReadInt(); + SpellID = reader.ReadInt(); break; } @@ -77,7 +75,7 @@ namespace Server.Items return; } - Spell spell = SpellRegistry.NewSpell( m_SpellID, from, this ); + Spell spell = SpellRegistry.NewSpell( SpellID, from, this ); if ( spell != null ) spell.Cast(); diff --git a/Scripts/Items/Skill Items/Magical/Spellbook.cs b/Scripts/Items/Skill Items/Magical/Spellbook.cs index c7998a754..757ed5f2c 100644 --- a/Scripts/Items/Skill Items/Magical/Spellbook.cs +++ b/Scripts/Items/Skill Items/Magical/Spellbook.cs @@ -317,7 +317,6 @@ namespace Server.Items public virtual int BookCount => 64; private ulong m_Content; - private int m_Count; public override bool AllowSecureTrade( Mobile from, Mobile to, Mobile newOwner, bool accepted ) { @@ -369,7 +368,7 @@ namespace Server.Items if ( val >= 0 && val < BookCount ) { m_Content |= (ulong)1 << val; - ++m_Count; + ++SpellCount; InvalidateProperties(); @@ -393,11 +392,11 @@ namespace Server.Items { m_Content = value; - m_Count = 0; + SpellCount = 0; while ( value > 0 ) { - m_Count += (int)(value & 0x1); + SpellCount += (int)(value & 0x1); value >>= 1; } @@ -407,7 +406,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public int SpellCount => m_Count; + public int SpellCount { get; private set; } [Constructible] public Spellbook() : this( (ulong)0 ) @@ -532,16 +531,16 @@ namespace Server.Items to.Send( new NewSpellbookContent( this, ItemID, BookOffset + 1, m_Content ) ); } else { if (ns.ContainerGridLines) { - to.Send(new SpellbookContent6017(m_Count, BookOffset + 1, m_Content, this)); + to.Send(new SpellbookContent6017(SpellCount, BookOffset + 1, m_Content, this)); } else { - to.Send(new SpellbookContent(m_Count, BookOffset + 1, m_Content, this)); + to.Send(new SpellbookContent(SpellCount, BookOffset + 1, m_Content, this)); } } } else { if ( ns.ContainerGridLines ) { - to.Send( new SpellbookContent6017( m_Count, BookOffset + 1, m_Content, this ) ); + to.Send( new SpellbookContent6017( SpellCount, BookOffset + 1, m_Content, this ) ); } else { - to.Send( new SpellbookContent( m_Count, BookOffset + 1, m_Content, this ) ); + to.Send( new SpellbookContent( SpellCount, BookOffset + 1, m_Content, this ) ); } } } @@ -660,7 +659,7 @@ namespace Server.Items if ( Core.ML && (prop = m_AosAttributes.IncreasedKarmaLoss) != 0 ) list.Add( 1075210, prop.ToString() ); // Increased Karma Loss ~1val~% - list.Add( 1042886, m_Count.ToString() ); // ~1_NUMBERS_OF_SPELLS~ Spells + list.Add( 1042886, SpellCount.ToString() ); // ~1_NUMBERS_OF_SPELLS~ Spells } public override void OnSingleClick( Mobile from ) @@ -670,7 +669,7 @@ namespace Server.Items if ( m_Crafter != null ) LabelTo( from, 1050043, m_Crafter.Name ); // crafted by ~1_NAME~ - LabelTo( from, 1042886, m_Count.ToString() ); + LabelTo( from, 1042886, SpellCount.ToString() ); } public override void OnDoubleClick( Mobile from ) @@ -721,7 +720,7 @@ namespace Server.Items m_AosSkillBonuses.Serialize( writer ); writer.Write( m_Content ); - writer.Write( m_Count ); + writer.Write( SpellCount ); } public override void Deserialize( GenericReader reader ) @@ -765,7 +764,7 @@ namespace Server.Items case 0: { m_Content = reader.ReadULong(); - m_Count = reader.ReadInt(); + SpellCount = reader.ReadInt(); break; } diff --git a/Scripts/Items/Skill Items/Misc/Bandage.cs b/Scripts/Items/Skill Items/Misc/Bandage.cs index b3607ccb8..e4d0cd7ef 100644 --- a/Scripts/Items/Skill Items/Misc/Bandage.cs +++ b/Scripts/Items/Skill Items/Misc/Bandage.cs @@ -157,40 +157,36 @@ namespace Server.Items public class BandageContext { - private Mobile m_Healer; - private Mobile m_Patient; - private int m_Slips; - private Timer m_Timer; + public Mobile Healer { get; } - public Mobile Healer => m_Healer; - public Mobile Patient => m_Patient; - public int Slips{ get => m_Slips; - set => m_Slips = value; - } - public Timer Timer => m_Timer; + public Mobile Patient { get; } + + public int Slips { get; set; } + + public Timer Timer { get; private set; } public void Slip() { - m_Healer.SendLocalizedMessage( 500961 ); // Your fingers slip! - ++m_Slips; + Healer.SendLocalizedMessage( 500961 ); // Your fingers slip! + ++Slips; } public BandageContext( Mobile healer, Mobile patient, TimeSpan delay ) { - m_Healer = healer; - m_Patient = patient; + Healer = healer; + Patient = patient; - m_Timer = new InternalTimer( this, delay ); - m_Timer.Start(); + Timer = new InternalTimer( this, delay ); + Timer.Start(); } public void StopHeal() { - m_Table.Remove( m_Healer ); + m_Table.Remove( Healer ); - m_Timer?.Stop(); + Timer?.Stop(); - m_Timer = null; + Timer = null; } private static Dictionary m_Table = new Dictionary(); @@ -223,38 +219,38 @@ namespace Server.Items bool playSound = true; bool checkSkills = false; - SkillName primarySkill = GetPrimarySkill( m_Patient ); - SkillName secondarySkill = GetSecondarySkill( m_Patient ); + SkillName primarySkill = GetPrimarySkill( Patient ); + SkillName secondarySkill = GetSecondarySkill( Patient ); - BaseCreature petPatient = m_Patient as BaseCreature; + BaseCreature petPatient = Patient as BaseCreature; - if ( !m_Healer.Alive ) + if ( !Healer.Alive ) { healerNumber = 500962; // You were unable to finish your work before you died. patientNumber = -1; playSound = false; } - else if ( !m_Healer.InRange( m_Patient, Bandage.Range ) ) + else if ( !Healer.InRange( Patient, Bandage.Range ) ) { healerNumber = 500963; // You did not stay close enough to heal your target. patientNumber = -1; playSound = false; } - else if ( !m_Patient.Alive || (petPatient != null && petPatient.IsDeadPet) ) + else if ( !Patient.Alive || (petPatient != null && petPatient.IsDeadPet) ) { - double healing = m_Healer.Skills[primarySkill].Value; - double anatomy = m_Healer.Skills[secondarySkill].Value; - double chance = ((healing - 68.0) / 50.0) - (m_Slips * 0.02); + double healing = Healer.Skills[primarySkill].Value; + double anatomy = Healer.Skills[secondarySkill].Value; + double chance = ((healing - 68.0) / 50.0) - (Slips * 0.02); if (( (checkSkills = (healing >= 80.0 && anatomy >= 80.0)) && chance > Utility.RandomDouble() ) - || ( Core.SE && petPatient is Factions.FactionWarHorse && petPatient.ControlMaster == m_Healer) ) //TODO: Dbl check doesn't check for faction of the horse here? + || ( Core.SE && petPatient is Factions.FactionWarHorse && petPatient.ControlMaster == Healer) ) //TODO: Dbl check doesn't check for faction of the horse here? { - if ( m_Patient.Map == null || !m_Patient.Map.CanFit( m_Patient.Location, 16, false, false ) ) + if ( Patient.Map == null || !Patient.Map.CanFit( Patient.Location, 16, false, false ) ) { healerNumber = 501042; // Target can not be resurrected at that location. patientNumber = 502391; // Thou can not be resurrected there! } - else if ( m_Patient.Region != null && m_Patient.Region.IsPartOf( "Khaldun" ) ) + else if ( Patient.Region != null && Patient.Region.IsPartOf( "Khaldun" ) ) { healerNumber = 1010395; // The veil of death in this area is too strong and resists thy efforts to restore life. patientNumber = -1; @@ -264,14 +260,14 @@ namespace Server.Items healerNumber = 500965; // You are able to resurrect your patient. patientNumber = -1; - m_Patient.PlaySound( 0x214 ); - m_Patient.FixedEffect( 0x376A, 10, 16 ); + Patient.PlaySound( 0x214 ); + Patient.FixedEffect( 0x376A, 10, 16 ); if ( petPatient != null && petPatient.IsDeadPet ) { Mobile master = petPatient.ControlMaster; - if ( master != null && m_Healer == master ) + if ( master != null && Healer == master ) { petPatient.ResurrectPet(); @@ -285,7 +281,7 @@ namespace Server.Items healerNumber = 503255; // You are able to resurrect the creature. master.CloseGump( typeof( PetResurrectGump ) ); - master.SendGump( new PetResurrectGump( m_Healer, petPatient ) ); + master.SendGump( new PetResurrectGump( Healer, petPatient ) ); } else { @@ -302,7 +298,7 @@ namespace Server.Items healerNumber = 503255; // You are able to resurrect the creature. friend.CloseGump( typeof( PetResurrectGump ) ); - friend.SendGump( new PetResurrectGump( m_Healer, petPatient ) ); + friend.SendGump( new PetResurrectGump( Healer, petPatient ) ); found = true; break; @@ -315,8 +311,8 @@ namespace Server.Items } else { - m_Patient.CloseGump( typeof( ResurrectGump ) ); - m_Patient.SendGump( new ResurrectGump( m_Patient, m_Healer ) ); + Patient.CloseGump( typeof( ResurrectGump ) ); + Patient.SendGump( new ResurrectGump( Patient, Healer ) ); } } } @@ -330,19 +326,19 @@ namespace Server.Items patientNumber = -1; } } - else if ( m_Patient.Poisoned ) + else if ( Patient.Poisoned ) { - m_Healer.SendLocalizedMessage( 500969 ); // You finish applying the bandages. + Healer.SendLocalizedMessage( 500969 ); // You finish applying the bandages. - double healing = m_Healer.Skills[primarySkill].Value; - double anatomy = m_Healer.Skills[secondarySkill].Value; - double chance = ((healing - 30.0) / 50.0) - (m_Patient.Poison.Level * 0.1) - (m_Slips * 0.02); + double healing = Healer.Skills[primarySkill].Value; + double anatomy = Healer.Skills[secondarySkill].Value; + double chance = ((healing - 30.0) / 50.0) - (Patient.Poison.Level * 0.1) - (Slips * 0.02); if ( (checkSkills = (healing >= 60.0 && anatomy >= 60.0)) && chance > Utility.RandomDouble() ) { - if ( m_Patient.CurePoison( m_Healer ) ) + if ( Patient.CurePoison( Healer ) ) { - healerNumber = (m_Healer == m_Patient) ? -1 : 1010058; // You have cured the target of all poisons. + healerNumber = (Healer == Patient) ? -1 : 1010058; // You have cured the target of all poisons. patientNumber = 1010059; // You have been cured of all poisons. } else @@ -357,20 +353,20 @@ namespace Server.Items patientNumber = -1; } } - else if ( BleedAttack.IsBleeding( m_Patient ) ) + else if ( BleedAttack.IsBleeding( Patient ) ) { healerNumber = 1060088; // You bind the wound and stop the bleeding patientNumber = 1060167; // The bleeding wounds have healed, you are no longer bleeding! - BleedAttack.EndBleed( m_Patient, false ); + BleedAttack.EndBleed( Patient, false ); } - else if ( MortalStrike.IsWounded( m_Patient ) ) + else if ( MortalStrike.IsWounded( Patient ) ) { - healerNumber = ( m_Healer == m_Patient ? 1005000 : 1010398 ); + healerNumber = ( Healer == Patient ? 1005000 : 1010398 ); patientNumber = -1; playSound = false; } - else if ( m_Patient.Hits == m_Patient.HitsMax ) + else if ( Patient.Hits == Patient.HitsMax ) { healerNumber = 500967; // You heal what little damage your patient had. patientNumber = -1; @@ -380,9 +376,9 @@ namespace Server.Items checkSkills = true; patientNumber = -1; - double healing = m_Healer.Skills[primarySkill].Value; - double anatomy = m_Healer.Skills[secondarySkill].Value; - double chance = ((healing + 10.0) / 100.0) - (m_Slips * 0.02); + double healing = Healer.Skills[primarySkill].Value; + double anatomy = Healer.Skills[secondarySkill].Value; + double chance = ((healing + 10.0) / 100.0) - (Slips * 0.02); if ( chance > Utility.RandomDouble() ) { @@ -403,13 +399,13 @@ namespace Server.Items double toHeal = min + (Utility.RandomDouble() * (max - min)); - if ( m_Patient.Body.IsMonster || m_Patient.Body.IsAnimal ) - toHeal += m_Patient.HitsMax / 100; + if ( Patient.Body.IsMonster || Patient.Body.IsAnimal ) + toHeal += Patient.HitsMax / 100; if ( Core.AOS ) - toHeal -= toHeal * m_Slips * 0.35; // TODO: Verify algorithm + toHeal -= toHeal * Slips * 0.35; // TODO: Verify algorithm else - toHeal -= m_Slips * 4; + toHeal -= Slips * 4; if ( toHeal < 1 ) { @@ -417,7 +413,7 @@ namespace Server.Items healerNumber = 500968; // You apply the bandages, but they barely help. } - m_Patient.Heal( (int) toHeal, m_Healer, false ); + Patient.Heal( (int) toHeal, Healer, false ); } else { @@ -427,18 +423,18 @@ namespace Server.Items } if ( healerNumber != -1 ) - m_Healer.SendLocalizedMessage( healerNumber ); + Healer.SendLocalizedMessage( healerNumber ); if ( patientNumber != -1 ) - m_Patient.SendLocalizedMessage( patientNumber ); + Patient.SendLocalizedMessage( patientNumber ); if ( playSound ) - m_Patient.PlaySound( 0x57 ); + Patient.PlaySound( 0x57 ); if ( checkSkills ) { - m_Healer.CheckSkill( secondarySkill, 0.0, 120.0 ); - m_Healer.CheckSkill( primarySkill, 0.0, 120.0 ); + Healer.CheckSkill( secondarySkill, 0.0, 120.0 ); + Healer.CheckSkill( primarySkill, 0.0, 120.0 ); } } diff --git a/Scripts/Items/Skill Items/Misc/RepairDeed.cs b/Scripts/Items/Skill Items/Misc/RepairDeed.cs index 0bb8ff965..af7fa247f 100644 --- a/Scripts/Items/Skill Items/Misc/RepairDeed.cs +++ b/Scripts/Items/Skill Items/Misc/RepairDeed.cs @@ -9,23 +9,21 @@ namespace Server.Items { private class RepairSkillInfo { - private CraftSystem m_System; - private Type[] m_NearbyTypes; - private TextDefinition m_NotNearbyMessage, m_Name; + public TextDefinition NotNearbyMessage { get; } - public TextDefinition NotNearbyMessage => m_NotNearbyMessage; - public TextDefinition Name => m_Name; + public TextDefinition Name { get; } - public CraftSystem System => m_System; - public Type[] NearbyTypes => m_NearbyTypes; + public CraftSystem System { get; } + + public Type[] NearbyTypes { get; } public RepairSkillInfo( CraftSystem system, Type[] nearbyTypes, TextDefinition notNearbyMessage, TextDefinition name ) { - m_System = system; - m_NearbyTypes = nearbyTypes; - m_NotNearbyMessage = notNearbyMessage; - m_Name = name; + System = system; + NearbyTypes = nearbyTypes; + NotNearbyMessage = notNearbyMessage; + Name = name; } public RepairSkillInfo( CraftSystem system, Type nearbyType, TextDefinition notNearbyMessage, TextDefinition name ) @@ -33,23 +31,23 @@ namespace Server.Items { } - public static RepairSkillInfo[] Table => m_Table; - private static RepairSkillInfo[] m_Table = { - new RepairSkillInfo( DefBlacksmithy.CraftSystem, typeof( Blacksmith ), 1047013, 1023015 ), - new RepairSkillInfo( DefTailoring.CraftSystem, typeof( Tailor ), 1061132, 1022981 ), - new RepairSkillInfo( DefTinkering.CraftSystem, typeof( Tinker ), 1061166, 1022983 ), - new RepairSkillInfo( DefCarpentry.CraftSystem, typeof( Carpenter ), 1061135, 1060774 ), - new RepairSkillInfo( DefBowFletching.CraftSystem, typeof( Bowyer ), 1061134, 1023005 ) - }; + public static RepairSkillInfo[] Table { get; } = + { + new RepairSkillInfo( DefBlacksmithy.CraftSystem, typeof( Blacksmith ), 1047013, 1023015 ), + new RepairSkillInfo( DefTailoring.CraftSystem, typeof( Tailor ), 1061132, 1022981 ), + new RepairSkillInfo( DefTinkering.CraftSystem, typeof( Tinker ), 1061166, 1022983 ), + new RepairSkillInfo( DefCarpentry.CraftSystem, typeof( Carpenter ), 1061135, 1060774 ), + new RepairSkillInfo( DefBowFletching.CraftSystem, typeof( Bowyer ), 1061134, 1023005 ) + }; public static RepairSkillInfo GetInfo( RepairSkillType type ) { int v = (int)type; - if ( v < 0 || v >= m_Table.Length ) + if ( v < 0 || v >= Table.Length ) v = 0; - return m_Table[v]; + return Table[v]; } } public enum RepairSkillType diff --git a/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs b/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs index 6a98c0372..b00968bfe 100644 --- a/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs +++ b/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs @@ -18,25 +18,16 @@ namespace Server.Items public abstract class BaseInstrument : Item, ICraftable, ISlayer { - private int m_WellSound, m_BadlySound; private SlayerName m_Slayer, m_Slayer2; private InstrumentQuality m_Quality; private Mobile m_Crafter; private int m_UsesRemaining; [CommandProperty( AccessLevel.GameMaster )] - public int SuccessSound - { - get => m_WellSound; - set => m_WellSound = value; - } + public int SuccessSound { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int FailureSound - { - get => m_BadlySound; - set => m_BadlySound = value; - } + public int FailureSound { get; set; } [CommandProperty( AccessLevel.GameMaster )] public SlayerName Slayer @@ -323,8 +314,8 @@ namespace Server.Items public BaseInstrument( int itemID, int wellSound, int badlySound ) : base( itemID ) { - m_WellSound = wellSound; - m_BadlySound = badlySound; + SuccessSound = wellSound; + FailureSound = badlySound; UsesRemaining = Utility.RandomMinMax( InitMinUses, InitMaxUses ); } @@ -440,8 +431,8 @@ namespace Server.Items writer.WriteEncodedInt( (int)UsesRemaining ); - writer.WriteEncodedInt( (int) m_WellSound ); - writer.WriteEncodedInt( (int) m_BadlySound ); + writer.WriteEncodedInt( (int) SuccessSound ); + writer.WriteEncodedInt( (int) FailureSound ); } public override void Deserialize( GenericReader reader ) @@ -471,8 +462,8 @@ namespace Server.Items UsesRemaining = reader.ReadEncodedInt(); - m_WellSound = reader.ReadEncodedInt(); - m_BadlySound = reader.ReadEncodedInt(); + SuccessSound = reader.ReadEncodedInt(); + FailureSound = reader.ReadEncodedInt(); break; } @@ -485,15 +476,15 @@ namespace Server.Items UsesRemaining = reader.ReadEncodedInt(); - m_WellSound = reader.ReadEncodedInt(); - m_BadlySound = reader.ReadEncodedInt(); + SuccessSound = reader.ReadEncodedInt(); + FailureSound = reader.ReadEncodedInt(); break; } case 0: { - m_WellSound = reader.ReadInt(); - m_BadlySound = reader.ReadInt(); + SuccessSound = reader.ReadInt(); + FailureSound = reader.ReadInt(); UsesRemaining = Utility.RandomMinMax( InitMinUses, InitMaxUses ); break; @@ -536,12 +527,12 @@ namespace Server.Items public void PlayInstrumentWell( Mobile from ) { - from.PlaySound( m_WellSound ); + from.PlaySound( SuccessSound ); } public void PlayInstrumentBadly( Mobile from ) { - from.PlaySound( m_BadlySound ); + from.PlaySound( FailureSound ); } private class InternalTimer : Timer diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/CustomHuePicker.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/CustomHuePicker.cs index 696cceffc..52fadb5b8 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/CustomHuePicker.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/CustomHuePicker.cs @@ -5,58 +5,53 @@ namespace Server.Items { public class CustomHueGroup { - private int m_Name; - private string m_NameString; - private int[] m_Hues; + public int Name { get; } - public int Name => m_Name; - public string NameString => m_NameString; + public string NameString { get; } - public int[] Hues => m_Hues; + public int[] Hues { get; } public CustomHueGroup( int name, int[] hues ) { - m_Name = name; - m_Hues = hues; + Name = name; + Hues = hues; } public CustomHueGroup( string name, int[] hues ) { - m_NameString = name; - m_Hues = hues; + NameString = name; + Hues = hues; } } public class CustomHuePicker { - private CustomHueGroup[] m_Groups; - private bool m_DefaultSupported; - private int m_Title; - private string m_TitleString; + public bool DefaultSupported { get; } - public bool DefaultSupported => m_DefaultSupported; - public CustomHueGroup[] Groups => m_Groups; - public int Title => m_Title; - public string TitleString => m_TitleString; + public CustomHueGroup[] Groups { get; } + + public int Title { get; } + + public string TitleString { get; } public CustomHuePicker( CustomHueGroup[] groups, bool defaultSupported ) { - m_Groups = groups; - m_DefaultSupported = defaultSupported; + Groups = groups; + DefaultSupported = defaultSupported; } public CustomHuePicker( CustomHueGroup[] groups, bool defaultSupported, int title ) { - m_Groups = groups; - m_DefaultSupported = defaultSupported; - m_Title = title; + Groups = groups; + DefaultSupported = defaultSupported; + Title = title; } public CustomHuePicker( CustomHueGroup[] groups, bool defaultSupported, string title ) { - m_Groups = groups; - m_DefaultSupported = defaultSupported; - m_TitleString = title; + Groups = groups; + DefaultSupported = defaultSupported; + TitleString = title; } public static readonly CustomHuePicker SpecialDyeTub = new CustomHuePicker( new[] diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs index 60eb198fc..cad02af27 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs @@ -15,7 +15,6 @@ namespace Server.Items { private bool m_Redyable; private int m_DyedHue; - private SecureLevel m_SecureLevel; public virtual CustomHuePicker CustomHuePicker => null; @@ -35,7 +34,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (int)m_SecureLevel ); + writer.Write( (int)Level ); writer.Write( (bool) m_Redyable ); writer.Write( (int) m_DyedHue ); } @@ -50,7 +49,7 @@ namespace Server.Items { case 1: { - m_SecureLevel = (SecureLevel)reader.ReadInt(); + Level = (SecureLevel)reader.ReadInt(); goto case 0; } case 0: @@ -85,11 +84,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public SecureLevel Level - { - get => m_SecureLevel; - set => m_SecureLevel = value; - } + public SecureLevel Level { get; set; } [Constructible] public DyeTub() : base( 0xFAB ) diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/FurnitureDyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/FurnitureDyeTub.cs index 91686bbcd..0cc06a033 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/FurnitureDyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/FurnitureDyeTub.cs @@ -8,14 +8,8 @@ namespace Server.Items public override int FailMessage => 501021; // That is not a piece of furniture. public override int LabelNumber => 1041246; // Furniture Dye Tub - private bool m_IsRewardItem; - [CommandProperty( AccessLevel.GameMaster )] - public bool IsRewardItem - { - get => m_IsRewardItem; - set => m_IsRewardItem = value; - } + public bool IsRewardItem { get; set; } [Constructible] public FurnitureDyeTub() @@ -25,7 +19,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if ( m_IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) ) + if ( IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) ) return; base.OnDoubleClick( from ); @@ -39,7 +33,7 @@ namespace Server.Items { base.GetProperties( list ); - if ( Core.ML && m_IsRewardItem ) + if ( Core.ML && IsRewardItem ) list.Add( 1076217 ); // 1st Year Veteran Reward } @@ -49,7 +43,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (bool) m_IsRewardItem ); + writer.Write( (bool) IsRewardItem ); } public override void Deserialize( GenericReader reader ) @@ -62,7 +56,7 @@ namespace Server.Items { case 1: { - m_IsRewardItem = reader.ReadBool(); + IsRewardItem = reader.ReadBool(); break; } } diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/LeatherDyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/LeatherDyeTub.cs index 1d8053252..17f106b78 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/LeatherDyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/LeatherDyeTub.cs @@ -9,14 +9,8 @@ namespace Server.Items public override int LabelNumber => 1041284; // Leather Dye Tub public override CustomHuePicker CustomHuePicker => CustomHuePicker.LeatherDyeTub; - private bool m_IsRewardItem; - [CommandProperty( AccessLevel.GameMaster )] - public bool IsRewardItem - { - get => m_IsRewardItem; - set => m_IsRewardItem = value; - } + public bool IsRewardItem { get; set; } [Constructible] public LeatherDyeTub() @@ -26,7 +20,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if ( m_IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) ) + if ( IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) ) return; base.OnDoubleClick( from ); @@ -40,7 +34,7 @@ namespace Server.Items { base.GetProperties( list ); - if ( Core.ML && m_IsRewardItem ) + if ( Core.ML && IsRewardItem ) list.Add( 1076218 ); // 2nd Year Veteran Reward } @@ -50,7 +44,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (bool) m_IsRewardItem ); + writer.Write( (bool) IsRewardItem ); } public override void Deserialize( GenericReader reader ) @@ -63,7 +57,7 @@ namespace Server.Items { case 1: { - m_IsRewardItem = reader.ReadBool(); + IsRewardItem = reader.ReadBool(); break; } } diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RewardBlackDyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RewardBlackDyeTub.cs index f5fa77487..8c6fc8fa1 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RewardBlackDyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RewardBlackDyeTub.cs @@ -4,14 +4,8 @@ namespace Server.Items { public override int LabelNumber => 1006008; // Black Dye Tub - private bool m_IsRewardItem; - [CommandProperty( AccessLevel.GameMaster )] - public bool IsRewardItem - { - get => m_IsRewardItem; - set => m_IsRewardItem = value; - } + public bool IsRewardItem { get; set; } [Constructible] public RewardBlackDyeTub() @@ -23,7 +17,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if ( m_IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) ) + if ( IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) ) return; base.OnDoubleClick( from ); @@ -37,7 +31,7 @@ namespace Server.Items { base.GetProperties( list ); - if ( Core.ML && m_IsRewardItem ) + if ( Core.ML && IsRewardItem ) list.Add( 1076217 ); // 1st Year Veteran Reward } @@ -47,7 +41,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (bool) m_IsRewardItem ); + writer.Write( (bool) IsRewardItem ); } public override void Deserialize( GenericReader reader ) @@ -60,7 +54,7 @@ namespace Server.Items { case 1: { - m_IsRewardItem = reader.ReadBool(); + IsRewardItem = reader.ReadBool(); break; } } diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RunebookDyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RunebookDyeTub.cs index 6a1b90333..49fd474dd 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RunebookDyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RunebookDyeTub.cs @@ -9,14 +9,8 @@ namespace Server.Items public override int LabelNumber => 1049740; // Runebook Dye Tub public override CustomHuePicker CustomHuePicker => CustomHuePicker.LeatherDyeTub; - private bool m_IsRewardItem; - [CommandProperty( AccessLevel.GameMaster )] - public bool IsRewardItem - { - get => m_IsRewardItem; - set => m_IsRewardItem = value; - } + public bool IsRewardItem { get; set; } [Constructible] public RunebookDyeTub() @@ -26,7 +20,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if ( m_IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) ) + if ( IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) ) return; base.OnDoubleClick( from ); @@ -40,7 +34,7 @@ namespace Server.Items { base.GetProperties( list ); - if ( Core.ML && m_IsRewardItem ) + if ( Core.ML && IsRewardItem ) list.Add( 1076220 ); // 4th Year Veteran Reward } @@ -50,7 +44,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (bool) m_IsRewardItem ); + writer.Write( (bool) IsRewardItem ); } public override void Deserialize( GenericReader reader ) @@ -63,7 +57,7 @@ namespace Server.Items { case 1: { - m_IsRewardItem = reader.ReadBool(); + IsRewardItem = reader.ReadBool(); break; } } diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/SpecialDyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/SpecialDyeTub.cs index c388f3015..cefa6ca0a 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/SpecialDyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/SpecialDyeTub.cs @@ -7,14 +7,8 @@ namespace Server.Items public override CustomHuePicker CustomHuePicker => CustomHuePicker.SpecialDyeTub; public override int LabelNumber => 1041285; // Special Dye Tub - private bool m_IsRewardItem; - [CommandProperty( AccessLevel.GameMaster )] - public bool IsRewardItem - { - get => m_IsRewardItem; - set => m_IsRewardItem = value; - } + public bool IsRewardItem { get; set; } [Constructible] public SpecialDyeTub() @@ -24,7 +18,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + if ( IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) return; base.OnDoubleClick( from ); @@ -38,7 +32,7 @@ namespace Server.Items { base.GetProperties( list ); - if ( Core.ML && m_IsRewardItem ) + if ( Core.ML && IsRewardItem ) list.Add( 1076217 ); // 1st Year Veteran Reward } @@ -48,7 +42,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (bool) m_IsRewardItem ); + writer.Write( (bool) IsRewardItem ); } public override void Deserialize( GenericReader reader ) @@ -61,7 +55,7 @@ namespace Server.Items { case 1: { - m_IsRewardItem = reader.ReadBool(); + IsRewardItem = reader.ReadBool(); break; } } diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/StatuetteDyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/StatuetteDyeTub.cs index 66ff29be0..f58f9baaf 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/StatuetteDyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/StatuetteDyeTub.cs @@ -9,14 +9,8 @@ namespace Server.Items public override int LabelNumber => 1049741; // Reward Statuette Dye Tub public override CustomHuePicker CustomHuePicker => CustomHuePicker.LeatherDyeTub; - private bool m_IsRewardItem; - [CommandProperty( AccessLevel.GameMaster )] - public bool IsRewardItem - { - get => m_IsRewardItem; - set => m_IsRewardItem = value; - } + public bool IsRewardItem { get; set; } [Constructible] public StatuetteDyeTub() @@ -26,7 +20,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if ( m_IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) ) + if ( IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) ) return; base.OnDoubleClick( from ); @@ -40,7 +34,7 @@ namespace Server.Items { base.GetProperties( list ); - if ( Core.ML && m_IsRewardItem ) + if ( Core.ML && IsRewardItem ) list.Add( 1076221 ); // 5th Year Veteran Reward } @@ -50,7 +44,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (bool) m_IsRewardItem ); + writer.Write( (bool) IsRewardItem ); } public override void Deserialize( GenericReader reader ) @@ -63,7 +57,7 @@ namespace Server.Items { case 1: { - m_IsRewardItem = reader.ReadBool(); + IsRewardItem = reader.ReadBool(); break; } } diff --git a/Scripts/Items/Skill Items/Thief/DisguiseKit.cs b/Scripts/Items/Skill Items/Thief/DisguiseKit.cs index 34df71f7f..f7efae3d8 100644 --- a/Scripts/Items/Skill Items/Thief/DisguiseKit.cs +++ b/Scripts/Items/Skill Items/Thief/DisguiseKit.cs @@ -301,25 +301,25 @@ namespace Server.Items public static void CreateTimer( Mobile m, TimeSpan delay ) { if ( m != null ) - if ( !m_Timers.ContainsKey( m ) ) - m_Timers[m] = new InternalTimer( m, delay ); + if ( !Timers.ContainsKey( m ) ) + Timers[m] = new InternalTimer( m, delay ); } public static void StartTimer( Mobile m ) { - m_Timers.TryGetValue( m, out Timer t ); + Timers.TryGetValue( m, out Timer t ); t?.Start(); } public static bool IsDisguised( Mobile m ) { - return m_Timers.ContainsKey( m ); + return Timers.ContainsKey( m ); } public static bool StopTimer( Mobile m ) { - m_Timers.TryGetValue( m, out Timer t ); + Timers.TryGetValue( m, out Timer t ); if ( t != null ) { @@ -336,12 +336,12 @@ namespace Server.Items public static bool RemoveTimer( Mobile m ) { - m_Timers.TryGetValue( m, out Timer t ); + Timers.TryGetValue( m, out Timer t ); if ( t != null ) { t.Stop(); - m_Timers.Remove( m ); + Timers.Remove( m ); } return ( t != null ); @@ -349,7 +349,7 @@ namespace Server.Items public static TimeSpan TimeRemaining( Mobile m ) { - m_Timers.TryGetValue( m, out Timer t ); + Timers.TryGetValue( m, out Timer t ); if ( t != null ) { @@ -359,8 +359,6 @@ namespace Server.Items return TimeSpan.Zero; } - private static Dictionary m_Timers = new Dictionary(); - - public static Dictionary Timers => m_Timers; + public static Dictionary Timers { get; } = new Dictionary(); } } diff --git a/Scripts/Items/Skill Items/Thief/DisguisePersistance.cs b/Scripts/Items/Skill Items/Thief/DisguisePersistance.cs index 67bf6b9db..fecbae57d 100644 --- a/Scripts/Items/Skill Items/Thief/DisguisePersistance.cs +++ b/Scripts/Items/Skill Items/Thief/DisguisePersistance.cs @@ -5,9 +5,7 @@ namespace Server.Items { public class DisguisePersistance : Item { - private static DisguisePersistance m_Instance; - - public static DisguisePersistance Instance => m_Instance; + public static DisguisePersistance Instance { get; private set; } public override string DefaultName => "Disguise Persistance - Internal"; @@ -15,15 +13,15 @@ namespace Server.Items { Movable = false; - if ( m_Instance == null || m_Instance.Deleted ) - m_Instance = this; + if ( Instance == null || Instance.Deleted ) + Instance = this; else base.Delete(); } public DisguisePersistance( Serial serial ) : base( serial ) { - m_Instance = this; + Instance = this; } public override void Serialize( GenericWriter writer ) diff --git a/Scripts/Items/Skill Items/Tinkering/Clocks.cs b/Scripts/Items/Skill Items/Tinkering/Clocks.cs index edc2ee015..f0725af8b 100644 --- a/Scripts/Items/Skill Items/Tinkering/Clocks.cs +++ b/Scripts/Items/Skill Items/Tinkering/Clocks.cs @@ -17,13 +17,11 @@ namespace Server.Items [Flippable( 0x104B, 0x104C )] public class Clock : Item { - private static DateTime m_ServerStart; - - public static DateTime ServerStart => m_ServerStart; + public static DateTime ServerStart { get; private set; } public static void Initialize() { - m_ServerStart = DateTime.UtcNow; + ServerStart = DateTime.UtcNow; } [Constructible] diff --git a/Scripts/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicBox.cs b/Scripts/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicBox.cs index 161d3d00c..b254b5452 100644 --- a/Scripts/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicBox.cs +++ b/Scripts/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicBox.cs @@ -22,32 +22,24 @@ namespace Server.Items { public override int LabelNumber => 1075198; // Dawn�s Music Box - private List m_Tracks; - - public List Tracks => m_Tracks; - - private SecureLevel m_Level; + public List Tracks { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public SecureLevel Level - { - get => m_Level; - set => m_Level = value; - } + public SecureLevel Level { get; set; } [Constructible] public DawnsMusicBox() : base( 0x2AF9 ) { Weight = 1.0; - m_Tracks = new List(); + Tracks = new List(); - while ( m_Tracks.Count < 4 ) + while ( Tracks.Count < 4 ) { MusicName name = RandomTrack( DawnsMusicRarity.Common ); - if ( !m_Tracks.Contains( name ) ) - m_Tracks.Add( name ); + if ( !Tracks.Contains( name ) ) + Tracks.Add( name ); } } @@ -60,8 +52,8 @@ namespace Server.Items if ( !(newItem is DawnsMusicBox box) ) return; - box.m_Tracks = new List(); - box.m_Tracks.AddRange( m_Tracks ); + box.Tracks = new List(); + box.Tracks.AddRange( Tracks ); } public override void GetProperties( ObjectPropertyList list ) @@ -72,9 +64,9 @@ namespace Server.Items int uncommonSongs = 0; int rareSongs = 0; - for ( int i = 0; i < m_Tracks.Count; i++ ) + for ( int i = 0; i < Tracks.Count; i++ ) { - DawnsMusicInfo info = GetInfo( m_Tracks[ i ] ); + DawnsMusicInfo info = GetInfo( Tracks[ i ] ); switch ( info.Rarity ) { @@ -169,12 +161,12 @@ namespace Server.Items writer.WriteEncodedInt( 0 ); // version - writer.Write( (int) m_Tracks.Count ); + writer.Write( (int) Tracks.Count ); - for ( int i = 0; i < m_Tracks.Count; i++ ) - writer.Write( (int) m_Tracks[ i ] ); + for ( int i = 0; i < Tracks.Count; i++ ) + writer.Write( (int) Tracks[ i ] ); - writer.Write( (int) m_Level ); + writer.Write( (int) Level ); writer.Write( (int) m_ItemID ); } @@ -185,12 +177,12 @@ namespace Server.Items int version = reader.ReadEncodedInt(); int count = reader.ReadInt(); - m_Tracks = new List(); + Tracks = new List(); for ( int i = 0; i < count; i++ ) - m_Tracks.Add( (MusicName) reader.ReadInt() ); + Tracks.Add( (MusicName) reader.ReadInt() ); - m_Level = (SecureLevel) reader.ReadInt(); + Level = (SecureLevel) reader.ReadInt(); m_ItemID = reader.ReadInt(); } diff --git a/Scripts/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicGear.cs b/Scripts/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicGear.cs index 43fadd80e..01df62595 100644 --- a/Scripts/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicGear.cs +++ b/Scripts/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicGear.cs @@ -11,14 +11,8 @@ namespace Server.Items public static DawnsMusicGear RandomRare => new DawnsMusicGear( DawnsMusicBox.RandomTrack( DawnsMusicRarity.Rare ) ); - private MusicName m_Music; - [CommandProperty( AccessLevel.GameMaster )] - public MusicName Music - { - get => m_Music; - set => m_Music = value; - } + public MusicName Music { get; set; } [Constructible] public DawnsMusicGear() : this( DawnsMusicBox.RandomTrack( DawnsMusicRarity.Common ) ) @@ -28,7 +22,7 @@ namespace Server.Items [Constructible] public DawnsMusicGear( MusicName music ) : base( 0x1053 ) { - m_Music = music; + Music = music; Weight = 1.0; } @@ -39,7 +33,7 @@ namespace Server.Items public override void AddNameProperty( ObjectPropertyList list ) { - DawnsMusicInfo info = DawnsMusicBox.GetInfo( m_Music ); + DawnsMusicInfo info = DawnsMusicBox.GetInfo( Music ); if ( info != null ) { @@ -67,7 +61,7 @@ namespace Server.Items writer.WriteEncodedInt( (int) 1 ); // version - writer.Write( (int) m_Music ); + writer.Write( (int) Music ); } public override void Deserialize( GenericReader reader ) @@ -80,7 +74,7 @@ namespace Server.Items { case 1: { - m_Music = (MusicName) reader.ReadInt(); + Music = (MusicName) reader.ReadInt(); break; } } @@ -97,7 +91,7 @@ namespace Server.Items else rarity = DawnsMusicRarity.Common; - m_Music = DawnsMusicBox.RandomTrack( rarity ); + Music = DawnsMusicBox.RandomTrack( rarity ); } } diff --git a/Scripts/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicInfo.cs b/Scripts/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicInfo.cs index 08d61fc20..7b1e64d15 100644 --- a/Scripts/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicInfo.cs +++ b/Scripts/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicInfo.cs @@ -9,18 +9,14 @@ public class DawnsMusicInfo { - private int m_Name; + public int Name { get; } - public int Name => m_Name; - - private DawnsMusicRarity m_Rarity; - - public DawnsMusicRarity Rarity => m_Rarity; + public DawnsMusicRarity Rarity { get; } public DawnsMusicInfo( int name, DawnsMusicRarity rarity ) { - m_Name = name; - m_Rarity = rarity; + Name = name; + Rarity = rarity; } } } diff --git a/Scripts/Items/Special/Gifts/RoseOfTrinsic.cs b/Scripts/Items/Special/Gifts/RoseOfTrinsic.cs index 7fe6cebf7..930984c61 100644 --- a/Scripts/Items/Special/Gifts/RoseOfTrinsic.cs +++ b/Scripts/Items/Special/Gifts/RoseOfTrinsic.cs @@ -16,16 +16,10 @@ namespace Server.Items private DateTime m_NextSpawnTime; private SpawnTimer m_SpawnTimer; - private SecureLevel m_Level; - public override int LabelNumber => 1062913; // Rose of Trinsic [CommandProperty( AccessLevel.GameMaster )] - public SecureLevel Level - { - get => m_Level; - set => m_Level = value; - } + public SecureLevel Level { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int Petals @@ -142,7 +136,7 @@ namespace Server.Items writer.WriteEncodedInt( (int) m_Petals ); writer.WriteDeltaTime( (DateTime) m_NextSpawnTime ); - writer.WriteEncodedInt( (int) m_Level ); + writer.WriteEncodedInt( (int) Level ); } public override void Deserialize(GenericReader reader) @@ -153,7 +147,7 @@ namespace Server.Items m_Petals = reader.ReadEncodedInt(); m_NextSpawnTime = reader.ReadDeltaTime(); - m_Level = (SecureLevel) reader.ReadEncodedInt(); + Level = (SecureLevel) reader.ReadEncodedInt(); if ( m_Petals < 10 ) StartSpawnTimer( m_NextSpawnTime - DateTime.UtcNow ); diff --git a/Scripts/Items/Special/Gifts/TapestryOfSosaria.cs b/Scripts/Items/Special/Gifts/TapestryOfSosaria.cs index 60aa26932..a5045f49c 100644 --- a/Scripts/Items/Special/Gifts/TapestryOfSosaria.cs +++ b/Scripts/Items/Special/Gifts/TapestryOfSosaria.cs @@ -9,16 +9,10 @@ namespace Server.Items [FlippableAttribute( 0x234E, 0x234F )] public class TapestryOfSosaria : Item, ISecurable { - private SecureLevel m_Level; - public override int LabelNumber => 1062917; // The Tapestry of Sosaria [CommandProperty( AccessLevel.GameMaster )] - public SecureLevel Level - { - get => m_Level; - set => m_Level = value; - } + public SecureLevel Level { get; set; } [Constructible] public TapestryOfSosaria() : base( 0x234E ) @@ -65,7 +59,7 @@ namespace Server.Items writer.WriteEncodedInt( (int) 0 ); // version - writer.WriteEncodedInt( (int) m_Level ); + writer.WriteEncodedInt( (int) Level ); } public override void Deserialize(GenericReader reader) @@ -74,7 +68,7 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - m_Level = (SecureLevel) reader.ReadEncodedInt(); + Level = (SecureLevel) reader.ReadEncodedInt(); } } } diff --git a/Scripts/Items/Special/Heritage Items/Curtains.cs b/Scripts/Items/Special/Heritage Items/Curtains.cs index 24ebd5da0..8ef6abee6 100644 --- a/Scripts/Items/Special/Heritage Items/Curtains.cs +++ b/Scripts/Items/Special/Heritage Items/Curtains.cs @@ -8,18 +8,12 @@ namespace Server.Items public override int LabelNumber => 1076280; // Curtains public override bool DisplayWeight => false; - private int m_ClosedID; - [CommandProperty( AccessLevel.GameMaster )] - public int ClosedID - { - get => m_ClosedID; - set => m_ClosedID = value; - } + public int ClosedID { get; set; } public CurtainsComponent( int itemID, int closedID ) : base( itemID ) { - m_ClosedID = closedID; + ClosedID = closedID; } public CurtainsComponent( Serial serial ) : base( serial ) @@ -55,7 +49,7 @@ namespace Server.Items writer.WriteEncodedInt( 0 ); // version - writer.Write( (int) m_ClosedID ); + writer.Write( (int) ClosedID ); } public override void Deserialize( GenericReader reader ) @@ -64,7 +58,7 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - m_ClosedID = reader.ReadInt(); + ClosedID = reader.ReadInt(); } #region IDyable diff --git a/Scripts/Items/Special/Holiday/Christmas/HolidayTree.cs b/Scripts/Items/Special/Holiday/Christmas/HolidayTree.cs index f69537447..3dde06d75 100644 --- a/Scripts/Items/Special/Holiday/Christmas/HolidayTree.cs +++ b/Scripts/Items/Special/Holiday/Christmas/HolidayTree.cs @@ -13,14 +13,9 @@ namespace Server.Items public class HolidayTree : Item, IAddon { private ArrayList m_Components; - private Mobile m_Placer; [CommandProperty( AccessLevel.GameMaster )] - public Mobile Placer - { - get => m_Placer; - set => m_Placer = value; - } + public Mobile Placer { get; set; } private class Ornament : Item { @@ -111,7 +106,7 @@ namespace Server.Items Movable = false; MoveToWorld( loc, from.Map ); - m_Placer = from; + Placer = from; m_Components = new ArrayList(); switch ( type ) @@ -220,7 +215,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( m_Placer ); + writer.Write( Placer ); writer.Write( (int) m_Components.Count ); @@ -238,7 +233,7 @@ namespace Server.Items { case 1: { - m_Placer = reader.ReadMobile(); + Placer = reader.ReadMobile(); goto case 0; } @@ -280,7 +275,7 @@ namespace Server.Items { if ( from.InRange( GetWorldLocation(), 1 ) ) { - if ( m_Placer == null || from == m_Placer || from.AccessLevel >= AccessLevel.GameMaster ) + if ( Placer == null || from == Placer || from.AccessLevel >= AccessLevel.GameMaster ) { from.AddToBackpack( new HolidayTreeDeed() ); diff --git a/Scripts/Items/Special/Holiday/HolidayFoods.cs b/Scripts/Items/Special/Holiday/HolidayFoods.cs index 37a36ec67..1846c05f0 100644 --- a/Scripts/Items/Special/Holiday/HolidayFoods.cs +++ b/Scripts/Items/Special/Holiday/HolidayFoods.cs @@ -5,51 +5,41 @@ namespace Server.Items { public class CandyCane : Food { - private static Dictionary m_ToothAches; - - public static Dictionary ToothAches - { - get => m_ToothAches; - set => m_ToothAches = value; - } + public static Dictionary ToothAches { get; set; } public static void Initialize() { - m_ToothAches = new Dictionary(); + ToothAches = new Dictionary(); } public class CandyCaneTimer : Timer { - private int m_Eaten; - private Mobile m_Eater; + public Mobile Eater { get; } - public Mobile Eater => m_Eater; - public int Eaten { get => m_Eaten; - set => m_Eaten = value; - } + public int Eaten { get; set; } public CandyCaneTimer( Mobile eater ) : base( TimeSpan.FromSeconds( 30 ), TimeSpan.FromSeconds( 30 ) ) { - m_Eater = eater; + Eater = eater; Priority = TimerPriority.FiveSeconds; Start(); } protected override void OnTick() { - --m_Eaten; + --Eaten; - if ( m_Eater == null || m_Eater.Deleted || m_Eaten <= 0 ) + if ( Eater == null || Eater.Deleted || Eaten <= 0 ) { Stop(); - m_ToothAches.Remove( m_Eater ); + ToothAches.Remove( Eater ); } - else if ( m_Eater.Map != Map.Internal && m_Eater.Alive ) + else if ( Eater.Map != Map.Internal && Eater.Alive ) { - if ( m_Eaten > 60 ) + if ( Eaten > 60 ) { - m_Eater.Say( 1077388 + Utility.Random( 5 ) ); + Eater.Say( 1077388 + Utility.Random( 5 ) ); /* ARRGH! My tooth hurts sooo much! * You just can't find a good Britannian dentist these days... @@ -58,12 +48,12 @@ namespace Server.Items * AAAH! It feels like someone kicked me in the teeth! */ - if ( Utility.RandomBool() && m_Eater.Body.IsHuman && !m_Eater.Mounted ) - m_Eater.Animate( 32, 5, 1, true, false, 0 ); + if ( Utility.RandomBool() && Eater.Body.IsHuman && !Eater.Mounted ) + Eater.Animate( 32, 5, 1, true, false, 0 ); } - else if ( m_Eaten == 60 ) + else if ( Eaten == 60 ) { - m_Eater.SendLocalizedMessage( 1077393 ); // The extreme pain in your teeth subsides. + Eater.SendLocalizedMessage( 1077393 ); // The extreme pain in your teeth subsides. } } } @@ -71,15 +61,15 @@ namespace Server.Items private static CandyCaneTimer EnsureTimer( Mobile from ) { - if (!m_ToothAches.TryGetValue( from, out CandyCaneTimer timer )) - m_ToothAches[from] = timer = new CandyCaneTimer( from ); + if (!ToothAches.TryGetValue( from, out CandyCaneTimer timer )) + ToothAches[from] = timer = new CandyCaneTimer( from ); return timer; } public static int GetToothAche( Mobile from ) { - if (m_ToothAches.TryGetValue( from, out CandyCaneTimer timer )) + if (ToothAches.TryGetValue( from, out CandyCaneTimer timer )) return timer.Eaten; return 0; diff --git a/Scripts/Items/Special/House Raffle/HouseRaffleStone.cs b/Scripts/Items/Special/House Raffle/HouseRaffleStone.cs index 846796192..babfc0ef5 100644 --- a/Scripts/Items/Special/House Raffle/HouseRaffleStone.cs +++ b/Scripts/Items/Special/House Raffle/HouseRaffleStone.cs @@ -12,33 +12,29 @@ namespace Server.Items { public class RaffleEntry { - private Mobile m_From; - private IPAddress m_Address; - private DateTime m_Date; + public Mobile From { get; } - public Mobile From => m_From; + public IPAddress Address { get; } - public IPAddress Address => m_Address; - - public DateTime Date => m_Date; + public DateTime Date { get; } public RaffleEntry( Mobile from ) { - m_From = from; + From = from; - if ( m_From.NetState != null ) - m_Address = m_From.NetState.Address; + if ( From.NetState != null ) + Address = From.NetState.Address; else - m_Address = IPAddress.None; + Address = IPAddress.None; - m_Date = DateTime.UtcNow; + Date = DateTime.UtcNow; } public void Serialize( GenericWriter writer ) { - writer.Write( m_From ); - writer.Write( m_Address ); - writer.Write( m_Date ); + writer.Write( From ); + writer.Write( Address ); + writer.Write( Date ); } public RaffleEntry( GenericReader reader, int version ) @@ -50,9 +46,9 @@ namespace Server.Items case 1: case 0: { - m_From = reader.ReadMobile(); - m_Address = Utility.Intern( reader.ReadIPAddress() ); - m_Date = reader.ReadDateTime(); + From = reader.ReadMobile(); + Address = Utility.Intern( reader.ReadIPAddress() ); + Date = reader.ReadDateTime(); break; } @@ -89,16 +85,12 @@ namespace Server.Items private Map m_Facet; private Mobile m_Winner; - private HouseRaffleDeed m_Deed; private HouseRaffleState m_State; private DateTime m_Started; private TimeSpan m_Duration; - private HouseRaffleExpireAction m_ExpireAction; private int m_TicketPrice; - private List m_Entries; - [CommandProperty( AccessLevel.GameMaster, AccessLevel.Seer )] public HouseRaffleState CurrentState { @@ -109,9 +101,9 @@ namespace Server.Items { if ( value == HouseRaffleState.Active ) { - m_Entries.Clear(); + Entries.Clear(); m_Winner = null; - m_Deed = null; + Deed = null; m_Started = DateTime.UtcNow; } @@ -155,11 +147,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Seer )] - public HouseRaffleDeed Deed - { - get => m_Deed; - set => m_Deed = value; - } + public HouseRaffleDeed Deed { get; set; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Seer )] public DateTime Started @@ -188,11 +176,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Seer )] - public HouseRaffleExpireAction ExpireAction - { - get => m_ExpireAction; - set => m_ExpireAction = value; - } + public HouseRaffleExpireAction ExpireAction { get; set; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Seer )] public int TicketPrice @@ -205,7 +189,7 @@ namespace Server.Items } } - public List Entries => m_Entries; + public List Entries { get; private set; } public override string DefaultName => "a house raffle stone"; @@ -260,15 +244,15 @@ namespace Server.Items m_Facet = null; m_Winner = null; - m_Deed = null; + Deed = null; m_State = HouseRaffleState.Inactive; m_Started = DateTime.MinValue; m_Duration = DefaultDuration; - m_ExpireAction = HouseRaffleExpireAction.None; + ExpireAction = HouseRaffleExpireAction.None; m_TicketPrice = DefaultTicketPrice; - m_Entries = new List(); + Entries = new List(); Movable = false; @@ -305,7 +289,7 @@ namespace Server.Items if ( !(from.Account is Account acc) ) return false; - foreach ( RaffleEntry entry in m_Entries ) + foreach ( RaffleEntry entry in Entries ) { if ( entry.From != null ) { @@ -327,7 +311,7 @@ namespace Server.Items IPAddress address = from.NetState.Address; int tickets = 0; - foreach ( RaffleEntry entry in m_Entries ) + foreach ( RaffleEntry entry in Entries ) { if ( Utility.IPMatchClassC( entry.Address, address ) ) { @@ -479,7 +463,7 @@ namespace Server.Items if ( m_TicketPrice == 0 || ( from.Backpack != null && from.Backpack.ConsumeTotal( typeof( Gold ), m_TicketPrice ) ) || ( bank != null && bank.ConsumeTotal( typeof( Gold ), m_TicketPrice ) ) ) { - m_Entries.Add( new RaffleEntry( from ) ); + Entries.Add( new RaffleEntry( from ) ); from.SendMessage( MessageHue, "You have successfully entered the plot's raffle." ); } @@ -501,25 +485,25 @@ namespace Server.Items m_State = HouseRaffleState.Completed; - if ( m_Region != null && m_Entries.Count != 0 ) + if ( m_Region != null && Entries.Count != 0 ) { - int winner = Utility.Random( m_Entries.Count ); + int winner = Utility.Random( Entries.Count ); - m_Winner = m_Entries[winner].From; + m_Winner = Entries[winner].From; if ( m_Winner != null ) { - m_Deed = new HouseRaffleDeed( this, m_Winner ); + Deed = new HouseRaffleDeed( this, m_Winner ); m_Winner.SendMessage( MessageHue, "Congratulations, {0}! You have won the raffle for the plot located at {1}.", m_Winner.Name, FormatLocation() ); - if ( m_Winner.AddToBackpack( m_Deed ) ) + if ( m_Winner.AddToBackpack( Deed ) ) { m_Winner.SendMessage( MessageHue, "The writ of lease has been placed in your backpack." ); } else { - m_Winner.BankBox.DropItem( m_Deed ); + m_Winner.BankBox.DropItem( Deed ); m_Winner.SendMessage( MessageHue, "As your backpack is full, the writ of lease has been placed in your bank box." ); } } @@ -548,9 +532,9 @@ namespace Server.Items writer.Write( (int) 3 ); // version writer.WriteEncodedInt( (int) m_State ); - writer.WriteEncodedInt( (int) m_ExpireAction ); + writer.WriteEncodedInt( (int) ExpireAction ); - writer.Write( m_Deed ); + writer.Write( Deed ); writer.Write( m_Bounds ); writer.Write( m_Facet ); @@ -561,9 +545,9 @@ namespace Server.Items writer.Write( m_Started ); writer.Write( m_Duration ); - writer.Write( m_Entries.Count ); + writer.Write( Entries.Count ); - foreach ( RaffleEntry entry in m_Entries ) + foreach ( RaffleEntry entry in Entries ) entry.Serialize( writer ); } @@ -583,13 +567,13 @@ namespace Server.Items } case 2: { - m_ExpireAction = (HouseRaffleExpireAction) reader.ReadEncodedInt(); + ExpireAction = (HouseRaffleExpireAction) reader.ReadEncodedInt(); goto case 1; } case 1: { - m_Deed = reader.ReadItem(); + Deed = reader.ReadItem(); goto case 0; } @@ -607,7 +591,7 @@ namespace Server.Items m_Duration = reader.ReadTimeSpan(); int entryCount = reader.ReadInt(); - m_Entries = new List( entryCount ); + Entries = new List( entryCount ); for ( int i = 0; i < entryCount; i++ ) { @@ -616,7 +600,7 @@ namespace Server.Items if ( entry.From == null ) continue; // Character was deleted - m_Entries.Add( entry ); + Entries.Add( entry ); } InvalidateRegion(); diff --git a/Scripts/Items/Special/MiniHouses.cs b/Scripts/Items/Special/MiniHouses.cs index 57a439747..106b871b6 100644 --- a/Scripts/Items/Special/MiniHouses.cs +++ b/Scripts/Items/Special/MiniHouses.cs @@ -175,26 +175,24 @@ namespace Server.Items public class MiniHouseInfo { - private int[] m_Graphics; - private int m_LabelNumber; + public int[] Graphics { get; } - public int[] Graphics => m_Graphics; - public int LabelNumber => m_LabelNumber; + public int LabelNumber { get; } public MiniHouseInfo( int start, int count, int labelNumber ) { - m_Graphics = new int[count]; + Graphics = new int[count]; for ( int i = 0; i < count; ++i ) - m_Graphics[i] = start + i; + Graphics[i] = start + i; - m_LabelNumber = labelNumber; + LabelNumber = labelNumber; } public MiniHouseInfo( int labelNumber, params int[] graphics ) { - m_LabelNumber = labelNumber; - m_Graphics = graphics; + LabelNumber = labelNumber; + Graphics = graphics; } private static MiniHouseInfo[] m_Info = { diff --git a/Scripts/Items/Special/MonsterStatuette.cs b/Scripts/Items/Special/MonsterStatuette.cs index eb89781e6..e3426d425 100644 --- a/Scripts/Items/Special/MonsterStatuette.cs +++ b/Scripts/Items/Special/MonsterStatuette.cs @@ -51,26 +51,24 @@ namespace Server.Items public class MonsterStatuetteInfo { - private int m_LabelNumber; - private int m_ItemID; - private int[] m_Sounds; + public int LabelNumber { get; } - public int LabelNumber => m_LabelNumber; - public int ItemID => m_ItemID; - public int[] Sounds => m_Sounds; + public int ItemID { get; } + + public int[] Sounds { get; } public MonsterStatuetteInfo( int labelNumber, int itemID, int baseSoundID ) { - m_LabelNumber = labelNumber; - m_ItemID = itemID; - m_Sounds = new[]{ baseSoundID, baseSoundID + 1, baseSoundID + 2, baseSoundID + 3, baseSoundID + 4 }; + LabelNumber = labelNumber; + ItemID = itemID; + Sounds = new[]{ baseSoundID, baseSoundID + 1, baseSoundID + 2, baseSoundID + 3, baseSoundID + 4 }; } public MonsterStatuetteInfo( int labelNumber, int itemID, int[] sounds ) { - m_LabelNumber = labelNumber; - m_ItemID = itemID; - m_Sounds = sounds; + LabelNumber = labelNumber; + ItemID = itemID; + Sounds = sounds; } private static MonsterStatuetteInfo[] m_Table = { @@ -131,14 +129,9 @@ namespace Server.Items { private MonsterStatuetteType m_Type; private bool m_TurnedOn; - private bool m_IsRewardItem; [CommandProperty( AccessLevel.GameMaster )] - public bool IsRewardItem - { - get => m_IsRewardItem; - set => m_IsRewardItem = value; - } + public bool IsRewardItem { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool TurnedOn @@ -216,7 +209,7 @@ namespace Server.Items { base.GetProperties( list ); - if ( Core.ML && m_IsRewardItem ) + if ( Core.ML && IsRewardItem ) list.Add( RewardSystem.GetRewardYearLabel( this, new object[]{ m_Type } ) ); // X Year Veteran Reward if ( m_TurnedOn ) @@ -291,7 +284,7 @@ namespace Server.Items writer.WriteEncodedInt( (int) m_Type ); writer.Write( (bool) m_TurnedOn ); - writer.Write( (bool) m_IsRewardItem ); + writer.Write( (bool) IsRewardItem ); } public override void Deserialize( GenericReader reader ) @@ -306,7 +299,7 @@ namespace Server.Items { m_Type = (MonsterStatuetteType)reader.ReadEncodedInt(); m_TurnedOn = reader.ReadBool(); - m_IsRewardItem = reader.ReadBool(); + IsRewardItem = reader.ReadBool(); break; } } diff --git a/Scripts/Items/Special/Mutation Core/PlagueBeastInnard.cs b/Scripts/Items/Special/Mutation Core/PlagueBeastInnard.cs index 7730161bd..154033352 100644 --- a/Scripts/Items/Special/Mutation Core/PlagueBeastInnard.cs +++ b/Scripts/Items/Special/Mutation Core/PlagueBeastInnard.cs @@ -75,13 +75,7 @@ namespace Server.Items public class PlagueBeastComponent : PlagueBeastInnard { - private PlagueBeastOrgan m_Organ; - - public PlagueBeastOrgan Organ - { - get => m_Organ; - set => m_Organ = value; - } + public PlagueBeastOrgan Organ { get; set; } public bool IsBrain => ItemID == 0x1CF0; @@ -123,10 +117,10 @@ namespace Server.Items public override bool OnDragDrop( Mobile from, Item dropped ) { - if ( m_Organ != null && m_Organ.OnDropped( from, dropped, this ) ) + if ( Organ != null && Organ.OnDropped( from, dropped, this ) ) { if ( dropped is PlagueBeastComponent component ) - m_Organ.Components.Add( component ); + Organ.Components.Add( component ); } return true; @@ -136,14 +130,14 @@ namespace Server.Items { if ( IsAccessibleTo( from ) ) { - if ( m_Organ != null && m_Organ.OnLifted( from, this ) ) + if ( Organ != null && Organ.OnLifted( from, this ) ) { from.SendLocalizedMessage( IsGland ? 1071895 : 1071914, null, 0x3B2 ); // * You rip the organ out of the plague beast's flesh * - if ( m_Organ.Components.Contains( this ) ) - m_Organ.Components.Remove( this ); + if ( Organ.Components.Contains( this ) ) + Organ.Components.Remove( this ); - m_Organ = null; + Organ = null; from.PlaySound( 0x1CA ); } @@ -163,7 +157,7 @@ namespace Server.Items writer.WriteEncodedInt( 0 ); // version - writer.WriteItem( m_Organ ); + writer.WriteItem( Organ ); } public override void Deserialize( GenericReader reader ) @@ -172,7 +166,7 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - m_Organ = reader.ReadItem(); + Organ = reader.ReadItem(); } } } diff --git a/Scripts/Items/Special/Mutation Core/PlagueBeastMutationCore.cs b/Scripts/Items/Special/Mutation Core/PlagueBeastMutationCore.cs index 7a57301f1..6df6021b4 100644 --- a/Scripts/Items/Special/Mutation Core/PlagueBeastMutationCore.cs +++ b/Scripts/Items/Special/Mutation Core/PlagueBeastMutationCore.cs @@ -6,32 +6,26 @@ namespace Server.Items { public class PlagueBeastMutationCore : Item, IScissorable { - private bool m_Cut; - [CommandProperty( AccessLevel.GameMaster )] - public bool Cut - { - get => m_Cut; - set => m_Cut = value; - } + public bool Cut { get; set; } public override string DefaultName => "a plague beast mutation core"; [Constructible] public PlagueBeastMutationCore() : base( 0x1CF0 ) { - m_Cut = true; + Cut = true; Weight = 1.0; Hue = 0x480; } public virtual bool Scissor( Mobile from, Scissors scissors ) { - if ( !m_Cut ) + if ( !Cut ) { PlagueBeastLord owner = RootParent as PlagueBeastLord; - m_Cut = true; + Cut = true; Movable = true; from.AddToBackpack( this ); @@ -62,7 +56,7 @@ namespace Server.Items writer.WriteEncodedInt( 0 ); // version - writer.Write( (bool) m_Cut ); + writer.Write( (bool) Cut ); } public override void Deserialize( GenericReader reader ) @@ -71,7 +65,7 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - m_Cut = reader.ReadBool(); + Cut = reader.ReadBool(); } } } diff --git a/Scripts/Items/Special/Mutation Core/PlagueBeastOrgans.cs b/Scripts/Items/Special/Mutation Core/PlagueBeastOrgans.cs index bfb2b5292..3b4f1bf5e 100644 --- a/Scripts/Items/Special/Mutation Core/PlagueBeastOrgans.cs +++ b/Scripts/Items/Special/Mutation Core/PlagueBeastOrgans.cs @@ -8,25 +8,11 @@ namespace Server.Items { public virtual bool IsCuttable => false; - private List m_Components; + public List Components { get; private set; } - public List Components => m_Components; + public int BrainHue { get; set; } - private int m_BrainHue; - - public int BrainHue - { - get => m_BrainHue; - set => m_BrainHue = value; - } - - private bool m_Opened; - - public bool Opened - { - get => m_Opened; - set => m_Opened = value; - } + public bool Opened { get; set; } private Timer m_Timer; @@ -37,8 +23,8 @@ namespace Server.Items public PlagueBeastOrgan( int itemID, int hue ) : base( itemID, hue ) { - m_Components = new List(); - m_Opened = false; + Components = new List(); + Opened = false; Movable = false; @@ -58,14 +44,14 @@ namespace Server.Items c.Location = new Point3D( X + x, Y + y, Z ); c.Map = Map; - m_Components.Add( c ); + Components.Add( c ); } public override bool Scissor( Mobile from, Scissors scissors ) { if ( IsCuttable && IsAccessibleTo( from ) ) { - if ( !m_Opened && m_Timer == null ) + if ( !Opened && m_Timer == null ) { m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 3 ), FinishOpening, from ); scissors.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071897 ); // You carefully cut into the organ. @@ -96,7 +82,7 @@ namespace Server.Items public virtual void FinishOpening( Mobile from ) { - m_Opened = true; + Opened = true; Owner?.PlaySound( 0x50 ); } @@ -111,9 +97,9 @@ namespace Server.Items writer.WriteEncodedInt( 0 ); // version - writer.WriteItemList( m_Components ); - writer.Write( (int) m_BrainHue ); - writer.Write( (bool) m_Opened ); + writer.WriteItemList( Components ); + writer.Write( (int) BrainHue ); + writer.Write( (bool) Opened ); } public override void Deserialize( GenericReader reader ) @@ -122,9 +108,9 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - m_Components = reader.ReadStrongItemList(); - m_BrainHue = reader.ReadInt(); - m_Opened = reader.ReadBool(); + Components = reader.ReadStrongItemList(); + BrainHue = reader.ReadInt(); + Opened = reader.ReadBool(); } } diff --git a/Scripts/Items/Special/Mutation Core/PlagueBeastVein.cs b/Scripts/Items/Special/Mutation Core/PlagueBeastVein.cs index 4d3bd5c69..0e8bdcbf3 100644 --- a/Scripts/Items/Special/Mutation Core/PlagueBeastVein.cs +++ b/Scripts/Items/Special/Mutation Core/PlagueBeastVein.cs @@ -5,22 +5,20 @@ namespace Server.Items { public class PlagueBeastVein : PlagueBeastComponent { - private bool m_Cut; - - public bool Cut => m_Cut; + public bool Cut { get; private set; } private Timer m_Timer; public PlagueBeastVein( int itemID, int hue ) : base( itemID, hue ) { - m_Cut = false; + Cut = false; } public override bool Scissor( Mobile from, Scissors scissors ) { if ( IsAccessibleTo( from ) ) { - if ( !m_Cut && m_Timer == null ) + if ( !Cut && m_Timer == null ) { m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 3 ), CuttingDone, from ); scissors.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071899 ); // You begin cutting through the vein. @@ -41,7 +39,7 @@ namespace Server.Items private void CuttingDone( Mobile from ) { - m_Cut = true; + Cut = true; if ( ItemID == 0x1B1C ) ItemID = 0x1B1B; @@ -64,7 +62,7 @@ namespace Server.Items writer.WriteEncodedInt( 0 ); // version - writer.Write( (bool) m_Cut ); + writer.Write( (bool) Cut ); } public override void Deserialize( GenericReader reader ) @@ -73,7 +71,7 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - m_Cut = reader.ReadBool(); + Cut = reader.ReadBool(); } } } diff --git a/Scripts/Items/Special/Solen Items/BallOfSummoning.cs b/Scripts/Items/Special/Solen Items/BallOfSummoning.cs index 364cfec9d..6bf2d01ae 100644 --- a/Scripts/Items/Special/Solen Items/BallOfSummoning.cs +++ b/Scripts/Items/Special/Solen Items/BallOfSummoning.cs @@ -15,7 +15,6 @@ namespace Server.Items private int m_Charges; private int m_Recharges; private BaseCreature m_Pet; - private string m_PetName; [CommandProperty( AccessLevel.GameMaster )] public int Charges @@ -80,7 +79,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public string PetName => m_PetName; + public string PetName { get; private set; } [Constructible] public BallOfSummoning() : base( 0xE2E ) @@ -90,17 +89,17 @@ namespace Server.Items m_Charges = Utility.RandomMinMax( 3, 9 ); - m_PetName = ""; + PetName = ""; } public override void AddNameProperty( ObjectPropertyList list ) { - list.Add( 1054131, m_Charges.ToString() + ( m_PetName.Length == 0 ? "\t " : "\t" + m_PetName ) ); // a crystal ball of pet summoning: [charges: ~1_charges~] : [linked pet: ~2_petName~] + list.Add( 1054131, m_Charges.ToString() + ( PetName.Length == 0 ? "\t " : "\t" + PetName ) ); // a crystal ball of pet summoning: [charges: ~1_charges~] : [linked pet: ~2_petName~] } public override void OnSingleClick( Mobile from ) { - LabelTo( from, 1054131, m_Charges.ToString() + ( m_PetName.Length == 0 ? "\t " : "\t" + m_PetName ) ); // a crystal ball of pet summoning: [charges: ~1_charges~] : [linked pet: ~2_petName~] + LabelTo( from, 1054131, m_Charges.ToString() + ( PetName.Length == 0 ? "\t " : "\t" + PetName ) ); // a crystal ball of pet summoning: [charges: ~1_charges~] : [linked pet: ~2_petName~] } private delegate void BallCallback( Mobile from ); @@ -328,9 +327,9 @@ namespace Server.Items BaseCreature pet = Pet; if ( pet == null ) - m_PetName = ""; + PetName = ""; else - m_PetName = pet.Name; + PetName = pet.Name; InvalidateProperties(); } @@ -349,7 +348,7 @@ namespace Server.Items writer.WriteEncodedInt( (int) m_Charges ); writer.Write( (Mobile) Pet ); - writer.Write( (string) m_PetName ); + writer.Write( (string) PetName ); } public override void Deserialize( GenericReader reader ) @@ -369,7 +368,7 @@ namespace Server.Items { m_Charges = Math.Min( reader.ReadEncodedInt(), MaxCharges ); Pet = (BaseCreature) reader.ReadMobile(); - m_PetName = reader.ReadString(); + PetName = reader.ReadString(); break; } } diff --git a/Scripts/Items/Special/SoulStone.cs b/Scripts/Items/Special/SoulStone.cs index ab0b0a4c2..8425d8c08 100644 --- a/Scripts/Items/Special/SoulStone.cs +++ b/Scripts/Items/Special/SoulStone.cs @@ -15,14 +15,8 @@ namespace Server.Items private int m_ActiveItemID; private int m_InactiveItemID; - private SecureLevel m_Level; - [CommandProperty( AccessLevel.GameMaster )] - public SecureLevel Level - { - get => m_Level; - set => m_Level = value; - } + public SecureLevel Level { get; set; } [CommandProperty( AccessLevel.GameMaster )] public virtual int ActiveItemID @@ -50,18 +44,14 @@ namespace Server.Items } } - private string m_Account, m_LastUserName; + private string m_LastUserName; private DateTime m_NextUse; // TODO: unused, it's here not to break serialize/deserialize private SkillName m_Skill; private double m_SkillValue; [CommandProperty( AccessLevel.GameMaster )] - public string Account - { - get => m_Account; - set => m_Account = value; - } + public string Account { get; set; } [CommandProperty( AccessLevel.GameMaster )] public string LastUserName @@ -121,7 +111,7 @@ namespace Server.Items m_InactiveItemID = inactiveItemID; m_ActiveItemID = activeItemID; - m_Account = account; + Account = account; } public override void GetProperties( ObjectPropertyList list ) @@ -751,12 +741,12 @@ namespace Server.Items writer.Write( (string) m_LastUserName ); //version 2 - writer.Write( (int)m_Level ); + writer.Write( (int)Level ); writer.Write( m_ActiveItemID ); writer.Write( m_InactiveItemID ); - writer.Write( (string) m_Account ); + writer.Write( (string) Account ); writer.Write( (DateTime) m_NextUse ); //TODO: delete it in a harmless way writer.WriteEncodedInt( (int) m_Skill ); @@ -778,7 +768,7 @@ namespace Server.Items } case 2: { - m_Level = (SecureLevel)reader.ReadInt(); + Level = (SecureLevel)reader.ReadInt(); goto case 1; } case 1: @@ -790,7 +780,7 @@ namespace Server.Items } case 0: { - m_Account = reader.ReadString(); + Account = reader.ReadString(); m_NextUse = reader.ReadDateTime(); //TODO: delete it in a harmless way m_Skill = (SkillName)reader.ReadEncodedInt(); diff --git a/Scripts/Items/Special/Special Scrolls/SpecialScroll.cs b/Scripts/Items/Special/Special Scrolls/SpecialScroll.cs index 53f27b59b..de8d8e372 100644 --- a/Scripts/Items/Special/Special Scrolls/SpecialScroll.cs +++ b/Scripts/Items/Special/Special Scrolls/SpecialScroll.cs @@ -6,14 +6,10 @@ namespace Server.Items { public abstract class SpecialScroll : Item { - private SkillName m_Skill; - private double m_Value; - #region Old Item Serialization Vars /* DO NOT USE! Only used in serialization of special scrolls that originally derived from Item */ - private bool m_InheritsItem; - protected bool InheritsItem => m_InheritsItem; + protected bool InheritsItem { get; private set; } #endregion @@ -26,8 +22,8 @@ namespace Server.Items LootType = LootType.Cursed; Weight = 1.0; - m_Skill = skill; - m_Value = value; + Skill = skill; + Value = value; } public SpecialScroll( Serial serial ) : base( serial ) @@ -35,27 +31,19 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public SkillName Skill - { - get => m_Skill; - set => m_Skill = value; - } + public SkillName Skill { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public double Value - { - get => m_Value; - set => m_Value = value; - } + public double Value { get; set; } public virtual string GetNameLocalized() { - return string.Concat( "#", AosSkillBonuses.GetLabel( m_Skill ).ToString() ); + return string.Concat( "#", AosSkillBonuses.GetLabel( Skill ).ToString() ); } public virtual string GetName() { - int index = (int)m_Skill; + int index = (int)Skill; SkillInfo[] table = SkillInfo.Table; if ( index >= 0 && index < table.Length ) @@ -96,8 +84,8 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (int) m_Skill ); - writer.Write( (double) m_Value ); + writer.Write( (int) Skill ); + writer.Write( (double) Value ); } public override void Deserialize( GenericReader reader ) @@ -110,25 +98,25 @@ namespace Server.Items { case 1: { - m_Skill = (SkillName)reader.ReadInt(); - m_Value = reader.ReadDouble(); + Skill = (SkillName)reader.ReadInt(); + Value = reader.ReadDouble(); break; } case 0: { - m_InheritsItem = true; + InheritsItem = true; if ( !(this is StatCapScroll) ) - m_Skill = (SkillName)reader.ReadInt(); + Skill = (SkillName)reader.ReadInt(); else - m_Skill = SkillName.Alchemy; + Skill = SkillName.Alchemy; if ( this is ScrollofAlacrity ) - m_Value = 0.0; + Value = 0.0; else if ( this is StatCapScroll ) - m_Value = (double)reader.ReadInt(); + Value = (double)reader.ReadInt(); else - m_Value = reader.ReadDouble(); + Value = reader.ReadDouble(); break; } diff --git a/Scripts/Items/Special/Veteran Rewards/Cannon.cs b/Scripts/Items/Special/Veteran Rewards/Cannon.cs index 02579c776..6d1d717bc 100644 --- a/Scripts/Items/Special/Veteran Rewards/Cannon.cs +++ b/Scripts/Items/Special/Veteran Rewards/Cannon.cs @@ -62,12 +62,11 @@ namespace Server.Items } } - private CannonDirection m_CannonDirection; private int m_Charges; private bool m_IsRewardItem; [CommandProperty( AccessLevel.GameMaster )] - public CannonDirection CannonDirection => m_CannonDirection; + public CannonDirection CannonDirection { get; private set; } [CommandProperty( AccessLevel.GameMaster )] public int Charges @@ -98,7 +97,7 @@ namespace Server.Items [Constructible] public CannonAddon( CannonDirection direction ) { - m_CannonDirection = direction; + CannonDirection = direction; switch ( direction ) { @@ -224,7 +223,7 @@ namespace Server.Items writer.WriteEncodedInt( 0 ); // version - writer.Write( (int) m_CannonDirection ); + writer.Write( (int) CannonDirection ); writer.Write( (int) m_Charges ); writer.Write( (bool) m_IsRewardItem ); } @@ -235,7 +234,7 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - m_CannonDirection = (CannonDirection) reader.ReadInt(); + CannonDirection = (CannonDirection) reader.ReadInt(); m_Charges = reader.ReadInt(); m_IsRewardItem = reader.ReadBool(); } diff --git a/Scripts/Items/Special/Veteran Rewards/MiningCart.cs b/Scripts/Items/Special/Veteran Rewards/MiningCart.cs index 6b9d5885b..63b7850d4 100644 --- a/Scripts/Items/Special/Veteran Rewards/MiningCart.cs +++ b/Scripts/Items/Special/Veteran Rewards/MiningCart.cs @@ -21,52 +21,32 @@ namespace Server.Items get { MiningCartDeed deed = new MiningCartDeed(); - deed.IsRewardItem = m_IsRewardItem; - deed.Gems = m_Gems; - deed.Ore = m_Ore; + deed.IsRewardItem = IsRewardItem; + deed.Gems = Gems; + deed.Ore = Ore; return deed; } } - private bool m_IsRewardItem; + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool IsRewardItem - { - get => m_IsRewardItem; - set => m_IsRewardItem = value; - } - - private MiningCartType m_CartType; + public MiningCartType CartType { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public MiningCartType CartType => m_CartType; - - private int m_Gems; + public int Gems { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int Gems - { - get => m_Gems; - set => m_Gems = value; - } - - private int m_Ore; - - [CommandProperty( AccessLevel.GameMaster )] - public int Ore - { - get => m_Ore; - set => m_Ore = value; - } + public int Ore { get; set; } private Timer m_Timer; [Constructible] public MiningCart( MiningCartType type ) { - m_CartType = type; + CartType = type; switch ( type ) { @@ -121,15 +101,15 @@ namespace Server.Items private void GiveResources() { - switch ( m_CartType ) + switch ( CartType ) { case MiningCartType.OreSouth: case MiningCartType.OreEast: - m_Ore = Math.Min( 100, m_Ore + 10 ); + Ore = Math.Min( 100, Ore + 10 ); break; case MiningCartType.GemSouth: case MiningCartType.GemEast: - m_Gems = Math.Min( 50, m_Gems + 5 ); + Gems = Math.Min( 50, Gems + 5 ); break; } } @@ -163,11 +143,11 @@ namespace Server.Items } else if ( house != null && house.HasSecureAccess( from, SecureLevel.Friends ) ) { - switch ( m_CartType ) + switch ( CartType ) { case MiningCartType.OreSouth: case MiningCartType.OreEast: - if ( m_Ore > 0 ) + if ( Ore > 0 ) { Item ingots = null; @@ -184,7 +164,7 @@ namespace Server.Items case 8: ingots = new ValoriteIngot(); break; } - int amount = Math.Min( 10, m_Ore ); + int amount = Math.Min( 10, Ore ); ingots.Amount = amount; if ( !from.PlaceInBackpack( ingots ) ) @@ -195,7 +175,7 @@ namespace Server.Items else { PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString() ); // Ore: ~1_COUNT~ - m_Ore -= amount; + Ore -= amount; } } else @@ -204,7 +184,7 @@ namespace Server.Items break; case MiningCartType.GemSouth: case MiningCartType.GemEast: - if ( m_Gems > 0 ) + if ( Gems > 0 ) { Item gems = null; @@ -229,7 +209,7 @@ namespace Server.Items case 14: gems = new BlueDiamond(); break; } - int amount = Math.Min( 5, m_Gems ); + int amount = Math.Min( 5, Gems ); gems.Amount = amount; if ( !from.PlaceInBackpack( gems ) ) @@ -240,7 +220,7 @@ namespace Server.Items else { PublicOverheadMessage( MessageType.Regular, 0, 1094723, amount.ToString() ); // Gems: ~1_COUNT~ - m_Gems -= amount; + Gems -= amount; } } else @@ -260,12 +240,12 @@ namespace Server.Items writer.WriteEncodedInt( 1 ); // version #region version 1 - writer.Write( (int) m_CartType ); + writer.Write( (int) CartType ); #endregion - writer.Write( (bool) m_IsRewardItem ); - writer.Write( (int) m_Gems ); - writer.Write( (int) m_Ore ); + writer.Write( (bool) IsRewardItem ); + writer.Write( (int) Gems ); + writer.Write( (int) Ore ); if ( m_Timer != null ) writer.Write( (DateTime) m_Timer.Next ); @@ -282,12 +262,12 @@ namespace Server.Items switch ( version ) { case 1: - m_CartType = (MiningCartType) reader.ReadInt(); + CartType = (MiningCartType) reader.ReadInt(); goto case 0; case 0: - m_IsRewardItem = reader.ReadBool(); - m_Gems = reader.ReadInt(); - m_Ore = reader.ReadInt(); + IsRewardItem = reader.ReadBool(); + Gems = reader.ReadInt(); + Ore = reader.ReadInt(); DateTime next = reader.ReadDateTime(); @@ -310,8 +290,8 @@ namespace Server.Items { MiningCart addon = new MiningCart( m_CartType ); addon.IsRewardItem = m_IsRewardItem; - addon.Gems = m_Gems; - addon.Ore = m_Ore; + addon.Gems = Gems; + addon.Ore = Ore; return addon; } @@ -328,23 +308,11 @@ namespace Server.Items set{ m_IsRewardItem = value; InvalidateProperties(); } } - private int m_Gems; + [CommandProperty( AccessLevel.GameMaster )] + public int Gems { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int Gems - { - get => m_Gems; - set => m_Gems = value; - } - - private int m_Ore; - - [CommandProperty( AccessLevel.GameMaster )] - public int Ore - { - get => m_Ore; - set => m_Ore = value; - } + public int Ore { get; set; } [Constructible] public MiningCartDeed() @@ -385,8 +353,8 @@ namespace Server.Items writer.WriteEncodedInt( 0 ); // version writer.Write( (bool) m_IsRewardItem ); - writer.Write( (int) m_Gems ); - writer.Write( (int) m_Ore ); + writer.Write( (int) Gems ); + writer.Write( (int) Ore ); } public override void Deserialize( GenericReader reader ) @@ -396,8 +364,8 @@ namespace Server.Items int version = reader.ReadEncodedInt(); m_IsRewardItem = reader.ReadBool(); - m_Gems = reader.ReadInt(); - m_Ore = reader.ReadInt(); + Gems = reader.ReadInt(); + Ore = reader.ReadInt(); } public void GetOptions( RewardOptionList list ) diff --git a/Scripts/Items/Suits/BaseSuit.cs b/Scripts/Items/Suits/BaseSuit.cs index e9698ef83..1dd05fba3 100644 --- a/Scripts/Items/Suits/BaseSuit.cs +++ b/Scripts/Items/Suits/BaseSuit.cs @@ -2,12 +2,8 @@ namespace Server.Items { public abstract class BaseSuit : Item { - private AccessLevel m_AccessLevel; - [CommandProperty( AccessLevel.Administrator )] - public AccessLevel AccessLevel{ get => m_AccessLevel; - set => m_AccessLevel = value; - } + public AccessLevel AccessLevel { get; set; } public BaseSuit( AccessLevel level, int hue, int itemID ) : base( itemID ) { @@ -17,7 +13,7 @@ namespace Server.Items LootType = LootType.Newbied; Layer = Layer.OuterTorso; - m_AccessLevel = level; + AccessLevel = level; } public BaseSuit( Serial serial ) : base( serial ) @@ -30,7 +26,7 @@ namespace Server.Items writer.Write( (int) 0 ); // version - writer.Write( (int) m_AccessLevel ); + writer.Write( (int) AccessLevel ); } public override void Deserialize( GenericReader reader ) @@ -43,7 +39,7 @@ namespace Server.Items { case 0: { - m_AccessLevel = (AccessLevel)reader.ReadInt(); + AccessLevel = (AccessLevel)reader.ReadInt(); break; } } @@ -53,7 +49,7 @@ namespace Server.Items { object root = RootParent; - if ( root is Mobile mobile && mobile.AccessLevel < m_AccessLevel ) + if ( root is Mobile mobile && mobile.AccessLevel < AccessLevel ) { Delete(); return false; @@ -76,15 +72,15 @@ namespace Server.Items public override bool VerifyMove( Mobile from ) { - return ( from.AccessLevel >= m_AccessLevel ); + return ( from.AccessLevel >= AccessLevel ); } public override bool OnEquip( Mobile from ) { - if ( from.AccessLevel < m_AccessLevel ) + if ( from.AccessLevel < AccessLevel ) from.SendMessage( "You may not wear this." ); - return ( from.AccessLevel >= m_AccessLevel ); + return ( from.AccessLevel >= AccessLevel ); } } } diff --git a/Scripts/Items/Talismans/TalismanAttribute.cs b/Scripts/Items/Talismans/TalismanAttribute.cs index 650bcb324..19ff251c0 100644 --- a/Scripts/Items/Talismans/TalismanAttribute.cs +++ b/Scripts/Items/Talismans/TalismanAttribute.cs @@ -5,36 +5,20 @@ namespace Server.Items [PropertyObject] public class TalismanAttribute { - private Type m_Type; - private TextDefinition m_Name; - private int m_Amount; + [CommandProperty( AccessLevel.GameMaster )] + public Type Type { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Type Type - { - get => m_Type; - set => m_Type = value; - } + public TextDefinition Name { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TextDefinition Name - { - get => m_Name; - set => m_Name = value; - } + public int Amount { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int Amount - { - get => m_Amount; - set => m_Amount = value; - } + public bool IsEmpty => Type == null; [CommandProperty( AccessLevel.GameMaster )] - public bool IsEmpty => m_Type == null; - - [CommandProperty( AccessLevel.GameMaster )] - public bool IsItem => m_Type != null && m_Type.Namespace.Equals( "Server.Items" ); + public bool IsItem => Type != null && Type.Namespace.Equals( "Server.Items" ); public TalismanAttribute() : this( null, 0, 0 ) { @@ -44,9 +28,9 @@ namespace Server.Items { if ( copy != null ) { - m_Type = copy.Type; - m_Name = copy.Name; - m_Amount = copy.Amount; + Type = copy.Type; + Name = copy.Name; + Amount = copy.Amount; } } @@ -56,9 +40,9 @@ namespace Server.Items public TalismanAttribute( Type type, TextDefinition name, int amount ) { - m_Type = type; - m_Name = name; - m_Amount = amount; + Type = type; + Name = name; + Amount = amount; } public TalismanAttribute( GenericReader reader ) @@ -68,19 +52,19 @@ namespace Server.Items SaveFlag flags = (SaveFlag) reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.Type ) ) - m_Type = ScriptCompiler.FindTypeByFullName( reader.ReadString(), false ); + Type = ScriptCompiler.FindTypeByFullName( reader.ReadString(), false ); if ( GetSaveFlag( flags, SaveFlag.Name ) ) - m_Name = TextDefinition.Deserialize( reader ); + Name = TextDefinition.Deserialize( reader ); if ( GetSaveFlag( flags, SaveFlag.Amount ) ) - m_Amount = reader.ReadEncodedInt(); + Amount = reader.ReadEncodedInt(); } public override string ToString() { - if ( m_Type != null ) - return m_Type.Name; + if ( Type != null ) + return Type.Name; return "None"; } @@ -111,26 +95,26 @@ namespace Server.Items SaveFlag flags = SaveFlag.None; - SetSaveFlag( ref flags, SaveFlag.Type, m_Type != null ); - SetSaveFlag( ref flags, SaveFlag.Name, m_Name != null ); - SetSaveFlag( ref flags, SaveFlag.Amount, m_Amount != 0 ); + SetSaveFlag( ref flags, SaveFlag.Type, Type != null ); + SetSaveFlag( ref flags, SaveFlag.Name, Name != null ); + SetSaveFlag( ref flags, SaveFlag.Amount, Amount != 0 ); writer.WriteEncodedInt( (int) flags ); if ( GetSaveFlag( flags, SaveFlag.Type ) ) - writer.Write( m_Type.FullName ); + writer.Write( Type.FullName ); if ( GetSaveFlag( flags, SaveFlag.Name ) ) - TextDefinition.Serialize( writer, m_Name ); + TextDefinition.Serialize( writer, Name ); if ( GetSaveFlag( flags, SaveFlag.Amount ) ) - writer.WriteEncodedInt( m_Amount ); + writer.WriteEncodedInt( Amount ); } public int DamageBonus( Mobile to ) { - if ( to != null && to.GetType() == m_Type ) // Verified: only works on the exact type - return m_Amount; + if ( to != null && to.GetType() == Type ) // Verified: only works on the exact type + return Amount; return 0; } diff --git a/Scripts/Items/Traps/GasTrap.cs b/Scripts/Items/Traps/GasTrap.cs index ff2da4b5f..6ae3ba0d0 100644 --- a/Scripts/Items/Traps/GasTrap.cs +++ b/Scripts/Items/Traps/GasTrap.cs @@ -12,14 +12,8 @@ namespace Server.Items public class GasTrap : BaseTrap { - private Poison m_Poison; - [CommandProperty( AccessLevel.GameMaster )] - public Poison Poison - { - get => m_Poison; - set => m_Poison = value; - } + public Poison Poison { get; set; } [CommandProperty( AccessLevel.GameMaster )] public GasTrapType Type @@ -68,7 +62,7 @@ namespace Server.Items [Constructible] public GasTrap( GasTrapType type, Poison poison ) : base( GetBaseID( type ) ) { - m_Poison = poison; + Poison = poison; } public override bool PassivelyTriggered => false; @@ -78,13 +72,13 @@ namespace Server.Items public override void OnTrigger( Mobile from ) { - if ( m_Poison == null || !from.Player || !from.Alive || from.AccessLevel > AccessLevel.Player ) + if ( Poison == null || !from.Player || !from.Alive || from.AccessLevel > AccessLevel.Player ) return; Effects.SendLocationEffect( Location, Map, GetBaseID( Type ) - 2, 16, 3, GetEffectHue(), 0 ); Effects.PlaySound( Location, Map, 0x231 ); - from.ApplyPoison( from, m_Poison ); + from.ApplyPoison( from, Poison ); from.LocalOverheadMessage( MessageType.Regular, 0x22, 500855 ); // You are enveloped by a noxious gas cloud! } @@ -99,7 +93,7 @@ namespace Server.Items writer.Write( (int) 0 ); // version - Poison.Serialize( m_Poison, writer ); + Poison.Serialize( Poison, writer ); } public override void Deserialize( GenericReader reader ) @@ -112,7 +106,7 @@ namespace Server.Items { case 0: { - m_Poison = Poison.Deserialize( reader ); + Poison = Poison.Deserialize( reader ); break; } } diff --git a/Scripts/Items/Weapons/Abilities/DualWield.cs b/Scripts/Items/Weapons/Abilities/DualWield.cs index 78f6cf5d5..6a66abc5b 100644 --- a/Scripts/Items/Weapons/Abilities/DualWield.cs +++ b/Scripts/Items/Weapons/Abilities/DualWield.cs @@ -9,8 +9,7 @@ namespace Server.Items ///
public class DualWield : WeaponAbility { - private static Hashtable m_Registry = new Hashtable(); - public static Hashtable Registry => m_Registry; + public static Hashtable Registry { get; } = new Hashtable(); public DualWield() { @@ -56,15 +55,14 @@ namespace Server.Items public class DualWieldTimer : Timer { private Mobile m_Owner; - private int m_BonusSwingSpeed; - public int BonusSwingSpeed => m_BonusSwingSpeed; + public int BonusSwingSpeed { get; } public DualWieldTimer( Mobile owner, int bonusSwingSpeed ) : base( TimeSpan.FromSeconds( 6.0 ) ) { m_Owner = owner; - m_BonusSwingSpeed = bonusSwingSpeed; + BonusSwingSpeed = bonusSwingSpeed; Priority = TimerPriority.FiftyMS; } diff --git a/Scripts/Items/Weapons/Abilities/Feint.cs b/Scripts/Items/Weapons/Abilities/Feint.cs index 5ded73b9a..86aa26bb2 100644 --- a/Scripts/Items/Weapons/Abilities/Feint.cs +++ b/Scripts/Items/Weapons/Abilities/Feint.cs @@ -9,8 +9,7 @@ namespace Server.Items ///
public class Feint : WeaponAbility { - private static Hashtable m_Registry = new Hashtable(); - public static Hashtable Registry => m_Registry; + public static Hashtable Registry { get; } = new Hashtable(); public Feint() { @@ -57,15 +56,14 @@ namespace Server.Items public class FeintTimer : Timer { private Mobile m_Defender; - private int m_SwingSpeedReduction; - public int SwingSpeedReduction => m_SwingSpeedReduction; + public int SwingSpeedReduction { get; } public FeintTimer( Mobile defender, int swingSpeedReduction ) : base( TimeSpan.FromSeconds( 6.0 ) ) { m_Defender = defender; - m_SwingSpeedReduction = swingSpeedReduction; + SwingSpeedReduction = swingSpeedReduction; Priority = TimerPriority.FiftyMS; } diff --git a/Scripts/Items/Weapons/Abilities/FrenziedWhirlwind.cs b/Scripts/Items/Weapons/Abilities/FrenziedWhirlwind.cs index 715a436a6..d3b8ef581 100644 --- a/Scripts/Items/Weapons/Abilities/FrenziedWhirlwind.cs +++ b/Scripts/Items/Weapons/Abilities/FrenziedWhirlwind.cs @@ -26,8 +26,7 @@ namespace Server.Items public override int BaseMana => 30; - private static Hashtable m_Registry = new Hashtable(); - public static Hashtable Registry => m_Registry; + public static Hashtable Registry { get; } = new Hashtable(); public override void OnHit( Mobile attacker, Mobile defender, int damage ) { diff --git a/Scripts/Items/Weapons/Abilities/TalonStrike.cs b/Scripts/Items/Weapons/Abilities/TalonStrike.cs index 5606fd075..614a91a42 100644 --- a/Scripts/Items/Weapons/Abilities/TalonStrike.cs +++ b/Scripts/Items/Weapons/Abilities/TalonStrike.cs @@ -9,8 +9,7 @@ namespace Server.Items ///
public class TalonStrike : WeaponAbility { - private static Hashtable m_Registry = new Hashtable(); - public static Hashtable Registry => m_Registry; + public static Hashtable Registry { get; } = new Hashtable(); public TalonStrike() { diff --git a/Scripts/Items/Weapons/Abilities/WeaponAbility.cs b/Scripts/Items/Weapons/Abilities/WeaponAbility.cs index 90f2e5073..061251d82 100644 --- a/Scripts/Items/Weapons/Abilities/WeaponAbility.cs +++ b/Scripts/Items/Weapons/Abilities/WeaponAbility.cs @@ -249,81 +249,77 @@ namespace Server.Items return CheckSkills( from ) && CheckMana( from, false ); } - private static WeaponAbility[] m_Abilities = new WeaponAbility[31] - { - null, - new ArmorIgnore(), - new BleedAttack(), - new ConcussionBlow(), - new CrushingBlow(), - new Disarm(), - new Dismount(), - new DoubleStrike(), - new InfectiousStrike(), - new MortalStrike(), - new MovingShot(), - new ParalyzingBlow(), - new ShadowStrike(), - new WhirlwindAttack(), + public static WeaponAbility[] Abilities { get; } = new WeaponAbility[31] + { + null, + new ArmorIgnore(), + new BleedAttack(), + new ConcussionBlow(), + new CrushingBlow(), + new Disarm(), + new Dismount(), + new DoubleStrike(), + new InfectiousStrike(), + new MortalStrike(), + new MovingShot(), + new ParalyzingBlow(), + new ShadowStrike(), + new WhirlwindAttack(), - new RidingSwipe(), - new FrenziedWhirlwind(), - new Block(), - new DefenseMastery(), - new NerveStrike(), - new TalonStrike(), - new Feint(), - new DualWield(), - new DoubleShot(), - new ArmorPierce(), - null, - null, - null, - null, - null, - null, - new Disrobe() - }; + new RidingSwipe(), + new FrenziedWhirlwind(), + new Block(), + new DefenseMastery(), + new NerveStrike(), + new TalonStrike(), + new Feint(), + new DualWield(), + new DoubleShot(), + new ArmorPierce(), + null, + null, + null, + null, + null, + null, + new Disrobe() + }; - public static WeaponAbility[] Abilities => m_Abilities; + public static Hashtable Table { get; } = new Hashtable(); - private static Hashtable m_Table = new Hashtable(); + public static readonly WeaponAbility ArmorIgnore = Abilities[ 1]; + public static readonly WeaponAbility BleedAttack = Abilities[ 2]; + public static readonly WeaponAbility ConcussionBlow = Abilities[ 3]; + public static readonly WeaponAbility CrushingBlow = Abilities[ 4]; + public static readonly WeaponAbility Disarm = Abilities[ 5]; + public static readonly WeaponAbility Dismount = Abilities[ 6]; + public static readonly WeaponAbility DoubleStrike = Abilities[ 7]; + public static readonly WeaponAbility InfectiousStrike = Abilities[ 8]; + public static readonly WeaponAbility MortalStrike = Abilities[ 9]; + public static readonly WeaponAbility MovingShot = Abilities[10]; + public static readonly WeaponAbility ParalyzingBlow = Abilities[11]; + public static readonly WeaponAbility ShadowStrike = Abilities[12]; + public static readonly WeaponAbility WhirlwindAttack = Abilities[13]; - public static Hashtable Table => m_Table; + public static readonly WeaponAbility RidingSwipe = Abilities[14]; + public static readonly WeaponAbility FrenziedWhirlwind = Abilities[15]; + public static readonly WeaponAbility Block = Abilities[16]; + public static readonly WeaponAbility DefenseMastery = Abilities[17]; + public static readonly WeaponAbility NerveStrike = Abilities[18]; + public static readonly WeaponAbility TalonStrike = Abilities[19]; + public static readonly WeaponAbility Feint = Abilities[20]; + public static readonly WeaponAbility DualWield = Abilities[21]; + public static readonly WeaponAbility DoubleShot = Abilities[22]; + public static readonly WeaponAbility ArmorPierce = Abilities[23]; - public static readonly WeaponAbility ArmorIgnore = m_Abilities[ 1]; - public static readonly WeaponAbility BleedAttack = m_Abilities[ 2]; - public static readonly WeaponAbility ConcussionBlow = m_Abilities[ 3]; - public static readonly WeaponAbility CrushingBlow = m_Abilities[ 4]; - public static readonly WeaponAbility Disarm = m_Abilities[ 5]; - public static readonly WeaponAbility Dismount = m_Abilities[ 6]; - public static readonly WeaponAbility DoubleStrike = m_Abilities[ 7]; - public static readonly WeaponAbility InfectiousStrike = m_Abilities[ 8]; - public static readonly WeaponAbility MortalStrike = m_Abilities[ 9]; - public static readonly WeaponAbility MovingShot = m_Abilities[10]; - public static readonly WeaponAbility ParalyzingBlow = m_Abilities[11]; - public static readonly WeaponAbility ShadowStrike = m_Abilities[12]; - public static readonly WeaponAbility WhirlwindAttack = m_Abilities[13]; + public static readonly WeaponAbility Bladeweave = Abilities[24]; + public static readonly WeaponAbility ForceArrow = Abilities[25]; + public static readonly WeaponAbility LightningArrow = Abilities[26]; + public static readonly WeaponAbility PsychicAttack = Abilities[27]; + public static readonly WeaponAbility SerpentArrow = Abilities[28]; + public static readonly WeaponAbility ForceOfNature = Abilities[29]; - public static readonly WeaponAbility RidingSwipe = m_Abilities[14]; - public static readonly WeaponAbility FrenziedWhirlwind = m_Abilities[15]; - public static readonly WeaponAbility Block = m_Abilities[16]; - public static readonly WeaponAbility DefenseMastery = m_Abilities[17]; - public static readonly WeaponAbility NerveStrike = m_Abilities[18]; - public static readonly WeaponAbility TalonStrike = m_Abilities[19]; - public static readonly WeaponAbility Feint = m_Abilities[20]; - public static readonly WeaponAbility DualWield = m_Abilities[21]; - public static readonly WeaponAbility DoubleShot = m_Abilities[22]; - public static readonly WeaponAbility ArmorPierce = m_Abilities[23]; - - public static readonly WeaponAbility Bladeweave = m_Abilities[24]; - public static readonly WeaponAbility ForceArrow = m_Abilities[25]; - public static readonly WeaponAbility LightningArrow = m_Abilities[26]; - public static readonly WeaponAbility PsychicAttack = m_Abilities[27]; - public static readonly WeaponAbility SerpentArrow = m_Abilities[28]; - public static readonly WeaponAbility ForceOfNature = m_Abilities[29]; - - public static readonly WeaponAbility Disrobe = m_Abilities[30]; + public static readonly WeaponAbility Disrobe = Abilities[30]; public static bool IsWeaponAbility( Mobile m, WeaponAbility a ) { @@ -346,7 +342,7 @@ namespace Server.Items return null; } - WeaponAbility a = (WeaponAbility)m_Table[m]; + WeaponAbility a = (WeaponAbility)Table[m]; if ( !IsWeaponAbility( m, a ) ) { @@ -385,13 +381,13 @@ namespace Server.Items if ( a == null ) { - m_Table.Remove( m ); + Table.Remove( m ); } else { SpecialMove.ClearCurrentMove( m ); - m_Table[m] = a; + Table[m] = a; } return true; @@ -399,7 +395,7 @@ namespace Server.Items public static void ClearCurrentAbility( Mobile m ) { - m_Table.Remove( m ); + Table.Remove( m ); if ( Core.AOS && m.NetState != null ) m.Send( ClearWeaponAbility.Instance ); @@ -420,8 +416,8 @@ namespace Server.Items if ( index == 0 ) ClearCurrentAbility( e.Mobile ); - else if ( index >= 1 && index < m_Abilities.Length ) - SetCurrentAbility( e.Mobile, m_Abilities[index] ); + else if ( index >= 1 && index < Abilities.Length ) + SetCurrentAbility( e.Mobile, Abilities[index] ); } @@ -471,13 +467,11 @@ namespace Server.Items private class WeaponAbilityContext { - private Timer m_Timer; - - public Timer Timer => m_Timer; + public Timer Timer { get; } public WeaponAbilityContext( Timer timer ) { - m_Timer = timer; + Timer = timer; } } } diff --git a/Scripts/Items/Weapons/BaseWeapon.cs b/Scripts/Items/Weapons/BaseWeapon.cs index b7d8765eb..06e4da34b 100644 --- a/Scripts/Items/Weapons/BaseWeapon.cs +++ b/Scripts/Items/Weapons/BaseWeapon.cs @@ -80,10 +80,6 @@ namespace Server.Items private SlayerName m_Slayer2; private SkillMod m_SkillMod, m_MageMod; private CraftResource m_Resource; - private bool m_PlayerConstructed; - - private bool m_Cursed; // Is this weapon cursed via Curse Weapon necromancer spell? Temporary; not serialized. - private bool m_Consecrated; // Is this weapon blessed via Consecrate Weapon paladin ability? Temporary; not serialized. private AosAttributes m_AosAttributes; private AosWeaponAttributes m_AosWeaponAttributes; @@ -183,18 +179,10 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public bool Cursed - { - get => m_Cursed; - set => m_Cursed = value; - } + public bool Cursed { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool Consecrated - { - get => m_Consecrated; - set => m_Consecrated = value; - } + public bool Consecrated { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool Identified @@ -292,11 +280,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public bool PlayerConstructed - { - get => m_PlayerConstructed; - set => m_PlayerConstructed = value; - } + public bool PlayerConstructed { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int MaxRange @@ -1304,13 +1288,7 @@ namespace Server.Items return 0; } - private static bool m_InDoubleStrike; - - public static bool InDoubleStrike - { - get => m_InDoubleStrike; - set => m_InDoubleStrike = value; - } + public static bool InDoubleStrike { get; set; } public virtual void OnHit( Mobile attacker, Mobile defender, double damageBonus = 1.0) { @@ -1413,7 +1391,7 @@ namespace Server.Items percentageBonus += packInstinctBonus; } - if ( m_InDoubleStrike ) + if ( InDoubleStrike ) { percentageBonus -= 10; } @@ -1480,7 +1458,7 @@ namespace Server.Items quiver.AlterBowDamage( ref phys, ref fire, ref cold, ref pois, ref nrgy, ref chaos, ref direct ); } - if ( m_Consecrated ) + if ( Consecrated ) { phys = defender.PhysicalResistance; fire = defender.FireResistance; @@ -1544,7 +1522,7 @@ namespace Server.Items if ( (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitLeechMana ) * propertyBonus) > Utility.Random( 100 ) ) manaLeech += 40; // HitLeechMana% chance to leech 40% of damage as mana - if ( m_Cursed ) + if ( Cursed ) lifeLeech += 50; // Additional 50% life leech for cursed weapons (necro spell) context = TransformationSpellHelper.GetContext( attacker ); @@ -2423,7 +2401,7 @@ namespace Server.Items SetSaveFlag( ref flags, SaveFlag.Resource, m_Resource != CraftResource.Iron ); SetSaveFlag( ref flags, SaveFlag.xAttributes, !m_AosAttributes.IsEmpty ); SetSaveFlag( ref flags, SaveFlag.xWeaponAttributes, !m_AosWeaponAttributes.IsEmpty ); - SetSaveFlag( ref flags, SaveFlag.PlayerConstructed, m_PlayerConstructed ); + SetSaveFlag( ref flags, SaveFlag.PlayerConstructed, PlayerConstructed ); SetSaveFlag( ref flags, SaveFlag.SkillBonuses, !m_AosSkillBonuses.IsEmpty ); SetSaveFlag( ref flags, SaveFlag.Slayer2, m_Slayer2 != SlayerName.None ); SetSaveFlag( ref flags, SaveFlag.ElementalDamages, !m_AosElementDamages.IsEmpty ); @@ -2720,7 +2698,7 @@ namespace Server.Items } if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) - m_PlayerConstructed = true; + PlayerConstructed = true; if ( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) m_AosSkillBonuses = new AosSkillBonuses( this, reader ); @@ -2876,7 +2854,7 @@ namespace Server.Items } if ( version < 6 ) - m_PlayerConstructed = true; // we don't know, so, assume it's crafted + PlayerConstructed = true; // we don't know, so, assume it's crafted } #endregion @@ -3354,13 +3332,7 @@ namespace Server.Items from.Send( new DisplayEquipmentInfo( this, eqInfo ) ); } - private static BaseWeapon m_Fists; // This value holds the default--fist--weapon - - public static BaseWeapon Fists - { - get => m_Fists; - set => m_Fists = value; - } + public static BaseWeapon Fists { get; set; } #region ICraftable Members diff --git a/Scripts/Items/Weapons/SlayerEntry.cs b/Scripts/Items/Weapons/SlayerEntry.cs index e401ab370..756105b67 100644 --- a/Scripts/Items/Weapons/SlayerEntry.cs +++ b/Scripts/Items/Weapons/SlayerEntry.cs @@ -4,15 +4,11 @@ namespace Server.Items { public class SlayerEntry { - private SlayerGroup m_Group; - private SlayerName m_Name; - private Type[] m_Types; + public SlayerGroup Group { get; set; } - public SlayerGroup Group{ get => m_Group; - set => m_Group = value; - } - public SlayerName Name => m_Name; - public Type[] Types => m_Types; + public SlayerName Name { get; } + + public Type[] Types { get; } private static int[] m_AosTitles = { 1060479, // undead slayer @@ -80,23 +76,23 @@ namespace Server.Items { int[] titles = ( Core.AOS ? m_AosTitles : m_OldTitles ); - return titles[(int)m_Name - 1]; + return titles[(int)Name - 1]; } } public SlayerEntry( SlayerName name, params Type[] types ) { - m_Name = name; - m_Types = types; + Name = name; + Types = types; } public bool Slays( Mobile m ) { Type t = m.GetType(); - for ( int i = 0; i < m_Types.Length; ++i ) + for ( int i = 0; i < Types.Length; ++i ) { - if ( m_Types[i].IsAssignableFrom( t ) ) + if ( Types[i].IsAssignableFrom( t ) ) return true; } diff --git a/Scripts/Items/Weapons/SlayerGroup.cs b/Scripts/Items/Weapons/SlayerGroup.cs index 1a99741f7..dc1763d0b 100644 --- a/Scripts/Items/Weapons/SlayerGroup.cs +++ b/Scripts/Items/Weapons/SlayerGroup.cs @@ -5,28 +5,25 @@ namespace Server.Items { public class SlayerGroup { - private static SlayerEntry[] m_TotalEntries; - private static SlayerGroup[] m_Groups; + public static SlayerEntry[] TotalEntries { get; } - public static SlayerEntry[] TotalEntries => m_TotalEntries; - - public static SlayerGroup[] Groups => m_Groups; + public static SlayerGroup[] Groups { get; } public static SlayerEntry GetEntryByName( SlayerName name ) { int v = (int)name; - if ( v >= 0 && v < m_TotalEntries.Length ) - return m_TotalEntries[v]; + if ( v >= 0 && v < TotalEntries.Length ) + return TotalEntries[v]; return null; } public static SlayerName GetLootSlayerType( Type type ) { - for ( int i = 0; i < m_Groups.Length; ++i ) + for ( int i = 0; i < Groups.Length; ++i ) { - SlayerGroup group = m_Groups[i]; + SlayerGroup group = Groups[i]; Type[] foundOn = group.FoundOn; bool inGroup = false; @@ -39,7 +36,7 @@ namespace Server.Items int index = Utility.Random( 1 + group.Entries.Length ); if ( index == 0 ) - return group.m_Super.Name; + return group.Super.Name; return group.Entries[index - 1].Name; } @@ -136,7 +133,7 @@ namespace Server.Items new SlayerEntry( SlayerName.SnakesBane, typeof( DeepSeaSerpent ), typeof( GiantIceWorm ), typeof( GiantSerpent ), typeof( IceSerpent ), typeof( IceSnake ), typeof( LavaSerpent ), typeof( LavaSnake ), typeof( SeaSerpent ), typeof( Serado ), typeof( SilverSerpent ), typeof( Snake ), typeof( Yamandon ) ) }; - m_Groups = new[] + Groups = new[] { humanoid, undead, @@ -147,7 +144,7 @@ namespace Server.Items fey }; - m_TotalEntries = CompileEntries( m_Groups ); + TotalEntries = CompileEntries( Groups ); } private static SlayerEntry[] CompileEntries( SlayerGroup[] groups ) @@ -172,23 +169,13 @@ namespace Server.Items return entries; } - private SlayerGroup[] m_Opposition; - private SlayerEntry m_Super; - private SlayerEntry[] m_Entries; - private Type[] m_FoundOn; + public SlayerGroup[] Opposition { get; set; } - public SlayerGroup[] Opposition{ get => m_Opposition; - set => m_Opposition = value; - } - public SlayerEntry Super{ get => m_Super; - set => m_Super = value; - } - public SlayerEntry[] Entries{ get => m_Entries; - set => m_Entries = value; - } - public Type[] FoundOn{ get => m_FoundOn; - set => m_FoundOn = value; - } + public SlayerEntry Super { get; set; } + + public SlayerEntry[] Entries { get; set; } + + public Type[] FoundOn { get; set; } public bool OppositionSuperSlays( Mobile m ) { diff --git a/Scripts/Misc/AOS.cs b/Scripts/Misc/AOS.cs index 0555143ae..2c2373b4a 100644 --- a/Scripts/Misc/AOS.cs +++ b/Scripts/Misc/AOS.cs @@ -1146,24 +1146,23 @@ namespace Server [PropertyObject] public abstract class BaseAttributes { - private Item m_Owner; private uint m_Names; private int[] m_Values; private static int[] m_Empty = new int[0]; public bool IsEmpty => (m_Names == 0); - public Item Owner => m_Owner; + public Item Owner { get; } public BaseAttributes( Item owner ) { - m_Owner = owner; + Owner = owner; m_Values = m_Empty; } public BaseAttributes( Item owner, BaseAttributes other ) { - m_Owner = owner; + Owner = owner; m_Values = new int[other.m_Values.Length]; other.m_Values.CopyTo( m_Values, 0 ); m_Names = other.m_Names; @@ -1171,7 +1170,7 @@ namespace Server public BaseAttributes( Item owner, GenericReader reader ) { - m_Owner = owner; + Owner = owner; int version = reader.ReadByte(); @@ -1233,14 +1232,14 @@ namespace Server { if ( (bitmask == (int)AosWeaponAttribute.DurabilityBonus) && (this is AosWeaponAttributes) ) { - if ( m_Owner is BaseWeapon weapon ) + if ( Owner is BaseWeapon weapon ) weapon.UnscaleDurability(); } else if ( (bitmask == (int)AosArmorAttribute.DurabilityBonus) && (this is AosArmorAttributes) ) { - if ( m_Owner is BaseArmor armor ) + if ( Owner is BaseArmor armor ) armor.UnscaleDurability(); - else if ( m_Owner is BaseClothing clothing ) + else if ( Owner is BaseClothing clothing ) clothing.UnscaleDurability(); } @@ -1304,18 +1303,18 @@ namespace Server if ( (bitmask == (int)AosWeaponAttribute.DurabilityBonus) && (this is AosWeaponAttributes) ) { - if ( m_Owner is BaseWeapon weapon ) + if ( Owner is BaseWeapon weapon ) weapon.ScaleDurability(); } else if ( (bitmask == (int)AosArmorAttribute.DurabilityBonus) && (this is AosArmorAttributes) ) { - if ( m_Owner is BaseArmor armor ) + if ( Owner is BaseArmor armor ) armor.ScaleDurability(); - else if ( m_Owner is BaseClothing clothing ) + else if ( Owner is BaseClothing clothing ) clothing.ScaleDurability(); } - if ( m_Owner.Parent is Mobile m ) + if ( Owner.Parent is Mobile m ) { m.CheckStatTimers(); m.UpdateResistances(); @@ -1328,7 +1327,7 @@ namespace Server } } - m_Owner.InvalidateProperties(); + Owner.InvalidateProperties(); } private int GetIndex( uint mask ) diff --git a/Scripts/Misc/Assistants.cs b/Scripts/Misc/Assistants.cs index 73368f8b5..fe9a6405f 100644 --- a/Scripts/Misc/Assistants.cs +++ b/Scripts/Misc/Assistants.cs @@ -60,8 +60,6 @@ namespace Server.Misc All = ulong.MaxValue } - private static Features m_DisallowedFeatures = Features.None; - public static void DisallowFeature(Features feature) { SetDisallowed(feature, true); @@ -75,12 +73,12 @@ namespace Server.Misc public static void SetDisallowed(Features feature, bool value) { if (value) - m_DisallowedFeatures |= feature; + DisallowedFeatures |= feature; else - m_DisallowedFeatures &= ~feature; + DisallowedFeatures &= ~feature; } - public static Features DisallowedFeatures => m_DisallowedFeatures; + public static Features DisallowedFeatures { get; private set; } = Features.None; } private static class Negotiator diff --git a/Scripts/Misc/AutoRestart.cs b/Scripts/Misc/AutoRestart.cs index 43cb8c26e..edf6f7d24 100644 --- a/Scripts/Misc/AutoRestart.cs +++ b/Scripts/Misc/AutoRestart.cs @@ -12,10 +12,9 @@ namespace Server.Misc private static TimeSpan WarningDelay = TimeSpan.FromMinutes( 1.0 ); // at what interval should the shutdown message be displayed? - private static bool m_Restarting; private static DateTime m_RestartTime; - public static bool Restarting => m_Restarting; + public static bool Restarting { get; private set; } public static void Initialize() { @@ -25,7 +24,7 @@ namespace Server.Misc public static void Restart_OnCommand( CommandEventArgs e ) { - if ( m_Restarting ) + if ( Restarting ) { e.Mobile.SendMessage( "The server is already restarting." ); } @@ -59,7 +58,7 @@ namespace Server.Misc protected override void OnTick() { - if ( m_Restarting || !Enabled ) + if ( Restarting || !Enabled ) return; if ( DateTime.UtcNow < m_RestartTime ) @@ -73,7 +72,7 @@ namespace Server.Misc AutoSave.Save(); - m_Restarting = true; + Restarting = true; DelayCall( RestartDelay, Restart_Callback ); } diff --git a/Scripts/Misc/AutoSave.cs b/Scripts/Misc/AutoSave.cs index 5ae91ae9b..cdedfbbfb 100644 --- a/Scripts/Misc/AutoSave.cs +++ b/Scripts/Misc/AutoSave.cs @@ -16,13 +16,7 @@ namespace Server.Misc CommandSystem.Register( "SetSaves", AccessLevel.Administrator, SetSaves_OnCommand ); } - private static bool m_SavesEnabled = true; - - public static bool SavesEnabled - { - get => m_SavesEnabled; - set => m_SavesEnabled = value; - } + public static bool SavesEnabled { get; set; } = true; [Usage( "SetSaves " )] [Description( "Enables or disables automatic shard saving." )] @@ -30,8 +24,8 @@ namespace Server.Misc { if ( e.Length == 1 ) { - m_SavesEnabled = e.GetBoolean( 0 ); - e.Mobile.SendMessage( "Saves have been {0}.", m_SavesEnabled ? "enabled" : "disabled" ); + SavesEnabled = e.GetBoolean( 0 ); + e.Mobile.SendMessage( "Saves have been {0}.", SavesEnabled ? "enabled" : "disabled" ); } else { @@ -46,7 +40,7 @@ namespace Server.Misc protected override void OnTick() { - if ( !m_SavesEnabled || AutoRestart.Restarting ) + if ( !SavesEnabled || AutoRestart.Restarting ) return; if ( m_Warning == TimeSpan.Zero ) diff --git a/Scripts/Misc/BuffIcons.cs b/Scripts/Misc/BuffIcons.cs index 1756293cf..d05a92191 100644 --- a/Scripts/Misc/BuffIcons.cs +++ b/Scripts/Misc/BuffIcons.cs @@ -21,29 +21,22 @@ namespace Server } #region Properties - private BuffIcon m_ID; - public BuffIcon ID => m_ID; - private int m_TitleCliloc; - public int TitleCliloc => m_TitleCliloc; + public BuffIcon ID { get; } - private int m_SecondaryCliloc; - public int SecondaryCliloc => m_SecondaryCliloc; + public int TitleCliloc { get; } - private TimeSpan m_TimeLength; - public TimeSpan TimeLength => m_TimeLength; + public int SecondaryCliloc { get; } - private DateTime m_TimeStart; - public DateTime TimeStart => m_TimeStart; + public TimeSpan TimeLength { get; } - private Timer m_Timer; - public Timer Timer => m_Timer; + public DateTime TimeStart { get; } - private bool m_RetainThroughDeath; - public bool RetainThroughDeath => m_RetainThroughDeath; + public Timer Timer { get; } - private TextDefinition m_Args; - public TextDefinition Args => m_Args; + public bool RetainThroughDeath { get; } + + public TextDefinition Args { get; } #endregion @@ -55,9 +48,9 @@ namespace Server public BuffInfo( BuffIcon iconID, int titleCliloc, int secondaryCliloc ) { - m_ID = iconID; - m_TitleCliloc = titleCliloc; - m_SecondaryCliloc = secondaryCliloc; + ID = iconID; + TitleCliloc = titleCliloc; + SecondaryCliloc = secondaryCliloc; } public BuffInfo( BuffIcon iconID, int titleCliloc, TimeSpan length, Mobile m ) @@ -69,10 +62,10 @@ namespace Server public BuffInfo( BuffIcon iconID, int titleCliloc, int secondaryCliloc, TimeSpan length, Mobile m ) : this( iconID, titleCliloc, secondaryCliloc ) { - m_TimeLength = length; - m_TimeStart = DateTime.UtcNow; + TimeLength = length; + TimeStart = DateTime.UtcNow; - m_Timer = Timer.DelayCall( length, delegate + Timer = Timer.DelayCall( length, delegate { if ( !(m is PlayerMobile pm) ) return; @@ -90,7 +83,7 @@ namespace Server public BuffInfo( BuffIcon iconID, int titleCliloc, int secondaryCliloc, TextDefinition args ) : this( iconID, titleCliloc, secondaryCliloc ) { - m_Args = args; + Args = args; } public BuffInfo( BuffIcon iconID, int titleCliloc, bool retainThroughDeath ) @@ -101,7 +94,7 @@ namespace Server public BuffInfo( BuffIcon iconID, int titleCliloc, int secondaryCliloc, bool retainThroughDeath ) : this( iconID, titleCliloc, secondaryCliloc ) { - m_RetainThroughDeath = retainThroughDeath; + RetainThroughDeath = retainThroughDeath; } public BuffInfo( BuffIcon iconID, int titleCliloc, TextDefinition args, bool retainThroughDeath ) @@ -112,7 +105,7 @@ namespace Server public BuffInfo( BuffIcon iconID, int titleCliloc, int secondaryCliloc, TextDefinition args, bool retainThroughDeath ) : this( iconID, titleCliloc, secondaryCliloc, args ) { - m_RetainThroughDeath = retainThroughDeath; + RetainThroughDeath = retainThroughDeath; } public BuffInfo( BuffIcon iconID, int titleCliloc, TimeSpan length, Mobile m, TextDefinition args ) @@ -123,7 +116,7 @@ namespace Server public BuffInfo( BuffIcon iconID, int titleCliloc, int secondaryCliloc, TimeSpan length, Mobile m, TextDefinition args ) : this( iconID, titleCliloc, secondaryCliloc, length, m ) { - m_Args = args; + Args = args; } public BuffInfo( BuffIcon iconID, int titleCliloc, TimeSpan length, Mobile m, TextDefinition args, bool retainThroughDeath ) @@ -134,8 +127,8 @@ namespace Server public BuffInfo( BuffIcon iconID, int titleCliloc, int secondaryCliloc, TimeSpan length, Mobile m, TextDefinition args, bool retainThroughDeath ) : this( iconID, titleCliloc, secondaryCliloc, length, m ) { - m_Args = args; - m_RetainThroughDeath = retainThroughDeath; + Args = args; + RetainThroughDeath = retainThroughDeath; } #endregion diff --git a/Scripts/Misc/ClientVerification.cs b/Scripts/Misc/ClientVerification.cs index e34c2cff7..b5c1a2968 100644 --- a/Scripts/Misc/ClientVerification.cs +++ b/Scripts/Misc/ClientVerification.cs @@ -21,43 +21,18 @@ namespace Server.Misc private static bool m_DetectClientRequirement = true; private static OldClientResponse m_OldClientResponse = OldClientResponse.LenientKick; - private static ClientVersion m_Required; - private static bool m_AllowRegular = true, m_AllowUOTD = true, m_AllowGod = true; - private static TimeSpan m_AgeLeniency = TimeSpan.FromDays( 10 ); private static TimeSpan m_GameTimeLeniency = TimeSpan.FromHours( 25 ); - private static TimeSpan m_KickDelay = TimeSpan.FromSeconds( 20.0 ); + public static ClientVersion Required { get; set; } - public static ClientVersion Required - { - get => m_Required; - set => m_Required = value; - } + public static bool AllowRegular { get; set; } = true; - public static bool AllowRegular - { - get => m_AllowRegular; - set => m_AllowRegular = value; - } + public static bool AllowUOTD { get; set; } = true; - public static bool AllowUOTD - { - get => m_AllowUOTD; - set => m_AllowUOTD = value; - } + public static bool AllowGod { get; set; } = true; - public static bool AllowGod - { - get => m_AllowGod; - set => m_AllowGod = value; - } - - public static TimeSpan KickDelay - { - get => m_KickDelay; - set => m_KickDelay = value; - } + public static TimeSpan KickDelay { get; set; } = TimeSpan.FromSeconds( 20.0 ); public static void Initialize() { diff --git a/Scripts/Misc/Emitter.cs b/Scripts/Misc/Emitter.cs index 83cb57ce6..455f9f559 100644 --- a/Scripts/Misc/Emitter.cs +++ b/Scripts/Misc/Emitter.cs @@ -56,16 +56,11 @@ namespace Server public class MethodEmitter { - private TypeBuilder m_TypeBuilder; - - private MethodBuilder m_Builder; - private ILGenerator m_Generator; - private Type[] m_ArgumentTypes; - public TypeBuilder Type => m_TypeBuilder; + public TypeBuilder Type { get; } - public ILGenerator Generator => m_Generator; + public ILGenerator Generator { get; private set; } private class CallInfo { @@ -89,11 +84,11 @@ namespace Server private Dictionary> m_Temps; - public MethodBuilder Method => m_Builder; + public MethodBuilder Method { get; private set; } public MethodEmitter( TypeBuilder typeBuilder ) { - m_TypeBuilder = typeBuilder; + Type = typeBuilder; m_Temps = new Dictionary>(); @@ -103,15 +98,15 @@ namespace Server public void Define( string name, MethodAttributes attr, Type returnType, Type[] parms ) { - m_Builder = m_TypeBuilder.DefineMethod( name, attr, returnType, parms ); - m_Generator = m_Builder.GetILGenerator(); + Method = Type.DefineMethod( name, attr, returnType, parms ); + Generator = Method.GetILGenerator(); m_ArgumentTypes = parms; } public LocalBuilder CreateLocal( Type localType ) { - return m_Generator.DeclareLocal( localType ); + return Generator.DeclareLocal( localType ); } public LocalBuilder AcquireTemp( Type localType ) @@ -135,31 +130,31 @@ namespace Server public void Branch( Label label ) { - m_Generator.Emit( OpCodes.Br, label ); + Generator.Emit( OpCodes.Br, label ); } public void BranchIfFalse( Label label ) { Pop( typeof( object ) ); - m_Generator.Emit( OpCodes.Brfalse, label ); + Generator.Emit( OpCodes.Brfalse, label ); } public void BranchIfTrue( Label label ) { Pop( typeof( object ) ); - m_Generator.Emit( OpCodes.Brtrue, label ); + Generator.Emit( OpCodes.Brtrue, label ); } public Label CreateLabel() { - return m_Generator.DefineLabel(); + return Generator.DefineLabel(); } public void MarkLabel( Label label ) { - m_Generator.MarkLabel( label ); + Generator.MarkLabel( label ); } public void Pop() @@ -191,10 +186,10 @@ namespace Server public void Return() { - if ( m_Stack.Count != ( m_Builder.ReturnType == typeof( void ) ? 0 : 1 ) ) + if ( m_Stack.Count != ( Method.ReturnType == typeof( void ) ? 0 : 1 ) ) throw new InvalidOperationException( "Stack return mismatch." ); - m_Generator.Emit( OpCodes.Ret ); + Generator.Emit( OpCodes.Ret ); } public void LoadNull() @@ -206,7 +201,7 @@ namespace Server { Push( type ); - m_Generator.Emit( OpCodes.Ldnull ); + Generator.Emit( OpCodes.Ldnull ); } public void Load( string value ) @@ -214,9 +209,9 @@ namespace Server Push( typeof( string ) ); if ( value != null ) - m_Generator.Emit( OpCodes.Ldstr, value ); + Generator.Emit( OpCodes.Ldstr, value ); else - m_Generator.Emit( OpCodes.Ldnull ); + Generator.Emit( OpCodes.Ldnull ); } public void Load( Enum value ) @@ -232,21 +227,21 @@ namespace Server { Push( typeof( long ) ); - m_Generator.Emit( OpCodes.Ldc_I8, value ); + Generator.Emit( OpCodes.Ldc_I8, value ); } public void Load( float value ) { Push( typeof( float ) ); - m_Generator.Emit( OpCodes.Ldc_R4, value ); + Generator.Emit( OpCodes.Ldc_R4, value ); } public void Load( double value ) { Push( typeof( double ) ); - m_Generator.Emit( OpCodes.Ldc_R8, value ); + Generator.Emit( OpCodes.Ldc_R8, value ); } public void Load( char value ) @@ -262,9 +257,9 @@ namespace Server Push( typeof( bool ) ); if ( value ) - m_Generator.Emit( OpCodes.Ldc_I4_1 ); + Generator.Emit( OpCodes.Ldc_I4_1 ); else - m_Generator.Emit( OpCodes.Ldc_I4_0 ); + Generator.Emit( OpCodes.Ldc_I4_0 ); } public void Load( int value ) @@ -274,50 +269,50 @@ namespace Server switch ( value ) { case -1: - m_Generator.Emit( OpCodes.Ldc_I4_M1 ); + Generator.Emit( OpCodes.Ldc_I4_M1 ); break; case 0: - m_Generator.Emit( OpCodes.Ldc_I4_0 ); + Generator.Emit( OpCodes.Ldc_I4_0 ); break; case 1: - m_Generator.Emit( OpCodes.Ldc_I4_1 ); + Generator.Emit( OpCodes.Ldc_I4_1 ); break; case 2: - m_Generator.Emit( OpCodes.Ldc_I4_2 ); + Generator.Emit( OpCodes.Ldc_I4_2 ); break; case 3: - m_Generator.Emit( OpCodes.Ldc_I4_3 ); + Generator.Emit( OpCodes.Ldc_I4_3 ); break; case 4: - m_Generator.Emit( OpCodes.Ldc_I4_4 ); + Generator.Emit( OpCodes.Ldc_I4_4 ); break; case 5: - m_Generator.Emit( OpCodes.Ldc_I4_5 ); + Generator.Emit( OpCodes.Ldc_I4_5 ); break; case 6: - m_Generator.Emit( OpCodes.Ldc_I4_6 ); + Generator.Emit( OpCodes.Ldc_I4_6 ); break; case 7: - m_Generator.Emit( OpCodes.Ldc_I4_7 ); + Generator.Emit( OpCodes.Ldc_I4_7 ); break; case 8: - m_Generator.Emit( OpCodes.Ldc_I4_8 ); + Generator.Emit( OpCodes.Ldc_I4_8 ); break; default: if ( value >= sbyte.MinValue && value <= sbyte.MaxValue ) - m_Generator.Emit( OpCodes.Ldc_I4_S, (sbyte) value ); + Generator.Emit( OpCodes.Ldc_I4_S, (sbyte) value ); else - m_Generator.Emit( OpCodes.Ldc_I4, value ); + Generator.Emit( OpCodes.Ldc_I4, value ); break; } @@ -329,7 +324,7 @@ namespace Server Push( field.FieldType ); - m_Generator.Emit( OpCodes.Ldfld, field ); + Generator.Emit( OpCodes.Ldfld, field ); } public void LoadLocal( LocalBuilder local ) @@ -341,26 +336,26 @@ namespace Server switch ( index ) { case 0: - m_Generator.Emit( OpCodes.Ldloc_0 ); + Generator.Emit( OpCodes.Ldloc_0 ); break; case 1: - m_Generator.Emit( OpCodes.Ldloc_1 ); + Generator.Emit( OpCodes.Ldloc_1 ); break; case 2: - m_Generator.Emit( OpCodes.Ldloc_2 ); + Generator.Emit( OpCodes.Ldloc_2 ); break; case 3: - m_Generator.Emit( OpCodes.Ldloc_3 ); + Generator.Emit( OpCodes.Ldloc_3 ); break; default: if ( index >= byte.MinValue && index <= byte.MinValue ) - m_Generator.Emit( OpCodes.Ldloc_S, (byte) index ); + Generator.Emit( OpCodes.Ldloc_S, (byte) index ); else - m_Generator.Emit( OpCodes.Ldloc, (short) index ); + Generator.Emit( OpCodes.Ldloc, (short) index ); break; } @@ -370,7 +365,7 @@ namespace Server { Pop( local.LocalType ); - m_Generator.Emit( OpCodes.Stloc, local ); + Generator.Emit( OpCodes.Stloc, local ); } public void LoadArgument( int index ) @@ -378,31 +373,31 @@ namespace Server if ( index > 0 ) Push( m_ArgumentTypes[index - 1] ); else - Push( m_TypeBuilder ); + Push( Type ); switch ( index ) { case 0: - m_Generator.Emit( OpCodes.Ldarg_0 ); + Generator.Emit( OpCodes.Ldarg_0 ); break; case 1: - m_Generator.Emit( OpCodes.Ldarg_1 ); + Generator.Emit( OpCodes.Ldarg_1 ); break; case 2: - m_Generator.Emit( OpCodes.Ldarg_2 ); + Generator.Emit( OpCodes.Ldarg_2 ); break; case 3: - m_Generator.Emit( OpCodes.Ldarg_3 ); + Generator.Emit( OpCodes.Ldarg_3 ); break; default: if ( index >= byte.MinValue && index <= byte.MaxValue ) - m_Generator.Emit( OpCodes.Ldarg_S, (byte) index ); + Generator.Emit( OpCodes.Ldarg_S, (byte) index ); else - m_Generator.Emit( OpCodes.Ldarg, (short) index ); + Generator.Emit( OpCodes.Ldarg, (short) index ); break; } @@ -413,7 +408,7 @@ namespace Server Pop( typeof( object ) ); Push( type ); - m_Generator.Emit( OpCodes.Isinst, type ); + Generator.Emit( OpCodes.Isinst, type ); } public void Neg() @@ -422,7 +417,7 @@ namespace Server Push( typeof( int ) ); - m_Generator.Emit( OpCodes.Neg ); + Generator.Emit( OpCodes.Neg ); } public void Compare( OpCode opCode ) @@ -432,7 +427,7 @@ namespace Server Push( typeof( int ) ); - m_Generator.Emit( opCode ); + Generator.Emit( opCode ); } public void LogicalNot() @@ -441,8 +436,8 @@ namespace Server Push( typeof( int ) ); - m_Generator.Emit( OpCodes.Ldc_I4_0 ); - m_Generator.Emit( OpCodes.Ceq ); + Generator.Emit( OpCodes.Ldc_I4_0 ); + Generator.Emit( OpCodes.Ceq ); } public void Xor() @@ -452,7 +447,7 @@ namespace Server Push( typeof( int ) ); - m_Generator.Emit( OpCodes.Xor ); + Generator.Emit( OpCodes.Xor ); } public Type Active => m_Stack.Peek(); @@ -662,8 +657,8 @@ namespace Server { LocalBuilder temp = AcquireTemp( type ); - m_Generator.Emit( OpCodes.Stloc, temp ); - m_Generator.Emit( OpCodes.Ldloca, temp ); + Generator.Emit( OpCodes.Stloc, temp ); + Generator.Emit( OpCodes.Ldloca, temp ); ReleaseTemp( temp ); } @@ -674,12 +669,12 @@ namespace Server CallInfo call = m_Calls.Pop(); if ( ( call.type.IsValueType || call.type.IsByRef ) && call.method.DeclaringType != call.type ) - m_Generator.Emit( OpCodes.Constrained, call.type ); + Generator.Emit( OpCodes.Constrained, call.type ); if ( call.method.DeclaringType.IsValueType || call.method.IsStatic ) - m_Generator.Emit( OpCodes.Call, call.method ); + Generator.Emit( OpCodes.Call, call.method ); else - m_Generator.Emit( OpCodes.Callvirt, call.method ); + Generator.Emit( OpCodes.Callvirt, call.method ); for ( int i = call.parms.Length - 1; i >= 0; --i ) Pop( call.parms[i].ParameterType ); @@ -703,7 +698,7 @@ namespace Server throw new InvalidOperationException( "Parameter type mismatch." ); if ( argumentType.IsValueType && !parm.ParameterType.IsValueType ) - m_Generator.Emit( OpCodes.Box, argumentType ); + Generator.Emit( OpCodes.Box, argumentType ); } } } diff --git a/Scripts/Misc/Geometry.cs b/Scripts/Misc/Geometry.cs index a722677ba..faff955e0 100644 --- a/Scripts/Misc/Geometry.cs +++ b/Scripts/Misc/Geometry.cs @@ -25,19 +25,17 @@ namespace Server.Misc public class CirclePoint { - private Point2D point; - private int angle; - private int quadrant; - - public Point2D Point => point; - public int Angle => angle; - public int Quadrant => quadrant; + public Point2D Point { get; } + + public int Angle { get; } + + public int Quadrant { get; } public CirclePoint( Point2D point, int angle, int quadrant ) { - this.point = point; - this.angle = angle; - this.quadrant = quadrant; + this.Point = point; + this.Angle = angle; + this.Quadrant = quadrant; } } diff --git a/Scripts/Misc/Gifts/Winter2004/LightOfTheWinterSolstice.cs b/Scripts/Misc/Gifts/Winter2004/LightOfTheWinterSolstice.cs index 6fad105e8..26816bffc 100644 --- a/Scripts/Misc/Gifts/Winter2004/LightOfTheWinterSolstice.cs +++ b/Scripts/Misc/Gifts/Winter2004/LightOfTheWinterSolstice.cs @@ -24,12 +24,8 @@ namespace Server.Items "Zippy" }; - private string m_Dipper; - [CommandProperty( AccessLevel.GameMaster )] - public string Dipper{ get => m_Dipper; - set => m_Dipper = value; - } + public string Dipper { get; set; } [Constructible] public LightOfTheWinterSolstice() : this( m_StaffNames[Utility.Random( m_StaffNames.Length )] ) @@ -39,7 +35,7 @@ namespace Server.Items [Constructible] public LightOfTheWinterSolstice( string dipper ) : base( 0x236E ) { - m_Dipper = dipper; + Dipper = dipper; Weight = 1.0; LootType = LootType.Blessed; @@ -55,7 +51,7 @@ namespace Server.Items { base.OnSingleClick( from ); - LabelTo( from, 1070881, m_Dipper ); // Hand Dipped by ~1_name~ + LabelTo( from, 1070881, Dipper ); // Hand Dipped by ~1_name~ LabelTo( from, 1070880 ); // Winter 2004 } @@ -63,7 +59,7 @@ namespace Server.Items { base.GetProperties( list ); - list.Add( 1070881, m_Dipper ); // Hand Dipped by ~1_name~ + list.Add( 1070881, Dipper ); // Hand Dipped by ~1_name~ list.Add( 1070880 ); // Winter 2004 } @@ -73,7 +69,7 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (string) m_Dipper ); + writer.Write( (string) Dipper ); } public override void Deserialize( GenericReader reader ) @@ -86,18 +82,18 @@ namespace Server.Items { case 1: { - m_Dipper = reader.ReadString(); + Dipper = reader.ReadString(); break; } case 0: { - m_Dipper = m_StaffNames[Utility.Random( m_StaffNames.Length )]; + Dipper = m_StaffNames[Utility.Random( m_StaffNames.Length )]; break; } } - if ( m_Dipper != null ) - m_Dipper = string.Intern( m_Dipper ); + if ( Dipper != null ) + Dipper = string.Intern( Dipper ); } } } \ No newline at end of file diff --git a/Scripts/Misc/Guild.cs b/Scripts/Misc/Guild.cs index a358237cf..dff9dc63f 100644 --- a/Scripts/Misc/Guild.cs +++ b/Scripts/Misc/Guild.cs @@ -42,32 +42,30 @@ namespace Server.Guilds public static RankDefinition Member => Ranks[1]; public static RankDefinition Lowest => Ranks[0]; - private TextDefinition m_Name; - private int m_Rank; - private RankFlags m_Flags; + public TextDefinition Name { get; } - public TextDefinition Name => m_Name; - public int Rank => m_Rank; - public RankFlags Flags => m_Flags; + public int Rank { get; } + + public RankFlags Flags { get; private set; } public RankDefinition( TextDefinition name, int rank, RankFlags flags ) { - m_Name = name; - m_Rank = rank; - m_Flags = flags; + Name = name; + Rank = rank; + Flags = flags; } public bool GetFlag( RankFlags flag ) { - return ( (m_Flags & flag) != 0 ); + return ( (Flags & flag) != 0 ); } public void SetFlag( RankFlags flag, bool value ) { if ( value ) - m_Flags |= flag; + Flags |= flag; else - m_Flags &= ~flag; + Flags &= ~flag; } } @@ -76,16 +74,13 @@ namespace Server.Guilds #region Alliances public class AllianceInfo { - private static Dictionary m_Alliances = new Dictionary(); + public static Dictionary Alliances { get; } = new Dictionary(); - public static Dictionary Alliances => m_Alliances; - - private string m_Name; private Guild m_Leader; private List m_Members; private List m_PendingMembers; - public string Name => m_Name; + public string Name { get; } public void CalculateAllianceLeader() { @@ -141,7 +136,7 @@ namespace Server.Guilds public AllianceInfo( Guild leader, string name, Guild partner ) { m_Leader = leader; - m_Name = name; + Name = name; m_Members = new List(); m_PendingMembers = new List(); @@ -149,22 +144,22 @@ namespace Server.Guilds leader.Alliance = this; partner.Alliance = this; - if ( !m_Alliances.ContainsKey( m_Name.ToLower() ) ) - m_Alliances.Add( m_Name.ToLower(), this ); + if ( !Alliances.ContainsKey( Name.ToLower() ) ) + Alliances.Add( Name.ToLower(), this ); } public void Serialize( GenericWriter writer ) { writer.Write( (int)0 ); //Version - writer.Write( m_Name ); + writer.Write( Name ); writer.Write( m_Leader ); writer.WriteGuildList( m_Members, true ); writer.WriteGuildList( m_PendingMembers, true ); - if ( !m_Alliances.ContainsKey( m_Name.ToLower() ) ) - m_Alliances.Add( m_Name.ToLower(), this ); + if ( !Alliances.ContainsKey( Name.ToLower() ) ) + Alliances.Add( Name.ToLower(), this ); } public AllianceInfo( GenericReader reader ) @@ -175,7 +170,7 @@ namespace Server.Guilds { case 0: { - m_Name = reader.ReadString(); + Name = reader.ReadString(); m_Leader = reader.ReadGuild() as Guild; m_Members = reader.ReadStrongGuildList(); @@ -253,10 +248,10 @@ namespace Server.Guilds for( int i = 0; i < m_Members.Count; i++ ) m_Members[i].Alliance = null; - m_Alliances.TryGetValue( m_Name.ToLower(), out AllianceInfo aInfo ); + Alliances.TryGetValue( Name.ToLower(), out AllianceInfo aInfo ); if ( aInfo == this ) - m_Alliances.Remove( m_Name.ToLower() ); + Alliances.Remove( Name.ToLower() ); } public void InvalidateMemberProperties() @@ -407,54 +402,27 @@ namespace Server.Guilds public class WarDeclaration { - private int m_Kills; - private int m_MaxKills; + public int Kills { get; set; } - private TimeSpan m_WarLength; - private DateTime m_WarBeginning; + public int MaxKills { get; set; } - private Guild m_Guild; - private Guild m_Opponent; + public TimeSpan WarLength { get; set; } - private bool m_WarRequester; + public Guild Opponent { get; } - public int Kills - { - get => m_Kills; - set => m_Kills = value; - } - public int MaxKills - { - get => m_MaxKills; - set => m_MaxKills = value; - } - public TimeSpan WarLength - { - get => m_WarLength; - set => m_WarLength = value; - } - public Guild Opponent => m_Opponent; + public Guild Guild { get; } - public Guild Guild => m_Guild; + public DateTime WarBeginning { get; set; } - public DateTime WarBeginning - { - get => m_WarBeginning; - set => m_WarBeginning = value; - } - public bool WarRequester - { - get => m_WarRequester; - set => m_WarRequester = value; - } + public bool WarRequester { get; set; } public WarDeclaration( Guild g, Guild opponent, int maxKills, TimeSpan warLength, bool warRequester ) { - m_Guild = g; - m_MaxKills = maxKills; - m_Opponent = opponent; - m_WarLength = warLength; - m_WarRequester = warRequester; + Guild = g; + MaxKills = maxKills; + Opponent = opponent; + WarLength = warLength; + WarRequester = warRequester; } public WarDeclaration( GenericReader reader ) @@ -465,16 +433,16 @@ namespace Server.Guilds { case 0: { - m_Kills = reader.ReadInt(); - m_MaxKills = reader.ReadInt(); + Kills = reader.ReadInt(); + MaxKills = reader.ReadInt(); - m_WarLength = reader.ReadTimeSpan(); - m_WarBeginning = reader.ReadDateTime(); + WarLength = reader.ReadTimeSpan(); + WarBeginning = reader.ReadDateTime(); - m_Guild = reader.ReadGuild() as Guild; - m_Opponent = reader.ReadGuild() as Guild; + Guild = reader.ReadGuild() as Guild; + Opponent = reader.ReadGuild() as Guild; - m_WarRequester = reader.ReadBool(); + WarRequester = reader.ReadBool(); break; } @@ -485,50 +453,50 @@ namespace Server.Guilds { writer.Write( (int)0 ); //version - writer.Write( m_Kills ); - writer.Write( m_MaxKills ); + writer.Write( Kills ); + writer.Write( MaxKills ); - writer.Write( m_WarLength ); - writer.Write( m_WarBeginning ); + writer.Write( WarLength ); + writer.Write( WarBeginning ); - writer.Write( m_Guild ); - writer.Write( m_Opponent ); + writer.Write( Guild ); + writer.Write( Opponent ); - writer.Write( m_WarRequester ); + writer.Write( WarRequester ); } public WarStatus Status { get { - if ( m_Opponent == null || m_Opponent.Disbanded ) + if ( Opponent == null || Opponent.Disbanded ) return WarStatus.Win; - if ( m_Guild == null || m_Guild.Disbanded ) + if ( Guild == null || Guild.Disbanded ) return WarStatus.Lose; - WarDeclaration w = m_Opponent.FindActiveWar( m_Guild ); + WarDeclaration w = Opponent.FindActiveWar( Guild ); - if ( m_Opponent.FindPendingWar( m_Guild ) != null && m_Guild.FindPendingWar( m_Opponent ) != null ) + if ( Opponent.FindPendingWar( Guild ) != null && Guild.FindPendingWar( Opponent ) != null ) return WarStatus.Pending; if ( w == null ) return WarStatus.Win; - if ( m_WarLength != TimeSpan.Zero && (m_WarBeginning + m_WarLength) < DateTime.UtcNow ) + if ( WarLength != TimeSpan.Zero && (WarBeginning + WarLength) < DateTime.UtcNow ) { - if ( m_Kills > w.m_Kills ) + if ( Kills > w.Kills ) return WarStatus.Win; - if ( m_Kills < w.m_Kills ) + if ( Kills < w.Kills ) return WarStatus.Lose; return WarStatus.Draw; } - if ( m_MaxKills > 0 ) + if ( MaxKills > 0 ) { - if ( m_Kills >= m_MaxKills ) + if ( Kills >= MaxKills ) return WarStatus.Win; - if ( w.m_Kills >= w.MaxKills ) + if ( w.Kills >= w.MaxKills ) return WarStatus.Lose; } @@ -735,9 +703,9 @@ namespace Server.Guilds #region New Wars - public List PendingWars => m_PendingWars; + public List PendingWars { get; private set; } - public List AcceptedWars => m_AcceptedWars; + public List AcceptedWars { get; private set; } public WarDeclaration FindPendingWar( Guild g ) @@ -871,28 +839,7 @@ namespace Server.Guilds private string m_Name; private string m_Abbreviation; - private List m_Allies; - private List m_Enemies; - - private List m_Members; - - private Item m_Guildstone; - private Item m_Teleporter; - - private string m_Charter; - private string m_Website; - - private DateTime m_LastFealty; - private GuildType m_Type; - private DateTime m_TypeLastChange; - - private List m_AllyDeclarations, m_AllyInvitations; - - private List m_WarDeclarations, m_WarInvitations; - private List m_Candidates, m_Accepted; - - private List m_PendingWars, m_AcceptedWars; private AllianceInfo m_AllianceInfo; private Guild m_AllianceLeader; @@ -903,30 +850,30 @@ namespace Server.Guilds #region Ctor mumbo-jumbo m_Leader = leader; - m_Members = new List(); - m_Allies = new List(); - m_Enemies = new List(); - m_WarDeclarations = new List(); - m_WarInvitations = new List(); - m_AllyDeclarations = new List(); - m_AllyInvitations = new List(); - m_Candidates = new List(); - m_Accepted = new List(); + Members = new List(); + Allies = new List(); + Enemies = new List(); + WarDeclarations = new List(); + WarInvitations = new List(); + AllyDeclarations = new List(); + AllyInvitations = new List(); + Candidates = new List(); + Accepted = new List(); - m_LastFealty = DateTime.UtcNow; + LastFealty = DateTime.UtcNow; m_Name = name; m_Abbreviation = abbreviation; - m_TypeLastChange = DateTime.MinValue; + TypeLastChange = DateTime.MinValue; AddMember( m_Leader ); if ( m_Leader is PlayerMobile mobile ) mobile.GuildRank = RankDefinition.Leader; - m_AcceptedWars = new List(); - m_PendingWars = new List(); + AcceptedWars = new List(); + PendingWars = new List(); #endregion } @@ -936,11 +883,11 @@ namespace Server.Guilds public void InvalidateMemberProperties( bool onlyOPL = false) { - if ( m_Members != null ) + if ( Members != null ) { - for ( int i = 0; i < m_Members.Count; i++ ) + for ( int i = 0; i < Members.Count; i++ ) { - Mobile m = m_Members[i]; + Mobile m = Members[i]; m.InvalidateProperties(); if ( !onlyOPL ) @@ -951,10 +898,10 @@ namespace Server.Guilds public void InvalidateMemberNotoriety() { - if ( m_Members != null ) + if ( Members != null ) { - for (int i=0; i < m_Members.Count; i++) - m_Members[i].Delta( MobileDelta.Noto ); + for (int i=0; i < Members.Count; i++) + Members[i].Delta( MobileDelta.Noto ); } } @@ -1021,7 +968,7 @@ namespace Server.Guilds List.Remove( Id ); - foreach ( Mobile m in m_Members ) + foreach ( Mobile m in Members ) { m.SendLocalizedMessage( 502131 ); // Your guild has disbanded. @@ -1031,20 +978,20 @@ namespace Server.Guilds m.Guild = null; } - m_Members.Clear(); + Members.Clear(); - for ( int i = m_Allies.Count - 1; i >= 0; --i ) - if ( i < m_Allies.Count ) - RemoveAlly( m_Allies[i] ); + for ( int i = Allies.Count - 1; i >= 0; --i ) + if ( i < Allies.Count ) + RemoveAlly( Allies[i] ); - for ( int i = m_Enemies.Count - 1; i >= 0; --i ) - if ( i < m_Enemies.Count ) - RemoveEnemy( m_Enemies[i] ); + for ( int i = Enemies.Count - 1; i >= 0; --i ) + if ( i < Enemies.Count ) + RemoveEnemy( Enemies[i] ); if ( !NewGuildSystem ) - m_Guildstone?.Delete(); + Guildstone?.Delete(); - m_Guildstone = null; + Guildstone = null; CheckExpiredWars(); @@ -1054,7 +1001,7 @@ namespace Server.Guilds #region Is(...) public bool IsMember( Mobile m ) { - return m_Members.Contains( m ); + return Members.Contains( m ); } public bool IsAlly( Guild g ) @@ -1064,7 +1011,7 @@ namespace Server.Guilds return (Alliance != null && Alliance.IsMember( this ) && Alliance.IsMember( g )); } - return m_Allies.Contains( g ); + return Allies.Contains( g ); } public bool IsEnemy( Guild g ) @@ -1091,7 +1038,7 @@ namespace Server.Guilds return false; } - return m_Enemies.Contains( g ); + return Enemies.Contains( g ); } #endregion @@ -1108,18 +1055,18 @@ namespace Server.Guilds writer.Write( (int) 5 );//version #region War Serialization - writer.Write( m_PendingWars.Count ); + writer.Write( PendingWars.Count ); - for( int i = 0; i < m_PendingWars.Count; i++ ) + for( int i = 0; i < PendingWars.Count; i++ ) { - m_PendingWars[i].Serialize( writer ); + PendingWars[i].Serialize( writer ); } - writer.Write( m_AcceptedWars.Count ); + writer.Write( AcceptedWars.Count ); - for( int i = 0; i < m_AcceptedWars.Count; i++ ) + for( int i = 0; i < AcceptedWars.Count; i++ ) { - m_AcceptedWars[i].Serialize( writer ); + AcceptedWars[i].Serialize( writer ); } #endregion @@ -1137,33 +1084,33 @@ namespace Server.Guilds // - writer.WriteGuildList( m_AllyDeclarations, true ); - writer.WriteGuildList( m_AllyInvitations, true ); + writer.WriteGuildList( AllyDeclarations, true ); + writer.WriteGuildList( AllyInvitations, true ); - writer.Write( m_TypeLastChange ); + writer.Write( TypeLastChange ); writer.Write( (int)m_Type ); - writer.Write( m_LastFealty ); + writer.Write( LastFealty ); writer.Write( m_Leader ); writer.Write( m_Name ); writer.Write( m_Abbreviation ); - writer.WriteGuildList( m_Allies, true ); - writer.WriteGuildList( m_Enemies, true ); - writer.WriteGuildList( m_WarDeclarations, true ); - writer.WriteGuildList( m_WarInvitations, true ); + writer.WriteGuildList( Allies, true ); + writer.WriteGuildList( Enemies, true ); + writer.WriteGuildList( WarDeclarations, true ); + writer.WriteGuildList( WarInvitations, true ); - writer.Write( m_Members, true ); - writer.Write( m_Candidates, true ); - writer.Write( m_Accepted, true ); + writer.Write( Members, true ); + writer.Write( Candidates, true ); + writer.Write( Accepted, true ); - writer.Write( m_Guildstone ); - writer.Write( m_Teleporter ); + writer.Write( Guildstone ); + writer.Write( Teleporter ); - writer.Write( m_Charter ); - writer.Write( m_Website ); + writer.Write( Charter ); + writer.Write( Website ); } public override void Deserialize( GenericReader reader ) @@ -1176,17 +1123,17 @@ namespace Server.Guilds { int count = reader.ReadInt(); - m_PendingWars = new List(); + PendingWars = new List(); for( int i = 0; i < count; i++ ) { - m_PendingWars.Add( new WarDeclaration( reader ) ); + PendingWars.Add( new WarDeclaration( reader ) ); } count = reader.ReadInt(); - m_AcceptedWars = new List(); + AcceptedWars = new List(); for( int i = 0; i < count; i++ ) { - m_AcceptedWars.Add( new WarDeclaration( reader ) ); + AcceptedWars.Add( new WarDeclaration( reader ) ); } bool isAllianceLeader = reader.ReadBool(); @@ -1201,14 +1148,14 @@ namespace Server.Guilds } case 4: { - m_AllyDeclarations = reader.ReadStrongGuildList(); - m_AllyInvitations = reader.ReadStrongGuildList(); + AllyDeclarations = reader.ReadStrongGuildList(); + AllyInvitations = reader.ReadStrongGuildList(); goto case 3; } case 3: { - m_TypeLastChange = reader.ReadDateTime(); + TypeLastChange = reader.ReadDateTime(); goto case 2; } @@ -1220,7 +1167,7 @@ namespace Server.Guilds } case 1: { - m_LastFealty = reader.ReadDateTime(); + LastFealty = reader.ReadDateTime(); goto case 0; } @@ -1234,37 +1181,37 @@ namespace Server.Guilds m_Name = reader.ReadString(); m_Abbreviation = reader.ReadString(); - m_Allies = reader.ReadStrongGuildList(); - m_Enemies = reader.ReadStrongGuildList(); - m_WarDeclarations = reader.ReadStrongGuildList(); - m_WarInvitations = reader.ReadStrongGuildList(); + Allies = reader.ReadStrongGuildList(); + Enemies = reader.ReadStrongGuildList(); + WarDeclarations = reader.ReadStrongGuildList(); + WarInvitations = reader.ReadStrongGuildList(); - m_Members = reader.ReadStrongMobileList(); - m_Candidates = reader.ReadStrongMobileList(); - m_Accepted = reader.ReadStrongMobileList(); + Members = reader.ReadStrongMobileList(); + Candidates = reader.ReadStrongMobileList(); + Accepted = reader.ReadStrongMobileList(); - m_Guildstone = reader.ReadItem(); - m_Teleporter = reader.ReadItem(); + Guildstone = reader.ReadItem(); + Teleporter = reader.ReadItem(); - m_Charter = reader.ReadString(); - m_Website = reader.ReadString(); + Charter = reader.ReadString(); + Website = reader.ReadString(); break; } } - if ( m_AllyDeclarations == null ) - m_AllyDeclarations = new List(); + if ( AllyDeclarations == null ) + AllyDeclarations = new List(); - if ( m_AllyInvitations == null ) - m_AllyInvitations = new List(); + if ( AllyInvitations == null ) + AllyInvitations = new List(); - if ( m_AcceptedWars == null ) - m_AcceptedWars = new List(); + if ( AcceptedWars == null ) + AcceptedWars = new List(); - if ( m_PendingWars == null ) - m_PendingWars = new List(); + if ( PendingWars == null ) + PendingWars = new List(); /* @@ -1277,7 +1224,7 @@ namespace Server.Guilds private void VerifyGuild_Callback() { - if ( (!NewGuildSystem && m_Guildstone == null) || m_Members.Count == 0 ) + if ( (!NewGuildSystem && Guildstone == null) || Members.Count == 0 ) Disband(); CheckExpiredWars(); @@ -1298,12 +1245,12 @@ namespace Server.Guilds #region Add/Remove Member/Old Ally/Old Enemy public void AddMember( Mobile m ) { - if ( !m_Members.Contains( m ) ) + if ( !Members.Contains( m ) ) { if ( m.Guild != null && m.Guild != this ) ((Guild)m.Guild).RemoveMember( m ); - m_Members.Add( m ); + Members.Add( m ); m.Guild = this; if ( !NewGuildSystem ) @@ -1324,9 +1271,9 @@ namespace Server.Guilds } public void RemoveMember( Mobile m, int message ) { - if ( m_Members.Contains( m ) ) + if ( Members.Contains( m ) ) { - m_Members.Remove( m ); + Members.Remove( m ); Guild guild = m.Guild as Guild; @@ -1346,7 +1293,7 @@ namespace Server.Guilds Disband(); } - if ( m_Members.Count == 0 ) + if ( Members.Count == 0 ) Disband(); guild?.InvalidateWarNotoriety(); @@ -1357,9 +1304,9 @@ namespace Server.Guilds public void AddAlly( Guild g ) { - if ( !m_Allies.Contains( g ) ) + if ( !Allies.Contains( g ) ) { - m_Allies.Add( g ); + Allies.Add( g ); g.AddAlly( this ); } @@ -1367,9 +1314,9 @@ namespace Server.Guilds public void RemoveAlly( Guild g ) { - if ( m_Allies.Contains( g ) ) + if ( Allies.Contains( g ) ) { - m_Allies.Remove( g ); + Allies.Remove( g ); g.RemoveAlly( this ); } @@ -1377,9 +1324,9 @@ namespace Server.Guilds public void AddEnemy( Guild g ) { - if ( !m_Enemies.Contains( g ) ) + if ( !Enemies.Contains( g ) ) { - m_Enemies.Add( g ); + Enemies.Add( g ); g.AddEnemy( this ); } @@ -1387,9 +1334,9 @@ namespace Server.Guilds public void RemoveEnemy( Guild g ) { - if ( m_Enemies != null && m_Enemies.Contains( g ) ) + if ( Enemies != null && Enemies.Contains( g ) ) { - m_Enemies.Remove( g ); + Enemies.Remove( g ); g.RemoveEnemy( this ); } @@ -1404,20 +1351,20 @@ namespace Server.Guilds } public void GuildMessage( int number ) { - for ( int i = 0; i < m_Members.Count; ++i ) - m_Members[i].SendLocalizedMessage( number ); + for ( int i = 0; i < Members.Count; ++i ) + Members[i].SendLocalizedMessage( number ); } public void GuildMessage( int number, string args, int hue = 0x3B2) { - for ( int i = 0; i < m_Members.Count; ++i ) - m_Members[i].SendLocalizedMessage( number, args, hue ); + for ( int i = 0; i < Members.Count; ++i ) + Members[i].SendLocalizedMessage( number, args, hue ); } public void GuildMessage( int number, bool append, string affix, string args = "", int hue = 0x3B2) { - for ( int i = 0; i < m_Members.Count; ++i ) - m_Members[i].SendLocalizedMessage( number, append, affix, args, hue ); + for ( int i = 0; i < Members.Count; ++i ) + Members[i].SendLocalizedMessage( number, append, affix, args, hue ); } public void GuildTextMessage( string text ) @@ -1430,8 +1377,8 @@ namespace Server.Guilds } public void GuildTextMessage( int hue, string text ) { - for( int i = 0; i < m_Members.Count; ++i ) - m_Members[i].SendMessage( hue, text ); + for( int i = 0; i < Members.Count; ++i ) + Members[i].SendMessage( hue, text ); } public void GuildTextMessage( int hue, string format, params object[] args ) { @@ -1441,9 +1388,9 @@ namespace Server.Guilds public void GuildChat( Mobile from, int hue, string text ) { Packet p = null; - for ( int i = 0; i < m_Members.Count; i++ ) + for ( int i = 0; i < Members.Count; i++ ) { - Mobile m = m_Members[i]; + Mobile m = Members[i]; NetState state = m.NetState; @@ -1495,9 +1442,9 @@ namespace Server.Guilds int votingMembers = 0; - for ( int i = 0; m_Members != null && i < m_Members.Count; ++i ) + for ( int i = 0; Members != null && i < Members.Count; ++i ) { - Mobile memb = m_Members[i]; + Mobile memb = Members[i]; if ( !CanVote( memb ) ) continue; @@ -1545,25 +1492,17 @@ namespace Server.Guilds GuildMessage( 1018015, true, winner.Name ); // Guild Message: Guildmaster changed to: Leader = winner; - m_LastFealty = DateTime.UtcNow; + LastFealty = DateTime.UtcNow; } #endregion #region Getters & Setters [CommandProperty( AccessLevel.GameMaster )] - public Item Guildstone - { - get => m_Guildstone; - set => m_Guildstone = value; - } + public Item Guildstone { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Item Teleporter - { - get => m_Teleporter; - set => m_Teleporter = value; - } + public Item Teleporter { get; set; } [CommandProperty( AccessLevel.GameMaster )] public override string Name @@ -1575,16 +1514,12 @@ namespace Server.Guilds InvalidateMemberProperties( true ); - m_Guildstone?.InvalidateProperties(); + Guildstone?.InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] - public string Website - { - get => m_Website; - set => m_Website = value; - } + public string Website { get; set; } [CommandProperty( AccessLevel.GameMaster )] public override string Abbreviation @@ -1596,16 +1531,12 @@ namespace Server.Guilds InvalidateMemberProperties( true ); - m_Guildstone?.InvalidateProperties(); + Guildstone?.InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] - public string Charter - { - get => m_Charter; - set => m_Charter = value; - } + public string Charter { get; set; } [CommandProperty( AccessLevel.GameMaster )] public override GuildType Type @@ -1616,7 +1547,7 @@ namespace Server.Guilds if ( m_Type != value ) { m_Type = value; - m_TypeLastChange = DateTime.UtcNow; + TypeLastChange = DateTime.UtcNow; InvalidateMemberProperties(); } @@ -1624,32 +1555,28 @@ namespace Server.Guilds } [CommandProperty( AccessLevel.GameMaster )] - public DateTime LastFealty - { - get => m_LastFealty; - set => m_LastFealty = value; - } + public DateTime LastFealty { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime TypeLastChange => m_TypeLastChange; + public DateTime TypeLastChange { get; private set; } - public List Allies => m_Allies; + public List Allies { get; private set; } - public List Enemies => m_Enemies; + public List Enemies { get; private set; } - public List AllyDeclarations => m_AllyDeclarations; + public List AllyDeclarations { get; private set; } - public List AllyInvitations => m_AllyInvitations; + public List AllyInvitations { get; private set; } - public List WarDeclarations => m_WarDeclarations; + public List WarDeclarations { get; private set; } - public List WarInvitations => m_WarInvitations; + public List WarInvitations { get; private set; } - public List Candidates => m_Candidates; + public List Candidates { get; private set; } - public List Accepted => m_Accepted; + public List Accepted { get; private set; } - public List Members => m_Members; + public List Members { get; private set; } #endregion } diff --git a/Scripts/Misc/HardwareInfo.cs b/Scripts/Misc/HardwareInfo.cs index 50755595d..db055ea02 100644 --- a/Scripts/Misc/HardwareInfo.cs +++ b/Scripts/Misc/HardwareInfo.cs @@ -8,96 +8,83 @@ namespace Server { public class HardwareInfo { - private int m_InstanceID; - private int m_OSMajor, m_OSMinor, m_OSRevision; - private int m_CpuManufacturer, m_CpuFamily, m_CpuModel, m_CpuClockSpeed, m_CpuQuantity; - private int m_PhysicalMemory; - private int m_ScreenWidth, m_ScreenHeight, m_ScreenDepth; - private int m_DXMajor, m_DXMinor; - private int m_VCVendorID, m_VCDeviceID, m_VCMemory; - private int m_Distribution, m_ClientsRunning, m_ClientsInstalled, m_PartialInstalled; - private string m_VCDescription; - private string m_Language; - private string m_Unknown; - private DateTime m_TimeReceived; + [CommandProperty( AccessLevel.GameMaster )] + public int CpuModel { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int CpuModel => m_CpuModel; + public int CpuClockSpeed { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int CpuClockSpeed => m_CpuClockSpeed; + public int CpuQuantity { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int CpuQuantity => m_CpuQuantity; + public int OSMajor { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int OSMajor => m_OSMajor; + public int OSMinor { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int OSMinor => m_OSMinor; + public int OSRevision { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int OSRevision => m_OSRevision; + public int InstanceID { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int InstanceID => m_InstanceID; + public int ScreenWidth { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int ScreenWidth => m_ScreenWidth; + public int ScreenHeight { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int ScreenHeight => m_ScreenHeight; + public int ScreenDepth { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int ScreenDepth => m_ScreenDepth; + public int PhysicalMemory { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int PhysicalMemory => m_PhysicalMemory; + public int CpuManufacturer { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int CpuManufacturer => m_CpuManufacturer; + public int CpuFamily { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int CpuFamily => m_CpuFamily; + public int VCVendorID { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int VCVendorID => m_VCVendorID; + public int VCDeviceID { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int VCDeviceID => m_VCDeviceID; + public int VCMemory { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int VCMemory => m_VCMemory; + public int DXMajor { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int DXMajor => m_DXMajor; + public int DXMinor { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int DXMinor => m_DXMinor; + public string VCDescription { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public string VCDescription => m_VCDescription; + public string Language { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public string Language => m_Language; + public int Distribution { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int Distribution => m_Distribution; + public int ClientsRunning { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int ClientsRunning => m_ClientsRunning; + public int ClientsInstalled { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int ClientsInstalled => m_ClientsInstalled; + public int PartialInstalled { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int PartialInstalled => m_PartialInstalled; + public string Unknown { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public string Unknown => m_Unknown; - - [CommandProperty( AccessLevel.GameMaster )] - public DateTime TimeReceived => m_TimeReceived; + public DateTime TimeReceived { get; private set; } public static void Initialize() { @@ -148,33 +135,33 @@ namespace Server HardwareInfo info = new HardwareInfo(); - info.m_InstanceID = pvSrc.ReadInt32(); - info.m_OSMajor = pvSrc.ReadInt32(); - info.m_OSMinor = pvSrc.ReadInt32(); - info.m_OSRevision = pvSrc.ReadInt32(); - info.m_CpuManufacturer = pvSrc.ReadByte(); - info.m_CpuFamily = pvSrc.ReadInt32(); - info.m_CpuModel = pvSrc.ReadInt32(); - info.m_CpuClockSpeed = pvSrc.ReadInt32(); - info.m_CpuQuantity = pvSrc.ReadByte(); - info.m_PhysicalMemory = pvSrc.ReadInt32(); - info.m_ScreenWidth = pvSrc.ReadInt32(); - info.m_ScreenHeight = pvSrc.ReadInt32(); - info.m_ScreenDepth = pvSrc.ReadInt32(); - info.m_DXMajor = pvSrc.ReadInt16(); - info.m_DXMinor = pvSrc.ReadInt16(); - info.m_VCDescription = pvSrc.ReadUnicodeStringLESafe( 64 ); - info.m_VCVendorID = pvSrc.ReadInt32(); - info.m_VCDeviceID = pvSrc.ReadInt32(); - info.m_VCMemory = pvSrc.ReadInt32(); - info.m_Distribution = pvSrc.ReadByte(); - info.m_ClientsRunning = pvSrc.ReadByte(); - info.m_ClientsInstalled = pvSrc.ReadByte(); - info.m_PartialInstalled = pvSrc.ReadByte(); - info.m_Language = pvSrc.ReadUnicodeStringLESafe( 4 ); - info.m_Unknown = pvSrc.ReadStringSafe( 64 ); + info.InstanceID = pvSrc.ReadInt32(); + info.OSMajor = pvSrc.ReadInt32(); + info.OSMinor = pvSrc.ReadInt32(); + info.OSRevision = pvSrc.ReadInt32(); + info.CpuManufacturer = pvSrc.ReadByte(); + info.CpuFamily = pvSrc.ReadInt32(); + info.CpuModel = pvSrc.ReadInt32(); + info.CpuClockSpeed = pvSrc.ReadInt32(); + info.CpuQuantity = pvSrc.ReadByte(); + info.PhysicalMemory = pvSrc.ReadInt32(); + info.ScreenWidth = pvSrc.ReadInt32(); + info.ScreenHeight = pvSrc.ReadInt32(); + info.ScreenDepth = pvSrc.ReadInt32(); + info.DXMajor = pvSrc.ReadInt16(); + info.DXMinor = pvSrc.ReadInt16(); + info.VCDescription = pvSrc.ReadUnicodeStringLESafe( 64 ); + info.VCVendorID = pvSrc.ReadInt32(); + info.VCDeviceID = pvSrc.ReadInt32(); + info.VCMemory = pvSrc.ReadInt32(); + info.Distribution = pvSrc.ReadByte(); + info.ClientsRunning = pvSrc.ReadByte(); + info.ClientsInstalled = pvSrc.ReadByte(); + info.PartialInstalled = pvSrc.ReadByte(); + info.Language = pvSrc.ReadUnicodeStringLESafe( 4 ); + info.Unknown = pvSrc.ReadStringSafe( 64 ); - info.m_TimeReceived = DateTime.UtcNow; + info.TimeReceived = DateTime.UtcNow; if ( state.Account is Account acct ) acct.HardwareInfo = info; diff --git a/Scripts/Misc/InhumanSpeech.cs b/Scripts/Misc/InhumanSpeech.cs index 37db5afc4..802b2be4b 100644 --- a/Scripts/Misc/InhumanSpeech.cs +++ b/Scripts/Misc/InhumanSpeech.cs @@ -274,22 +274,11 @@ namespace Server.Misc } } - private string[] m_Syllables; private string[] m_Keywords; - private string[] m_Responses; private Dictionary m_KeywordHash; - private int m_Hue; - private int m_Sound; - - private IHSFlags m_Flags; - - public string[] Syllables - { - get => m_Syllables; - set => m_Syllables = value; - } + public string[] Syllables { get; set; } public string[] Keywords { @@ -303,33 +292,17 @@ namespace Server.Misc } } - public string[] Responses - { - get => m_Responses; - set => m_Responses = value; - } + public string[] Responses { get; set; } - public int Hue - { - get => m_Hue; - set => m_Hue = value; - } + public int Hue { get; set; } - public int Sound - { - get => m_Sound; - set => m_Sound = value; - } + public int Sound { get; set; } - public IHSFlags Flags - { - get => m_Flags; - set => m_Flags = value; - } + public IHSFlags Flags { get; set; } public string GetRandomSyllable() { - return m_Syllables[Utility.Random( m_Syllables.Length )]; + return Syllables[Utility.Random( Syllables.Length )]; } public string ConstructWord( int syllableCount ) @@ -402,17 +375,17 @@ namespace Server.Misc private string GetRandomResponseWord( List keywordsFound ) { - int random = Utility.Random( keywordsFound.Count + m_Responses.Length ); + int random = Utility.Random( keywordsFound.Count + Responses.Length ); if ( random < keywordsFound.Count ) return keywordsFound[random]; - return m_Responses[random - keywordsFound.Count]; + return Responses[random - keywordsFound.Count]; } public bool OnSpeech( Mobile mob, Mobile speaker, string text ) { - if ( (m_Flags & IHSFlags.OnSpeech) == 0 || m_Keywords == null || m_Responses == null || m_KeywordHash == null ) + if ( (Flags & IHSFlags.OnSpeech) == 0 || m_Keywords == null || Responses == null || m_KeywordHash == null ) return false; // not enabled if ( !speaker.Alive ) @@ -511,7 +484,7 @@ namespace Server.Misc public void OnDeath( Mobile mob ) { - if ( (m_Flags & IHSFlags.OnDeath) == 0 ) + if ( (Flags & IHSFlags.OnDeath) == 0 ) return; // not enabled if ( 90 > Utility.Random( 100 ) ) @@ -530,7 +503,7 @@ namespace Server.Misc public void OnMovement( Mobile mob, Mobile mover, Point3D oldLocation ) { - if ( (m_Flags & IHSFlags.OnMovement) == 0 ) + if ( (Flags & IHSFlags.OnMovement) == 0 ) return; // not enabled if ( !mover.Player || (mover.Hidden && mover.AccessLevel > AccessLevel.Player) ) @@ -547,7 +520,7 @@ namespace Server.Misc public void OnDamage( Mobile mob, int amount ) { - if ( (m_Flags & IHSFlags.OnDamaged) == 0 ) + if ( (Flags & IHSFlags.OnDamaged) == 0 ) return; // not enabled if ( 90 > Utility.Random( 100 ) ) @@ -577,13 +550,13 @@ namespace Server.Misc public void OnConstruct( Mobile mob ) { - mob.SpeechHue = m_Hue; + mob.SpeechHue = Hue; } public void SaySentance( Mobile mob, int wordCount ) { mob.Say( ConstructSentance( wordCount ) ); - mob.PlaySound( m_Sound ); + mob.PlaySound( Sound ); } public InhumanSpeech() diff --git a/Scripts/Misc/LanguageStatistics.cs b/Scripts/Misc/LanguageStatistics.cs index 430932867..ac7e2d1f2 100644 --- a/Scripts/Misc/LanguageStatistics.cs +++ b/Scripts/Misc/LanguageStatistics.cs @@ -26,18 +26,17 @@ namespace Server.Misc { struct InternationalCode { - string m_Code; - string m_Language; - string m_Country; - string m_Language_LocalName; - string m_Country_LocalName; bool m_HasLocalInfo; - public string Code => m_Code; - public string Language => m_Language; - public string Country => m_Country; - public string Language_LocalName => m_Language_LocalName; - public string Country_LocalName => m_Country_LocalName; + public string Code { get; } + + public string Language { get; } + + public string Country { get; } + + public string Language_LocalName { get; } + + public string Country_LocalName { get; } public InternationalCode( string code, string language, string country ) : this( code, language, country, null, null ) { @@ -46,11 +45,11 @@ namespace Server.Misc public InternationalCode( string code, string language, string country, string language_localname, string country_localname ) { - m_Code = code; - m_Language = language; - m_Country = country; - m_Language_LocalName = language_localname; - m_Country_LocalName = country_localname; + Code = code; + Language = language; + Country = country; + Language_LocalName = language_localname; + Country_LocalName = country_localname; m_HasLocalInfo = true; } @@ -61,15 +60,15 @@ namespace Server.Misc if ( m_HasLocalInfo ) { s = - $"{(DefaultLocalNames ? m_Language_LocalName : m_Language)}‎ - {(DefaultLocalNames ? m_Country_LocalName : m_Country)}"; + $"{(DefaultLocalNames ? Language_LocalName : Language)}‎ - {(DefaultLocalNames ? Country_LocalName : Country)}"; if ( ShowAlternatives ) s += - $"‎ 【{(DefaultLocalNames ? m_Language : m_Language_LocalName)}‎ - {(DefaultLocalNames ? m_Country : m_Country_LocalName)}‎】"; + $"‎ 【{(DefaultLocalNames ? Language : Language_LocalName)}‎ - {(DefaultLocalNames ? Country : Country_LocalName)}‎】"; } else { - s = $"{m_Language}‎ - {m_Country}"; + s = $"{Language}‎ - {Country}"; } return s; @@ -313,21 +312,19 @@ namespace Server.Misc private class InternationalCodeCounter { - private string m_Code; - private int m_Count; + public string Code { get; } - public string Code => m_Code; - public int Count => m_Count; + public int Count { get; private set; } public InternationalCodeCounter( string code ) { - m_Code = code; - m_Count = 1; + Code = code; + Count = 1; } public void Increase() { - m_Count++; + Count++; } } diff --git a/Scripts/Misc/Loot.cs b/Scripts/Misc/Loot.cs index a91777373..fad2eba1e 100644 --- a/Scripts/Misc/Loot.cs +++ b/Scripts/Misc/Loot.cs @@ -8,229 +8,215 @@ namespace Server #region List definitions #region Mondain's Legacy - private static Type[] m_MLWeaponTypes = { - typeof( AssassinSpike ), typeof( DiamondMace ), typeof( ElvenMachete ), - typeof( ElvenSpellblade ), typeof( Leafblade ), typeof( OrnateAxe ), - typeof( RadiantScimitar ), typeof( RuneBlade ), typeof( WarCleaver ), - typeof( WildStaff ) - }; - public static Type[] MLWeaponTypes => m_MLWeaponTypes; + public static Type[] MLWeaponTypes { get; } = + { + typeof( AssassinSpike ), typeof( DiamondMace ), typeof( ElvenMachete ), + typeof( ElvenSpellblade ), typeof( Leafblade ), typeof( OrnateAxe ), + typeof( RadiantScimitar ), typeof( RuneBlade ), typeof( WarCleaver ), + typeof( WildStaff ) + }; - private static Type[] m_MLRangedWeaponTypes = { - typeof( ElvenCompositeLongbow ), typeof( MagicalShortbow ) - }; + public static Type[] MLRangedWeaponTypes { get; } = + { + typeof( ElvenCompositeLongbow ), typeof( MagicalShortbow ) + }; - public static Type[] MLRangedWeaponTypes => m_MLRangedWeaponTypes; + public static Type[] MLArmorTypes { get; } = + { + typeof( Circlet ), typeof( GemmedCirclet ), typeof( LeafTonlet ), + typeof( RavenHelm ), typeof( RoyalCirclet ), typeof( VultureHelm ), + typeof( WingedHelm ), typeof( LeafArms ), typeof( LeafChest ), + typeof( LeafGloves ), typeof( LeafGorget ), typeof( LeafLegs ), + typeof( WoodlandArms ), typeof( WoodlandChest ), typeof( WoodlandGloves ), + typeof( WoodlandGorget ), typeof( WoodlandLegs ), typeof( HideChest ), + typeof( HideGloves ), typeof( HideGorget ), typeof( HidePants ), + typeof( HidePauldrons ) + }; - private static Type[] m_MLArmorTypes = { - typeof( Circlet ), typeof( GemmedCirclet ), typeof( LeafTonlet ), - typeof( RavenHelm ), typeof( RoyalCirclet ), typeof( VultureHelm ), - typeof( WingedHelm ), typeof( LeafArms ), typeof( LeafChest ), - typeof( LeafGloves ), typeof( LeafGorget ), typeof( LeafLegs ), - typeof( WoodlandArms ), typeof( WoodlandChest ), typeof( WoodlandGloves ), - typeof( WoodlandGorget ), typeof( WoodlandLegs ), typeof( HideChest ), - typeof( HideGloves ), typeof( HideGorget ), typeof( HidePants ), - typeof( HidePauldrons ) - }; - - public static Type[] MLArmorTypes => m_MLArmorTypes; - - private static Type[] m_MLClothingTypes = { - typeof( MaleElvenRobe ), typeof( FemaleElvenRobe ), typeof( ElvenPants ), - typeof( ElvenShirt ), typeof( ElvenDarkShirt ), typeof( ElvenBoots ), - typeof( VultureHelm ), typeof( WoodlandBelt ) - }; - - public static Type[] MLClothingTypes => m_MLClothingTypes; + public static Type[] MLClothingTypes { get; } = + { + typeof( MaleElvenRobe ), typeof( FemaleElvenRobe ), typeof( ElvenPants ), + typeof( ElvenShirt ), typeof( ElvenDarkShirt ), typeof( ElvenBoots ), + typeof( VultureHelm ), typeof( WoodlandBelt ) + }; #endregion - private static Type[] m_SEWeaponTypes = { - typeof( Bokuto ), typeof( Daisho ), typeof( Kama ), - typeof( Lajatang ), typeof( NoDachi ), typeof( Nunchaku ), - typeof( Sai ), typeof( Tekagi ), typeof( Tessen ), - typeof( Tetsubo ), typeof( Wakizashi ) - }; + public static Type[] SEWeaponTypes { get; } = + { + typeof( Bokuto ), typeof( Daisho ), typeof( Kama ), + typeof( Lajatang ), typeof( NoDachi ), typeof( Nunchaku ), + typeof( Sai ), typeof( Tekagi ), typeof( Tessen ), + typeof( Tetsubo ), typeof( Wakizashi ) + }; - public static Type[] SEWeaponTypes => m_SEWeaponTypes; + public static Type[] AosWeaponTypes { get; } = + { + typeof( Scythe ), typeof( BoneHarvester ), typeof( Scepter ), + typeof( BladedStaff ), typeof( Pike ), typeof( DoubleBladedStaff ), + typeof( Lance ), typeof( CrescentBlade ) + }; - private static Type[] m_AosWeaponTypes = { - typeof( Scythe ), typeof( BoneHarvester ), typeof( Scepter ), - typeof( BladedStaff ), typeof( Pike ), typeof( DoubleBladedStaff ), - typeof( Lance ), typeof( CrescentBlade ) - }; + public static Type[] WeaponTypes { get; } = + { + typeof( Axe ), typeof( BattleAxe ), typeof( DoubleAxe ), + typeof( ExecutionersAxe ), typeof( Hatchet ), typeof( LargeBattleAxe ), + typeof( TwoHandedAxe ), typeof( WarAxe ), typeof( Club ), + typeof( Mace ), typeof( Maul ), typeof( WarHammer ), + typeof( WarMace ), typeof( Bardiche ), typeof( Halberd ), + typeof( Spear ), typeof( ShortSpear ), typeof( Pitchfork ), + typeof( WarFork ), typeof( BlackStaff ), typeof( GnarledStaff ), + typeof( QuarterStaff ), typeof( Broadsword ), typeof( Cutlass ), + typeof( Katana ), typeof( Kryss ), typeof( Longsword ), + typeof( Scimitar ), typeof( VikingSword ), typeof( Pickaxe ), + typeof( HammerPick ), typeof( ButcherKnife ), typeof( Cleaver ), + typeof( Dagger ), typeof( SkinningKnife ), typeof( ShepherdsCrook ) + }; - public static Type[] AosWeaponTypes => m_AosWeaponTypes; + public static Type[] SERangedWeaponTypes { get; } = + { + typeof( Yumi ) + }; - private static Type[] m_WeaponTypes = { - typeof( Axe ), typeof( BattleAxe ), typeof( DoubleAxe ), - typeof( ExecutionersAxe ), typeof( Hatchet ), typeof( LargeBattleAxe ), - typeof( TwoHandedAxe ), typeof( WarAxe ), typeof( Club ), - typeof( Mace ), typeof( Maul ), typeof( WarHammer ), - typeof( WarMace ), typeof( Bardiche ), typeof( Halberd ), - typeof( Spear ), typeof( ShortSpear ), typeof( Pitchfork ), - typeof( WarFork ), typeof( BlackStaff ), typeof( GnarledStaff ), - typeof( QuarterStaff ), typeof( Broadsword ), typeof( Cutlass ), - typeof( Katana ), typeof( Kryss ), typeof( Longsword ), - typeof( Scimitar ), typeof( VikingSword ), typeof( Pickaxe ), - typeof( HammerPick ), typeof( ButcherKnife ), typeof( Cleaver ), - typeof( Dagger ), typeof( SkinningKnife ), typeof( ShepherdsCrook ) - }; + public static Type[] AosRangedWeaponTypes { get; } = + { + typeof( CompositeBow ), typeof( RepeatingCrossbow ) + }; - public static Type[] WeaponTypes => m_WeaponTypes; + public static Type[] RangedWeaponTypes { get; } = + { + typeof( Bow ), typeof( Crossbow ), typeof( HeavyCrossbow ) + }; - private static Type[] m_SERangedWeaponTypes = { - typeof( Yumi ) - }; + public static Type[] SEArmorTypes { get; } = + { + typeof( ChainHatsuburi ), typeof( LeatherDo ), typeof( LeatherHaidate ), + typeof( LeatherHiroSode ), typeof( LeatherJingasa ), typeof( LeatherMempo ), + typeof( LeatherNinjaHood ), typeof( LeatherNinjaJacket ), typeof( LeatherNinjaMitts ), + typeof( LeatherNinjaPants ), typeof( LeatherSuneate ), typeof( DecorativePlateKabuto ), + typeof( HeavyPlateJingasa ), typeof( LightPlateJingasa ), typeof( PlateBattleKabuto ), + typeof( PlateDo ), typeof( PlateHaidate ), typeof( PlateHatsuburi ), + typeof( PlateHiroSode ), typeof( PlateMempo ), typeof( PlateSuneate ), + typeof( SmallPlateJingasa ), typeof( StandardPlateKabuto ), typeof( StuddedDo ), + typeof( StuddedHaidate ), typeof( StuddedHiroSode ), typeof( StuddedMempo ), + typeof( StuddedSuneate ) + }; - public static Type[] SERangedWeaponTypes => m_SERangedWeaponTypes; + public static Type[] ArmorTypes { get; } = + { + typeof( BoneArms ), typeof( BoneChest ), typeof( BoneGloves ), + typeof( BoneLegs ), typeof( BoneHelm ), typeof( ChainChest ), + typeof( ChainLegs ), typeof( ChainCoif ), typeof( Bascinet ), + typeof( CloseHelm ), typeof( Helmet ), typeof( NorseHelm ), + typeof( OrcHelm ), typeof( FemaleLeatherChest ), typeof( LeatherArms ), + typeof( LeatherBustierArms ), typeof( LeatherChest ), typeof( LeatherGloves ), + typeof( LeatherGorget ), typeof( LeatherLegs ), typeof( LeatherShorts ), + typeof( LeatherSkirt ), typeof( LeatherCap ), typeof( FemalePlateChest ), + typeof( PlateArms ), typeof( PlateChest ), typeof( PlateGloves ), + typeof( PlateGorget ), typeof( PlateHelm ), typeof( PlateLegs ), + typeof( RingmailArms ), typeof( RingmailChest ), typeof( RingmailGloves ), + typeof( RingmailLegs ), typeof( FemaleStuddedChest ), typeof( StuddedArms ), + typeof( StuddedBustierArms ), typeof( StuddedChest ), typeof( StuddedGloves ), + typeof( StuddedGorget ), typeof( StuddedLegs ) + }; - private static Type[] m_AosRangedWeaponTypes = { - typeof( CompositeBow ), typeof( RepeatingCrossbow ) - }; + public static Type[] AosShieldTypes { get; } = + { + typeof( ChaosShield ), typeof( OrderShield ) + }; - public static Type[] AosRangedWeaponTypes => m_AosRangedWeaponTypes; + public static Type[] ShieldTypes { get; } = + { + typeof( BronzeShield ), typeof( Buckler ), typeof( HeaterShield ), + typeof( MetalShield ), typeof( MetalKiteShield ), typeof( WoodenKiteShield ), + typeof( WoodenShield ) + }; - private static Type[] m_RangedWeaponTypes = { - typeof( Bow ), typeof( Crossbow ), typeof( HeavyCrossbow ) - }; + public static Type[] GemTypes { get; } = + { + typeof( Amber ), typeof( Amethyst ), typeof( Citrine ), + typeof( Diamond ), typeof( Emerald ), typeof( Ruby ), + typeof( Sapphire ), typeof( StarSapphire ), typeof( Tourmaline ) + }; - public static Type[] RangedWeaponTypes => m_RangedWeaponTypes; + public static Type[] JewelryTypes { get; } = + { + typeof( GoldRing ), typeof( GoldBracelet ), + typeof( SilverRing ), typeof( SilverBracelet ) + }; - private static Type[] m_SEArmorTypes = { - typeof( ChainHatsuburi ), typeof( LeatherDo ), typeof( LeatherHaidate ), - typeof( LeatherHiroSode ), typeof( LeatherJingasa ), typeof( LeatherMempo ), - typeof( LeatherNinjaHood ), typeof( LeatherNinjaJacket ), typeof( LeatherNinjaMitts ), - typeof( LeatherNinjaPants ), typeof( LeatherSuneate ), typeof( DecorativePlateKabuto ), - typeof( HeavyPlateJingasa ), typeof( LightPlateJingasa ), typeof( PlateBattleKabuto ), - typeof( PlateDo ), typeof( PlateHaidate ), typeof( PlateHatsuburi ), - typeof( PlateHiroSode ), typeof( PlateMempo ), typeof( PlateSuneate ), - typeof( SmallPlateJingasa ), typeof( StandardPlateKabuto ), typeof( StuddedDo ), - typeof( StuddedHaidate ), typeof( StuddedHiroSode ), typeof( StuddedMempo ), - typeof( StuddedSuneate ) - }; + public static Type[] RegTypes { get; } = + { + typeof( BlackPearl ), typeof( Bloodmoss ), typeof( Garlic ), + typeof( Ginseng ), typeof( MandrakeRoot ), typeof( Nightshade ), + typeof( SulfurousAsh ), typeof( SpidersSilk ) + }; - public static Type[] SEArmorTypes => m_SEArmorTypes; + public static Type[] NecroRegTypes { get; } = + { + typeof( BatWing ), typeof( GraveDust ), typeof( DaemonBlood ), + typeof( NoxCrystal ), typeof( PigIron ) + }; - private static Type[] m_ArmorTypes = { - typeof( BoneArms ), typeof( BoneChest ), typeof( BoneGloves ), - typeof( BoneLegs ), typeof( BoneHelm ), typeof( ChainChest ), - typeof( ChainLegs ), typeof( ChainCoif ), typeof( Bascinet ), - typeof( CloseHelm ), typeof( Helmet ), typeof( NorseHelm ), - typeof( OrcHelm ), typeof( FemaleLeatherChest ), typeof( LeatherArms ), - typeof( LeatherBustierArms ), typeof( LeatherChest ), typeof( LeatherGloves ), - typeof( LeatherGorget ), typeof( LeatherLegs ), typeof( LeatherShorts ), - typeof( LeatherSkirt ), typeof( LeatherCap ), typeof( FemalePlateChest ), - typeof( PlateArms ), typeof( PlateChest ), typeof( PlateGloves ), - typeof( PlateGorget ), typeof( PlateHelm ), typeof( PlateLegs ), - typeof( RingmailArms ), typeof( RingmailChest ), typeof( RingmailGloves ), - typeof( RingmailLegs ), typeof( FemaleStuddedChest ), typeof( StuddedArms ), - typeof( StuddedBustierArms ), typeof( StuddedChest ), typeof( StuddedGloves ), - typeof( StuddedGorget ), typeof( StuddedLegs ) - }; + public static Type[] PotionTypes { get; } = + { + typeof( AgilityPotion ), typeof( StrengthPotion ), typeof( RefreshPotion ), + typeof( LesserCurePotion ), typeof( LesserHealPotion ), typeof( LesserPoisonPotion ) + }; - public static Type[] ArmorTypes => m_ArmorTypes; + public static Type[] SEInstrumentTypes { get; } = + { + typeof( BambooFlute ) + }; - private static Type[] m_AosShieldTypes = { - typeof( ChaosShield ), typeof( OrderShield ) - }; + public static Type[] InstrumentTypes { get; } = + { + typeof( Drums ), typeof( Harp ), typeof( LapHarp ), + typeof( Lute ), typeof( Tambourine ), typeof( TambourineTassel ) + }; - public static Type[] AosShieldTypes => m_AosShieldTypes; - - private static Type[] m_ShieldTypes = { - typeof( BronzeShield ), typeof( Buckler ), typeof( HeaterShield ), - typeof( MetalShield ), typeof( MetalKiteShield ), typeof( WoodenKiteShield ), - typeof( WoodenShield ) - }; - - public static Type[] ShieldTypes => m_ShieldTypes; - - private static Type[] m_GemTypes = { - typeof( Amber ), typeof( Amethyst ), typeof( Citrine ), - typeof( Diamond ), typeof( Emerald ), typeof( Ruby ), - typeof( Sapphire ), typeof( StarSapphire ), typeof( Tourmaline ) - }; - - public static Type[] GemTypes => m_GemTypes; - - private static Type[] m_JewelryTypes = { - typeof( GoldRing ), typeof( GoldBracelet ), - typeof( SilverRing ), typeof( SilverBracelet ) - }; - - public static Type[] JewelryTypes => m_JewelryTypes; - - private static Type[] m_RegTypes = { - typeof( BlackPearl ), typeof( Bloodmoss ), typeof( Garlic ), - typeof( Ginseng ), typeof( MandrakeRoot ), typeof( Nightshade ), - typeof( SulfurousAsh ), typeof( SpidersSilk ) - }; - - public static Type[] RegTypes => m_RegTypes; - - private static Type[] m_NecroRegTypes = { - typeof( BatWing ), typeof( GraveDust ), typeof( DaemonBlood ), - typeof( NoxCrystal ), typeof( PigIron ) - }; - - public static Type[] NecroRegTypes => m_NecroRegTypes; - - private static Type[] m_PotionTypes = { - typeof( AgilityPotion ), typeof( StrengthPotion ), typeof( RefreshPotion ), - typeof( LesserCurePotion ), typeof( LesserHealPotion ), typeof( LesserPoisonPotion ) - }; - - public static Type[] PotionTypes => m_PotionTypes; - - private static Type[] m_SEInstrumentTypes = { - typeof( BambooFlute ) - }; - - public static Type[] SEInstrumentTypes => m_SEInstrumentTypes; - - private static Type[] m_InstrumentTypes = { - typeof( Drums ), typeof( Harp ), typeof( LapHarp ), - typeof( Lute ), typeof( Tambourine ), typeof( TambourineTassel ) - }; - - public static Type[] InstrumentTypes => m_InstrumentTypes; - - private static Type[] m_StatueTypes = { + public static Type[] StatueTypes { get; } = + { typeof( StatueSouth ), typeof( StatueSouth2 ), typeof( StatueNorth ), typeof( StatueWest ), typeof( StatueEast ), typeof( StatueEast2 ), typeof( StatueSouthEast ), typeof( BustSouth ), typeof( BustEast ) }; - public static Type[] StatueTypes => m_StatueTypes; + #region Mondain's Legacy - private static Type[] m_RegularScrollTypes = { - typeof( ReactiveArmorScroll ), typeof( ClumsyScroll ), typeof( CreateFoodScroll ), typeof( FeeblemindScroll ), - typeof( HealScroll ), typeof( MagicArrowScroll ), typeof( NightSightScroll ), typeof( WeakenScroll ), - typeof( AgilityScroll ), typeof( CunningScroll ), typeof( CureScroll ), typeof( HarmScroll ), - typeof( MagicTrapScroll ), typeof( MagicUnTrapScroll ), typeof( ProtectionScroll ), typeof( StrengthScroll ), - typeof( BlessScroll ), typeof( FireballScroll ), typeof( MagicLockScroll ), typeof( PoisonScroll ), - typeof( TelekinisisScroll ), typeof( TeleportScroll ), typeof( UnlockScroll ), typeof( WallOfStoneScroll ), - typeof( ArchCureScroll ), typeof( ArchProtectionScroll ), typeof( CurseScroll ), typeof( FireFieldScroll ), - typeof( GreaterHealScroll ), typeof( LightningScroll ), typeof( ManaDrainScroll ), typeof( RecallScroll ), - typeof( BladeSpiritsScroll ), typeof( DispelFieldScroll ), typeof( IncognitoScroll ), typeof( MagicReflectScroll ), - typeof( MindBlastScroll ), typeof( ParalyzeScroll ), typeof( PoisonFieldScroll ), typeof( SummonCreatureScroll ), - typeof( DispelScroll ), typeof( EnergyBoltScroll ), typeof( ExplosionScroll ), typeof( InvisibilityScroll ), - typeof( MarkScroll ), typeof( MassCurseScroll ), typeof( ParalyzeFieldScroll ), typeof( RevealScroll ), - typeof( ChainLightningScroll ), typeof( EnergyFieldScroll ), typeof( FlamestrikeScroll ), typeof( GateTravelScroll ), - typeof( ManaVampireScroll ), typeof( MassDispelScroll ), typeof( MeteorSwarmScroll ), typeof( PolymorphScroll ), - typeof( EarthquakeScroll ), typeof( EnergyVortexScroll ), typeof( ResurrectionScroll ), typeof( SummonAirElementalScroll ), - typeof( SummonDaemonScroll ), typeof( SummonEarthElementalScroll ), typeof( SummonFireElementalScroll ), typeof( SummonWaterElementalScroll ) - }; + #endregion - private static Type[] m_NecromancyScrollTypes = { - typeof( AnimateDeadScroll ), typeof( BloodOathScroll ), typeof( CorpseSkinScroll ), typeof( CurseWeaponScroll ), - typeof( EvilOmenScroll ), typeof( HorrificBeastScroll ), typeof( LichFormScroll ), typeof( MindRotScroll ), - typeof( PainSpikeScroll ), typeof( PoisonStrikeScroll ), typeof( StrangleScroll ), typeof( SummonFamiliarScroll ), - typeof( VampiricEmbraceScroll ), typeof( VengefulSpiritScroll ), typeof( WitherScroll ), typeof( WraithFormScroll ) - }; - - private static Type[] m_SENecromancyScrollTypes = { + public static Type[] RegularScrollTypes { get; } = + { + typeof( ReactiveArmorScroll ), typeof( ClumsyScroll ), typeof( CreateFoodScroll ), typeof( FeeblemindScroll ), + typeof( HealScroll ), typeof( MagicArrowScroll ), typeof( NightSightScroll ), typeof( WeakenScroll ), + typeof( AgilityScroll ), typeof( CunningScroll ), typeof( CureScroll ), typeof( HarmScroll ), + typeof( MagicTrapScroll ), typeof( MagicUnTrapScroll ), typeof( ProtectionScroll ), typeof( StrengthScroll ), + typeof( BlessScroll ), typeof( FireballScroll ), typeof( MagicLockScroll ), typeof( PoisonScroll ), + typeof( TelekinisisScroll ), typeof( TeleportScroll ), typeof( UnlockScroll ), typeof( WallOfStoneScroll ), + typeof( ArchCureScroll ), typeof( ArchProtectionScroll ), typeof( CurseScroll ), typeof( FireFieldScroll ), + typeof( GreaterHealScroll ), typeof( LightningScroll ), typeof( ManaDrainScroll ), typeof( RecallScroll ), + typeof( BladeSpiritsScroll ), typeof( DispelFieldScroll ), typeof( IncognitoScroll ), typeof( MagicReflectScroll ), + typeof( MindBlastScroll ), typeof( ParalyzeScroll ), typeof( PoisonFieldScroll ), typeof( SummonCreatureScroll ), + typeof( DispelScroll ), typeof( EnergyBoltScroll ), typeof( ExplosionScroll ), typeof( InvisibilityScroll ), + typeof( MarkScroll ), typeof( MassCurseScroll ), typeof( ParalyzeFieldScroll ), typeof( RevealScroll ), + typeof( ChainLightningScroll ), typeof( EnergyFieldScroll ), typeof( FlamestrikeScroll ), typeof( GateTravelScroll ), + typeof( ManaVampireScroll ), typeof( MassDispelScroll ), typeof( MeteorSwarmScroll ), typeof( PolymorphScroll ), + typeof( EarthquakeScroll ), typeof( EnergyVortexScroll ), typeof( ResurrectionScroll ), typeof( SummonAirElementalScroll ), + typeof( SummonDaemonScroll ), typeof( SummonEarthElementalScroll ), typeof( SummonFireElementalScroll ), typeof( SummonWaterElementalScroll ) + }; + + public static Type[] NecromancyScrollTypes { get; } = + { + typeof( AnimateDeadScroll ), typeof( BloodOathScroll ), typeof( CorpseSkinScroll ), typeof( CurseWeaponScroll ), + typeof( EvilOmenScroll ), typeof( HorrificBeastScroll ), typeof( LichFormScroll ), typeof( MindRotScroll ), + typeof( PainSpikeScroll ), typeof( PoisonStrikeScroll ), typeof( StrangleScroll ), typeof( SummonFamiliarScroll ), + typeof( VampiricEmbraceScroll ), typeof( VengefulSpiritScroll ), typeof( WitherScroll ), typeof( WraithFormScroll ) + }; + + public static Type[] SENecromancyScrollTypes { get; } = + { typeof( AnimateDeadScroll ), typeof( BloodOathScroll ), typeof( CorpseSkinScroll ), typeof( CurseWeaponScroll ), typeof( EvilOmenScroll ), typeof( HorrificBeastScroll ), typeof( LichFormScroll ), typeof( MindRotScroll ), typeof( PainSpikeScroll ), typeof( PoisonStrikeScroll ), typeof( StrangleScroll ), typeof( SummonFamiliarScroll ), @@ -238,43 +224,34 @@ namespace Server typeof( ExorcismScroll ) }; - private static Type[] m_PaladinScrollTypes = new Type[0]; + public static Type[] PaladinScrollTypes { get; } = new Type[0]; #region Mondain's Legacy - private static Type[] m_ArcanistScrollTypes = { + public static Type[] ArcanistScrollTypes { get; } = + { typeof( ArcaneCircleScroll ), typeof( GiftOfRenewalScroll ), typeof( ImmolatingWeaponScroll ), typeof( AttuneWeaponScroll ), typeof( ThunderstormScroll ), typeof( NatureFuryScroll ), /*typeof( SummonFeyScroll ), typeof( SummonFiendScroll ),*/ typeof( ReaperFormScroll ), typeof( WildfireScroll ), typeof( EssenceOfWindScroll ), typeof( DryadAllureScroll ), typeof( EtherealVoyageScroll ), typeof( WordOfDeathScroll ), typeof( GiftOfLifeScroll ), typeof( ArcaneEmpowermentScroll ) }; - #endregion - - public static Type[] RegularScrollTypes => m_RegularScrollTypes; - public static Type[] NecromancyScrollTypes => m_NecromancyScrollTypes; - public static Type[] SENecromancyScrollTypes => m_SENecromancyScrollTypes; - public static Type[] PaladinScrollTypes => m_PaladinScrollTypes; - - #region Mondain's Legacy - public static Type[] ArcanistScrollTypes => m_ArcanistScrollTypes; #endregion - private static Type[] m_GrimmochJournalTypes = { + public static Type[] GrimmochJournalTypes { get; } = + { typeof( GrimmochJournal1 ), typeof( GrimmochJournal2 ), typeof( GrimmochJournal3 ), typeof( GrimmochJournal6 ), typeof( GrimmochJournal7 ), typeof( GrimmochJournal11 ), typeof( GrimmochJournal14 ), typeof( GrimmochJournal17 ), typeof( GrimmochJournal23 ) }; - public static Type[] GrimmochJournalTypes => m_GrimmochJournalTypes; - - private static Type[] m_LysanderNotebookTypes = { + public static Type[] LysanderNotebookTypes { get; } = + { typeof( LysanderNotebook1 ), typeof( LysanderNotebook2 ), typeof( LysanderNotebook3 ), typeof( LysanderNotebook7 ), typeof( LysanderNotebook8 ), typeof( LysanderNotebook11 ) }; - public static Type[] LysanderNotebookTypes => m_LysanderNotebookTypes; - - private static Type[] m_TavarasJournalTypes = { + public static Type[] TavarasJournalTypes { get; } = + { typeof( TavarasJournal1 ), typeof( TavarasJournal2 ), typeof( TavarasJournal3 ), typeof( TavarasJournal6 ), typeof( TavarasJournal7 ), typeof( TavarasJournal8 ), typeof( TavarasJournal9 ), typeof( TavarasJournal11 ), typeof( TavarasJournal14 ), @@ -282,93 +259,85 @@ namespace Server typeof( TavarasJournal19 ) }; - public static Type[] TavarasJournalTypes => m_TavarasJournalTypes; - - private static Type[] m_NewWandTypes = { - typeof( FireballWand ), typeof( LightningWand ), typeof( MagicArrowWand ), - typeof( GreaterHealWand ), typeof( HarmWand ), typeof( HealWand ) - }; - public static Type[] NewWandTypes => m_NewWandTypes; - - private static Type[] m_WandTypes = { - typeof( ClumsyWand ), typeof( FeebleWand ), - typeof( ManaDrainWand ), typeof( WeaknessWand ) - }; - public static Type[] WandTypes => m_WandTypes; - - private static Type[] m_OldWandTypes = { - typeof( IDWand ) - }; - public static Type[] OldWandTypes => m_OldWandTypes; - - private static Type[] m_SEClothingTypes = { - typeof( ClothNinjaJacket ), typeof( FemaleKimono ), typeof( Hakama ), - typeof( HakamaShita ), typeof( JinBaori ), typeof( Kamishimo ), - typeof( MaleKimono ), typeof( NinjaTabi ), typeof( Obi ), - typeof( SamuraiTabi ), typeof( TattsukeHakama ), typeof( Waraji ) - }; - - public static Type[] SEClothingTypes => m_SEClothingTypes; - - private static Type[] m_AosClothingTypes = { - typeof( FurSarong ), typeof( FurCape ), typeof( FlowerGarland ), - typeof( GildedDress ), typeof( FurBoots ), typeof( FormalShirt ), + public static Type[] NewWandTypes { get; } = + { + typeof( FireballWand ), typeof( LightningWand ), typeof( MagicArrowWand ), + typeof( GreaterHealWand ), typeof( HarmWand ), typeof( HealWand ) }; - public static Type[] AosClothingTypes => m_AosClothingTypes; + public static Type[] WandTypes { get; } = + { + typeof( ClumsyWand ), typeof( FeebleWand ), + typeof( ManaDrainWand ), typeof( WeaknessWand ) + }; - private static Type[] m_ClothingTypes = { - typeof( Cloak ), - typeof( Bonnet ), typeof( Cap ), typeof( FeatheredHat ), - typeof( FloppyHat ), typeof( JesterHat ), typeof( Surcoat ), - typeof( SkullCap ), typeof( StrawHat ), typeof( TallStrawHat ), - typeof( TricorneHat ), typeof( WideBrimHat ), typeof( WizardsHat ), - typeof( BodySash ), typeof( Doublet ), typeof( Boots ), - typeof( FullApron ), typeof( JesterSuit ), typeof( Sandals ), - typeof( Tunic ), typeof( Shoes ), typeof( Shirt ), - typeof( Kilt ), typeof( Skirt ), typeof( FancyShirt ), - typeof( FancyDress ), typeof( ThighBoots ), typeof( LongPants ), - typeof( PlainDress ), typeof( Robe ), typeof( ShortPants ), - typeof( HalfApron ) - }; - public static Type[] ClothingTypes => m_ClothingTypes; + public static Type[] OldWandTypes { get; } = + { + typeof( IDWand ) + }; - private static Type[] m_SEHatTypes = { - typeof( ClothNinjaHood ), typeof( Kasa ) - }; + public static Type[] SEClothingTypes { get; } = + { + typeof( ClothNinjaJacket ), typeof( FemaleKimono ), typeof( Hakama ), + typeof( HakamaShita ), typeof( JinBaori ), typeof( Kamishimo ), + typeof( MaleKimono ), typeof( NinjaTabi ), typeof( Obi ), + typeof( SamuraiTabi ), typeof( TattsukeHakama ), typeof( Waraji ) + }; - public static Type[] SEHatTypes => m_SEHatTypes; + public static Type[] AosClothingTypes { get; } = + { + typeof( FurSarong ), typeof( FurCape ), typeof( FlowerGarland ), + typeof( GildedDress ), typeof( FurBoots ), typeof( FormalShirt ), + }; - private static Type[] m_AosHatTypes = { - typeof( FlowerGarland ), typeof( BearMask ), typeof( DeerMask ) //Are Bear& Deer mask inside the Pre-AoS loottables too? - }; + public static Type[] ClothingTypes { get; } = + { + typeof( Cloak ), + typeof( Bonnet ), typeof( Cap ), typeof( FeatheredHat ), + typeof( FloppyHat ), typeof( JesterHat ), typeof( Surcoat ), + typeof( SkullCap ), typeof( StrawHat ), typeof( TallStrawHat ), + typeof( TricorneHat ), typeof( WideBrimHat ), typeof( WizardsHat ), + typeof( BodySash ), typeof( Doublet ), typeof( Boots ), + typeof( FullApron ), typeof( JesterSuit ), typeof( Sandals ), + typeof( Tunic ), typeof( Shoes ), typeof( Shirt ), + typeof( Kilt ), typeof( Skirt ), typeof( FancyShirt ), + typeof( FancyDress ), typeof( ThighBoots ), typeof( LongPants ), + typeof( PlainDress ), typeof( Robe ), typeof( ShortPants ), + typeof( HalfApron ) + }; - public static Type[] AosHatTypes => m_AosHatTypes; + public static Type[] SEHatTypes { get; } = + { + typeof( ClothNinjaHood ), typeof( Kasa ) + }; - private static Type[] m_HatTypes = { - typeof( SkullCap ), typeof( Bandana ), typeof( FloppyHat ), - typeof( Cap ), typeof( WideBrimHat ), typeof( StrawHat ), - typeof( TallStrawHat ), typeof( WizardsHat ), typeof( Bonnet ), - typeof( FeatheredHat ), typeof( TricorneHat ), typeof( JesterHat ) - }; + public static Type[] AosHatTypes { get; } = + { + typeof( FlowerGarland ), typeof( BearMask ), typeof( DeerMask ) //Are Bear& Deer mask inside the Pre-AoS loottables too? + }; - public static Type[] HatTypes => m_HatTypes; + public static Type[] HatTypes { get; } = + { + typeof( SkullCap ), typeof( Bandana ), typeof( FloppyHat ), + typeof( Cap ), typeof( WideBrimHat ), typeof( StrawHat ), + typeof( TallStrawHat ), typeof( WizardsHat ), typeof( Bonnet ), + typeof( FeatheredHat ), typeof( TricorneHat ), typeof( JesterHat ) + }; - private static Type[] m_LibraryBookTypes = { - typeof( GrammarOfOrcish ), typeof( CallToAnarchy ), typeof( ArmsAndWeaponsPrimer ), - typeof( SongOfSamlethe ), typeof( TaleOfThreeTribes ), typeof( GuideToGuilds ), - typeof( BirdsOfBritannia ), typeof( BritannianFlora ), typeof( ChildrenTalesVol2 ), - typeof( TalesOfVesperVol1 ), typeof( DeceitDungeonOfHorror ), typeof( DimensionalTravel ), - typeof( EthicalHedonism ), typeof( MyStory ), typeof( DiversityOfOurLand ), - typeof( QuestOfVirtues ), typeof( RegardingLlamas ), typeof( TalkingToWisps ), - typeof( TamingDragons ), typeof( BoldStranger ), typeof( BurningOfTrinsic ), - typeof( TheFight ), typeof( LifeOfATravellingMinstrel ), typeof( MajorTradeAssociation ), - typeof( RankingsOfTrades ), typeof( WildGirlOfTheForest ), typeof( TreatiseOnAlchemy ), - typeof( VirtueBook ) - }; - - public static Type[] LibraryBookTypes => m_LibraryBookTypes; + public static Type[] LibraryBookTypes { get; } = + { + typeof( GrammarOfOrcish ), typeof( CallToAnarchy ), typeof( ArmsAndWeaponsPrimer ), + typeof( SongOfSamlethe ), typeof( TaleOfThreeTribes ), typeof( GuideToGuilds ), + typeof( BirdsOfBritannia ), typeof( BritannianFlora ), typeof( ChildrenTalesVol2 ), + typeof( TalesOfVesperVol1 ), typeof( DeceitDungeonOfHorror ), typeof( DimensionalTravel ), + typeof( EthicalHedonism ), typeof( MyStory ), typeof( DiversityOfOurLand ), + typeof( QuestOfVirtues ), typeof( RegardingLlamas ), typeof( TalkingToWisps ), + typeof( TamingDragons ), typeof( BoldStranger ), typeof( BurningOfTrinsic ), + typeof( TheFight ), typeof( LifeOfATravellingMinstrel ), typeof( MajorTradeAssociation ), + typeof( RankingsOfTrades ), typeof( WildGirlOfTheForest ), typeof( TreatiseOnAlchemy ), + typeof( VirtueBook ) + }; #endregion @@ -377,10 +346,10 @@ namespace Server public static BaseWand RandomWand() { if ( Core.ML ) - return Construct( m_NewWandTypes ) as BaseWand; + return Construct( NewWandTypes ) as BaseWand; if ( Core.AOS ) - return Construct( m_WandTypes, m_NewWandTypes ) as BaseWand; - return Construct( m_OldWandTypes, m_WandTypes, m_NewWandTypes ) as BaseWand; + return Construct( WandTypes, NewWandTypes ) as BaseWand; + return Construct( OldWandTypes, WandTypes, NewWandTypes ) as BaseWand; } public static BaseClothing RandomClothing() @@ -392,16 +361,16 @@ namespace Server { #region Mondain's Legacy if ( Core.ML && isMondain ) - return Construct( m_MLClothingTypes, m_AosClothingTypes, m_ClothingTypes ) as BaseClothing; + return Construct( MLClothingTypes, AosClothingTypes, ClothingTypes ) as BaseClothing; #endregion if ( Core.SE && inTokuno ) - return Construct( m_SEClothingTypes, m_AosClothingTypes, m_ClothingTypes ) as BaseClothing; + return Construct( SEClothingTypes, AosClothingTypes, ClothingTypes ) as BaseClothing; if ( Core.AOS ) - return Construct( m_AosClothingTypes, m_ClothingTypes ) as BaseClothing; + return Construct( AosClothingTypes, ClothingTypes ) as BaseClothing; - return Construct( m_ClothingTypes ) as BaseClothing; + return Construct( ClothingTypes ) as BaseClothing; } public static BaseWeapon RandomRangedWeapon() @@ -413,16 +382,16 @@ namespace Server { #region Mondain's Legacy if ( Core.ML && isMondain ) - return Construct( m_MLRangedWeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes ) as BaseWeapon; + return Construct( MLRangedWeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes ) as BaseWeapon; #endregion if ( Core.SE && inTokuno ) - return Construct( m_SERangedWeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes ) as BaseWeapon; + return Construct( SERangedWeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes ) as BaseWeapon; if ( Core.AOS ) - return Construct( m_AosRangedWeaponTypes, m_RangedWeaponTypes ) as BaseWeapon; + return Construct( AosRangedWeaponTypes, RangedWeaponTypes ) as BaseWeapon; - return Construct( m_RangedWeaponTypes ) as BaseWeapon; + return Construct( RangedWeaponTypes ) as BaseWeapon; } public static BaseWeapon RandomWeapon() @@ -434,16 +403,16 @@ namespace Server { #region Mondain's Legacy if ( Core.ML && isMondain ) - return Construct( m_MLWeaponTypes, m_AosWeaponTypes, m_WeaponTypes ) as BaseWeapon; + return Construct( MLWeaponTypes, AosWeaponTypes, WeaponTypes ) as BaseWeapon; #endregion if ( Core.SE && inTokuno ) - return Construct( m_SEWeaponTypes, m_AosWeaponTypes, m_WeaponTypes ) as BaseWeapon; + return Construct( SEWeaponTypes, AosWeaponTypes, WeaponTypes ) as BaseWeapon; if ( Core.AOS ) - return Construct( m_AosWeaponTypes, m_WeaponTypes ) as BaseWeapon; + return Construct( AosWeaponTypes, WeaponTypes ) as BaseWeapon; - return Construct( m_WeaponTypes ) as BaseWeapon; + return Construct( WeaponTypes ) as BaseWeapon; } public static Item RandomWeaponOrJewelry() @@ -455,21 +424,21 @@ namespace Server { #region Mondain's Legacy if ( Core.ML && isMondain ) - return Construct( m_MLWeaponTypes, m_AosWeaponTypes, m_WeaponTypes, m_JewelryTypes ); + return Construct( MLWeaponTypes, AosWeaponTypes, WeaponTypes, JewelryTypes ); #endregion if ( Core.SE && inTokuno ) - return Construct( m_SEWeaponTypes, m_AosWeaponTypes, m_WeaponTypes, m_JewelryTypes ); + return Construct( SEWeaponTypes, AosWeaponTypes, WeaponTypes, JewelryTypes ); if ( Core.AOS ) - return Construct( m_AosWeaponTypes, m_WeaponTypes, m_JewelryTypes ); + return Construct( AosWeaponTypes, WeaponTypes, JewelryTypes ); - return Construct( m_WeaponTypes, m_JewelryTypes ); + return Construct( WeaponTypes, JewelryTypes ); } public static BaseJewel RandomJewelry() { - return Construct( m_JewelryTypes ) as BaseJewel; + return Construct( JewelryTypes ) as BaseJewel; } public static BaseArmor RandomArmor() @@ -481,13 +450,13 @@ namespace Server { #region Mondain's Legacy if ( Core.ML && isMondain ) - return Construct( m_MLArmorTypes, m_ArmorTypes ) as BaseArmor; + return Construct( MLArmorTypes, ArmorTypes ) as BaseArmor; #endregion if ( Core.SE && inTokuno ) - return Construct( m_SEArmorTypes, m_ArmorTypes ) as BaseArmor; + return Construct( SEArmorTypes, ArmorTypes ) as BaseArmor; - return Construct( m_ArmorTypes ) as BaseArmor; + return Construct( ArmorTypes ) as BaseArmor; } public static BaseHat RandomHat() @@ -498,12 +467,12 @@ namespace Server public static BaseHat RandomHat( bool inTokuno ) { if ( Core.SE && inTokuno ) - return Construct( m_SEHatTypes, m_AosHatTypes, m_HatTypes ) as BaseHat; + return Construct( SEHatTypes, AosHatTypes, HatTypes ) as BaseHat; if ( Core.AOS ) - return Construct( m_AosHatTypes, m_HatTypes ) as BaseHat; + return Construct( AosHatTypes, HatTypes ) as BaseHat; - return Construct( m_HatTypes ) as BaseHat; + return Construct( HatTypes ) as BaseHat; } public static Item RandomArmorOrHat() @@ -515,24 +484,24 @@ namespace Server { #region Mondain's Legacy if ( Core.ML && isMondain ) - return Construct( m_MLArmorTypes, m_ArmorTypes, m_AosHatTypes, m_HatTypes ); + return Construct( MLArmorTypes, ArmorTypes, AosHatTypes, HatTypes ); #endregion if ( Core.SE && inTokuno ) - return Construct( m_SEArmorTypes, m_ArmorTypes, m_SEHatTypes, m_AosHatTypes, m_HatTypes ); + return Construct( SEArmorTypes, ArmorTypes, SEHatTypes, AosHatTypes, HatTypes ); if ( Core.AOS ) - return Construct( m_ArmorTypes, m_AosHatTypes, m_HatTypes ); + return Construct( ArmorTypes, AosHatTypes, HatTypes ); - return Construct( m_ArmorTypes, m_HatTypes ); + return Construct( ArmorTypes, HatTypes ); } public static BaseShield RandomShield() { if ( Core.AOS ) - return Construct( m_AosShieldTypes, m_ShieldTypes ) as BaseShield; + return Construct( AosShieldTypes, ShieldTypes ) as BaseShield; - return Construct( m_ShieldTypes ) as BaseShield; + return Construct( ShieldTypes ) as BaseShield; } public static BaseArmor RandomArmorOrShield() @@ -544,16 +513,16 @@ namespace Server { #region Mondain's Legacy if ( Core.ML && isMondain ) - return Construct( m_MLArmorTypes, m_ArmorTypes, m_AosShieldTypes, m_ShieldTypes ) as BaseArmor; + return Construct( MLArmorTypes, ArmorTypes, AosShieldTypes, ShieldTypes ) as BaseArmor; #endregion if ( Core.SE && inTokuno ) - return Construct( m_SEArmorTypes, m_ArmorTypes, m_AosShieldTypes, m_ShieldTypes ) as BaseArmor; + return Construct( SEArmorTypes, ArmorTypes, AosShieldTypes, ShieldTypes ) as BaseArmor; if ( Core.AOS ) - return Construct( m_ArmorTypes, m_AosShieldTypes, m_ShieldTypes ) as BaseArmor; + return Construct( ArmorTypes, AosShieldTypes, ShieldTypes ) as BaseArmor; - return Construct( m_ArmorTypes, m_ShieldTypes ) as BaseArmor; + return Construct( ArmorTypes, ShieldTypes ) as BaseArmor; } public static Item RandomArmorOrShieldOrJewelry() @@ -565,16 +534,16 @@ namespace Server { #region Mondain's Legacy if ( Core.ML && isMondain ) - return Construct( m_MLArmorTypes, m_ArmorTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes, m_JewelryTypes ); + return Construct( MLArmorTypes, ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes ); #endregion if ( Core.SE && inTokuno ) - return Construct( m_SEArmorTypes, m_ArmorTypes, m_SEHatTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes, m_JewelryTypes ); + return Construct( SEArmorTypes, ArmorTypes, SEHatTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes ); if ( Core.AOS ) - return Construct( m_ArmorTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes, m_JewelryTypes ); + return Construct( ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes ); - return Construct( m_ArmorTypes, m_HatTypes, m_ShieldTypes, m_JewelryTypes ); + return Construct( ArmorTypes, HatTypes, ShieldTypes, JewelryTypes ); } public static Item RandomArmorOrShieldOrWeapon() @@ -586,16 +555,16 @@ namespace Server { #region Mondain's Legacy if ( Core.ML && isMondain ) - return Construct( m_MLWeaponTypes, m_AosWeaponTypes, m_WeaponTypes, m_MLRangedWeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes, m_MLArmorTypes, m_ArmorTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes ); + return Construct( MLWeaponTypes, AosWeaponTypes, WeaponTypes, MLRangedWeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes, MLArmorTypes, ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes ); #endregion if ( Core.SE && inTokuno ) - return Construct( m_SEWeaponTypes, m_AosWeaponTypes, m_WeaponTypes, m_SERangedWeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes, m_SEArmorTypes, m_ArmorTypes, m_SEHatTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes ); + return Construct( SEWeaponTypes, AosWeaponTypes, WeaponTypes, SERangedWeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes, SEArmorTypes, ArmorTypes, SEHatTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes ); if ( Core.AOS ) - return Construct( m_AosWeaponTypes, m_WeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes, m_ArmorTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes ); + return Construct( AosWeaponTypes, WeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes, ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes ); - return Construct( m_WeaponTypes, m_RangedWeaponTypes, m_ArmorTypes, m_HatTypes, m_ShieldTypes ); + return Construct( WeaponTypes, RangedWeaponTypes, ArmorTypes, HatTypes, ShieldTypes ); } public static Item RandomArmorOrShieldOrWeaponOrJewelry() @@ -607,64 +576,64 @@ namespace Server { #region Mondain's Legacy if ( Core.ML && isMondain ) - return Construct( m_MLWeaponTypes, m_AosWeaponTypes, m_WeaponTypes, m_MLRangedWeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes, m_MLArmorTypes, m_ArmorTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes, m_JewelryTypes ); + return Construct( MLWeaponTypes, AosWeaponTypes, WeaponTypes, MLRangedWeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes, MLArmorTypes, ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes ); #endregion if ( Core.SE && inTokuno ) - return Construct( m_SEWeaponTypes, m_AosWeaponTypes, m_WeaponTypes, m_SERangedWeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes, m_SEArmorTypes, m_ArmorTypes, m_SEHatTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes, m_JewelryTypes ); + return Construct( SEWeaponTypes, AosWeaponTypes, WeaponTypes, SERangedWeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes, SEArmorTypes, ArmorTypes, SEHatTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes ); if ( Core.AOS ) - return Construct( m_AosWeaponTypes, m_WeaponTypes, m_AosRangedWeaponTypes, m_RangedWeaponTypes, m_ArmorTypes, m_AosHatTypes, m_HatTypes, m_AosShieldTypes, m_ShieldTypes, m_JewelryTypes ); + return Construct( AosWeaponTypes, WeaponTypes, AosRangedWeaponTypes, RangedWeaponTypes, ArmorTypes, AosHatTypes, HatTypes, AosShieldTypes, ShieldTypes, JewelryTypes ); - return Construct( m_WeaponTypes, m_RangedWeaponTypes, m_ArmorTypes, m_HatTypes, m_ShieldTypes, m_JewelryTypes ); + return Construct( WeaponTypes, RangedWeaponTypes, ArmorTypes, HatTypes, ShieldTypes, JewelryTypes ); } #region Chest of Heirlooms public static Item ChestOfHeirloomsContains() { - return Construct( m_SEArmorTypes, m_SEHatTypes, m_SEWeaponTypes, m_SERangedWeaponTypes, m_JewelryTypes ); + return Construct( SEArmorTypes, SEHatTypes, SEWeaponTypes, SERangedWeaponTypes, JewelryTypes ); } #endregion public static Item RandomGem() { - return Construct( m_GemTypes ); + return Construct( GemTypes ); } public static Item RandomReagent() { - return Construct( m_RegTypes ); + return Construct( RegTypes ); } public static Item RandomNecromancyReagent() { - return Construct( m_NecroRegTypes ); + return Construct( NecroRegTypes ); } public static Item RandomPossibleReagent() { if ( Core.AOS ) - return Construct( m_RegTypes, m_NecroRegTypes ); + return Construct( RegTypes, NecroRegTypes ); - return Construct( m_RegTypes ); + return Construct( RegTypes ); } public static Item RandomPotion() { - return Construct( m_PotionTypes ); + return Construct( PotionTypes ); } public static BaseInstrument RandomInstrument() { if ( Core.SE ) - return Construct( m_InstrumentTypes, m_SEInstrumentTypes ) as BaseInstrument; + return Construct( InstrumentTypes, SEInstrumentTypes ) as BaseInstrument; - return Construct( m_InstrumentTypes ) as BaseInstrument; + return Construct( InstrumentTypes ) as BaseInstrument; } public static Item RandomStatue() { - return Construct( m_StatueTypes ); + return Construct( StatueTypes ); } public static SpellScroll RandomScroll( int minIndex, int maxIndex, SpellbookType type ) @@ -674,10 +643,10 @@ namespace Server switch ( type ) { default: - case SpellbookType.Regular: types = m_RegularScrollTypes; break; - case SpellbookType.Necromancer: types = (Core.SE ? m_SENecromancyScrollTypes : m_NecromancyScrollTypes ); break; - case SpellbookType.Paladin: types = m_PaladinScrollTypes; break; - case SpellbookType.Arcanist: types = m_ArcanistScrollTypes; break; + case SpellbookType.Regular: types = RegularScrollTypes; break; + case SpellbookType.Necromancer: types = (Core.SE ? SENecromancyScrollTypes : NecromancyScrollTypes ); break; + case SpellbookType.Paladin: types = PaladinScrollTypes; break; + case SpellbookType.Arcanist: types = ArcanistScrollTypes; break; } return Construct( types, Utility.RandomMinMax( minIndex, maxIndex ) ) as SpellScroll; @@ -685,22 +654,22 @@ namespace Server public static BaseBook RandomGrimmochJournal() { - return Construct( m_GrimmochJournalTypes ) as BaseBook; + return Construct( GrimmochJournalTypes ) as BaseBook; } public static BaseBook RandomLysanderNotebook() { - return Construct( m_LysanderNotebookTypes ) as BaseBook; + return Construct( LysanderNotebookTypes ) as BaseBook; } public static BaseBook RandomTavarasJournal() { - return Construct( m_TavarasJournalTypes ) as BaseBook; + return Construct( TavarasJournalTypes ) as BaseBook; } public static BaseBook RandomLibraryBook() { - return Construct( m_LibraryBookTypes ) as BaseBook; + return Construct( LibraryBookTypes ) as BaseBook; } public static BaseTalisman RandomTalisman() diff --git a/Scripts/Misc/LootPack.cs b/Scripts/Misc/LootPack.cs index 74c3618b0..7e49c716e 100644 --- a/Scripts/Misc/LootPack.cs +++ b/Scripts/Misc/LootPack.cs @@ -500,50 +500,19 @@ namespace Server public class LootPackEntry { - private int m_Chance; - private LootPackDice m_Quantity; - - private int m_MaxProps, m_MinIntensity, m_MaxIntensity; - private bool m_AtSpawnTime; - private LootPackItem[] m_Items; + public int Chance { get; set; } - public int Chance - { - get => m_Chance; - set => m_Chance = value; - } + public LootPackDice Quantity { get; set; } - public LootPackDice Quantity - { - get => m_Quantity; - set => m_Quantity = value; - } + public int MaxProps { get; set; } - public int MaxProps - { - get => m_MaxProps; - set => m_MaxProps = value; - } + public int MinIntensity { get; set; } - public int MinIntensity - { - get => m_MinIntensity; - set => m_MinIntensity = value; - } + public int MaxIntensity { get; set; } - public int MaxIntensity - { - get => m_MaxIntensity; - set => m_MaxIntensity = value; - } - - public LootPackItem[] Items - { - get => m_Items; - set => m_Items = value; - } + public LootPackItem[] Items { get; set; } private static bool IsInTokuno( Mobile m ) { @@ -570,14 +539,14 @@ namespace Server int totalChance = 0; - for ( int i = 0; i < m_Items.Length; ++i ) - totalChance += m_Items[i].Chance; + for ( int i = 0; i < Items.Length; ++i ) + totalChance += Items[i].Chance; int rnd = Utility.Random( totalChance ); - for ( int i = 0; i < m_Items.Length; ++i ) + for ( int i = 0; i < Items.Length; ++i ) { - LootPackItem item = m_Items[i]; + LootPackItem item = Items[i]; if ( rnd < item.Chance ) return Mutate( from, luckChance, item.Construct( IsInTokuno( from ), IsMondain( from ) ) ); @@ -590,7 +559,7 @@ namespace Server private int GetRandomOldBonus() { - int rnd = Utility.RandomMinMax( m_MinIntensity, m_MaxIntensity ); + int rnd = Utility.RandomMinMax( MinIntensity, MaxIntensity ); if ( 50 > rnd ) return 1; @@ -626,26 +595,26 @@ namespace Server if ( Core.AOS ) { int bonusProps = GetBonusProperties(); - int min = m_MinIntensity; - int max = m_MaxIntensity; + int min = MinIntensity; + int max = MaxIntensity; - if ( bonusProps < m_MaxProps && LootPack.CheckLuck( luckChance ) ) + if ( bonusProps < MaxProps && LootPack.CheckLuck( luckChance ) ) ++bonusProps; int props = 1 + bonusProps; // Make sure we're not spawning items with 6 properties. - if ( props > m_MaxProps ) - props = m_MaxProps; + if ( props > MaxProps ) + props = MaxProps; if ( item is BaseWeapon weapon ) - BaseRunicTool.ApplyAttributesTo( weapon, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); + BaseRunicTool.ApplyAttributesTo( weapon, false, luckChance, props, MinIntensity, MaxIntensity ); else if ( item is BaseArmor armor ) - BaseRunicTool.ApplyAttributesTo( armor, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); + BaseRunicTool.ApplyAttributesTo( armor, false, luckChance, props, MinIntensity, MaxIntensity ); else if ( item is BaseJewel jewel ) - BaseRunicTool.ApplyAttributesTo( jewel, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); + BaseRunicTool.ApplyAttributesTo( jewel, false, luckChance, props, MinIntensity, MaxIntensity ); else - BaseRunicTool.ApplyAttributesTo( (BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); + BaseRunicTool.ApplyAttributesTo( (BaseHat)item, false, luckChance, props, MinIntensity, MaxIntensity ); } else // not aos { @@ -696,7 +665,7 @@ namespace Server } if ( item.Stackable ) - item.Amount = m_Quantity.Roll(); + item.Amount = Quantity.Roll(); } return item; @@ -721,19 +690,19 @@ namespace Server public LootPackEntry( bool atSpawnTime, LootPackItem[] items, double chance, LootPackDice quantity, int maxProps, int minIntensity, int maxIntensity ) { m_AtSpawnTime = atSpawnTime; - m_Items = items; - m_Chance = (int)(100 * chance); - m_Quantity = quantity; - m_MaxProps = maxProps; - m_MinIntensity = minIntensity; - m_MaxIntensity = maxIntensity; + Items = items; + Chance = (int)(100 * chance); + Quantity = quantity; + MaxProps = maxProps; + MinIntensity = minIntensity; + MaxIntensity = maxIntensity; } public int GetBonusProperties() { int p0=0, p1=0, p2=0, p3=0, p4=0, p5=0; - switch ( m_MaxProps ) + switch ( MaxProps ) { case 1: p0= 3; p1= 1; break; case 2: p0= 6; p1= 3; p2= 1; break; @@ -770,20 +739,9 @@ namespace Server public class LootPackItem { - private Type m_Type; - private int m_Chance; + public Type Type { get; set; } - public Type Type - { - get => m_Type; - set => m_Type = value; - } - - public int Chance - { - get => m_Chance; - set => m_Chance = value; - } + public int Chance { get; set; } private static Type[] m_BlankTypes = { typeof( BlankScroll ) }; private static Type[][] m_NecroTypes = { @@ -841,28 +799,28 @@ namespace Server { Item item; - if ( m_Type == typeof( BaseRanged ) ) + if ( Type == typeof( BaseRanged ) ) item = Loot.RandomRangedWeapon( inTokuno, isMondain ); - else if ( m_Type == typeof( BaseWeapon ) ) + else if ( Type == typeof( BaseWeapon ) ) item = Loot.RandomWeapon( inTokuno, isMondain ); - else if ( m_Type == typeof( BaseArmor ) ) + else if ( Type == typeof( BaseArmor ) ) item = Loot.RandomArmorOrHat( inTokuno, isMondain ); - else if ( m_Type == typeof( BaseShield ) ) + else if ( Type == typeof( BaseShield ) ) item = Loot.RandomShield(); - else if ( m_Type == typeof( BaseJewel ) ) + else if ( Type == typeof( BaseJewel ) ) item = Core.AOS ? Loot.RandomJewelry() : Loot.RandomArmorOrShieldOrWeapon(); - else if ( m_Type == typeof( BaseInstrument ) ) + else if ( Type == typeof( BaseInstrument ) ) item = Loot.RandomInstrument(); - else if ( m_Type == typeof( Amber ) ) // gem + else if ( Type == typeof( Amber ) ) // gem item = Loot.RandomGem(); - else if ( m_Type == typeof( ClumsyScroll ) ) // low scroll + else if ( Type == typeof( ClumsyScroll ) ) // low scroll item = RandomScroll( 0, 1, 3 ); - else if ( m_Type == typeof( ArchCureScroll ) ) // med scroll + else if ( Type == typeof( ArchCureScroll ) ) // med scroll item = RandomScroll( 1, 4, 7 ); - else if ( m_Type == typeof( SummonAirElementalScroll ) ) // high scroll + else if ( Type == typeof( SummonAirElementalScroll ) ) // high scroll item = RandomScroll( 2, 8, 8 ); else - item = Activator.CreateInstance( m_Type ) as Item; + item = Activator.CreateInstance( Type ) as Item; return item; } @@ -875,39 +833,25 @@ namespace Server public LootPackItem( Type type, int chance ) { - m_Type = type; - m_Chance = chance; + Type = type; + Chance = chance; } } public class LootPackDice { - private int m_Count, m_Sides, m_Bonus; + public int Count { get; set; } - public int Count - { - get => m_Count; - set => m_Count = value; - } + public int Sides { get; set; } - public int Sides - { - get => m_Sides; - set => m_Sides = value; - } - - public int Bonus - { - get => m_Bonus; - set => m_Bonus = value; - } + public int Bonus { get; set; } public int Roll() { - int v = m_Bonus; + int v = Bonus; - for ( int i = 0; i < m_Count; ++i ) - v += Utility.Random( 1, m_Sides ); + for ( int i = 0; i < Count; ++i ) + v += Utility.Random( 1, Sides ); return v; } @@ -920,7 +864,7 @@ namespace Server if ( index < start ) return; - m_Count = Utility.ToInt32( str.Substring( start, index-start ) ); + Count = Utility.ToInt32( str.Substring( start, index-start ) ); start = index + 1; index = str.IndexOf( '+', start ); @@ -933,7 +877,7 @@ namespace Server if ( index < start ) index = str.Length; - m_Sides = Utility.ToInt32( str.Substring( start, index-start ) ); + Sides = Utility.ToInt32( str.Substring( start, index-start ) ); if ( index == str.Length ) return; @@ -941,17 +885,17 @@ namespace Server start = index + 1; index = str.Length; - m_Bonus = Utility.ToInt32( str.Substring( start, index-start ) ); + Bonus = Utility.ToInt32( str.Substring( start, index-start ) ); if ( negative ) - m_Bonus *= -1; + Bonus *= -1; } public LootPackDice( int count, int sides, int bonus ) { - m_Count = count; - m_Sides = sides; - m_Bonus = bonus; + Count = count; + Sides = sides; + Bonus = bonus; } } } diff --git a/Scripts/Misc/MondainsLegacy.cs b/Scripts/Misc/MondainsLegacy.cs index 9688e2310..dc5347625 100644 --- a/Scripts/Misc/MondainsLegacy.cs +++ b/Scripts/Misc/MondainsLegacy.cs @@ -6,9 +6,8 @@ namespace Server { public static class MondainsLegacy { - public static Type[] Artifacts => m_Artifacts; - - private static Type[] m_Artifacts = { + public static Type[] Artifacts { get; } = + { typeof( AegisOfGrace ), typeof( BladeDance ), typeof( BloodwoodSpirit ), typeof( Bonesmasher ), typeof( Boomstick ), typeof( BrightsightLenses ), typeof( FeyLeggings ), typeof( FleshRipper ), typeof( HelmOfSwiftness ), typeof( PadsOfTheCuSidhe ), typeof( QuiverOfRage ), typeof( QuiverOfElements ), @@ -27,7 +26,7 @@ namespace Server public static void GiveArtifactTo( Mobile m ) { - if ( !(Activator.CreateInstance( m_Artifacts[Utility.Random( m_Artifacts.Length )] ) is Item item) ) + if ( !(Activator.CreateInstance( Artifacts[Utility.Random( Artifacts.Length )] ) is Item item) ) return; if ( m.AddToBackpack( item ) ) diff --git a/Scripts/Misc/NameList.cs b/Scripts/Misc/NameList.cs index a0b53b817..c0eb26ab2 100644 --- a/Scripts/Misc/NameList.cs +++ b/Scripts/Misc/NameList.cs @@ -7,16 +7,14 @@ namespace Server { public class NameList { - private string m_Type; - private string[] m_List; + public string Type { get; } - public string Type => m_Type; - public string[] List => m_List; + public string[] List { get; } public bool ContainsName( string name ) { - for ( int i = 0; i < m_List.Length; i++ ) - if ( name == m_List[i] ) + for ( int i = 0; i < List.Length; i++ ) + if ( name == List[i] ) return true; return false; @@ -24,17 +22,17 @@ namespace Server public NameList( string type, XmlElement xml ) { - m_Type = type; - m_List = xml.InnerText.Split( ',' ); + Type = type; + List = xml.InnerText.Split( ',' ); - for ( int i = 0; i < m_List.Length; ++i ) - m_List[i] = Utility.Intern( m_List[i].Trim() ); + for ( int i = 0; i < List.Length; ++i ) + List[i] = Utility.Intern( List[i].Trim() ); } public string GetRandomName() { - if ( m_List.Length > 0 ) - return m_List[Utility.Random( m_List.Length )]; + if ( List.Length > 0 ) + return List[Utility.Random( List.Length )]; return ""; } diff --git a/Scripts/Misc/NameVerification.cs b/Scripts/Misc/NameVerification.cs index cf1813e42..dd09f8c6b 100644 --- a/Scripts/Misc/NameVerification.cs +++ b/Scripts/Misc/NameVerification.cs @@ -27,7 +27,7 @@ namespace Server.Misc public static bool Validate( string name, int minLength, int maxLength, bool allowLetters, bool allowDigits, bool noExceptionsAtStart, int maxExceptions, char[] exceptions ) { - return Validate( name, minLength, maxLength, allowLetters, allowDigits, noExceptionsAtStart, maxExceptions, exceptions, m_Disallowed, m_StartDisallowed ); + return Validate( name, minLength, maxLength, allowLetters, allowDigits, noExceptionsAtStart, maxExceptions, exceptions, Disallowed, StartDisallowed ); } public static bool Validate( string name, int minLength, int maxLength, bool allowLetters, bool allowDigits, bool noExceptionsAtStart, int maxExceptions, char[] exceptions, string[] disallowed, string[] startDisallowed ) @@ -109,94 +109,93 @@ namespace Server.Misc return true; } - public static string[] StartDisallowed => m_StartDisallowed; - public static string[] Disallowed => m_Disallowed; + public static string[] StartDisallowed { get; } = + { + "seer", + "counselor", + "gm", + "admin", + "lady", + "lord" + }; - private static string[] m_StartDisallowed = { - "seer", - "counselor", - "gm", - "admin", - "lady", - "lord" - }; - - private static string[] m_Disallowed = { - "jigaboo", - "chigaboo", - "wop", - "kyke", - "kike", - "tit", - "spic", - "prick", - "piss", - "lezbo", - "lesbo", - "felatio", - "dyke", - "dildo", - "chinc", - "chink", - "cunnilingus", - "cum", - "cocksucker", - "cock", - "clitoris", - "clit", - "ass", - "hitler", - "penis", - "nigga", - "nigger", - "klit", - "kunt", - "jiz", - "jism", - "jerkoff", - "jackoff", - "goddamn", - "fag", - "blowjob", - "bitch", - "asshole", - "dick", - "pussy", - "snatch", - "cunt", - "twat", - "shit", - "fuck", - "tailor", - "smith", - "scholar", - "rogue", - "novice", - "neophyte", - "merchant", - "medium", - "master", - "mage", - "lb", - "journeyman", - "grandmaster", - "fisherman", - "expert", - "chef", - "carpenter", - "british", - "blackthorne", - "blackthorn", - "beggar", - "archer", - "apprentice", - "adept", - "gamemaster", - "frozen", - "squelched", - "invulnerable", - "osi", - "origin" - }; + public static string[] Disallowed { get; } = + { + "jigaboo", + "chigaboo", + "wop", + "kyke", + "kike", + "tit", + "spic", + "prick", + "piss", + "lezbo", + "lesbo", + "felatio", + "dyke", + "dildo", + "chinc", + "chink", + "cunnilingus", + "cum", + "cocksucker", + "cock", + "clitoris", + "clit", + "ass", + "hitler", + "penis", + "nigga", + "nigger", + "klit", + "kunt", + "jiz", + "jism", + "jerkoff", + "jackoff", + "goddamn", + "fag", + "blowjob", + "bitch", + "asshole", + "dick", + "pussy", + "snatch", + "cunt", + "twat", + "shit", + "fuck", + "tailor", + "smith", + "scholar", + "rogue", + "novice", + "neophyte", + "merchant", + "medium", + "master", + "mage", + "lb", + "journeyman", + "grandmaster", + "fisherman", + "expert", + "chef", + "carpenter", + "british", + "blackthorne", + "blackthorn", + "beggar", + "archer", + "apprentice", + "adept", + "gamemaster", + "frozen", + "squelched", + "invulnerable", + "osi", + "origin" + }; } } diff --git a/Scripts/Misc/Poison.cs b/Scripts/Misc/Poison.cs index 4126eab06..fb5d980fb 100644 --- a/Scripts/Misc/Poison.cs +++ b/Scripts/Misc/Poison.cs @@ -39,8 +39,6 @@ namespace Server } // Info - private string m_Name; - private int m_Level; // Damage private int m_Minimum, m_Maximum; @@ -53,8 +51,8 @@ namespace Server public PoisonImpl( string name, int level, int min, int max, double percent, double delay, double interval, int count, int messageInterval ) { - m_Name = name; - m_Level = level; + Name = name; + Level = level; m_Minimum = min; m_Maximum = max; m_Scalar = percent * 0.01; @@ -64,24 +62,22 @@ namespace Server m_MessageInterval = messageInterval; } - public override string Name => m_Name; - public override int Level => m_Level; + public override string Name { get; } + + public override int Level { get; } public class PoisonTimer : Timer { private PoisonImpl m_Poison; private Mobile m_Mobile; - private Mobile m_From; private int m_LastDamage; private int m_Index; - public Mobile From{ get => m_From; - set => m_From = value; - } + public Mobile From { get; set; } public PoisonTimer( Mobile m, PoisonImpl p ) : base( p.m_Delay, p.m_Interval ) { - m_From = m; + From = m; m_Mobile = m; m_Poison = p; } @@ -132,18 +128,18 @@ namespace Server m_LastDamage = damage; } - m_From?.DoHarmful( m_Mobile, true ); + From?.DoHarmful( m_Mobile, true ); if ( m_Mobile is IHonorTarget honorTarget ) honorTarget.ReceivedHonorContext?.OnTargetPoisoned(); - AOS.Damage( m_Mobile, m_From, damage, 0, 0, 0, 100, 0 ); + AOS.Damage( m_Mobile, From, damage, 0, 0, 0, 100, 0 ); if ( 0.60 <= Utility.RandomDouble() ) // OSI: randomly revealed between first and third damage tick, guessing 60% chance m_Mobile.RevealingAction(); if ( (m_Index % m_Poison.m_MessageInterval) == 0 ) - m_Mobile.OnPoisoned( m_From, m_Poison, m_Poison ); + m_Mobile.OnPoisoned( From, m_Poison, m_Poison ); } } diff --git a/Scripts/Misc/ProfanityProtection.cs b/Scripts/Misc/ProfanityProtection.cs index c8856bdc8..9f7b5df02 100644 --- a/Scripts/Misc/ProfanityProtection.cs +++ b/Scripts/Misc/ProfanityProtection.cs @@ -54,66 +54,64 @@ namespace Server.Misc if ( from.AccessLevel > AccessLevel.Player ) return; - if ( !NameVerification.Validate( e.Speech, 0, int.MaxValue, true, true, false, int.MaxValue, m_Exceptions, m_Disallowed, m_StartDisallowed ) ) + if ( !NameVerification.Validate( e.Speech, 0, int.MaxValue, true, true, false, int.MaxValue, Exceptions, Disallowed, StartDisallowed ) ) e.Blocked = !OnProfanityDetected( from, e.Speech ); } - public static char[] Exceptions => m_Exceptions; - public static string[] StartDisallowed => m_StartDisallowed; - public static string[] Disallowed => m_Disallowed; + public static char[] Exceptions { get; } = + { + ' ', '-', '.', '\'', '"', ',', '_', '+', '=', '~', '`', '!', '^', '*', '\\', '/', ';', ':', '<', '>', '[', ']', '{', '}', '?', '|', '(', ')', '%', '$', '&', '#', '@' + }; - private static char[] m_Exceptions = { - ' ', '-', '.', '\'', '"', ',', '_', '+', '=', '~', '`', '!', '^', '*', '\\', '/', ';', ':', '<', '>', '[', ']', '{', '}', '?', '|', '(', ')', '%', '$', '&', '#', '@' - }; + public static string[] StartDisallowed { get; } = {}; - private static string[] m_StartDisallowed = {}; - - private static string[] m_Disallowed = { - "jigaboo", - "chigaboo", - "wop", - "kyke", - "kike", - "tit", - "spic", - "prick", - "piss", - "lezbo", - "lesbo", - "felatio", - "dyke", - "dildo", - "chinc", - "chink", - "cunnilingus", - "cum", - "cocksucker", - "cock", - "clitoris", - "clit", - "ass", - "hitler", - "penis", - "nigga", - "nigger", - "klit", - "kunt", - "jiz", - "jism", - "jerkoff", - "jackoff", - "goddamn", - "fag", - "blowjob", - "bitch", - "asshole", - "dick", - "pussy", - "snatch", - "cunt", - "twat", - "shit", - "fuck" - }; + public static string[] Disallowed { get; } = + { + "jigaboo", + "chigaboo", + "wop", + "kyke", + "kike", + "tit", + "spic", + "prick", + "piss", + "lezbo", + "lesbo", + "felatio", + "dyke", + "dildo", + "chinc", + "chink", + "cunnilingus", + "cum", + "cocksucker", + "cock", + "clitoris", + "clit", + "ass", + "hitler", + "penis", + "nigga", + "nigger", + "klit", + "kunt", + "jiz", + "jism", + "jerkoff", + "jackoff", + "goddamn", + "fag", + "blowjob", + "bitch", + "asshole", + "dick", + "pussy", + "snatch", + "cunt", + "twat", + "shit", + "fuck" + }; } } \ No newline at end of file diff --git a/Scripts/Misc/ResourceInfo.cs b/Scripts/Misc/ResourceInfo.cs index 7594bb208..d967516d6 100644 --- a/Scripts/Misc/ResourceInfo.cs +++ b/Scripts/Misc/ResourceInfo.cs @@ -48,103 +48,51 @@ namespace Server.Items public class CraftAttributeInfo { - private int m_WeaponFireDamage; - private int m_WeaponColdDamage; - private int m_WeaponPoisonDamage; - private int m_WeaponEnergyDamage; - private int m_WeaponChaosDamage; - private int m_WeaponDirectDamage; - private int m_WeaponDurability; - private int m_WeaponLuck; - private int m_WeaponGoldIncrease; - private int m_WeaponLowerRequirements; + public int WeaponFireDamage { get; set; } - private int m_ArmorPhysicalResist; - private int m_ArmorFireResist; - private int m_ArmorColdResist; - private int m_ArmorPoisonResist; - private int m_ArmorEnergyResist; - private int m_ArmorDurability; - private int m_ArmorLuck; - private int m_ArmorGoldIncrease; - private int m_ArmorLowerRequirements; + public int WeaponColdDamage { get; set; } - private int m_RunicMinAttributes; - private int m_RunicMaxAttributes; - private int m_RunicMinIntensity; - private int m_RunicMaxIntensity; + public int WeaponPoisonDamage { get; set; } - public int WeaponFireDamage{ get => m_WeaponFireDamage; - set => m_WeaponFireDamage = value; - } - public int WeaponColdDamage{ get => m_WeaponColdDamage; - set => m_WeaponColdDamage = value; - } - public int WeaponPoisonDamage{ get => m_WeaponPoisonDamage; - set => m_WeaponPoisonDamage = value; - } - public int WeaponEnergyDamage{ get => m_WeaponEnergyDamage; - set => m_WeaponEnergyDamage = value; - } - public int WeaponChaosDamage{ get => m_WeaponChaosDamage; - set => m_WeaponChaosDamage = value; - } - public int WeaponDirectDamage{ get => m_WeaponDirectDamage; - set => m_WeaponDirectDamage = value; - } - public int WeaponDurability{ get => m_WeaponDurability; - set => m_WeaponDurability = value; - } - public int WeaponLuck{ get => m_WeaponLuck; - set => m_WeaponLuck = value; - } - public int WeaponGoldIncrease{ get => m_WeaponGoldIncrease; - set => m_WeaponGoldIncrease = value; - } - public int WeaponLowerRequirements{ get => m_WeaponLowerRequirements; - set => m_WeaponLowerRequirements = value; - } + public int WeaponEnergyDamage { get; set; } - public int ArmorPhysicalResist{ get => m_ArmorPhysicalResist; - set => m_ArmorPhysicalResist = value; - } - public int ArmorFireResist{ get => m_ArmorFireResist; - set => m_ArmorFireResist = value; - } - public int ArmorColdResist{ get => m_ArmorColdResist; - set => m_ArmorColdResist = value; - } - public int ArmorPoisonResist{ get => m_ArmorPoisonResist; - set => m_ArmorPoisonResist = value; - } - public int ArmorEnergyResist{ get => m_ArmorEnergyResist; - set => m_ArmorEnergyResist = value; - } - public int ArmorDurability{ get => m_ArmorDurability; - set => m_ArmorDurability = value; - } - public int ArmorLuck{ get => m_ArmorLuck; - set => m_ArmorLuck = value; - } - public int ArmorGoldIncrease{ get => m_ArmorGoldIncrease; - set => m_ArmorGoldIncrease = value; - } - public int ArmorLowerRequirements{ get => m_ArmorLowerRequirements; - set => m_ArmorLowerRequirements = value; - } + public int WeaponChaosDamage { get; set; } - public int RunicMinAttributes{ get => m_RunicMinAttributes; - set => m_RunicMinAttributes = value; - } - public int RunicMaxAttributes{ get => m_RunicMaxAttributes; - set => m_RunicMaxAttributes = value; - } - public int RunicMinIntensity{ get => m_RunicMinIntensity; - set => m_RunicMinIntensity = value; - } - public int RunicMaxIntensity{ get => m_RunicMaxIntensity; - set => m_RunicMaxIntensity = value; - } + public int WeaponDirectDamage { get; set; } + + public int WeaponDurability { get; set; } + + public int WeaponLuck { get; set; } + + public int WeaponGoldIncrease { get; set; } + + public int WeaponLowerRequirements { get; set; } + + public int ArmorPhysicalResist { get; set; } + + public int ArmorFireResist { get; set; } + + public int ArmorColdResist { get; set; } + + public int ArmorPoisonResist { get; set; } + + public int ArmorEnergyResist { get; set; } + + public int ArmorDurability { get; set; } + + public int ArmorLuck { get; set; } + + public int ArmorGoldIncrease { get; set; } + + public int ArmorLowerRequirements { get; set; } + + public int RunicMinAttributes { get; set; } + + public int RunicMaxAttributes { get; set; } + + public int RunicMinIntensity { get; set; } + + public int RunicMaxIntensity { get; set; } public CraftAttributeInfo() { @@ -438,28 +386,26 @@ namespace Server.Items public class CraftResourceInfo { - private int m_Hue; - private int m_Number; - private string m_Name; - private CraftAttributeInfo m_AttributeInfo; - private CraftResource m_Resource; - private Type[] m_ResourceTypes; + public int Hue { get; } - public int Hue => m_Hue; - public int Number => m_Number; - public string Name => m_Name; - public CraftAttributeInfo AttributeInfo => m_AttributeInfo; - public CraftResource Resource => m_Resource; - public Type[] ResourceTypes => m_ResourceTypes; + public int Number { get; } + + public string Name { get; } + + public CraftAttributeInfo AttributeInfo { get; } + + public CraftResource Resource { get; } + + public Type[] ResourceTypes { get; } public CraftResourceInfo( int hue, int number, string name, CraftAttributeInfo attributeInfo, CraftResource resource, params Type[] resourceTypes ) { - m_Hue = hue; - m_Number = number; - m_Name = name; - m_AttributeInfo = attributeInfo; - m_Resource = resource; - m_ResourceTypes = resourceTypes; + Hue = hue; + Number = number; + Name = name; + AttributeInfo = attributeInfo; + Resource = resource; + ResourceTypes = resourceTypes; for ( int i = 0; i < resourceTypes.Length; ++i ) CraftResources.RegisterType( resourceTypes[i], resource ); @@ -727,21 +673,17 @@ namespace Server.Items public static readonly OreInfo Verite = new OreInfo( 7, 0x89F, "Verite" ); public static readonly OreInfo Valorite = new OreInfo( 8, 0x8AB, "Valorite" ); - private int m_Level; - private int m_Hue; - private string m_Name; - public OreInfo( int level, int hue, string name ) { - m_Level = level; - m_Hue = hue; - m_Name = name; + Level = level; + Hue = hue; + Name = name; } - public int Level => m_Level; + public int Level { get; } - public int Hue => m_Hue; + public int Hue { get; } - public string Name => m_Name; + public string Name { get; } } } diff --git a/Scripts/Misc/ShardPoller.cs b/Scripts/Misc/ShardPoller.cs index db85fb1e5..5d12b392b 100644 --- a/Scripts/Misc/ShardPoller.cs +++ b/Scripts/Misc/ShardPoller.cs @@ -12,25 +12,11 @@ namespace Server.Misc { private string m_Title; - private ShardPollOption[] m_Options; - private IPAddress[] m_Addresses; - - private TimeSpan m_Duration; - private DateTime m_StartTime; - private bool m_Active; - public ShardPollOption[] Options - { - get => m_Options; - set => m_Options = value; - } + public ShardPollOption[] Options { get; set; } - public IPAddress[] Addresses - { - get => m_Addresses; - set => m_Addresses = value; - } + public IPAddress[] Addresses { get; set; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] public string Title @@ -40,30 +26,22 @@ namespace Server.Misc } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] - public TimeSpan Duration - { - get => m_Duration; - set => m_Duration = value; - } + public TimeSpan Duration { get; set; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] - public DateTime StartTime - { - get => m_StartTime; - set => m_StartTime = value; - } + public DateTime StartTime { get; set; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] public TimeSpan TimeRemaining { get { - if ( m_StartTime == DateTime.MinValue || !m_Active ) + if ( StartTime == DateTime.MinValue || !m_Active ) return TimeSpan.Zero; try { - TimeSpan ts = (m_StartTime + m_Duration) - DateTime.UtcNow; + TimeSpan ts = (StartTime + Duration) - DateTime.UtcNow; if ( ts < TimeSpan.Zero ) return TimeSpan.Zero; @@ -90,7 +68,7 @@ namespace Server.Misc if ( m_Active ) { - m_StartTime = DateTime.UtcNow; + StartTime = DateTime.UtcNow; m_ActivePollers.Add( this ); } else @@ -102,9 +80,9 @@ namespace Server.Misc public bool HasAlreadyVoted( NetState ns ) { - for ( int i = 0; i < m_Options.Length; ++i ) + for ( int i = 0; i < Options.Length; ++i ) { - if ( m_Options[i].HasAlreadyVoted( ns ) ) + if ( Options[i].HasAlreadyVoted( ns ) ) return true; } @@ -118,30 +96,30 @@ namespace Server.Misc public void RemoveOption( ShardPollOption option ) { - int index = Array.IndexOf( m_Options, option ); + int index = Array.IndexOf( Options, option ); if ( index < 0 ) return; - ShardPollOption[] old = m_Options; - m_Options = new ShardPollOption[old.Length - 1]; + ShardPollOption[] old = Options; + Options = new ShardPollOption[old.Length - 1]; for ( int i = 0; i < index; ++i ) - m_Options[i] = old[i]; + Options[i] = old[i]; - for ( int i = index; i < m_Options.Length; ++i ) - m_Options[i] = old[i + 1]; + for ( int i = index; i < Options.Length; ++i ) + Options[i] = old[i + 1]; } public void AddOption( ShardPollOption option ) { - ShardPollOption[] old = m_Options; - m_Options = new ShardPollOption[old.Length + 1]; + ShardPollOption[] old = Options; + Options = new ShardPollOption[old.Length + 1]; for ( int i = 0; i < old.Length; ++i ) - m_Options[i] = old[i]; + Options[i] = old[i]; - m_Options[old.Length] = option; + Options[old.Length] = option; } public override string DefaultName => "shard poller"; @@ -149,9 +127,9 @@ namespace Server.Misc [Constructible( AccessLevel.Administrator )] public ShardPoller() : base( 0x1047 ) { - m_Duration = TimeSpan.FromHours( 24.0 ); - m_Options = new ShardPollOption[0]; - m_Addresses = new IPAddress[0]; + Duration = TimeSpan.FromHours( 24.0 ); + Options = new ShardPollOption[0]; + Addresses = new IPAddress[0]; Movable = false; } @@ -236,14 +214,14 @@ namespace Server.Misc writer.Write( (int) 0 ); // version writer.Write( m_Title ); - writer.Write( m_Duration ); - writer.Write( m_StartTime ); + writer.Write( Duration ); + writer.Write( StartTime ); writer.Write( m_Active ); - writer.Write( m_Options.Length ); + writer.Write( Options.Length ); - for ( int i = 0; i < m_Options.Length; ++i ) - m_Options[i].Serialize( writer ); + for ( int i = 0; i < Options.Length; ++i ) + Options[i].Serialize( writer ); } public override void Deserialize( GenericReader reader ) @@ -257,14 +235,14 @@ namespace Server.Misc case 0: { m_Title = reader.ReadString(); - m_Duration = reader.ReadTimeSpan(); - m_StartTime = reader.ReadDateTime(); + Duration = reader.ReadTimeSpan(); + StartTime = reader.ReadDateTime(); m_Active = reader.ReadBool(); - m_Options = new ShardPollOption[reader.ReadInt()]; + Options = new ShardPollOption[reader.ReadInt()]; - for ( int i = 0; i < m_Options.Length; ++i ) - m_Options[i] = new ShardPollOption( reader ); + for ( int i = 0; i < Options.Length; ++i ) + Options[i] = new ShardPollOption( reader ); if ( m_Active ) m_ActivePollers.Add( this ); @@ -285,23 +263,19 @@ namespace Server.Misc public class ShardPollOption { private string m_Title; - private int m_LineBreaks; - private IPAddress[] m_Voters; public string Title{ get => m_Title; - set{ m_Title = value; m_LineBreaks = GetBreaks( m_Title ); } } - public int LineBreaks => m_LineBreaks; + set{ m_Title = value; LineBreaks = GetBreaks( m_Title ); } } + public int LineBreaks { get; private set; } - public int Votes => m_Voters.Length; - public IPAddress[] Voters{ get => m_Voters; - set => m_Voters = value; - } + public int Votes => Voters.Length; + public IPAddress[] Voters { get; set; } public ShardPollOption( string title ) { m_Title = title; - m_LineBreaks = GetBreaks( m_Title ); - m_Voters = new IPAddress[0]; + LineBreaks = GetBreaks( m_Title ); + Voters = new IPAddress[0]; } public bool HasAlreadyVoted( NetState ns ) @@ -311,9 +285,9 @@ namespace Server.Misc IPAddress ipAddress = ns.Address; - for ( int i = 0; i < m_Voters.Length; ++i ) + for ( int i = 0; i < Voters.Length; ++i ) { - if ( Utility.IPMatchClassC( m_Voters[i], ipAddress ) ) + if ( Utility.IPMatchClassC( Voters[i], ipAddress ) ) return true; } @@ -325,18 +299,18 @@ namespace Server.Misc if ( ns == null ) return; - IPAddress[] old = m_Voters; - m_Voters = new IPAddress[old.Length + 1]; + IPAddress[] old = Voters; + Voters = new IPAddress[old.Length + 1]; for ( int i = 0; i < old.Length; ++i ) - m_Voters[i] = old[i]; + Voters[i] = old[i]; - m_Voters[old.Length] = ns.Address; + Voters[old.Length] = ns.Address; } public int ComputeHeight() { - int height = m_LineBreaks * 18; + int height = LineBreaks * 18; if ( height > 30 ) return height; @@ -370,12 +344,12 @@ namespace Server.Misc case 0: { m_Title = reader.ReadString(); - m_LineBreaks = GetBreaks( m_Title ); + LineBreaks = GetBreaks( m_Title ); - m_Voters = new IPAddress[reader.ReadInt()]; + Voters = new IPAddress[reader.ReadInt()]; - for ( int i = 0; i < m_Voters.Length; ++i ) - m_Voters[i] = Utility.Intern( reader.ReadIPAddress() ); + for ( int i = 0; i < Voters.Length; ++i ) + Voters[i] = Utility.Intern( reader.ReadIPAddress() ); break; } @@ -388,10 +362,10 @@ namespace Server.Misc writer.Write( m_Title ); - writer.Write( m_Voters.Length ); + writer.Write( Voters.Length ); - for ( int i = 0; i < m_Voters.Length; ++i ) - writer.Write( m_Voters[i] ); + for ( int i = 0; i < Voters.Length; ++i ) + writer.Write( Voters[i] ); } } @@ -399,10 +373,9 @@ namespace Server.Misc { private Mobile m_From; private ShardPoller m_Poller; - private bool m_Editing; private Queue m_Polls; - public bool Editing => m_Editing; + public bool Editing { get; } public void QueuePoll( ShardPoller poller ) { @@ -428,7 +401,7 @@ namespace Server.Misc { m_From = from; m_Poller = poller; - m_Editing = editing; + Editing = editing; m_Polls = polls; Closable = false; @@ -539,10 +512,10 @@ namespace Server.Misc if ( switched >= 0 && switched < m_Poller.Options.Length ) opt = m_Poller.Options[switched]; - if ( opt == null && !m_Editing ) + if ( opt == null && !Editing ) return; - if ( m_Editing ) + if ( Editing ) { if ( !m_Poller.Active ) { @@ -552,7 +525,7 @@ namespace Server.Misc else { m_From.SendMessage( "You may not edit an active poll. Deactivate it first." ); - m_From.SendGump( new ShardPollGump( m_From, m_Poller, m_Editing, m_Polls ) ); + m_From.SendGump( new ShardPollGump( m_From, m_Poller, Editing, m_Polls ) ); } } else @@ -565,9 +538,9 @@ namespace Server.Misc m_Poller.AddVote( sender, opt ); } } - else if ( info.ButtonID == 2 && m_Editing ) + else if ( info.ButtonID == 2 && Editing ) { - m_From.SendGump( new ShardPollGump( m_From, m_Poller, m_Editing, m_Polls ) ); + m_From.SendGump( new ShardPollGump( m_From, m_Poller, Editing, m_Polls ) ); m_From.SendGump( new PropertiesGump( m_From, m_Poller ) ); } } diff --git a/Scripts/Misc/TextDefinition.cs b/Scripts/Misc/TextDefinition.cs index 078c81dc6..15b979b57 100644 --- a/Scripts/Misc/TextDefinition.cs +++ b/Scripts/Misc/TextDefinition.cs @@ -8,13 +8,11 @@ namespace Server [Parsable] public class TextDefinition { - private int m_Number; - private string m_String; + public int Number { get; } - public int Number => m_Number; - public string String => m_String; + public string String { get; } - public bool IsEmpty => ( m_Number <= 0 && m_String == null ); + public bool IsEmpty => ( Number <= 0 && String == null ); public TextDefinition() : this( 0, null ) { @@ -30,36 +28,36 @@ namespace Server public TextDefinition( int number, string text ) { - m_Number = number; - m_String = text; + Number = number; + String = text; } public override string ToString() { - if ( m_Number > 0 ) - return string.Concat( "#", m_Number.ToString() ); - if ( m_String != null ) - return m_String; + if ( Number > 0 ) + return string.Concat( "#", Number.ToString() ); + if ( String != null ) + return String; return ""; } public string Format( bool propsGump ) { - if ( m_Number > 0 ) - return string.Format( "{0} (0x{0:X})", m_Number ); - if ( m_String != null ) - return $"\"{m_String}\""; + if ( Number > 0 ) + return string.Format( "{0} (0x{0:X})", Number ); + if ( String != null ) + return $"\"{String}\""; return propsGump ? "-empty-" : "empty"; } public string GetValue() { - if ( m_Number > 0 ) - return m_Number.ToString(); - if ( m_String != null ) - return m_String; + if ( Number > 0 ) + return Number.ToString(); + if ( String != null ) + return String; return ""; } @@ -70,15 +68,15 @@ namespace Server { writer.WriteEncodedInt( 3 ); } - else if ( def.m_Number > 0 ) + else if ( def.Number > 0 ) { writer.WriteEncodedInt( 1 ); - writer.WriteEncodedInt( def.m_Number ); + writer.WriteEncodedInt( def.Number ); } - else if ( def.m_String != null ) + else if ( def.String != null ) { writer.WriteEncodedInt( 2 ); - writer.Write( def.m_String ); + writer.Write( def.String ); } else { @@ -105,10 +103,10 @@ namespace Server if ( def == null ) return; - if ( def.m_Number > 0 ) - list.Add( def.m_Number ); - else if ( def.m_String != null ) - list.Add( def.m_String ); + if ( def.Number > 0 ) + list.Add( def.Number ); + else if ( def.String != null ) + list.Add( def.String ); } public static implicit operator TextDefinition( int v ) @@ -126,12 +124,12 @@ namespace Server if ( m == null ) return 0; - return m.m_Number; + return m.Number; } public static implicit operator string( TextDefinition m ) { - return m?.m_String; + return m?.String; } public static void AddHtmlText( Gump g, int x, int y, int width, int height, TextDefinition def, bool back, bool scroll, int numberColor, int stringColor ) @@ -139,19 +137,19 @@ namespace Server if ( def == null ) return; - if ( def.m_Number > 0 ) + if ( def.Number > 0 ) { if ( numberColor >= 0 ) // 5 bits per RGB component (15 bit RGB) - g.AddHtmlLocalized( x, y, width, height, def.m_Number, numberColor, back, scroll ); + g.AddHtmlLocalized( x, y, width, height, def.Number, numberColor, back, scroll ); else - g.AddHtmlLocalized( x, y, width, height, def.m_Number, back, scroll ); + g.AddHtmlLocalized( x, y, width, height, def.Number, back, scroll ); } - else if ( def.m_String != null ) + else if ( def.String != null ) { if ( stringColor >= 0 ) // 8 bits per RGB component (24 bit RGB) - g.AddHtml( x, y, width, height, $"{def.m_String}", back, scroll ); + g.AddHtml( x, y, width, height, $"{def.String}", back, scroll ); else - g.AddHtml( x, y, width, height, def.m_String, back, scroll ); + g.AddHtml( x, y, width, height, def.String, back, scroll ); } } @@ -165,10 +163,10 @@ namespace Server if ( def == null ) return; - if ( def.m_Number > 0 ) - m.SendLocalizedMessage( def.m_Number ); - else if ( def.m_String != null ) - m.SendMessage( def.m_String ); + if ( def.Number > 0 ) + m.SendLocalizedMessage( def.Number ); + else if ( def.String != null ) + m.SendMessage( def.String ); } public static void SendMessageTo( Mobile m, TextDefinition def, int hue ) @@ -176,10 +174,10 @@ namespace Server if ( def == null ) return; - if ( def.m_Number > 0 ) - m.SendLocalizedMessage( def.m_Number, "", hue ); - else if ( def.m_String != null ) - m.SendMessage( hue, def.m_String ); + if ( def.Number > 0 ) + m.SendLocalizedMessage( def.Number, "", hue ); + else if ( def.String != null ) + m.SendMessage( hue, def.String ); } public static void PublicOverheadMessage( Mobile m, MessageType messageType, int hue, TextDefinition def ) @@ -187,10 +185,10 @@ namespace Server if ( def == null ) return; - if ( def.m_Number > 0 ) - m.PublicOverheadMessage( messageType, hue, def.m_Number ); - else if ( def.m_String != null ) - m.PublicOverheadMessage( messageType, hue, false, def.m_String ); + if ( def.Number > 0 ) + m.PublicOverheadMessage( messageType, hue, def.Number ); + else if ( def.String != null ) + m.PublicOverheadMessage( messageType, hue, false, def.String ); } public static TextDefinition Parse( string value ) diff --git a/Scripts/Misc/ToggleItem.cs b/Scripts/Misc/ToggleItem.cs index 4bd532363..0bd25d310 100644 --- a/Scripts/Misc/ToggleItem.cs +++ b/Scripts/Misc/ToggleItem.cs @@ -36,30 +36,14 @@ namespace Server.Items TargetCommands.Register( new ToggleCommand() ); } - private int m_InactiveItemID; - private int m_ActiveItemID; - private bool m_PlayersCanToggle; + [CommandProperty( AccessLevel.GameMaster )] + public int InactiveItemID { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int InactiveItemID - { - get => m_InactiveItemID; - set => m_InactiveItemID = value; - } + public int ActiveItemID { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int ActiveItemID - { - get => m_ActiveItemID; - set => m_ActiveItemID = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public bool PlayersCanToggle - { - get => m_PlayersCanToggle; - set => m_PlayersCanToggle = value; - } + public bool PlayersCanToggle { get; set; } [Constructible] public ToggleItem( int inactiveItemID, int activeItemID, bool playersCanToggle = false) @@ -67,9 +51,9 @@ namespace Server.Items { Movable = false; - m_InactiveItemID = inactiveItemID; - m_ActiveItemID = activeItemID; - m_PlayersCanToggle = playersCanToggle; + InactiveItemID = inactiveItemID; + ActiveItemID = activeItemID; + PlayersCanToggle = playersCanToggle; } public override void OnDoubleClick( Mobile from ) @@ -78,7 +62,7 @@ namespace Server.Items { Toggle(); } - else if ( m_PlayersCanToggle ) + else if ( PlayersCanToggle ) { if ( from.InRange( GetWorldLocation(), 1 ) ) Toggle(); @@ -89,7 +73,7 @@ namespace Server.Items public void Toggle() { - ItemID = ( ItemID == m_ActiveItemID ) ? m_InactiveItemID : m_ActiveItemID; + ItemID = ( ItemID == ActiveItemID ) ? InactiveItemID : ActiveItemID; Visible = ( ItemID != 0x1 ); } @@ -104,9 +88,9 @@ namespace Server.Items writer.Write( (int) 0 ); // version - writer.Write( m_InactiveItemID ); - writer.Write( m_ActiveItemID ); - writer.Write( m_PlayersCanToggle ); + writer.Write( InactiveItemID ); + writer.Write( ActiveItemID ); + writer.Write( PlayersCanToggle ); } public override void Deserialize( GenericReader reader ) @@ -115,9 +99,9 @@ namespace Server.Items int version = reader.ReadInt(); - m_InactiveItemID = reader.ReadInt(); - m_ActiveItemID = reader.ReadInt(); - m_PlayersCanToggle = reader.ReadBool(); + InactiveItemID = reader.ReadInt(); + ActiveItemID = reader.ReadInt(); + PlayersCanToggle = reader.ReadBool(); } } } diff --git a/Scripts/Misc/Weather.cs b/Scripts/Misc/Weather.cs index 62e097fdd..ccc2e0abe 100644 --- a/Scripts/Misc/Weather.cs +++ b/Scripts/Misc/Weather.cs @@ -76,8 +76,8 @@ namespace Server.Misc Weather w = new Weather( m_Facets[i], new[]{ area }, temperature, chanceOfPercipitation, chanceOfExtremeTemperature, TimeSpan.FromSeconds( 30.0 ) ); - w.m_Bounds = bounds; - w.m_MoveSpeed = moveSpeed; + w.Bounds = bounds; + w.MoveSpeed = moveSpeed; } } @@ -105,43 +105,25 @@ namespace Server.Misc return false; } - private Map m_Facet; - private Rectangle2D[] m_Area; - private int m_Temperature; - private int m_ChanceOfPercipitation; - private int m_ChanceOfExtremeTemperature; + public Map Facet { get; } - public Map Facet => m_Facet; - public Rectangle2D[] Area{ get => m_Area; - set => m_Area = value; - } - public int Temperature{ get => m_Temperature; - set => m_Temperature = value; - } - public int ChanceOfPercipitation{ get => m_ChanceOfPercipitation; - set => m_ChanceOfPercipitation = value; - } - public int ChanceOfExtremeTemperature{ get => m_ChanceOfExtremeTemperature; - set => m_ChanceOfExtremeTemperature = value; - } + public Rectangle2D[] Area { get; set; } + + public int Temperature { get; set; } + + public int ChanceOfPercipitation { get; set; } + + public int ChanceOfExtremeTemperature { get; set; } // For dynamic weather: - private Rectangle2D m_Bounds; - private int m_MoveSpeed; - private int m_MoveAngleX, m_MoveAngleY; - public Rectangle2D Bounds{ get => m_Bounds; - set => m_Bounds = value; - } - public int MoveSpeed{ get => m_MoveSpeed; - set => m_MoveSpeed = value; - } - public int MoveAngleX{ get => m_MoveAngleX; - set => m_MoveAngleX = value; - } - public int MoveAngleY{ get => m_MoveAngleY; - set => m_MoveAngleY = value; - } + public Rectangle2D Bounds { get; set; } + + public int MoveSpeed { get; set; } + + public int MoveAngleX { get; set; } + + public int MoveAngleY { get; set; } public static bool CheckIntersection( Rectangle2D r1, Rectangle2D r2 ) { @@ -179,9 +161,9 @@ namespace Server.Misc public virtual bool IntersectsWith( Rectangle2D area ) { - for ( int i = 0; i < m_Area.Length; ++i ) + for ( int i = 0; i < Area.Length; ++i ) { - if ( CheckIntersection( area, m_Area[i] ) ) + if ( CheckIntersection( area, Area[i] ) ) return true; } @@ -190,11 +172,11 @@ namespace Server.Misc public Weather( Map facet, Rectangle2D[] area, int temperature, int chanceOfPercipitation, int chanceOfExtremeTemperature, TimeSpan interval ) { - m_Facet = facet; - m_Area = area; - m_Temperature = temperature; - m_ChanceOfPercipitation = chanceOfPercipitation; - m_ChanceOfExtremeTemperature = chanceOfExtremeTemperature; + Facet = facet; + Area = area; + Temperature = temperature; + ChanceOfPercipitation = chanceOfPercipitation; + ChanceOfExtremeTemperature = chanceOfExtremeTemperature; List list = GetWeatherList( facet ); @@ -205,20 +187,20 @@ namespace Server.Misc public virtual void Reposition() { - if ( m_Area.Length == 0 ) + if ( Area.Length == 0 ) return; - int width = m_Area[0].Width; - int height = m_Area[0].Height; + int width = Area[0].Width; + int height = Area[0].Height; Rectangle2D area = new Rectangle2D(); bool isValid = false; for ( int j = 0; j < 10; ++j ) { - area = new Rectangle2D( m_Bounds.X + Utility.Random( m_Bounds.Width - width ), m_Bounds.Y + Utility.Random( m_Bounds.Height - height ), width, height ); + area = new Rectangle2D( Bounds.X + Utility.Random( Bounds.Width - width ), Bounds.Y + Utility.Random( Bounds.Height - height ), width, height ); - if ( !CheckWeatherConflict( m_Facet, this, area ) ) + if ( !CheckWeatherConflict( Facet, this, area ) ) isValid = true; if ( isValid ) @@ -228,7 +210,7 @@ namespace Server.Misc if ( !isValid ) return; - m_Area[0] = area; + Area[0] = area; } public virtual void RecalculateMovementAngle() @@ -238,26 +220,26 @@ namespace Server.Misc double cos = Math.Cos( angle ); double sin = Math.Sin( angle ); - m_MoveAngleX = (int)(100 * cos); - m_MoveAngleY = (int)(100 * sin); + MoveAngleX = (int)(100 * cos); + MoveAngleY = (int)(100 * sin); } public virtual void MoveForward() { - if ( m_Area.Length == 0 ) + if ( Area.Length == 0 ) return; for ( int i = 0; i < 5; ++i ) // try 5 times to find a valid spot { - int xOffset = (m_MoveSpeed * m_MoveAngleX) / 100; - int yOffset = (m_MoveSpeed * m_MoveAngleY) / 100; + int xOffset = (MoveSpeed * MoveAngleX) / 100; + int yOffset = (MoveSpeed * MoveAngleY) / 100; - Rectangle2D oldArea = m_Area[0]; + Rectangle2D oldArea = Area[0]; Rectangle2D newArea = new Rectangle2D( oldArea.X + xOffset, oldArea.Y + yOffset, oldArea.Width, oldArea.Height ); - if ( !CheckWeatherConflict( m_Facet, this, newArea ) && CheckContains( m_Bounds, newArea ) ) + if ( !CheckWeatherConflict( Facet, this, newArea ) && CheckContains( Bounds, newArea ) ) { - m_Area[0] = newArea; + Area[0] = newArea; break; } @@ -273,10 +255,10 @@ namespace Server.Misc { if ( m_Stage == 0 ) { - m_Active = ( m_ChanceOfPercipitation > Utility.Random( 100 ) ); - m_ExtremeTemperature = ( m_ChanceOfExtremeTemperature > Utility.Random( 100 ) ); + m_Active = ( ChanceOfPercipitation > Utility.Random( 100 ) ); + m_ExtremeTemperature = ( ChanceOfExtremeTemperature > Utility.Random( 100 ) ); - if ( m_MoveSpeed > 0 ) + if ( MoveSpeed > 0 ) { Reposition(); RecalculateMovementAngle(); @@ -285,12 +267,12 @@ namespace Server.Misc if ( m_Active ) { - if ( m_Stage > 0 && m_MoveSpeed > 0 ) + if ( m_Stage > 0 && MoveSpeed > 0 ) MoveForward(); int type, density, temperature; - temperature = m_Temperature; + temperature = Temperature; if ( m_ExtremeTemperature ) temperature *= -1; @@ -325,13 +307,13 @@ namespace Server.Misc NetState ns = states[i]; Mobile mob = ns.Mobile; - if ( mob == null || mob.Map != m_Facet ) + if ( mob == null || mob.Map != Facet ) continue; - bool contains = ( m_Area.Length == 0 ); + bool contains = ( Area.Length == 0 ); - for ( int j = 0; !contains && j < m_Area.Length; ++j ) - contains = m_Area[j].Contains( mob.Location ); + for ( int j = 0; !contains && j < Area.Length; ++j ) + contains = Area[j].Contains( mob.Location ); if ( !contains ) continue; diff --git a/Scripts/Misc/WeightOverloading.cs b/Scripts/Misc/WeightOverloading.cs index e20047900..28278565c 100644 --- a/Scripts/Misc/WeightOverloading.cs +++ b/Scripts/Misc/WeightOverloading.cs @@ -16,19 +16,13 @@ namespace Server.Misc EventSink.Movement += EventSink_Movement; } - private static DFAlgorithm m_DFA; - - public static DFAlgorithm DFA - { - get => m_DFA; - set => m_DFA = value; - } + public static DFAlgorithm DFA { get; set; } public static void FatigueOnDamage( Mobile m, int damage ) { double fatigue = 0.0; - switch ( m_DFA ) + switch ( DFA ) { case DFAlgorithm.Standard: { diff --git a/Scripts/Mobiles/AI/AIControlMobileTarget.cs b/Scripts/Mobiles/AI/AIControlMobileTarget.cs index 564301d1c..26befc163 100644 --- a/Scripts/Mobiles/AI/AIControlMobileTarget.cs +++ b/Scripts/Mobiles/AI/AIControlMobileTarget.cs @@ -7,14 +7,13 @@ namespace Server.Targets public class AIControlMobileTarget : Target { private List m_List; - private OrderType m_Order; - public OrderType Order => m_Order; + public OrderType Order { get; } public AIControlMobileTarget( BaseAI ai, OrderType order ) : base( -1, false, ( order == OrderType.Attack ? TargetFlags.Harmful : TargetFlags.None ) ) { m_List = new List(); - m_Order = order; + Order = order; AddAI( ai ); } @@ -30,7 +29,7 @@ namespace Server.Targets if ( o is Mobile m ) { for ( int i = 0; i < m_List.Count; ++i ) - m_List[i].EndPickTarget( from, m, m_Order ); + m_List[i].EndPickTarget( from, m, Order ); } } } diff --git a/Scripts/Mobiles/AI/BaseAI.cs b/Scripts/Mobiles/AI/BaseAI.cs index dafb2da21..46579550b 100644 --- a/Scripts/Mobiles/AI/BaseAI.cs +++ b/Scripts/Mobiles/AI/BaseAI.cs @@ -1982,17 +1982,11 @@ namespace Server.Mobiles return delay; } - private long m_NextMove; - - public long NextMove - { - get => m_NextMove; - set => m_NextMove = value; - } + public long NextMove { get; set; } public virtual bool CheckMove() { - return (Core.TickCount - m_NextMove >= 0); + return (Core.TickCount - NextMove >= 0); } public virtual bool DoMove(Direction d) @@ -2021,10 +2015,10 @@ namespace Server.Mobiles int delay = (int)(TransformMoveDelay(m_Mobile.CurrentSpeed) * 1000); - m_NextMove += delay; + NextMove += delay; - if (Core.TickCount - m_NextMove > 0) - m_NextMove = Core.TickCount; + if (Core.TickCount - NextMove > 0) + NextMove = Core.TickCount; m_Mobile.Pushing = false; diff --git a/Scripts/Mobiles/AI/OppositionGroup.cs b/Scripts/Mobiles/AI/OppositionGroup.cs index b9a5c146e..25cea3314 100644 --- a/Scripts/Mobiles/AI/OppositionGroup.cs +++ b/Scripts/Mobiles/AI/OppositionGroup.cs @@ -43,90 +43,84 @@ namespace Server return -1; } - private static OppositionGroup m_TerathansAndOphidians = new OppositionGroup( new[] + public static OppositionGroup TerathansAndOphidians { get; } = new OppositionGroup( new[] { - new[] - { - typeof( TerathanAvenger ), - typeof( TerathanDrone ), - typeof( TerathanMatriarch ), - typeof( TerathanWarrior ) - }, - new[] - { - typeof( OphidianArchmage ), - typeof( OphidianKnight ), - typeof( OphidianMage ), - typeof( OphidianMatriarch ), - typeof( OphidianWarrior ) - } - } ); + new[] + { + typeof( TerathanAvenger ), + typeof( TerathanDrone ), + typeof( TerathanMatriarch ), + typeof( TerathanWarrior ) + }, + new[] + { + typeof( OphidianArchmage ), + typeof( OphidianKnight ), + typeof( OphidianMage ), + typeof( OphidianMatriarch ), + typeof( OphidianWarrior ) + } + } ); - public static OppositionGroup TerathansAndOphidians => m_TerathansAndOphidians; - - private static OppositionGroup m_SavagesAndOrcs = new OppositionGroup( new[] + public static OppositionGroup SavagesAndOrcs { get; } = new OppositionGroup( new[] { - new[] - { - typeof( Orc ), - typeof( OrcBomber ), - typeof( OrcBrute ), - typeof( OrcCaptain ), - typeof( OrcishLord ), - typeof( OrcishMage ), - typeof( SpawnedOrcishLord ) - }, - new[] - { - typeof( Savage ), - typeof( SavageRider ), - typeof( SavageRidgeback ), - typeof( SavageShaman ) - } - } ); + new[] + { + typeof( Orc ), + typeof( OrcBomber ), + typeof( OrcBrute ), + typeof( OrcCaptain ), + typeof( OrcishLord ), + typeof( OrcishMage ), + typeof( SpawnedOrcishLord ) + }, + new[] + { + typeof( Savage ), + typeof( SavageRider ), + typeof( SavageRidgeback ), + typeof( SavageShaman ) + } + } ); - public static OppositionGroup SavagesAndOrcs => m_SavagesAndOrcs; - - private static OppositionGroup m_FeyAndUndead = new OppositionGroup( new[] + public static OppositionGroup FeyAndUndead { get; } = new OppositionGroup( new[] { - new[] - { - typeof( Centaur ), - typeof( EtherealWarrior ), - typeof( Kirin ), - typeof( LordOaks ), - typeof( Pixie ), - typeof( Silvani ), - typeof( Unicorn ), - typeof( Wisp ), - typeof( Treefellow ), - typeof( MLDryad ), - typeof( Satyr ) - }, - new[] - { - typeof( AncientLich ), - typeof( Bogle ), - typeof( LichLord ), - typeof( Shade ), - typeof( Spectre ), - typeof( Wraith ), - typeof( BoneKnight ), - typeof( Ghoul ), - typeof( Mummy ), - typeof( SkeletalKnight ), - typeof( Skeleton ), - typeof( Zombie ), - typeof( ShadowKnight ), - typeof( DarknightCreeper ), - typeof( RevenantLion ), - typeof( LadyOfTheSnow ), - typeof( RottingCorpse ), - typeof( SkeletalDragon ), - typeof( Lich ) - } - } ); - - public static OppositionGroup FeyAndUndead => m_FeyAndUndead; + new[] + { + typeof( Centaur ), + typeof( EtherealWarrior ), + typeof( Kirin ), + typeof( LordOaks ), + typeof( Pixie ), + typeof( Silvani ), + typeof( Unicorn ), + typeof( Wisp ), + typeof( Treefellow ), + typeof( MLDryad ), + typeof( Satyr ) + }, + new[] + { + typeof( AncientLich ), + typeof( Bogle ), + typeof( LichLord ), + typeof( Shade ), + typeof( Spectre ), + typeof( Wraith ), + typeof( BoneKnight ), + typeof( Ghoul ), + typeof( Mummy ), + typeof( SkeletalKnight ), + typeof( Skeleton ), + typeof( Zombie ), + typeof( ShadowKnight ), + typeof( DarknightCreeper ), + typeof( RevenantLion ), + typeof( LadyOfTheSnow ), + typeof( RottingCorpse ), + typeof( SkeletalDragon ), + typeof( Lich ) + } + } ); } } \ No newline at end of file diff --git a/Scripts/Mobiles/AI/SpeedInfo.cs b/Scripts/Mobiles/AI/SpeedInfo.cs index da1dcdd42..129fcef7f 100644 --- a/Scripts/Mobiles/AI/SpeedInfo.cs +++ b/Scripts/Mobiles/AI/SpeedInfo.cs @@ -10,33 +10,17 @@ namespace Server // Should we use the new method of speeds? private static bool Enabled = true; - private double m_ActiveSpeed; - private double m_PassiveSpeed; - private Type[] m_Types; + public double ActiveSpeed { get; set; } - public double ActiveSpeed - { - get => m_ActiveSpeed; - set => m_ActiveSpeed = value; - } + public double PassiveSpeed { get; set; } - public double PassiveSpeed - { - get => m_PassiveSpeed; - set => m_PassiveSpeed = value; - } - - public Type[] Types - { - get => m_Types; - set => m_Types = value; - } + public Type[] Types { get; set; } public SpeedInfo( double activeSpeed, double passiveSpeed, Type[] types ) { - m_ActiveSpeed = activeSpeed; - m_PassiveSpeed = passiveSpeed; - m_Types = types; + ActiveSpeed = activeSpeed; + PassiveSpeed = passiveSpeed; + Types = types; } public static bool Contains( object obj ) diff --git a/Scripts/Mobiles/Animals/Cows/Cow.cs b/Scripts/Mobiles/Animals/Cows/Cow.cs index 7ba8fd3f6..f2af4649c 100644 --- a/Scripts/Mobiles/Animals/Cows/Cow.cs +++ b/Scripts/Mobiles/Animals/Cows/Cow.cs @@ -5,23 +5,12 @@ namespace Server.Mobiles public class Cow : BaseCreature { public override string CorpseName => "a cow corpse"; - private DateTime m_MilkedOn; [CommandProperty( AccessLevel.GameMaster )] - public DateTime MilkedOn - { - get => m_MilkedOn; - set => m_MilkedOn = value; - } - - private int m_Milk; + public DateTime MilkedOn { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int Milk - { - get => m_Milk; - set => m_Milk = value; - } + public int Milk { get; set; } public override string DefaultName => "a cow"; @@ -93,15 +82,15 @@ namespace Server.Mobiles from.SendLocalizedMessage( 1080400 ); // You can not milk the cow from this location. if ( Controlled && ControlMaster != from ) from.SendLocalizedMessage( 1071182 ); // The cow nimbly escapes your attempts to milk it. - if ( m_Milk == 0 && m_MilkedOn + TimeSpan.FromDays( 1 ) > DateTime.UtcNow ) + if ( Milk == 0 && MilkedOn + TimeSpan.FromDays( 1 ) > DateTime.UtcNow ) from.SendLocalizedMessage( 1080198 ); // This cow can not be milked now. Please wait for some time. else { - if ( m_Milk == 0 ) - m_Milk = 4; + if ( Milk == 0 ) + Milk = 4; - m_MilkedOn = DateTime.UtcNow; - m_Milk--; + MilkedOn = DateTime.UtcNow; + Milk--; return true; } @@ -119,8 +108,8 @@ namespace Server.Mobiles writer.Write( (int) 1 ); - writer.Write( (DateTime) m_MilkedOn ); - writer.Write( (int) m_Milk ); + writer.Write( (DateTime) MilkedOn ); + writer.Write( (int) Milk ); } public override void Deserialize( GenericReader reader ) @@ -131,8 +120,8 @@ namespace Server.Mobiles if ( version > 0 ) { - m_MilkedOn = reader.ReadDateTime(); - m_Milk = reader.ReadInt(); + MilkedOn = reader.ReadDateTime(); + Milk = reader.ReadInt(); } } } diff --git a/Scripts/Mobiles/Animals/Mounts/BaseMount.cs b/Scripts/Mobiles/Animals/Mounts/BaseMount.cs index a4992af07..97a4c959b 100644 --- a/Scripts/Mobiles/Animals/Mounts/BaseMount.cs +++ b/Scripts/Mobiles/Animals/Mounts/BaseMount.cs @@ -7,19 +7,13 @@ namespace Server.Mobiles public abstract class BaseMount : BaseCreature, IMount { private Mobile m_Rider; - private Item m_InternalItem; - private DateTime m_NextMountAbility; public virtual TimeSpan MountAbilityDelay => TimeSpan.Zero; [CommandProperty( AccessLevel.GameMaster )] - public DateTime NextMountAbility - { - get => m_NextMountAbility; - set => m_NextMountAbility = value; - } + public DateTime NextMountAbility { get; set; } - protected Item InternalItem => m_InternalItem; + protected Item InternalItem { get; private set; } public virtual bool AllowMaleRider => true; public virtual bool AllowFemaleRider => true; @@ -29,7 +23,7 @@ namespace Server.Mobiles Name = name; Body = bodyID; - m_InternalItem = new MountItem( this, itemID ); + InternalItem = new MountItem( this, itemID ); } [Hue, CommandProperty( AccessLevel.GameMaster )] @@ -40,8 +34,8 @@ namespace Server.Mobiles { base.Hue = value; - if ( m_InternalItem != null ) - m_InternalItem.Hue = value; + if ( InternalItem != null ) + InternalItem.Hue = value; } } @@ -54,8 +48,8 @@ namespace Server.Mobiles public override void OnAfterDelete() { - m_InternalItem?.Delete(); - m_InternalItem = null; + InternalItem?.Delete(); + InternalItem = null; base.OnAfterDelete(); } @@ -78,10 +72,10 @@ namespace Server.Mobiles writer.Write( ( int )1 ); // version - writer.Write( m_NextMountAbility ); + writer.Write( NextMountAbility ); writer.Write( m_Rider ); - writer.Write( m_InternalItem ); + writer.Write( InternalItem ); } public override void Deserialize( GenericReader reader ) @@ -94,15 +88,15 @@ namespace Server.Mobiles { case 1: { - m_NextMountAbility = reader.ReadDateTime(); + NextMountAbility = reader.ReadDateTime(); goto case 0; } case 0: { m_Rider = reader.ReadMobile(); - m_InternalItem = reader.ReadItem(); + InternalItem = reader.ReadItem(); - if ( m_InternalItem == null ) + if ( InternalItem == null ) Delete(); break; @@ -187,11 +181,11 @@ namespace Server.Mobiles [CommandProperty( AccessLevel.GameMaster )] public int ItemID { - get => m_InternalItem?.ItemID ?? 0; + get => InternalItem?.ItemID ?? 0; set { - if ( m_InternalItem != null ) - m_InternalItem.ItemID = value; + if ( InternalItem != null ) + InternalItem.ItemID = value; } } @@ -226,7 +220,7 @@ namespace Server.Mobiles Location = loc; Map = map; - m_InternalItem?.Internalize(); + InternalItem?.Internalize(); } else { @@ -237,8 +231,8 @@ namespace Server.Mobiles Dismount( value ); - if ( m_InternalItem != null ) - value.AddItem( m_InternalItem ); + if ( InternalItem != null ) + value.AddItem( InternalItem ); value.Direction = Direction; @@ -281,10 +275,10 @@ namespace Server.Mobiles if ( attacker == null ) attacker = m_Rider.FindMostRecentDamager( true ); - if ( !(attacker == this || attacker == m_Rider || willKill || DateTime.UtcNow < m_NextMountAbility) ) + if ( !(attacker == this || attacker == m_Rider || willKill || DateTime.UtcNow < NextMountAbility) ) { if ( DoMountAbility( amount, from ) ) - m_NextMountAbility = DateTime.UtcNow + MountAbilityDelay; + NextMountAbility = DateTime.UtcNow + MountAbilityDelay; } } diff --git a/Scripts/Mobiles/Animals/Mounts/Ethereals.cs b/Scripts/Mobiles/Animals/Mounts/Ethereals.cs index 80fdfcb65..7844e9160 100644 --- a/Scripts/Mobiles/Animals/Mounts/Ethereals.cs +++ b/Scripts/Mobiles/Animals/Mounts/Ethereals.cs @@ -10,15 +10,10 @@ namespace Server.Mobiles private int m_MountedID; private int m_RegularID; private Mobile m_Rider; - private bool m_IsRewardItem; private bool m_IsDonationItem; [CommandProperty( AccessLevel.GameMaster )] - public bool IsRewardItem - { - get => m_IsRewardItem; - set => m_IsRewardItem = value; - } + public bool IsRewardItem { get; set; } public override double DefaultWeight => 1.0; @@ -51,7 +46,7 @@ namespace Server.Mobiles list.Add( "Donation Ethereal" ); list.Add( "7.5 sec slower cast time if not a 9mo. Veteran" ); } - if ( Core.ML && m_IsRewardItem ) + if ( Core.ML && IsRewardItem ) list.Add( RewardSystem.GetRewardYearLabel( this, new object[] { } ) ); // X Year Veteran Reward } @@ -119,7 +114,7 @@ namespace Server.Mobiles return false; } - if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + if ( IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) { // CheckIsUsableBy sends the message return false; @@ -181,7 +176,7 @@ namespace Server.Mobiles writer.Write( (int)3 ); // version writer.Write( m_IsDonationItem ); - writer.Write( m_IsRewardItem ); + writer.Write( IsRewardItem ); writer.Write( (int)m_MountedID ); writer.Write( (int)m_RegularID ); @@ -204,7 +199,7 @@ namespace Server.Mobiles } case 2: { - m_IsRewardItem = reader.ReadBool(); + IsRewardItem = reader.ReadBool(); goto case 0; } case 1: reader.ReadInt(); goto case 0; diff --git a/Scripts/Mobiles/BaseCreature.cs b/Scripts/Mobiles/BaseCreature.cs index 3c59a17db..f7c8351ec 100644 --- a/Scripts/Mobiles/BaseCreature.cs +++ b/Scripts/Mobiles/BaseCreature.cs @@ -133,13 +133,12 @@ namespace Server.Mobiles public class FriendlyNameAttribute : Attribute { //future use: Talisman 'Protection/Bonus vs. Specific Creature - private TextDefinition m_FriendlyName; - public TextDefinition FriendlyName => m_FriendlyName; + public TextDefinition FriendlyName { get; } public FriendlyNameAttribute( TextDefinition friendlyName ) { - m_FriendlyName = friendlyName; + FriendlyName = friendlyName; } public static TextDefinition GetFriendlyNameFor( Type t ) @@ -165,85 +164,46 @@ namespace Server.Mobiles public const int MaxLoyalty = 100; #region Var declarations - private BaseAI m_AI; // THE AI private AIType m_CurrentAI; // The current AI private AIType m_DefaultAI; // The default AI - private Mobile m_FocusMob; // Use focus mob instead of combatant, maybe we don't whan to fight - private FightMode m_FightMode; // The style the mob uses - - private int m_RangePerception; // The view area - private int m_RangeFight; // The fight distance - - private bool m_DebugAI; // Show debug AI messages - private int m_Team; // Monster Team - private double m_ActiveSpeed; // Timer speed when active - private double m_PassiveSpeed; // Timer speed when not active private double m_CurrentSpeed; // The current speed, lets say it could be changed by something; private Point3D m_Home; // The home position of the creature, used by some AI - private Map m_HomeMap; // Used by grim reaper and guards that follow across maps! - private int m_RangeHome = 10; // The home range of the creature List m_SpellAttack; // List of attack spell/power List m_SpellDefense; // List of defensive spell/power private bool m_Controlled; // Is controlled private Mobile m_ControlMaster; // My master - private Mobile m_ControlTarget; // My target mobile - private Point3D m_ControlDest; // My target destination (patrol) private OrderType m_ControlOrder; // My order private int m_Loyalty; - private double m_MinTameSkill; private bool m_bTamable; private bool m_bSummoned; - private DateTime m_SummonEnd; - private int m_iControlSlots = 1; - - private bool m_bBardProvoked; - private bool m_bBardPacified; - private Mobile m_bBardMaster; - private Mobile m_bBardTarget; - private DateTime m_timeBardEnd; - private WayPoint m_CurrentWayPoint; - private IPoint2D m_TargetLocation; private Mobile m_SummonMaster; - private int m_HitsMax = -1; - private int m_StamMax = -1; - private int m_ManaMax = -1; private int m_DamageMin = -1; private int m_DamageMax = -1; - private int m_PhysicalResistance, m_PhysicalDamage = 100; - private int m_FireResistance, m_FireDamage; - private int m_ColdResistance, m_ColdDamage; - private int m_PoisonResistance, m_PoisonDamage; - private int m_EnergyResistance, m_EnergyDamage; - private int m_ChaosDamage; - private int m_DirectDamage; - - private List m_Owners; - private List m_Friends; + private int m_PhysicalResistance; + private int m_FireResistance; + private int m_ColdResistance; + private int m_PoisonResistance; + private int m_EnergyResistance; private bool m_IsStabled; - private Mobile m_StabledBy; private bool m_HasGeneratedLoot; // have we generated our loot yet? private bool m_Paragon; - private bool m_IsPrisoner; - - private string m_CorpseNameOverride; - private int m_FailedReturnHome; /* return to home failure counter */ #endregion @@ -274,21 +234,11 @@ namespace Server.Mobiles /* Do not serialize this till the code is finalized */ - private bool m_SeeksHome; + [CommandProperty( AccessLevel.GameMaster )] + public bool SeeksHome { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool SeeksHome - { - get => m_SeeksHome; - set => m_SeeksHome = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public string CorpseNameOverride - { - get => m_CorpseNameOverride; - set => m_CorpseNameOverride = value; - } + public string CorpseNameOverride { get; set; } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] public bool IsStabled @@ -303,24 +253,12 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )] - public Mobile StabledBy - { - get => m_StabledBy; - set => m_StabledBy = value; - } + public Mobile StabledBy { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool IsPrisoner - { - get => m_IsPrisoner; - set => m_IsPrisoner = value; - } + public bool IsPrisoner { get; set; } - protected DateTime SummonEnd - { - get => m_SummonEnd; - set => m_SummonEnd = value; - } + protected DateTime SummonEnd { get; set; } public virtual Faction FactionAllegiance => null; public virtual int FactionSilverWorth => 30; @@ -400,16 +338,13 @@ namespace Server.Mobiles public virtual TimeSpan BondingDelay => TimeSpan.FromDays( 7.0 ); public virtual TimeSpan BondingAbandonDelay => TimeSpan.FromDays( 1.0 ); - public override bool CanRegenHits => !m_IsDeadPet && base.CanRegenHits; - public override bool CanRegenStam => !IsParagon && !m_IsDeadPet && base.CanRegenStam; - public override bool CanRegenMana => !m_IsDeadPet && base.CanRegenMana; + public override bool CanRegenHits => !IsDeadPet && base.CanRegenHits; + public override bool CanRegenStam => !IsParagon && !IsDeadPet && base.CanRegenStam; + public override bool CanRegenMana => !IsDeadPet && base.CanRegenMana; - public override bool IsDeadBondedPet => m_IsDeadPet; + public override bool IsDeadBondedPet => IsDeadPet; private bool m_IsBonded; - private bool m_IsDeadPet; - private DateTime m_BondingBegin; - private DateTime m_OwnerAbandonTime; [CommandProperty( AccessLevel.GameMaster )] public Spawner MySpawner @@ -425,10 +360,10 @@ namespace Server.Mobiles { get { - if ( m_Owners == null || m_Owners.Count == 0 ) + if ( Owners == null || Owners.Count == 0 ) return null; - return m_Owners[m_Owners.Count - 1]; + return Owners[Owners.Count - 1]; } } @@ -439,25 +374,14 @@ namespace Server.Mobiles set{ m_IsBonded = value; InvalidateProperties(); } } - public bool IsDeadPet - { - get => m_IsDeadPet; - set => m_IsDeadPet = value; - } + public bool IsDeadPet { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime BondingBegin - { - get => m_BondingBegin; - set => m_BondingBegin = value; - } + public DateTime BondingBegin { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime OwnerAbandonTime - { - get => m_OwnerAbandonTime; - set => m_OwnerAbandonTime = value; - } + public DateTime OwnerAbandonTime { get; set; } + #endregion #region Delete Previously Tamed Timer @@ -548,39 +472,25 @@ namespace Server.Mobiles set{ m_EnergyResistance = value; UpdateResistances(); } } [CommandProperty( AccessLevel.GameMaster )] - public int PhysicalDamage{ get => m_PhysicalDamage; - set => m_PhysicalDamage = value; - } + public int PhysicalDamage { get; set; } = 100; [CommandProperty( AccessLevel.GameMaster )] - public int FireDamage{ get => m_FireDamage; - set => m_FireDamage = value; - } + public int FireDamage { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int ColdDamage{ get => m_ColdDamage; - set => m_ColdDamage = value; - } + public int ColdDamage { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int PoisonDamage{ get => m_PoisonDamage; - set => m_PoisonDamage = value; - } + public int PoisonDamage { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int EnergyDamage{ get => m_EnergyDamage; - set => m_EnergyDamage = value; - } + public int EnergyDamage { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int ChaosDamage{ get => m_ChaosDamage; - set => m_ChaosDamage = value; - } + public int ChaosDamage { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int DirectDamage{ get => m_DirectDamage; - set => m_DirectDamage = value; - } + public int DirectDamage { get; set; } #endregion @@ -608,7 +518,7 @@ namespace Server.Mobiles public virtual FoodType FavoriteFood => FoodType.Meat; public virtual PackInstinct PackInstinct => PackInstinct.None; - public List Owners => m_Owners; + public List Owners { get; private set; } public virtual bool AllowMaleTamer => true; public virtual bool AllowFemaleTamer => true; @@ -624,9 +534,9 @@ namespace Server.Mobiles public virtual Poison PoisonImmune => null; public virtual bool BardImmune => false; - public virtual bool Unprovokable => BardImmune || m_IsDeadPet; - public virtual bool Uncalmable => BardImmune || m_IsDeadPet; - public virtual bool AreaPeaceImmune => BardImmune || m_IsDeadPet; + public virtual bool Unprovokable => BardImmune || IsDeadPet; + public virtual bool Uncalmable => BardImmune || IsDeadPet; + public virtual bool AreaPeaceImmune => BardImmune || IsDeadPet; public virtual bool BleedImmune => false; public virtual double BonusPetDamageScalar => 1.0; @@ -705,8 +615,8 @@ namespace Server.Mobiles public virtual void BreathStallMovement() { - if ( m_AI != null ) - m_AI.NextMove = Core.TickCount + (int)(BreathStallTime * 1000); + if ( AIObject != null ) + AIObject.NextMove = Core.TickCount + (int)(BreathStallTime * 1000); } public virtual void BreathPlayAngerSound() @@ -863,25 +773,19 @@ namespace Server.Mobiles #region Flee!!! public virtual bool CanFlee => !m_Paragon; - private DateTime m_EndFlee; - - public DateTime EndFleeTime - { - get => m_EndFlee; - set => m_EndFlee = value; - } + public DateTime EndFleeTime { get; set; } public virtual void StopFlee() { - m_EndFlee = DateTime.MinValue; + EndFleeTime = DateTime.MinValue; } public virtual bool CheckFlee() { - if ( m_EndFlee == DateTime.MinValue ) + if ( EndFleeTime == DateTime.MinValue ) return false; - if ( DateTime.UtcNow >= m_EndFlee ) + if ( DateTime.UtcNow >= EndFleeTime ) { StopFlee(); return false; @@ -892,40 +796,40 @@ namespace Server.Mobiles public virtual void BeginFlee( TimeSpan maxDuration ) { - m_EndFlee = DateTime.UtcNow + maxDuration; + EndFleeTime = DateTime.UtcNow + maxDuration; } #endregion public virtual bool IsInvulnerable => false; - public BaseAI AIObject => m_AI; + public BaseAI AIObject { get; private set; } public const int MaxOwners = 5; public virtual OppositionGroup OppositionGroup => null; #region Friends - public List Friends => m_Friends; + public List Friends { get; private set; } - public virtual bool AllowNewPetFriend => ( m_Friends == null || m_Friends.Count < 5 ); + public virtual bool AllowNewPetFriend => ( Friends == null || Friends.Count < 5 ); public virtual bool IsPetFriend( Mobile m ) { - return ( m_Friends != null && m_Friends.Contains( m ) ); + return ( Friends != null && Friends.Contains( m ) ); } public virtual void AddPetFriend( Mobile m ) { - if ( m_Friends == null ) - m_Friends = new List(); + if ( Friends == null ) + Friends = new List(); - m_Friends.Add( m ); + Friends.Add( m ); } public virtual void RemovePetFriend( Mobile m ) { - m_Friends?.Remove( m ); + Friends?.Remove( m ); } public virtual bool IsFriend( Mobile m ) @@ -1054,10 +958,10 @@ namespace Server.Mobiles public virtual double GetControlChance( Mobile m, bool useBaseSkill = false) { - if ( m_MinTameSkill <= 29.1 || m_bSummoned || m.AccessLevel >= AccessLevel.GameMaster ) + if ( MinTameSkill <= 29.1 || m_bSummoned || m.AccessLevel >= AccessLevel.GameMaster ) return 1.0; - double dMinTameSkill = m_MinTameSkill; + double dMinTameSkill = MinTameSkill; if ( dMinTameSkill > -24.9 && AnimalTaming.CheckMastery( m, this ) ) dMinTameSkill = -24.9; @@ -1181,7 +1085,7 @@ namespace Server.Mobiles base.SetLocation( newLocation, isTeleport ); if ( isTeleport ) - m_AI?.OnTeleported(); + AIObject?.OnTeleported(); } public override void OnBeforeSpawn( Point3D location, Map m ) @@ -1229,18 +1133,10 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public WayPoint CurrentWayPoint - { - get => m_CurrentWayPoint; - set => m_CurrentWayPoint = value; - } + public WayPoint CurrentWayPoint { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public IPoint2D TargetLocation - { - get => m_TargetLocation; - set => m_TargetLocation = value; - } + public IPoint2D TargetLocation { get; set; } public virtual Mobile ConstantFocus => null; @@ -1267,8 +1163,8 @@ namespace Server.Mobiles { get { - if ( m_HitsMax > 0 ) { - int value = m_HitsMax + GetStatOffset( StatType.Str ); + if ( HitsMaxSeed > 0 ) { + int value = HitsMaxSeed + GetStatOffset( StatType.Str ); if ( value < 1 ) value = 1; @@ -1283,19 +1179,15 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public int HitsMaxSeed - { - get => m_HitsMax; - set => m_HitsMax = value; - } + public int HitsMaxSeed { get; set; } = -1; [CommandProperty( AccessLevel.GameMaster )] public override int StamMax { get { - if ( m_StamMax > 0 ) { - int value = m_StamMax + GetStatOffset( StatType.Dex ); + if ( StamMaxSeed > 0 ) { + int value = StamMaxSeed + GetStatOffset( StatType.Dex ); if ( value < 1 ) value = 1; @@ -1310,19 +1202,15 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public int StamMaxSeed - { - get => m_StamMax; - set => m_StamMax = value; - } + public int StamMaxSeed { get; set; } = -1; [CommandProperty( AccessLevel.GameMaster )] public override int ManaMax { get { - if ( m_ManaMax > 0 ) { - int value = m_ManaMax + GetStatOffset( StatType.Int ); + if ( ManaMaxSeed > 0 ) { + int value = ManaMaxSeed + GetStatOffset( StatType.Int ); if ( value < 1 ) value = 1; @@ -1337,11 +1225,7 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public int ManaMaxSeed - { - get => m_ManaMax; - set => m_ManaMax = value; - } + public int ManaMaxSeed { get; set; } = -1; public virtual bool CanOpenDoors => !Body.IsAnimal && !Body.IsSea; @@ -1355,11 +1239,7 @@ namespace Server.Mobiles BardPacified = false; } - private HonorContext m_ReceivedHonorContext; - - public HonorContext ReceivedHonorContext{ get => m_ReceivedHonorContext; - set => m_ReceivedHonorContext = value; - } + public HonorContext ReceivedHonorContext { get; set; } /* @@ -1416,7 +1296,7 @@ namespace Server.Mobiles if ( speechType != null && !willKill ) speechType.OnDamage( this, amount ); - m_ReceivedHonorContext?.OnTargetDamaged( from, amount ); + ReceivedHonorContext?.OnTargetDamaged( from, amount ); if ( !willKill ) { @@ -1632,34 +1512,34 @@ namespace Server.Mobiles m_CurrentAI = ai; m_DefaultAI = ai; - m_RangePerception = iRangePerception; - m_RangeFight = iRangeFight; + RangePerception = iRangePerception; + RangeFight = iRangeFight; - m_FightMode = mode; + FightMode = mode; m_Team = 0; SpeedInfo.GetSpeeds( this, ref dActiveSpeed, ref dPassiveSpeed ); - m_ActiveSpeed = dActiveSpeed; - m_PassiveSpeed = dPassiveSpeed; + ActiveSpeed = dActiveSpeed; + PassiveSpeed = dPassiveSpeed; m_CurrentSpeed = dPassiveSpeed; - m_DebugAI = false; + Debug = false; m_SpellAttack = new List(); m_SpellDefense = new List(); m_Controlled = false; m_ControlMaster = null; - m_ControlTarget = null; + ControlTarget = null; m_ControlOrder = OrderType.None; m_bTamable = false; - m_Owners = new List(); + Owners = new List(); - m_NextReacquireTime = Core.TickCount + (int)ReacquireDelay.TotalMilliseconds; + NextReacquireTime = Core.TickCount + (int)ReacquireDelay.TotalMilliseconds; ChangeAIType(AI); @@ -1678,7 +1558,7 @@ namespace Server.Mobiles m_SpellAttack = new List(); m_SpellDefense = new List(); - m_DebugAI = false; + Debug = false; } public override void Serialize( GenericWriter writer ) @@ -1690,13 +1570,13 @@ namespace Server.Mobiles writer.Write( (int)m_CurrentAI ); writer.Write( (int)m_DefaultAI ); - writer.Write( (int)m_RangePerception ); - writer.Write( (int)m_RangeFight ); + writer.Write( (int)RangePerception ); + writer.Write( (int)RangeFight ); writer.Write( (int)m_Team ); - writer.Write( (double)m_ActiveSpeed ); - writer.Write( (double)m_PassiveSpeed ); + writer.Write( (double)ActiveSpeed ); + writer.Write( (double)PassiveSpeed ); writer.Write( (double)m_CurrentSpeed ); writer.Write( (int) m_Home.X ); @@ -1704,7 +1584,7 @@ namespace Server.Mobiles writer.Write( (int) m_Home.Z ); // Version 1 - writer.Write( (int) m_RangeHome ); + writer.Write( (int) RangeHome ); int i=0; @@ -1721,64 +1601,64 @@ namespace Server.Mobiles } // Version 2 - writer.Write( (int) m_FightMode ); + writer.Write( (int) FightMode ); writer.Write( (bool) m_Controlled ); writer.Write( (Mobile) m_ControlMaster ); - writer.Write( (Mobile) m_ControlTarget ); - writer.Write( (Point3D) m_ControlDest ); + writer.Write( (Mobile) ControlTarget ); + writer.Write( (Point3D) ControlDest ); writer.Write( (int) m_ControlOrder ); - writer.Write( (double) m_MinTameSkill ); + writer.Write( (double) MinTameSkill ); // Removed in version 9 //writer.Write( (double) m_dMaxTameSkill ); writer.Write( (bool) m_bTamable ); writer.Write( (bool) m_bSummoned ); if ( m_bSummoned ) - writer.WriteDeltaTime( m_SummonEnd ); + writer.WriteDeltaTime( SummonEnd ); - writer.Write( (int) m_iControlSlots ); + writer.Write( (int) ControlSlots ); // Version 3 writer.Write( (int)m_Loyalty ); // Version 4 - writer.Write( m_CurrentWayPoint ); + writer.Write( CurrentWayPoint ); // Verison 5 writer.Write( m_SummonMaster ); // Version 6 - writer.Write( (int) m_HitsMax ); - writer.Write( (int) m_StamMax ); - writer.Write( (int) m_ManaMax ); + writer.Write( (int) HitsMaxSeed ); + writer.Write( (int) StamMaxSeed ); + writer.Write( (int) ManaMaxSeed ); writer.Write( (int) m_DamageMin ); writer.Write( (int) m_DamageMax ); // Version 7 writer.Write( (int) m_PhysicalResistance ); - writer.Write( (int) m_PhysicalDamage ); + writer.Write( (int) PhysicalDamage ); writer.Write( (int) m_FireResistance ); - writer.Write( (int) m_FireDamage ); + writer.Write( (int) FireDamage ); writer.Write( (int) m_ColdResistance ); - writer.Write( (int) m_ColdDamage ); + writer.Write( (int) ColdDamage ); writer.Write( (int) m_PoisonResistance ); - writer.Write( (int) m_PoisonDamage ); + writer.Write( (int) PoisonDamage ); writer.Write( (int) m_EnergyResistance ); - writer.Write( (int) m_EnergyDamage ); + writer.Write( (int) EnergyDamage ); // Version 8 - writer.Write( m_Owners, true ); + writer.Write( Owners, true ); // Version 10 - writer.Write( (bool) m_IsDeadPet ); + writer.Write( (bool) IsDeadPet ); writer.Write( (bool) m_IsBonded ); - writer.Write( (DateTime) m_BondingBegin ); - writer.Write( (DateTime) m_OwnerAbandonTime ); + writer.Write( (DateTime) BondingBegin ); + writer.Write( (DateTime) OwnerAbandonTime ); // Version 11 writer.Write( (bool) m_HasGeneratedLoot ); @@ -1787,14 +1667,14 @@ namespace Server.Mobiles writer.Write( (bool) m_Paragon ); // Version 13 - writer.Write( (bool) ( m_Friends != null && m_Friends.Count > 0 ) ); + writer.Write( (bool) ( Friends != null && Friends.Count > 0 ) ); - if ( m_Friends != null && m_Friends.Count > 0 ) - writer.Write( m_Friends, true ); + if ( Friends != null && Friends.Count > 0 ) + writer.Write( Friends, true ); // Version 14 - writer.Write( (bool)m_RemoveIfUntamed ); - writer.Write( (int)m_RemoveStep ); + writer.Write( (bool)RemoveIfUntamed ); + writer.Write( (int)RemoveStep ); // Version 17 if ( IsStabled || ( Controlled && ControlMaster != null ) ) @@ -1803,10 +1683,10 @@ namespace Server.Mobiles writer.Write( DeleteTimeLeft ); // Version 18 - writer.Write( m_CorpseNameOverride ); + writer.Write( CorpseNameOverride ); // Version 19 - writer.Write( m_HomeMap ); + writer.Write( HomeMap ); } private static double[] m_StandardActiveSpeeds = { @@ -1826,17 +1706,17 @@ namespace Server.Mobiles m_CurrentAI = (AIType)reader.ReadInt(); m_DefaultAI = (AIType)reader.ReadInt(); - m_RangePerception = reader.ReadInt(); - m_RangeFight = reader.ReadInt(); + RangePerception = reader.ReadInt(); + RangeFight = reader.ReadInt(); m_Team = reader.ReadInt(); - m_ActiveSpeed = reader.ReadDouble(); - m_PassiveSpeed = reader.ReadDouble(); + ActiveSpeed = reader.ReadDouble(); + PassiveSpeed = reader.ReadDouble(); m_CurrentSpeed = reader.ReadDouble(); - if ( m_RangePerception == OldRangePerception ) - m_RangePerception = DefaultRangePerception; + if ( RangePerception == OldRangePerception ) + RangePerception = DefaultRangePerception; m_Home.X = reader.ReadInt(); m_Home.Y = reader.ReadInt(); @@ -1844,7 +1724,7 @@ namespace Server.Mobiles if ( version >= 1 ) { - m_RangeHome = reader.ReadInt(); + RangeHome = reader.ReadInt(); int iCount = reader.ReadInt(); for ( int i = 0; i < iCount; i++ ) @@ -1872,20 +1752,20 @@ namespace Server.Mobiles } else { - m_RangeHome = 0; + RangeHome = 0; } if ( version >= 2 ) { - m_FightMode = ( FightMode )reader.ReadInt(); + FightMode = ( FightMode )reader.ReadInt(); m_Controlled = reader.ReadBool(); m_ControlMaster = reader.ReadMobile(); - m_ControlTarget = reader.ReadMobile(); - m_ControlDest = reader.ReadPoint3D(); + ControlTarget = reader.ReadMobile(); + ControlDest = reader.ReadPoint3D(); m_ControlOrder = (OrderType) reader.ReadInt(); - m_MinTameSkill = reader.ReadDouble(); + MinTameSkill = reader.ReadDouble(); if ( version < 9 ) reader.ReadDouble(); @@ -1895,19 +1775,19 @@ namespace Server.Mobiles if ( m_bSummoned ) { - m_SummonEnd = reader.ReadDeltaTime(); - new UnsummonTimer( m_ControlMaster, this, m_SummonEnd - DateTime.UtcNow ).Start(); + SummonEnd = reader.ReadDeltaTime(); + new UnsummonTimer( m_ControlMaster, this, SummonEnd - DateTime.UtcNow ).Start(); } - m_iControlSlots = reader.ReadInt(); + ControlSlots = reader.ReadInt(); } else { - m_FightMode = FightMode.Closest; + FightMode = FightMode.Closest; m_Controlled = false; m_ControlMaster = null; - m_ControlTarget = null; + ControlTarget = null; m_ControlOrder = OrderType.None; } @@ -1917,16 +1797,16 @@ namespace Server.Mobiles m_Loyalty = MaxLoyalty; // Wonderfully Happy if ( version >= 4 ) - m_CurrentWayPoint = reader.ReadItem() as WayPoint; + CurrentWayPoint = reader.ReadItem() as WayPoint; if ( version >= 5 ) m_SummonMaster = reader.ReadMobile(); if ( version >= 6 ) { - m_HitsMax = reader.ReadInt(); - m_StamMax = reader.ReadInt(); - m_ManaMax = reader.ReadInt(); + HitsMaxSeed = reader.ReadInt(); + StamMaxSeed = reader.ReadInt(); + ManaMaxSeed = reader.ReadInt(); m_DamageMin = reader.ReadInt(); m_DamageMax = reader.ReadInt(); } @@ -1934,32 +1814,32 @@ namespace Server.Mobiles if ( version >= 7 ) { m_PhysicalResistance = reader.ReadInt(); - m_PhysicalDamage = reader.ReadInt(); + PhysicalDamage = reader.ReadInt(); m_FireResistance = reader.ReadInt(); - m_FireDamage = reader.ReadInt(); + FireDamage = reader.ReadInt(); m_ColdResistance = reader.ReadInt(); - m_ColdDamage = reader.ReadInt(); + ColdDamage = reader.ReadInt(); m_PoisonResistance = reader.ReadInt(); - m_PoisonDamage = reader.ReadInt(); + PoisonDamage = reader.ReadInt(); m_EnergyResistance = reader.ReadInt(); - m_EnergyDamage = reader.ReadInt(); + EnergyDamage = reader.ReadInt(); } if ( version >= 8 ) - m_Owners = reader.ReadStrongMobileList(); + Owners = reader.ReadStrongMobileList(); else - m_Owners = new List(); + Owners = new List(); if ( version >= 10 ) { - m_IsDeadPet = reader.ReadBool(); + IsDeadPet = reader.ReadBool(); m_IsBonded = reader.ReadBool(); - m_BondingBegin = reader.ReadDateTime(); - m_OwnerAbandonTime = reader.ReadDateTime(); + BondingBegin = reader.ReadDateTime(); + OwnerAbandonTime = reader.ReadDateTime(); } if ( version >= 11 ) @@ -1973,41 +1853,41 @@ namespace Server.Mobiles m_Paragon = false; if ( version >= 13 && reader.ReadBool() ) - m_Friends = reader.ReadStrongMobileList(); + Friends = reader.ReadStrongMobileList(); else if ( version < 13 && m_ControlOrder >= OrderType.Unfriend ) ++m_ControlOrder; if ( version < 16 && Loyalty != MaxLoyalty ) Loyalty *= 10; - double activeSpeed = m_ActiveSpeed; - double passiveSpeed = m_PassiveSpeed; + double activeSpeed = ActiveSpeed; + double passiveSpeed = PassiveSpeed; SpeedInfo.GetSpeeds( this, ref activeSpeed, ref passiveSpeed ); bool isStandardActive = false; for ( int i = 0; !isStandardActive && i < m_StandardActiveSpeeds.Length; ++i ) - isStandardActive = ( m_ActiveSpeed == m_StandardActiveSpeeds[i] ); + isStandardActive = ( ActiveSpeed == m_StandardActiveSpeeds[i] ); bool isStandardPassive = false; for ( int i = 0; !isStandardPassive && i < m_StandardPassiveSpeeds.Length; ++i ) - isStandardPassive = ( m_PassiveSpeed == m_StandardPassiveSpeeds[i] ); + isStandardPassive = ( PassiveSpeed == m_StandardPassiveSpeeds[i] ); - if ( isStandardActive && m_CurrentSpeed == m_ActiveSpeed ) + if ( isStandardActive && m_CurrentSpeed == ActiveSpeed ) m_CurrentSpeed = activeSpeed; - else if ( isStandardPassive && m_CurrentSpeed == m_PassiveSpeed ) + else if ( isStandardPassive && m_CurrentSpeed == PassiveSpeed ) m_CurrentSpeed = passiveSpeed; if ( isStandardActive && !m_Paragon ) - m_ActiveSpeed = activeSpeed; + ActiveSpeed = activeSpeed; if ( isStandardPassive && !m_Paragon ) - m_PassiveSpeed = passiveSpeed; + PassiveSpeed = passiveSpeed; if ( version >= 14 ) { - m_RemoveIfUntamed = reader.ReadBool(); - m_RemoveStep = reader.ReadInt(); + RemoveIfUntamed = reader.ReadBool(); + RemoveStep = reader.ReadInt(); } TimeSpan deleteTime = TimeSpan.Zero; @@ -2025,10 +1905,10 @@ namespace Server.Mobiles } if ( version >= 18 ) - m_CorpseNameOverride = reader.ReadString(); + CorpseNameOverride = reader.ReadString(); if ( version >= 19 ) - m_HomeMap = reader.ReadMap(); + HomeMap = reader.ReadMap(); if ( version <= 14 && m_Paragon && Hue == 0x31 ) { @@ -2229,7 +2109,7 @@ namespace Server.Mobiles if ( master != null && master == from ) //So friends can't start the bonding process { - if ( m_MinTameSkill <= 29.1 || master.Skills[SkillName.AnimalTaming].Base >= m_MinTameSkill || OverrideBondingReqs() || (Core.ML && master.Skills[SkillName.AnimalTaming].Value >= m_MinTameSkill) ) + if ( MinTameSkill <= 29.1 || master.Skills[SkillName.AnimalTaming].Base >= MinTameSkill || OverrideBondingReqs() || (Core.ML && master.Skills[SkillName.AnimalTaming].Value >= MinTameSkill) ) { if ( BondingBegin == DateTime.MinValue ) { @@ -2317,45 +2197,45 @@ namespace Server.Mobiles public void ChangeAIType( AIType NewAI ) { - m_AI?.m_Timer.Stop(); + AIObject?.m_Timer.Stop(); if ( ForcedAI != null ) { - m_AI = ForcedAI; + AIObject = ForcedAI; return; } - m_AI = null; + AIObject = null; switch ( NewAI ) { case AIType.AI_Melee: - m_AI = new MeleeAI(this); + AIObject = new MeleeAI(this); break; case AIType.AI_Animal: - m_AI = new AnimalAI(this); + AIObject = new AnimalAI(this); break; case AIType.AI_Berserk: - m_AI = new BerserkAI(this); + AIObject = new BerserkAI(this); break; case AIType.AI_Archer: - m_AI = new ArcherAI(this); + AIObject = new ArcherAI(this); break; case AIType.AI_Healer: - m_AI = new HealerAI(this); + AIObject = new HealerAI(this); break; case AIType.AI_Vendor: - m_AI = new VendorAI(this); + AIObject = new VendorAI(this); break; case AIType.AI_Mage: - m_AI = new MageAI(this); + AIObject = new MageAI(this); break; case AIType.AI_Predator: //m_AI = new PredatorAI(this); - m_AI = new MeleeAI(this); + AIObject = new MeleeAI(this); break; case AIType.AI_Thief: - m_AI = new ThiefAI(this); + AIObject = new ThiefAI(this); break; } } @@ -2383,11 +2263,7 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.Administrator )] - public bool Debug - { - get => m_DebugAI; - set => m_DebugAI = value; - } + public bool Debug { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int Team @@ -2406,60 +2282,32 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public Mobile FocusMob - { - get => m_FocusMob; - set => m_FocusMob = value; - } + public Mobile FocusMob { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public FightMode FightMode - { - get => m_FightMode; - set => m_FightMode = value; - } + public FightMode FightMode { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int RangePerception - { - get => m_RangePerception; - set => m_RangePerception = value; - } + public int RangePerception { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int RangeFight - { - get => m_RangeFight; - set => m_RangeFight = value; - } + public int RangeFight { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int RangeHome - { - get => m_RangeHome; - set => m_RangeHome = value; - } + public int RangeHome { get; set; } = 10; [CommandProperty( AccessLevel.GameMaster )] - public double ActiveSpeed - { - get => m_ActiveSpeed; - set => m_ActiveSpeed = value; - } + public double ActiveSpeed { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public double PassiveSpeed - { - get => m_PassiveSpeed; - set => m_PassiveSpeed = value; - } + public double PassiveSpeed { get; set; } [CommandProperty( AccessLevel.GameMaster )] public double CurrentSpeed { get { - if ( m_TargetLocation != null ) + if ( TargetLocation != null ) return 0.3; return m_CurrentSpeed; @@ -2470,7 +2318,7 @@ namespace Server.Mobiles { m_CurrentSpeed = value; - m_AI?.OnCurrentSpeedChanged(); + AIObject?.OnCurrentSpeedChanged(); } } } @@ -2483,11 +2331,7 @@ namespace Server.Mobiles } [CommandProperty(AccessLevel.GameMaster)] - public Map HomeMap - { - get => m_HomeMap; - set => m_HomeMap = value; - } + public Map HomeMap { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool Controlled @@ -2597,18 +2441,10 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public Mobile ControlTarget - { - get => m_ControlTarget; - set => m_ControlTarget = value; - } + public Mobile ControlTarget { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D ControlDest - { - get => m_ControlDest; - set => m_ControlDest = value; - } + public Point3D ControlDest { get; set; } [CommandProperty( AccessLevel.GameMaster )] public OrderType ControlOrder @@ -2618,7 +2454,7 @@ namespace Server.Mobiles { m_ControlOrder = value; - m_AI?.OnCurrentOrderChanged(); + AIObject?.OnCurrentOrderChanged(); InvalidateProperties(); @@ -2627,46 +2463,22 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public bool BardProvoked - { - get => m_bBardProvoked; - set => m_bBardProvoked = value; - } + public bool BardProvoked { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool BardPacified - { - get => m_bBardPacified; - set => m_bBardPacified = value; - } + public bool BardPacified { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Mobile BardMaster - { - get => m_bBardMaster; - set => m_bBardMaster = value; - } + public Mobile BardMaster { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Mobile BardTarget - { - get => m_bBardTarget; - set => m_bBardTarget = value; - } + public Mobile BardTarget { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime BardEndTime - { - get => m_timeBardEnd; - set => m_timeBardEnd = value; - } + public DateTime BardEndTime { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public double MinTameSkill - { - get => m_MinTameSkill; - set => m_MinTameSkill = value; - } + public double MinTameSkill { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool Tamable @@ -2684,7 +2496,7 @@ namespace Server.Mobiles if ( m_bSummoned == value ) return; - m_NextReacquireTime = Core.TickCount; + NextReacquireTime = Core.TickCount; m_bSummoned = value; Delta( MobileDelta.Noto ); @@ -2694,11 +2506,7 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.Administrator )] - public int ControlSlots - { - get => m_iControlSlots; - set => m_iControlSlots = value; - } + public int ControlSlots { get; set; } = 1; public virtual bool NoHouseRestrictions => false; public virtual bool IsHouseSummonable => false; @@ -2763,11 +2571,11 @@ namespace Server.Mobiles public override void OnAfterDelete() { - if ( m_AI != null ) + if ( AIObject != null ) { - m_AI.m_Timer?.Stop(); + AIObject.m_Timer?.Stop(); - m_AI = null; + AIObject = null; } if ( m_DeleteTimer != null ) @@ -2789,13 +2597,13 @@ namespace Server.Mobiles public void DebugSay( string text ) { - if ( m_DebugAI ) + if ( Debug ) PublicOverheadMessage( MessageType.Regular, 41, false, text ); } public void DebugSay( string format, params object[] args ) { - if ( m_DebugAI ) + if ( Debug ) PublicOverheadMessage( MessageType.Regular, 41, false, string.Format( format, args ) ); } @@ -3100,11 +2908,11 @@ namespace Server.Mobiles OrderType ct = m_ControlOrder; - if ( m_AI != null ) + if ( AIObject != null ) { if ( !Core.ML || ( ct != OrderType.Follow && ct != OrderType.Stop && ct != OrderType.Stay ) ) { - m_AI.OnAggressiveAction( aggressor ); + AIObject.OnAggressiveAction( aggressor ); } else { @@ -3131,7 +2939,7 @@ namespace Server.Mobiles ControlTarget = aggressor; ControlOrder = OrderType.Attack; } - else if ( Combatant == null && !m_bBardPacified ) + else if ( Combatant == null && !BardPacified ) { Warmode = true; Combatant = aggressor; @@ -3164,7 +2972,7 @@ namespace Server.Mobiles base.GetContextMenuEntries( from, list ); if ( Commandable ) - m_AI?.GetContextMenuEntries( from, list ); + AIObject?.GetContextMenuEntries( from, list ); if ( m_bTamable && !m_Controlled && from.Alive ) list.Add( new TameEntry( from, this ) ); @@ -3201,7 +3009,7 @@ namespace Server.Mobiles if ( speechType != null && (speechType.Flags & IHSFlags.OnSpeech) != 0 && from.InRange( this, 3 ) ) return true; - return ( m_AI != null && m_AI.HandlesOnSpeech( from ) && from.InRange( this, m_RangePerception ) ); + return ( AIObject != null && AIObject.HandlesOnSpeech( from ) && from.InRange( this, RangePerception ) ); } public override void OnSpeech( SpeechEventArgs e ) @@ -3210,8 +3018,8 @@ namespace Server.Mobiles if ( speechType != null && speechType.OnSpeech( this, e.Mobile, e.Speech ) ) e.Handled = true; - else if ( !e.Handled && m_AI != null && e.Mobile.InRange( this, m_RangePerception ) ) - m_AI.OnSpeech( e ); + else if ( !e.Handled && AIObject != null && e.Mobile.InRange( this, RangePerception ) ) + AIObject.OnSpeech( e ); } public override bool IsHarmfulCriminal( Mobile target ) @@ -3361,8 +3169,8 @@ namespace Server.Mobiles { Map map = Map; - if ( PlayerRangeSensitive && m_AI != null && map != null && map.GetSector( Location ).Active ) - m_AI.Activate(); + if ( PlayerRangeSensitive && AIObject != null && map != null && map.GetSector( Location ).Active ) + AIObject.Activate(); } public override void OnCombatantChange() @@ -3393,7 +3201,7 @@ namespace Server.Mobiles public virtual void ForceReacquire() { - m_NextReacquireTime = Core.TickCount; + NextReacquireTime = Core.TickCount; } public override void OnMovement( Mobile m, Point3D oldLocation ) @@ -3422,7 +3230,7 @@ namespace Server.Mobiles speechType?.OnMovement( this, m, oldLocation ); /* Begin notice sound */ - if ( (!m.Hidden || m.AccessLevel == AccessLevel.Player) && m.Player && m_FightMode != FightMode.Aggressor && m_FightMode != FightMode.None && Combatant == null && !Controlled && !Summoned ) + if ( (!m.Hidden || m.AccessLevel == AccessLevel.Player) && m.Player && FightMode != FightMode.Aggressor && FightMode != FightMode.None && Combatant == null && !Controlled && !Summoned ) { // If this creature defends itself but doesn't actively attack (animal) or // doesn't fight at all (vendor) then no notice sounds are played.. @@ -3536,7 +3344,7 @@ namespace Server.Mobiles if ( val < 1000 && !Core.AOS ) val = (val * 100) / 60; - m_HitsMax = val; + HitsMaxSeed = val; Hits = HitsMax; } @@ -3548,31 +3356,31 @@ namespace Server.Mobiles max = (max * 100) / 60; } - m_HitsMax = Utility.RandomMinMax( min, max ); + HitsMaxSeed = Utility.RandomMinMax( min, max ); Hits = HitsMax; } public void SetStam( int val ) { - m_StamMax = val; + StamMaxSeed = val; Stam = StamMax; } public void SetStam( int min, int max ) { - m_StamMax = Utility.RandomMinMax( min, max ); + StamMaxSeed = Utility.RandomMinMax( min, max ); Stam = StamMax; } public void SetMana( int val ) { - m_ManaMax = val; + ManaMaxSeed = val; Mana = ManaMax; } public void SetMana( int min, int max ) { - m_ManaMax = Utility.RandomMinMax( min, max ); + ManaMaxSeed = Utility.RandomMinMax( min, max ); Mana = ManaMax; } @@ -3621,11 +3429,11 @@ namespace Server.Mobiles { switch ( type ) { - case ResistanceType.Physical: m_PhysicalDamage = val; break; - case ResistanceType.Fire: m_FireDamage = val; break; - case ResistanceType.Cold: m_ColdDamage = val; break; - case ResistanceType.Poison: m_PoisonDamage = val; break; - case ResistanceType.Energy: m_EnergyDamage = val; break; + case ResistanceType.Physical: PhysicalDamage = val; break; + case ResistanceType.Fire: FireDamage = val; break; + case ResistanceType.Cold: ColdDamage = val; break; + case ResistanceType.Poison: PoisonDamage = val; break; + case ResistanceType.Energy: EnergyDamage = val; break; } } @@ -4322,18 +4130,12 @@ namespace Server.Mobiles speechType?.OnDeath( this ); - m_ReceivedHonorContext?.OnTargetKilled(); + ReceivedHonorContext?.OnTargetKilled(); return base.OnBeforeDeath(); } - private bool m_NoKillAwards; - - public bool NoKillAwards - { - get => m_NoKillAwards; - set => m_NoKillAwards = value; - } + public bool NoKillAwards { get; set; } public int ComputeBonusDamage( List list, Mobile m ) { @@ -4557,7 +4359,7 @@ namespace Server.Mobiles } else { - if ( !Summoned && !m_NoKillAwards ) + if ( !Summoned && !NoKillAwards ) { int totalFame = Fame / 100; int totalKarma = -Karma / 100; @@ -4681,11 +4483,7 @@ namespace Server.Mobiles * This functionality appears to be implemented on OSI as well */ - private long m_NextReacquireTime; - - public long NextReacquireTime { get => m_NextReacquireTime; - set => m_NextReacquireTime = value; - } + public long NextReacquireTime { get; set; } public virtual TimeSpan ReacquireDelay => TimeSpan.FromSeconds( 10.0 ); public virtual bool ReacquireOnMovement => false; @@ -4699,7 +4497,7 @@ namespace Server.Mobiles SetControlMaster( null ); SummonMaster = null; - m_ReceivedHonorContext?.Cancel(); + ReceivedHonorContext?.Cancel(); base.OnDelete(); @@ -4798,13 +4596,7 @@ namespace Server.Mobiles } } - private static bool m_Summoning; - - public static bool Summoning - { - get => m_Summoning; - set => m_Summoning = value; - } + public static bool Summoning { get; set; } public static bool Summon( BaseCreature creature, Mobile caster, Point3D p, int sound, TimeSpan duration ) { @@ -4820,7 +4612,7 @@ namespace Server.Mobiles return false; } - m_Summoning = true; + Summoning = true; if ( controlled ) creature.SetControlMaster( caster ); @@ -4844,13 +4636,13 @@ namespace Server.Mobiles } new UnsummonTimer( caster, creature, duration ).Start(); - creature.m_SummonEnd = DateTime.UtcNow + duration; + creature.SummonEnd = DateTime.UtcNow + duration; creature.MoveToWorld( p, caster.Map ); Effects.PlaySound( p, creature.Map, sound ); - m_Summoning = false; + Summoning = false; return true; } @@ -5184,8 +4976,8 @@ namespace Server.Mobiles public override Mobile GetDamageMaster( Mobile damagee ) { - if ( m_bBardProvoked && damagee == m_bBardTarget ) - return m_bBardMaster; + if ( BardProvoked && damagee == BardTarget ) + return BardMaster; if ( m_Controlled && m_ControlMaster != null ) return m_ControlMaster; if ( m_bSummoned && m_SummonMaster != null ) @@ -5351,7 +5143,7 @@ namespace Server.Mobiles !Controlled && !Summoned && Spawner is Spawner spawner && spawner.Map == Map; } - public virtual bool ReturnsToHome => ( m_SeeksHome && ( Home != Point3D.Zero ) && !m_ReturnQueued && !Controlled && !Summoned ); + public virtual bool ReturnsToHome => ( SeeksHome && ( Home != Point3D.Zero ) && !m_ReturnQueued && !Controlled && !Summoned ); public override void OnSectorDeactivate() { @@ -5363,7 +5155,7 @@ namespace Server.Mobiles } else if ( PlayerRangeSensitive ) { - m_AI?.Deactivate(); + AIObject?.Deactivate(); } base.OnSectorDeactivate(); @@ -5379,7 +5171,7 @@ namespace Server.Mobiles if ( !( ( Map.GetSector( X, Y ) ).Active ) ) { - m_AI?.Deactivate(); + AIObject?.Deactivate(); } } } @@ -5391,26 +5183,19 @@ namespace Server.Mobiles { if ( PlayerRangeSensitive ) { - m_AI?.Activate(); + AIObject?.Activate(); } base.OnSectorActivate(); } - private bool m_RemoveIfUntamed; - // used for deleting untamed creatures [in houses] - private int m_RemoveStep; [CommandProperty( AccessLevel.GameMaster )] - public bool RemoveIfUntamed{ get => m_RemoveIfUntamed; - set => m_RemoveIfUntamed = value; - } + public bool RemoveIfUntamed { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int RemoveStep { get => m_RemoveStep; - set => m_RemoveStep = value; - } + public int RemoveStep { get; set; } } public class LoyaltyTimer : Timer diff --git a/Scripts/Mobiles/Healers/BaseHealer.cs b/Scripts/Mobiles/Healers/BaseHealer.cs index b9946b399..bc75f2a39 100644 --- a/Scripts/Mobiles/Healers/BaseHealer.cs +++ b/Scripts/Mobiles/Healers/BaseHealer.cs @@ -7,8 +7,7 @@ namespace Server.Mobiles { public abstract class BaseHealer : BaseVendor { - private List m_SBInfos = new List(); - protected override List SBInfos => m_SBInfos; + protected override List SBInfos { get; } = new List(); public override bool IsActiveVendor => false; public override bool IsInvulnerable => false; diff --git a/Scripts/Mobiles/Healers/PricedHealer.cs b/Scripts/Mobiles/Healers/PricedHealer.cs index a006ff997..cdaa844ed 100644 --- a/Scripts/Mobiles/Healers/PricedHealer.cs +++ b/Scripts/Mobiles/Healers/PricedHealer.cs @@ -4,14 +4,8 @@ namespace Server.Mobiles { public class PricedHealer : BaseHealer { - private int m_Price; - [CommandProperty( AccessLevel.GameMaster )] - public int Price - { - get => m_Price; - set => m_Price = value; - } + public int Price { get; set; } [Constructible] public PricedHealer() : this( 5000 ) @@ -21,7 +15,7 @@ namespace Server.Mobiles [Constructible] public PricedHealer( int price ) { - m_Price = price; + Price = price; if ( !Core.AOS ) NameHue = 0x35; @@ -43,7 +37,7 @@ namespace Server.Mobiles m.FixedEffect( 0x376A, 10, 16 ); m.CloseGump( typeof( ResurrectGump ) ); - m.SendGump( new ResurrectGump( m, this, m_Price ) ); + m.SendGump( new ResurrectGump( m, this, Price ) ); } public override bool CheckResurrect( Mobile m ) @@ -61,7 +55,7 @@ namespace Server.Mobiles writer.Write( (int) 0 ); // version - writer.Write( (int) m_Price ); + writer.Write( (int) Price ); } public override void Deserialize( GenericReader reader ) @@ -74,7 +68,7 @@ namespace Server.Mobiles { case 0: { - m_Price = reader.ReadInt(); + Price = reader.ReadInt(); break; } } diff --git a/Scripts/Mobiles/Monsters/AOS/DemonKnight.cs b/Scripts/Mobiles/Monsters/AOS/DemonKnight.cs index 4ae92cf9a..738b75c92 100644 --- a/Scripts/Mobiles/Monsters/AOS/DemonKnight.cs +++ b/Scripts/Mobiles/Monsters/AOS/DemonKnight.cs @@ -9,16 +9,13 @@ namespace Server.Mobiles public override string CorpseName => "a demon knight corpse"; public override bool IgnoreYoungProtection => Core.ML; - public static Type[] ArtifactRarity10 => m_ArtifactRarity10; - public static Type[] ArtifactRarity11 => m_ArtifactRarity11; - - private static Type[] m_ArtifactRarity10 = + public static Type[] ArtifactRarity10 { get; } = { typeof( LegacyOfTheDreadLord ), typeof( TheTaskmaster ) }; - private static Type[] m_ArtifactRarity11 = + public static Type[] ArtifactRarity11 { get; } = { typeof( TheDragonSlayer ), typeof( ArmorOfFortune ), @@ -58,18 +55,18 @@ namespace Server.Mobiles if ( !Core.AOS ) return null; - int count = ( m_ArtifactRarity10.Length * 5 ) + ( m_ArtifactRarity11.Length * 4 ); + int count = ( ArtifactRarity10.Length * 5 ) + ( ArtifactRarity11.Length * 4 ); int random = Utility.Random( count ); Type type; - if ( random < ( m_ArtifactRarity10.Length * 5 ) ) + if ( random < ( ArtifactRarity10.Length * 5 ) ) { - type = m_ArtifactRarity10[random / 5]; + type = ArtifactRarity10[random / 5]; } else { - random -= m_ArtifactRarity10.Length * 5; - type = m_ArtifactRarity11[random / 4]; + random -= ArtifactRarity10.Length * 5; + type = ArtifactRarity11[random / 4]; } return Loot.Construct( type ); diff --git a/Scripts/Mobiles/Monsters/Ants/BlackSolenQueen.cs b/Scripts/Mobiles/Monsters/Ants/BlackSolenQueen.cs index daee86897..e0b40a131 100644 --- a/Scripts/Mobiles/Monsters/Ants/BlackSolenQueen.cs +++ b/Scripts/Mobiles/Monsters/Ants/BlackSolenQueen.cs @@ -6,8 +6,7 @@ namespace Server.Mobiles public class BlackSolenQueen : BaseCreature { public override string CorpseName => "a solen queen corpse"; - private bool m_BurstSac; - public bool BurstSac => m_BurstSac; + public bool BurstSac { get; private set; } public override string DefaultName => "a black solen queen"; @@ -100,7 +99,7 @@ namespace Server.Mobiles if ( Hits < 50 ) { PublicOverheadMessage( MessageType.Regular, 0x3B2, true, "* The solen's acid sac is burst open! *" ); - m_BurstSac = true; + BurstSac = true; } } else if ( from != null && from != this && InRange( from, 1 ) ) @@ -127,7 +126,7 @@ namespace Server.Mobiles { base.Serialize( writer ); writer.Write( (int) 1 ); - writer.Write( m_BurstSac ); + writer.Write( BurstSac ); } public override void Deserialize( GenericReader reader ) @@ -139,7 +138,7 @@ namespace Server.Mobiles { case 1: { - m_BurstSac = reader.ReadBool(); + BurstSac = reader.ReadBool(); break; } } diff --git a/Scripts/Mobiles/Monsters/Ants/BlackSolenWarrior.cs b/Scripts/Mobiles/Monsters/Ants/BlackSolenWarrior.cs index 532d690b4..f87cf1e69 100644 --- a/Scripts/Mobiles/Monsters/Ants/BlackSolenWarrior.cs +++ b/Scripts/Mobiles/Monsters/Ants/BlackSolenWarrior.cs @@ -6,8 +6,7 @@ namespace Server.Mobiles public class BlackSolenWarrior : BaseCreature { public override string CorpseName => "a solen warrior corpse"; - private bool m_BurstSac; - public bool BurstSac => m_BurstSac; + public bool BurstSac { get; private set; } public override string DefaultName => "a black solen warrior"; @@ -101,7 +100,7 @@ namespace Server.Mobiles if ( Hits < 50 ) { PublicOverheadMessage( MessageType.Regular, 0x3B2, true, "* The solen's acid sac is burst open! *" ); - m_BurstSac = true; + BurstSac = true; } } else if ( from != null && from != this && InRange( from, 1 ) ) @@ -128,7 +127,7 @@ namespace Server.Mobiles { base.Serialize( writer ); writer.Write( (int) 1 ); - writer.Write( m_BurstSac ); + writer.Write( BurstSac ); } public override void Deserialize( GenericReader reader ) @@ -140,7 +139,7 @@ namespace Server.Mobiles { case 1: { - m_BurstSac = reader.ReadBool(); + BurstSac = reader.ReadBool(); break; } } diff --git a/Scripts/Mobiles/Monsters/Ants/RedSolenQueen.cs b/Scripts/Mobiles/Monsters/Ants/RedSolenQueen.cs index 2c6cce7d3..760049cc1 100644 --- a/Scripts/Mobiles/Monsters/Ants/RedSolenQueen.cs +++ b/Scripts/Mobiles/Monsters/Ants/RedSolenQueen.cs @@ -6,8 +6,7 @@ namespace Server.Mobiles public class RedSolenQueen : BaseCreature { public override string CorpseName => "a solen queen corpse"; - private bool m_BurstSac; - public bool BurstSac => m_BurstSac; + public bool BurstSac { get; private set; } public override string DefaultName => "a red solen queen"; @@ -100,7 +99,7 @@ namespace Server.Mobiles if ( Hits < 50 ) { PublicOverheadMessage( MessageType.Regular, 0x3B2, true, "* The solen's acid sac is burst open! *" ); - m_BurstSac = true; + BurstSac = true; } } else if ( from != null && from != this && InRange( from, 1 ) ) @@ -127,7 +126,7 @@ namespace Server.Mobiles { base.Serialize( writer ); writer.Write( (int) 1 ); - writer.Write( m_BurstSac ); + writer.Write( BurstSac ); } public override void Deserialize( GenericReader reader ) @@ -139,7 +138,7 @@ namespace Server.Mobiles { case 1: { - m_BurstSac = reader.ReadBool(); + BurstSac = reader.ReadBool(); break; } } diff --git a/Scripts/Mobiles/Monsters/Ants/RedSolenWarrior.cs b/Scripts/Mobiles/Monsters/Ants/RedSolenWarrior.cs index b7a6d555e..7509cff9d 100644 --- a/Scripts/Mobiles/Monsters/Ants/RedSolenWarrior.cs +++ b/Scripts/Mobiles/Monsters/Ants/RedSolenWarrior.cs @@ -6,8 +6,7 @@ namespace Server.Mobiles public class RedSolenWarrior : BaseCreature { public override string CorpseName => "a solen warrior corpse"; - private bool m_BurstSac; - public bool BurstSac => m_BurstSac; + public bool BurstSac { get; private set; } public override string DefaultName => "a red solen warrior"; @@ -100,7 +99,7 @@ namespace Server.Mobiles if ( Hits < 50 ) { PublicOverheadMessage( MessageType.Regular, 0x3B2, true, "* The solen's acid sac is burst open! *" ); - m_BurstSac = true; + BurstSac = true; } } else if ( from != null && from != this && InRange( from, 1 ) ) @@ -127,7 +126,7 @@ namespace Server.Mobiles { base.Serialize( writer ); writer.Write( (int) 1 ); - writer.Write( m_BurstSac ); + writer.Write( BurstSac ); } public override void Deserialize( GenericReader reader ) @@ -139,7 +138,7 @@ namespace Server.Mobiles { case 1: { - m_BurstSac = reader.ReadBool(); + BurstSac = reader.ReadBool(); break; } } diff --git a/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusMinion.cs b/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusMinion.cs index 997d05859..ebc457a88 100644 --- a/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusMinion.cs +++ b/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusMinion.cs @@ -5,8 +5,8 @@ namespace Server.Mobiles public class ExodusMinion : BaseCreature { public override string CorpseName => "a minion's corpse"; - private bool m_FieldActive; - public bool FieldActive => m_FieldActive; + public bool FieldActive { get; private set; } + public bool CanUseField // TODO: an OSI bug prevents to verify this => Hits >= HitsMax * 9 / 10; @@ -53,7 +53,7 @@ namespace Server.Mobiles case 2: PackItem( new ClockworkAssembly() ); break; } - m_FieldActive = CanUseField; + FieldActive = CanUseField; } public override void GenerateLoot() @@ -93,13 +93,13 @@ namespace Server.Mobiles public override void AlterMeleeDamageFrom( Mobile from, ref int damage ) { - if ( m_FieldActive ) + if ( FieldActive ) damage = 0; // no melee damage when the field is up } public override void AlterSpellDamageFrom( Mobile from, ref int damage ) { - if ( !m_FieldActive ) + if ( !FieldActive ) damage = 0; // no spell damage when the field is down } @@ -110,14 +110,14 @@ namespace Server.Mobiles SendEBolt( from ); } - if ( !m_FieldActive ) + if ( !FieldActive ) { // should there be an effect when spells nullifying is on? FixedParticles( 0, 10, 0, 0x2522, EffectLayer.Waist ); } - else if ( m_FieldActive && !CanUseField ) + else if ( FieldActive && !CanUseField ) { - m_FieldActive = false; + FieldActive = false; // TODO: message and effect when field turns down; cannot be verified on OSI due to a bug FixedParticles( 0x3735, 1, 30, 0x251F, EffectLayer.Waist ); @@ -128,7 +128,7 @@ namespace Server.Mobiles { base.OnGotMeleeAttack( attacker ); - if ( m_FieldActive ) + if ( FieldActive ) { FixedParticles( 0x376A, 20, 10, 0x2530, EffectLayer.Waist ); @@ -148,15 +148,15 @@ namespace Server.Mobiles base.OnThink(); // TODO: an OSI bug prevents to verify if the field can regenerate or not - if ( !m_FieldActive && !IsHurt() ) - m_FieldActive = true; + if ( !FieldActive && !IsHurt() ) + FieldActive = true; } public override bool Move( Direction d ) { bool move = base.Move( d ); - if ( move && m_FieldActive && Combatant != null ) + if ( move && FieldActive && Combatant != null ) FixedParticles( 0, 10, 0, 0x2530, EffectLayer.Waist ); return move; @@ -185,7 +185,7 @@ namespace Server.Mobiles base.Deserialize( reader ); int version = reader.ReadInt(); - m_FieldActive = CanUseField; + FieldActive = CanUseField; if ( Name == "Exodus Minion" ) Name = null; diff --git a/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusOverseer.cs b/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusOverseer.cs index fd4ad5c38..b7927f79e 100644 --- a/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusOverseer.cs +++ b/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusOverseer.cs @@ -5,8 +5,8 @@ namespace Server.Mobiles public class ExodusOverseer : BaseCreature { public override string CorpseName => "an overseer's corpse"; - private bool m_FieldActive; - public bool FieldActive => m_FieldActive; + public bool FieldActive { get; private set; } + public bool CanUseField // TODO: an OSI bug prevents to verify this => Hits >= HitsMax * 9 / 10; @@ -50,7 +50,7 @@ namespace Server.Mobiles else PackItem( new ArcaneGem() ); - m_FieldActive = CanUseField; + FieldActive = CanUseField; } public override void GenerateLoot() @@ -89,13 +89,13 @@ namespace Server.Mobiles public override void AlterMeleeDamageFrom( Mobile from, ref int damage ) { - if ( m_FieldActive ) + if ( FieldActive ) damage = 0; // no melee damage when the field is up } public override void AlterSpellDamageFrom( Mobile caster, ref int damage ) { - if ( !m_FieldActive ) + if ( !FieldActive ) damage = 0; // no spell damage when the field is down } @@ -106,14 +106,14 @@ namespace Server.Mobiles SendEBolt( from ); } - if ( !m_FieldActive ) + if ( !FieldActive ) { // should there be an effect when spells nullifying is on? FixedParticles( 0, 10, 0, 0x2522, EffectLayer.Waist ); } - else if ( m_FieldActive && !CanUseField ) + else if ( FieldActive && !CanUseField ) { - m_FieldActive = false; + FieldActive = false; // TODO: message and effect when field turns down; cannot be verified on OSI due to a bug FixedParticles( 0x3735, 1, 30, 0x251F, EffectLayer.Waist ); @@ -124,7 +124,7 @@ namespace Server.Mobiles { base.OnGotMeleeAttack( attacker ); - if ( m_FieldActive ) + if ( FieldActive ) { FixedParticles( 0x376A, 20, 10, 0x2530, EffectLayer.Waist ); @@ -144,15 +144,15 @@ namespace Server.Mobiles base.OnThink(); // TODO: an OSI bug prevents to verify if the field can regenerate or not - if ( !m_FieldActive && !IsHurt() ) - m_FieldActive = true; + if ( !FieldActive && !IsHurt() ) + FieldActive = true; } public override bool Move( Direction d ) { bool move = base.Move( d ); - if ( move && m_FieldActive && Combatant != null ) + if ( move && FieldActive && Combatant != null ) FixedParticles( 0, 10, 0, 0x2530, EffectLayer.Waist ); return move; @@ -181,7 +181,7 @@ namespace Server.Mobiles base.Deserialize( reader ); int version = reader.ReadInt(); - m_FieldActive = CanUseField; + FieldActive = CanUseField; if ( Name == "Exodus Overseer" ) Name = null; diff --git a/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs b/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs index b56acb94a..9893cad2a 100644 --- a/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs +++ b/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs @@ -316,16 +316,11 @@ namespace Server.Mobiles public class StainedOoze : Item { - private bool m_Corrosive; private Timer m_Timer; private int m_Ticks; [CommandProperty( AccessLevel.GameMaster )] - public bool Corrosive - { - get => m_Corrosive; - set => m_Corrosive = value; - } + public bool Corrosive { get; set; } [Constructible] public StainedOoze() @@ -340,7 +335,7 @@ namespace Server.Mobiles Movable = false; Hue = 0x95; - m_Corrosive = corrosive; + Corrosive = corrosive; m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), OnTick ); m_Ticks = 0; } @@ -387,7 +382,7 @@ namespace Server.Mobiles public void Damage( Mobile m ) { - if ( m_Corrosive ) + if ( Corrosive ) { List items = m.Items; bool damaged = false; @@ -422,7 +417,7 @@ namespace Server.Mobiles writer.Write( (int) 0 ); // version - writer.Write( m_Corrosive ); + writer.Write( Corrosive ); } public override void Deserialize( GenericReader reader ) @@ -431,7 +426,7 @@ namespace Server.Mobiles int version = reader.ReadInt(); - m_Corrosive = reader.ReadBool(); + Corrosive = reader.ReadBool(); m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), OnTick ); m_Ticks = ( ItemID == 0x122A ) ? 0 : 30; diff --git a/Scripts/Mobiles/Monsters/Misc/Melee/PlagueBeast.cs b/Scripts/Mobiles/Monsters/Misc/Melee/PlagueBeast.cs index 463e6b853..288994e20 100644 --- a/Scripts/Mobiles/Monsters/Misc/Melee/PlagueBeast.cs +++ b/Scripts/Mobiles/Monsters/Misc/Melee/PlagueBeast.cs @@ -7,16 +7,10 @@ namespace Server.Mobiles public class PlagueBeast : BaseCreature, IDevourer { public override string CorpseName => "a plague beast corpse"; - private int m_DevourTotal; private int m_DevourGoal; - private bool m_HasMetalChest; [CommandProperty( AccessLevel.GameMaster )] - public int TotalDevoured - { - get => m_DevourTotal; - set => m_DevourTotal = value; - } + public int TotalDevoured { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int DevourGoal @@ -26,7 +20,7 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public bool HasMetalChest => m_HasMetalChest; + public bool HasMetalChest { get; private set; } public override string DefaultName => "a plague beast"; @@ -67,7 +61,7 @@ namespace Server.Mobiles if ( Core.ML && Utility.RandomDouble() < 0.33 ) PackItem( Engines.Plants.Seed.RandomPeculiarSeed(4) ); - m_DevourTotal = 0; + TotalDevoured = 0; m_DevourGoal = Utility.RandomMinMax( 15, 25 ); // How many corpses must be devoured before a metal chest is awarded } @@ -151,8 +145,8 @@ namespace Server.Mobiles base.Serialize( writer ); writer.Write( (int) 1 ); - writer.Write( m_HasMetalChest ); - writer.Write( m_DevourTotal ); + writer.Write( HasMetalChest ); + writer.Write( TotalDevoured ); writer.Write( m_DevourGoal ); } @@ -165,8 +159,8 @@ namespace Server.Mobiles { case 1: { - m_HasMetalChest = reader.ReadBool(); - m_DevourTotal = reader.ReadInt(); + HasMetalChest = reader.ReadBool(); + TotalDevoured = reader.ReadInt(); m_DevourGoal = reader.ReadInt(); break; } @@ -203,14 +197,14 @@ namespace Server.Mobiles corpse.TurnToBones(); // Not bones yet, and we are a human body therefore we turn to bones. IncreaseHits( (int)Math.Ceiling( (double)corpse.Owner.HitsMax * 0.75 ) ); - m_DevourTotal++; + TotalDevoured++; PublicOverheadMessage( MessageType.Emote, 0x3B2, 1053033 ); // * The plague beast absorbs the fleshy remains of the corpse * - if ( !m_HasMetalChest && m_DevourTotal >= DevourGoal ) + if ( !HasMetalChest && TotalDevoured >= DevourGoal ) { PackItem( new MetalChest() ); - m_HasMetalChest = true; + HasMetalChest = true; } return true; diff --git a/Scripts/Mobiles/Monsters/Misc/Melee/PlagueBeastLord.cs b/Scripts/Mobiles/Monsters/Misc/Melee/PlagueBeastLord.cs index d4ca130bf..46c6d754e 100644 --- a/Scripts/Mobiles/Monsters/Misc/Melee/PlagueBeastLord.cs +++ b/Scripts/Mobiles/Monsters/Misc/Melee/PlagueBeastLord.cs @@ -9,14 +9,8 @@ namespace Server.Mobiles public override string CorpseName => "a plague beast lord corpse"; public override Poison PoisonImmune => Poison.Lethal; - private Mobile m_OpenedBy; - [CommandProperty( AccessLevel.GameMaster )] - public Mobile OpenedBy - { - get => m_OpenedBy; - set => m_OpenedBy = value; - } + public Mobile OpenedBy { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool IsBleeding @@ -80,7 +74,7 @@ namespace Server.Mobiles { if ( IsAccessibleTo( from ) ) { - if ( m_OpenedBy != null && Backpack != null ) + if ( OpenedBy != null && Backpack != null ) Backpack.DisplayTo( from ); else PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1071917, from.NetState ); // * You attempt to tear open the amorphous flesh, but it resists * @@ -105,8 +99,8 @@ namespace Server.Mobiles public override void OnDelete() { - if ( m_OpenedBy?.Holding is PlagueBeastInnard ) - m_OpenedBy.Holding.Delete(); + if ( OpenedBy?.Holding is PlagueBeastInnard ) + OpenedBy.Holding.Delete(); if ( Backpack != null ) { @@ -190,7 +184,7 @@ namespace Server.Mobiles if ( !InRange( check, 2 ) ) PrivateOverheadMessage( MessageType.Label, 0x3B2, 500446, check.NetState ); // That is too far away. - else if ( m_OpenedBy != null && m_OpenedBy != check ) + else if ( OpenedBy != null && OpenedBy != check ) PrivateOverheadMessage( MessageType.Label, 0x3B2, 500365, check.NetState ); // That is being used by someone else else if ( Frozen ) return true; @@ -200,9 +194,9 @@ namespace Server.Mobiles public virtual void Carve( Mobile from, Item item ) { - if ( m_OpenedBy == null && IsAccessibleTo( from ) ) + if ( OpenedBy == null && IsAccessibleTo( from ) ) { - m_OpenedBy = from; + OpenedBy = from; if ( m_Timer == null ) m_Timer = new DecayTimer( this ); @@ -243,7 +237,7 @@ namespace Server.Mobiles Frozen = false; Blessed = false; - if ( m_OpenedBy == null ) + if ( OpenedBy == null ) Hue = 0; } @@ -257,7 +251,7 @@ namespace Server.Mobiles writer.WriteEncodedInt( 0 ); // version - writer.Write( m_OpenedBy ); + writer.Write( OpenedBy ); if ( m_Timer != null ) { @@ -275,7 +269,7 @@ namespace Server.Mobiles int version = reader.ReadEncodedInt(); - m_OpenedBy = reader.ReadMobile(); + OpenedBy = reader.ReadMobile(); if ( reader.ReadBool() ) { @@ -293,12 +287,10 @@ namespace Server.Mobiles private class DecayTimer : Timer { private PlagueBeastLord m_Lord; - private int m_Count; - private int m_Deadline; - public int Count => m_Count; + public int Count { get; private set; } - public int Deadline => m_Deadline; + public int Deadline { get; private set; } public DecayTimer( PlagueBeastLord lord ) : this( lord, 0, 120 ) { @@ -307,8 +299,8 @@ namespace Server.Mobiles public DecayTimer( PlagueBeastLord lord, int count, int deadline ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ) ) { m_Lord = lord; - m_Count = count; - m_Deadline = deadline; + Count = count; + Deadline = deadline; } protected override void OnTick() @@ -319,22 +311,22 @@ namespace Server.Mobiles return; } - if ( m_Count + 15 == m_Deadline ) + if ( Count + 15 == Deadline ) { if ( m_Lord.OpenedBy != null ) m_Lord.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071921 ); // * The plague beast begins to bubble and dissolve! * m_Lord.PlaySound( 0x103 ); } - else if ( m_Count + 10 == m_Deadline ) + else if ( Count + 10 == Deadline ) { m_Lord.PlaySound( 0x21 ); } - else if ( m_Count + 5 == m_Deadline ) + else if ( Count + 5 == Deadline ) { m_Lord.PlaySound( 0x1C2 ); } - else if ( m_Count == m_Deadline ) + else if ( Count == Deadline ) { m_Lord.Unfreeze(); @@ -343,15 +335,15 @@ namespace Server.Mobiles Stop(); } - else if ( m_Count % 15 == 0 ) + else if ( Count % 15 == 0 ) m_Lord.PlaySound( 0x1BF ); - m_Count++; + Count++; } public void StartDissolving() { - m_Deadline = Math.Min( m_Count + 60, m_Deadline ); + Deadline = Math.Min( Count + 60, Deadline ); } } } diff --git a/Scripts/Mobiles/Monsters/Misc/Melee/PlagueSpawn.cs b/Scripts/Mobiles/Monsters/Misc/Melee/PlagueSpawn.cs index 0c14ac28f..363ea89b4 100644 --- a/Scripts/Mobiles/Monsters/Misc/Melee/PlagueSpawn.cs +++ b/Scripts/Mobiles/Monsters/Misc/Melee/PlagueSpawn.cs @@ -7,22 +7,12 @@ namespace Server.Mobiles public class PlagueSpawn : BaseCreature { public override string CorpseName => "a plague spawn corpse"; - private Mobile m_Owner; - private DateTime m_ExpireTime; [CommandProperty( AccessLevel.GameMaster )] - public Mobile Owner - { - get => m_Owner; - set => m_Owner = value; - } + public Mobile Owner { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime ExpireTime - { - get => m_ExpireTime; - set => m_ExpireTime = value; - } + public DateTime ExpireTime { get; set; } [Constructible] public PlagueSpawn() : this( null ) @@ -48,7 +38,7 @@ namespace Server.Mobiles public override void OnThink() { - if ( m_Owner != null && ( DateTime.UtcNow >= m_ExpireTime || m_Owner.Deleted || Map != m_Owner.Map || !InRange( m_Owner, 16 ) ) ) + if ( Owner != null && ( DateTime.UtcNow >= ExpireTime || Owner.Deleted || Map != Owner.Map || !InRange( Owner, 16 ) ) ) { PlaySound( GetIdleSound() ); Delete(); @@ -63,8 +53,8 @@ namespace Server.Mobiles public PlagueSpawn( Mobile owner ) : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 ) { - m_Owner = owner; - m_ExpireTime = DateTime.UtcNow + TimeSpan.FromMinutes( 1.0 ); + Owner = owner; + ExpireTime = DateTime.UtcNow + TimeSpan.FromMinutes( 1.0 ); Hue = Utility.Random( 0x11, 15 ); diff --git a/Scripts/Mobiles/Monsters/Reptile/Magic/Leviathan.cs b/Scripts/Mobiles/Monsters/Reptile/Magic/Leviathan.cs index 74790020a..7d35497b5 100644 --- a/Scripts/Mobiles/Monsters/Reptile/Magic/Leviathan.cs +++ b/Scripts/Mobiles/Monsters/Reptile/Magic/Leviathan.cs @@ -6,13 +6,8 @@ namespace Server.Mobiles public class Leviathan : BaseCreature { public override string CorpseName => "a leviathan corpse"; - private Mobile m_Fisher; - public Mobile Fisher - { - get => m_Fisher; - set => m_Fisher = value; - } + public Mobile Fisher { get; set; } public override string DefaultName => "a leviathan"; @@ -24,7 +19,7 @@ namespace Server.Mobiles [Constructible] public Leviathan( Mobile fisher ) : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 ) { - m_Fisher = fisher; + Fisher = fisher; // May not be OSI accurate; mostly copied from krakens Body = 77; @@ -110,9 +105,8 @@ namespace Server.Mobiles int version = reader.ReadInt(); } - public static Type[] Artifacts => m_Artifacts; - - private static Type[] m_Artifacts = { + public static Type[] Artifacts { get; } = + { // Decorations typeof( CandelabraOfSouls ), typeof( GhostShipAnchor ), @@ -142,7 +136,7 @@ namespace Server.Mobiles public static void GiveArtifactTo( Mobile m ) { - Item item = Loot.Construct( m_Artifacts ); + Item item = Loot.Construct( Artifacts ); if ( item == null ) return; @@ -162,8 +156,8 @@ namespace Server.Mobiles { GiveArtifactTo( mob ); - if ( mob == m_Fisher ) - m_Fisher = null; + if ( mob == Fisher ) + Fisher = null; } } @@ -171,10 +165,10 @@ namespace Server.Mobiles { base.OnDeath( c ); - if ( m_Fisher != null && 25 > Utility.Random( 100 ) ) - GiveArtifactTo( m_Fisher ); + if ( Fisher != null && 25 > Utility.Random( 100 ) ) + GiveArtifactTo( Fisher ); - m_Fisher = null; + Fisher = null; } } } diff --git a/Scripts/Mobiles/PlayerMobile.cs b/Scripts/Mobiles/PlayerMobile.cs index 69cb15751..56bd25763 100644 --- a/Scripts/Mobiles/PlayerMobile.cs +++ b/Scripts/Mobiles/PlayerMobile.cs @@ -158,64 +158,39 @@ namespace Server.Mobiles private class CountAndTimeStamp { private int m_Count; - private DateTime m_Stamp; public CountAndTimeStamp() { } - public DateTime TimeStamp => m_Stamp; + public DateTime TimeStamp { get; private set; } public int Count { get => m_Count; - set { m_Count = value; m_Stamp = DateTime.UtcNow; } + set { m_Count = value; TimeStamp = DateTime.UtcNow; } } } - private DesignContext m_DesignContext; - - private NpcGuild m_NpcGuild; - private DateTime m_NpcGuildJoinTime; - private DateTime m_NextBODTurnInTime; - private TimeSpan m_NpcGuildGameTime; - private PlayerFlag m_Flags; - private int m_StepsTaken; - private int m_Profession; - private bool m_IsStealthing; // IsStealthing should be moved to Server.Mobiles private bool m_IgnoreMobiles; // IgnoreMobiles should be moved to Server.Mobiles private int m_NonAutoreinsuredItems; // number of items that could not be automatically reinsured because gold in bank was not enough - private bool m_NinjaWepCooldown; + /* * a value of zero means, that the mobile is not executing the spell. Otherwise, * the value should match the BaseMana required */ - private int m_ExecutesLightningStrike; // move to Server.Mobiles?? - private DateTime m_LastOnline; private Guilds.RankDefinition m_GuildRank; - private int m_GuildMessageHue, m_AllianceMessageHue; - - private List m_AutoStabled; private List m_AllFollowers; - private List m_RecentlyReported; #region Getters & Setters - public List RecentlyReported - { - get => m_RecentlyReported; - set => m_RecentlyReported = value; - } + public List RecentlyReported { get; set; } - public List AutoStabled => m_AutoStabled; + public List AutoStabled { get; private set; } - public bool NinjaWepCooldown - { - get => m_NinjaWepCooldown; - set => m_NinjaWepCooldown = value; - } + public bool NinjaWepCooldown { get; set; } public List AllFollowers { @@ -239,37 +214,21 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public int GuildMessageHue - { - get => m_GuildMessageHue; - set => m_GuildMessageHue = value; - } + public int GuildMessageHue { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int AllianceMessageHue - { - get => m_AllianceMessageHue; - set => m_AllianceMessageHue = value; - } + public int AllianceMessageHue { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int Profession - { - get => m_Profession; - set => m_Profession = value; - } + public int Profession { get; set; } - public int StepsTaken - { - get => m_StepsTaken; - set => m_StepsTaken = value; - } + public int StepsTaken { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool IsStealthing // IsStealthing should be moved to Server.Mobiles { - get => m_IsStealthing; - set => m_IsStealthing = value; + get; + set; } [CommandProperty( AccessLevel.GameMaster )] @@ -287,66 +246,30 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public NpcGuild NpcGuild - { - get => m_NpcGuild; - set => m_NpcGuild = value; - } + public NpcGuild NpcGuild { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime NpcGuildJoinTime - { - get => m_NpcGuildJoinTime; - set => m_NpcGuildJoinTime = value; - } + public DateTime NpcGuildJoinTime { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime NextBODTurnInTime - { - get => m_NextBODTurnInTime; - set => m_NextBODTurnInTime = value; - } + public DateTime NextBODTurnInTime { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime LastOnline - { - get => m_LastOnline; - set => m_LastOnline = value; - } + public DateTime LastOnline { get; set; } [CommandProperty( AccessLevel.GameMaster )] public long LastMoved => LastMoveTime; [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan NpcGuildGameTime - { - get => m_NpcGuildGameTime; - set => m_NpcGuildGameTime = value; - } - - private int m_ToTItemsTurnedIn; + public TimeSpan NpcGuildGameTime { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int ToTItemsTurnedIn - { - get => m_ToTItemsTurnedIn; - set => m_ToTItemsTurnedIn = value; - } - - private int m_ToTTotalMonsterFame; + public int ToTItemsTurnedIn { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int ToTTotalMonsterFame - { - get => m_ToTTotalMonsterFame; - set => m_ToTTotalMonsterFame = value; - } + public int ToTTotalMonsterFame { get; set; } - public int ExecutesLightningStrike - { - get => m_ExecutesLightningStrike; - set => m_ExecutesLightningStrike = value; - } + public int ExecutesLightningStrike { get; set; } [CommandProperty( AccessLevel.GameMaster )] public int ToothAche @@ -358,11 +281,7 @@ namespace Server.Mobiles #endregion #region PlayerFlags - public PlayerFlag Flags - { - get => m_Flags; - set => m_Flags = value; - } + public PlayerFlag Flags { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool PagingSquelched @@ -457,15 +376,14 @@ namespace Server.Mobiles #endregion #region Auto Arrow Recovery - private Dictionary m_RecoverableAmmo = new Dictionary(); - public Dictionary RecoverableAmmo => m_RecoverableAmmo; + public Dictionary RecoverableAmmo { get; } = new Dictionary(); public void RecoverAmmo() { if ( Core.SE && Alive ) { - foreach ( KeyValuePair kvp in m_RecoverableAmmo ) + foreach ( KeyValuePair kvp in RecoverableAmmo ) { if ( kvp.Value > 0 ) { @@ -504,51 +422,29 @@ namespace Server.Mobiles } } - m_RecoverableAmmo.Clear(); + RecoverableAmmo.Clear(); } } #endregion - private DateTime m_AnkhNextUse; - [CommandProperty( AccessLevel.GameMaster )] - public DateTime AnkhNextUse - { - get => m_AnkhNextUse; - set => m_AnkhNextUse = value; - } + public DateTime AnkhNextUse { get; set; } [CommandProperty( AccessLevel.GameMaster )] public TimeSpan DisguiseTimeLeft => DisguiseTimers.TimeRemaining( this ); - private DateTime m_PeacedUntil; - [CommandProperty( AccessLevel.GameMaster )] - public DateTime PeacedUntil - { - get => m_PeacedUntil; - set => m_PeacedUntil = value; - } + public DateTime PeacedUntil { get; set; } #region Scroll of Alacrity - private DateTime m_AcceleratedStart; [CommandProperty(AccessLevel.GameMaster)] - public DateTime AcceleratedStart - { - get => m_AcceleratedStart; - set => m_AcceleratedStart = value; - } - - private SkillName m_AcceleratedSkill; + public DateTime AcceleratedStart { get; set; } [CommandProperty(AccessLevel.GameMaster)] - public SkillName AcceleratedSkill - { - get => m_AcceleratedSkill; - set => m_AcceleratedSkill = value; - } + public SkillName AcceleratedSkill { get; set; } + #endregion public static Direction GetDirection4( Point3D from, Point3D to ) @@ -668,22 +564,18 @@ namespace Server.Mobiles public bool GetFlag( PlayerFlag flag ) { - return ( (m_Flags & flag) != 0 ); + return ( (Flags & flag) != 0 ); } public void SetFlag( PlayerFlag flag, bool value ) { if ( value ) - m_Flags |= flag; + Flags |= flag; else - m_Flags &= ~flag; + Flags &= ~flag; } - public DesignContext DesignContext - { - get => m_DesignContext; - set => m_DesignContext = value; - } + public DesignContext DesignContext { get; set; } public static void Initialize() { @@ -861,9 +753,9 @@ namespace Server.Mobiles public override void OnManaChange(int oldValue) { base.OnManaChange(oldValue); - if (m_ExecutesLightningStrike > 0) + if (ExecutesLightningStrike > 0) { - if (Mana < m_ExecutesLightningStrike) + if (Mana < ExecutesLightningStrike) { SpecialMove.ClearCurrentMove(this); } @@ -1155,9 +1047,9 @@ namespace Server.Mobiles { if ( e.Mobile is PlayerMobile pm ) { - pm.m_SessionStart = DateTime.UtcNow; + pm.SessionStart = DateTime.UtcNow; - pm.m_Quest?.StartTimer(); + pm.Quest?.StartTimer(); pm.BedrollLogout = false; pm.LastOnline = DateTime.UtcNow; @@ -1206,11 +1098,11 @@ namespace Server.Mobiles if ( e.Mobile is PlayerMobile pm ) { - pm.m_GameTime += (DateTime.UtcNow - pm.m_SessionStart); + pm.m_GameTime += (DateTime.UtcNow - pm.SessionStart); - pm.m_Quest?.StopTimer(); + pm.Quest?.StopTimer(); - pm.m_SpeechLog = null; + pm.SpeechLog = null; pm.LastOnline = DateTime.UtcNow; } @@ -1219,14 +1111,14 @@ namespace Server.Mobiles public override void RevealingAction() { - if ( m_DesignContext != null ) + if ( DesignContext != null ) return; Spells.Sixth.InvisibilitySpell.RemoveTimer( this ); base.RevealingAction(); - m_IsStealthing = false; // IsStealthing should be moved to Server.Mobiles + IsStealthing = false; // IsStealthing should be moved to Server.Mobiles } public override void OnHiddenChanged() @@ -1261,7 +1153,7 @@ namespace Server.Mobiles public override bool CanBeHarmful( Mobile target, bool message, bool ignoreOurBlessedness ) { - if ( m_DesignContext != null || (target is PlayerMobile mobile && mobile.m_DesignContext != null) ) + if ( DesignContext != null || (target is PlayerMobile mobile && mobile.DesignContext != null) ) return false; if ( (target is BaseCreature creature && creature.IsInvulnerable) || target is PlayerVendor || target is TownCrier ) @@ -1282,7 +1174,7 @@ namespace Server.Mobiles public override bool CanBeBeneficial( Mobile target, bool message, bool allowDead ) { - if ( m_DesignContext != null || (target is PlayerMobile mobile && mobile.m_DesignContext != null) ) + if ( DesignContext != null || (target is PlayerMobile mobile && mobile.DesignContext != null) ) return false; return base.CanBeBeneficial( target, message, allowDead ); @@ -1290,7 +1182,7 @@ namespace Server.Mobiles public override bool CheckContextMenuDisplay( IEntity target ) { - return ( m_DesignContext == null ); + return ( DesignContext == null ); } public override void OnItemAdded( Item item ) @@ -1469,7 +1361,7 @@ namespace Server.Mobiles public override bool CheckMovement( Direction d, out int newZ ) { - DesignContext context = m_DesignContext; + DesignContext context = DesignContext; if ( context == null ) return base.CheckMovement( d, out newZ ); @@ -1492,16 +1384,15 @@ namespace Server.Mobiles public override bool AllowItemUse( Item item ) { #region Dueling - if ( m_DuelContext != null && !m_DuelContext.AllowItemUse( this, item ) ) + if ( DuelContext != null && !DuelContext.AllowItemUse( this, item ) ) return false; #endregion return DesignContext.Check( this ); } - public SkillName[] AnimalFormRestrictedSkills => m_AnimalFormRestrictedSkills; - - private SkillName[] m_AnimalFormRestrictedSkills = { + public SkillName[] AnimalFormRestrictedSkills { get; } = + { SkillName.ArmsLore, SkillName.Begging, SkillName.Discordance, SkillName.Forensics, SkillName.Inscribe, SkillName.ItemID, SkillName.Meditation, SkillName.Peacemaking, SkillName.Provocation, SkillName.RemoveTrap, SkillName.SpiritSpeak, SkillName.Stealing, @@ -1512,9 +1403,9 @@ namespace Server.Mobiles { if ( AnimalForm.UnderTransformation( this ) ) { - for( int i = 0; i < m_AnimalFormRestrictedSkills.Length; i++ ) + for( int i = 0; i < AnimalFormRestrictedSkills.Length; i++ ) { - if ( m_AnimalFormRestrictedSkills[i] == skill ) + if ( AnimalFormRestrictedSkills[i] == skill ) { SendLocalizedMessage( 1070771 ); // You cannot use that skill in this form. return false; @@ -1523,7 +1414,7 @@ namespace Server.Mobiles } #region Dueling - if ( m_DuelContext != null && !m_DuelContext.AllowSkillUse( this, skill ) ) + if ( DuelContext != null && !DuelContext.AllowSkillUse( this, skill ) ) return false; #endregion @@ -1581,7 +1472,7 @@ namespace Server.Mobiles if ( from == this ) { - m_Quest?.GetContextMenuEntries( list ); + Quest?.GetContextMenuEntries( list ); if ( Alive ) { @@ -1616,7 +1507,7 @@ namespace Server.Mobiles list.Add( new CallbackEntry( 6207, LeaveHouse ) ); } - if ( m_JusticeProtectors.Count > 0 ) + if ( JusticeProtectors.Count > 0 ) list.Add( new CallbackEntry( 6157, CancelProtection ) ); if ( Alive ) @@ -1665,9 +1556,9 @@ namespace Server.Mobiles private void CancelProtection() { - for ( int i = 0; i < m_JusticeProtectors.Count; ++i ) + for ( int i = 0; i < JusticeProtectors.Count; ++i ) { - Mobile prot = m_JusticeProtectors[i]; + Mobile prot = JusticeProtectors[i]; string args = $"{Name}\t{prot.Name}"; @@ -1675,7 +1566,7 @@ namespace Server.Mobiles SendLocalizedMessage( 1049371, args ); // The protective relationship between ~1_PLAYER1~ and ~2_PLAYER2~ has been ended. } - m_JusticeProtectors.Clear(); + JusticeProtectors.Clear(); } #region Insurance @@ -2250,7 +2141,7 @@ namespace Server.Mobiles return false; #region Dueling - if ( m_DuelContext != null && !m_DuelContext.AllowItemEquip( this, item ) ) + if ( DuelContext != null && !DuelContext.AllowItemEquip( this, item ) ) return false; #endregion @@ -2413,10 +2304,10 @@ namespace Server.Mobiles CheckLightLevels( false ); #region Dueling - m_DuelContext?.OnLocationChanged( this ); + DuelContext?.OnLocationChanged( this ); #endregion - DesignContext context = m_DesignContext; + DesignContext context = DesignContext; if ( context == null || m_NoRecursion ) return; @@ -2478,10 +2369,10 @@ namespace Server.Mobiles InvalidateProperties(); #region Dueling - m_DuelContext?.OnMapChanged( this ); + DuelContext?.OnMapChanged( this ); #endregion - DesignContext context = m_DesignContext; + DesignContext context = DesignContext; if ( context == null || m_NoRecursion ) return; @@ -2498,7 +2389,7 @@ namespace Server.Mobiles public override void OnBeneficialAction( Mobile target, bool isCriminal ) { - m_SentHonorContext?.OnSourceBeneficialAction( target ); + SentHonorContext?.OnSourceBeneficialAction( target ); base.OnBeneficialAction( target, isCriminal ); } @@ -2526,8 +2417,8 @@ namespace Server.Mobiles WeightOverloading.FatigueOnDamage( this, amount ); - m_ReceivedHonorContext?.OnTargetDamaged( from, amount ); - m_SentHonorContext?.OnSourceDamaged( from, amount ); + ReceivedHonorContext?.OnTargetDamaged( from, amount ); + SentHonorContext?.OnSourceDamaged( from, amount ); if ( willKill && from is PlayerMobile mobile ) Timer.DelayCall( TimeSpan.FromSeconds( 10 ), mobile.RecoverAmmo ); @@ -2571,9 +2462,7 @@ namespace Server.Mobiles private int m_InsuranceCost; private int m_InsuranceBonus; - private List m_EquipSnapshot; - - public List EquipSnapshot => m_EquipSnapshot; + public List EquipSnapshot { get; private set; } private bool FindItems_Callback(Item item) { @@ -2605,7 +2494,7 @@ namespace Server.Mobiles } } - m_EquipSnapshot = new List( Items ); + EquipSnapshot = new List( Items ); m_NonAutoreinsuredItems = 0; m_InsuranceCost = 0; @@ -2625,8 +2514,8 @@ namespace Server.Mobiles if ( m_InsuranceAward is PlayerMobile mobile ) mobile.m_InsuranceBonus = 0; - m_ReceivedHonorContext?.OnTargetKilled(); - m_SentHonorContext?.OnSourceKilled(); + ReceivedHonorContext?.OnTargetKilled(); + SentHonorContext?.OnSourceKilled(); RecoverAmmo(); @@ -2638,7 +2527,7 @@ namespace Server.Mobiles if ( InsuranceEnabled && item.Insured ) { #region Dueling - if ( m_DuelPlayer != null && m_DuelContext != null && m_DuelContext.Registered && m_DuelContext.Started && !m_DuelPlayer.Eliminated ) + if ( m_DuelPlayer != null && DuelContext != null && DuelContext.Registered && DuelContext.Started && !m_DuelPlayer.Eliminated ) return true; #endregion @@ -2727,7 +2616,7 @@ namespace Server.Mobiles base.OnDeath(c); - m_EquipSnapshot = null; + EquipSnapshot = null; HueMod = -1; NameMod = null; @@ -2754,9 +2643,9 @@ namespace Server.Mobiles SkillHandlers.StolenItem.ReturnOnDeath( this, c ); - if ( m_PermaFlags.Count > 0 ) + if ( PermaFlags.Count > 0 ) { - m_PermaFlags.Clear(); + PermaFlags.Clear(); if ( c is Corpse corpse ) corpse.Criminal = true; @@ -2812,13 +2701,13 @@ namespace Server.Mobiles killer = master; } - if ( Young && m_DuelContext == null ) + if ( Young && DuelContext == null ) { if ( YoungDeathTeleport() ) Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), SendYoungDeathNotice ); } - if ( m_DuelContext == null || !m_DuelContext.Registered || !m_DuelContext.Started || m_DuelPlayer == null || m_DuelPlayer.Eliminated ) + if ( DuelContext == null || !DuelContext.Registered || !DuelContext.Started || m_DuelPlayer == null || m_DuelPlayer.Eliminated ) Faction.HandleDeath( this, killer ); Server.Guilds.Guild.HandleDeath( this, killer ); @@ -2826,7 +2715,7 @@ namespace Server.Mobiles MLQuestSystem.HandleDeath( this ); #region Dueling - m_DuelContext?.OnDeath( this, c ); + DuelContext?.OnDeath( this, c ); #endregion if ( m_BuffTable != null ) @@ -2887,25 +2776,15 @@ namespace Server.Mobiles } #endregion - private List m_PermaFlags; - private List m_VisList; private Hashtable m_AntiMacroTable; private TimeSpan m_GameTime; private TimeSpan m_ShortTermElapse; private TimeSpan m_LongTermElapse; - private DateTime m_SessionStart; - private DateTime m_LastEscortTime; - private DateTime m_LastPetBallTime; private DateTime m_NextSmithBulkOrder; private DateTime m_NextTailorBulkOrder; private DateTime m_SavagePaintExpiration; - private SkillName m_Learning = (SkillName)(-1); - public SkillName Learning - { - get => m_Learning; - set => m_Learning = value; - } + public SkillName Learning { get; set; } = (SkillName)(-1); [CommandProperty( AccessLevel.GameMaster )] public TimeSpan SavagePaintExpiration @@ -2961,35 +2840,27 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public DateTime LastEscortTime - { - get => m_LastEscortTime; - set => m_LastEscortTime = value; - } + public DateTime LastEscortTime { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime LastPetBallTime - { - get => m_LastPetBallTime; - set => m_LastPetBallTime = value; - } + public DateTime LastPetBallTime { get; set; } public PlayerMobile() { - m_AutoStabled = new List(); + AutoStabled = new List(); - m_VisList = new List(); - m_PermaFlags = new List(); + VisibilityList = new List(); + PermaFlags = new List(); m_AntiMacroTable = new Hashtable(); - m_RecentlyReported = new List(); + RecentlyReported = new List(); - m_BOBFilter = new Engines.BulkOrders.BOBFilter(); + BOBFilter = new Engines.BulkOrders.BOBFilter(); m_GameTime = TimeSpan.Zero; m_ShortTermElapse = TimeSpan.FromHours( 8.0 ); m_LongTermElapse = TimeSpan.FromHours( 40.0 ); - m_JusticeProtectors = new List(); + JusticeProtectors = new List(); m_GuildRank = Guilds.RankDefinition.Lowest; m_ChampionTitles = new ChampionTitleInfo(); @@ -3035,7 +2906,7 @@ namespace Server.Mobiles g.Alliance.AllianceChat( this, text ); SendToStaffMessage( this, "[Alliance]: {0}", text ); - m_AllianceMessageHue = hue; + AllianceMessageHue = hue; } else { @@ -3044,7 +2915,7 @@ namespace Server.Mobiles } else //Type == MessageType.Guild { - m_GuildMessageHue = hue; + GuildMessageHue = hue; g.GuildChat( this, text ); SendToStaffMessage( this, "[Guild]: {0}", text ); @@ -3163,20 +3034,20 @@ namespace Server.Mobiles public PlayerMobile( Serial s ) : base( s ) { - m_VisList = new List(); + VisibilityList = new List(); m_AntiMacroTable = new Hashtable(); InvalidateMyRunUO(); } - public List VisibilityList => m_VisList; + public List VisibilityList { get; } - public List PermaFlags => m_PermaFlags; + public List PermaFlags { get; private set; } public override int Luck => AosAttributes.GetValue( this, AosAttribute.Luck ); public override bool IsHarmfulCriminal( Mobile target ) { - if ( SkillHandlers.Stealing.ClassicMode && target is PlayerMobile mobile && mobile.m_PermaFlags.Count > 0 ) + if ( SkillHandlers.Stealing.ClassicMode && target is PlayerMobile mobile && mobile.PermaFlags.Count > 0 ) { if ( Notoriety.Compute( this, mobile ) == Notoriety.Innocent ) mobile.Delta( MobileDelta.Noto ); @@ -3230,9 +3101,7 @@ namespace Server.Mobiles SetHairMods( -1, -1 ); } - private Engines.BulkOrders.BOBFilter m_BOBFilter; - - public Engines.BulkOrders.BOBFilter BOBFilter => m_BOBFilter; + public Engines.BulkOrders.BOBFilter BOBFilter { get; private set; } public override void Deserialize( GenericReader reader ) { @@ -3261,19 +3130,19 @@ namespace Server.Mobiles } case 28: { - m_PeacedUntil = reader.ReadDateTime(); + PeacedUntil = reader.ReadDateTime(); goto case 27; } case 27: { - m_AnkhNextUse = reader.ReadDateTime(); + AnkhNextUse = reader.ReadDateTime(); goto case 26; } case 26: { - m_AutoStabled = reader.ReadStrongMobileList(); + AutoStabled = reader.ReadStrongMobileList(); goto case 25; } @@ -3296,7 +3165,7 @@ namespace Server.Mobiles } case 24: { - m_LastHonorLoss = reader.ReadDeltaTime(); + LastHonorLoss = reader.ReadDeltaTime(); goto case 23; } case 23: @@ -3306,19 +3175,19 @@ namespace Server.Mobiles } case 22: { - m_LastValorLoss = reader.ReadDateTime(); + LastValorLoss = reader.ReadDateTime(); goto case 21; } case 21: { - m_ToTItemsTurnedIn = reader.ReadEncodedInt(); - m_ToTTotalMonsterFame = reader.ReadInt(); + ToTItemsTurnedIn = reader.ReadEncodedInt(); + ToTTotalMonsterFame = reader.ReadInt(); goto case 20; } case 20: { - m_AllianceMessageHue = reader.ReadEncodedInt(); - m_GuildMessageHue = reader.ReadEncodedInt(); + AllianceMessageHue = reader.ReadEncodedInt(); + GuildMessageHue = reader.ReadEncodedInt(); goto case 19; } @@ -3330,28 +3199,28 @@ namespace Server.Mobiles rank = maxRank; m_GuildRank = Guilds.RankDefinition.Ranks[rank]; - m_LastOnline = reader.ReadDateTime(); + LastOnline = reader.ReadDateTime(); goto case 18; } case 18: { - m_SolenFriendship = (SolenFriendship) reader.ReadEncodedInt(); + SolenFriendship = (SolenFriendship) reader.ReadEncodedInt(); goto case 17; } case 17: // changed how DoneQuests is serialized case 16: { - m_Quest = QuestSerializer.DeserializeQuest( reader ); + Quest = QuestSerializer.DeserializeQuest( reader ); - if ( m_Quest != null ) - m_Quest.From = this; + if ( Quest != null ) + Quest.From = this; int count = reader.ReadEncodedInt(); if ( count > 0 ) { - m_DoneQuests = new List(); + DoneQuests = new List(); for ( int i = 0; i < count; ++i ) { @@ -3363,31 +3232,31 @@ namespace Server.Mobiles else restartTime = reader.ReadDateTime(); - m_DoneQuests.Add( new QuestRestartInfo( questType, restartTime ) ); + DoneQuests.Add( new QuestRestartInfo( questType, restartTime ) ); } } - m_Profession = reader.ReadEncodedInt(); + Profession = reader.ReadEncodedInt(); goto case 15; } case 15: { - m_LastCompassionLoss = reader.ReadDeltaTime(); + LastCompassionLoss = reader.ReadDeltaTime(); goto case 14; } case 14: { - m_CompassionGains = reader.ReadEncodedInt(); + CompassionGains = reader.ReadEncodedInt(); - if ( m_CompassionGains > 0 ) - m_NextCompassionDay = reader.ReadDeltaTime(); + if ( CompassionGains > 0 ) + NextCompassionDay = reader.ReadDeltaTime(); goto case 13; } case 13: // just removed m_PaidInsurance list case 12: { - m_BOBFilter = new Engines.BulkOrders.BOBFilter( reader ); + BOBFilter = new Engines.BulkOrders.BOBFilter( reader ); goto case 11; } case 11: @@ -3428,14 +3297,14 @@ namespace Server.Mobiles } case 8: { - m_NpcGuild = (NpcGuild)reader.ReadInt(); - m_NpcGuildJoinTime = reader.ReadDateTime(); - m_NpcGuildGameTime = reader.ReadTimeSpan(); + NpcGuild = (NpcGuild)reader.ReadInt(); + NpcGuildJoinTime = reader.ReadDateTime(); + NpcGuildGameTime = reader.ReadTimeSpan(); goto case 7; } case 7: { - m_PermaFlags = reader.ReadStrongMobileList(); + PermaFlags = reader.ReadStrongMobileList(); goto case 6; } case 6: @@ -3450,20 +3319,20 @@ namespace Server.Mobiles } case 4: { - m_LastJusticeLoss = reader.ReadDeltaTime(); - m_JusticeProtectors = reader.ReadStrongMobileList(); + LastJusticeLoss = reader.ReadDeltaTime(); + JusticeProtectors = reader.ReadStrongMobileList(); goto case 3; } case 3: { - m_LastSacrificeGain = reader.ReadDeltaTime(); - m_LastSacrificeLoss = reader.ReadDeltaTime(); - m_AvailableResurrects = reader.ReadInt(); + LastSacrificeGain = reader.ReadDeltaTime(); + LastSacrificeLoss = reader.ReadDeltaTime(); + AvailableResurrects = reader.ReadInt(); goto case 2; } case 2: { - m_Flags = (PlayerFlag)reader.ReadInt(); + Flags = (PlayerFlag)reader.ReadInt(); goto case 1; } case 1: @@ -3476,32 +3345,32 @@ namespace Server.Mobiles case 0: { if ( version < 26 ) - m_AutoStabled = new List(); + AutoStabled = new List(); break; } } - if (m_RecentlyReported == null) - m_RecentlyReported = new List(); + if (RecentlyReported == null) + RecentlyReported = new List(); // Professions weren't verified on 1.0 RC0 - if ( !CharacterCreation.VerifyProfession( m_Profession ) ) - m_Profession = 0; + if ( !CharacterCreation.VerifyProfession( Profession ) ) + Profession = 0; - if ( m_PermaFlags == null ) - m_PermaFlags = new List(); + if ( PermaFlags == null ) + PermaFlags = new List(); - if ( m_JusticeProtectors == null ) - m_JusticeProtectors = new List(); + if ( JusticeProtectors == null ) + JusticeProtectors = new List(); - if ( m_BOBFilter == null ) - m_BOBFilter = new Engines.BulkOrders.BOBFilter(); + if ( BOBFilter == null ) + BOBFilter = new Engines.BulkOrders.BOBFilter(); if ( m_GuildRank == null ) m_GuildRank = Guilds.RankDefinition.Member; //Default to member if going from older version to new version (only time it should be null) - if ( m_LastOnline == DateTime.MinValue && Account != null ) - m_LastOnline = ((Account)Account).LastLogin; + if ( LastOnline == DateTime.MinValue && Account != null ) + LastOnline = ((Account)Account).LastLogin; if ( m_ChampionTitles == null ) m_ChampionTitles = new ChampionTitleInfo(); @@ -3566,9 +3435,9 @@ namespace Server.Mobiles writer.Write(false); } - writer.Write( (DateTime) m_PeacedUntil ); - writer.Write( (DateTime) m_AnkhNextUse ); - writer.Write( m_AutoStabled, true ); + writer.Write( (DateTime) PeacedUntil ); + writer.Write( (DateTime) AnkhNextUse ); + writer.Write( AutoStabled, true ); if ( m_AcquiredRecipes == null ) { @@ -3585,51 +3454,51 @@ namespace Server.Mobiles } } - writer.WriteDeltaTime( m_LastHonorLoss ); + writer.WriteDeltaTime( LastHonorLoss ); ChampionTitleInfo.Serialize( writer, m_ChampionTitles ); - writer.Write( m_LastValorLoss ); - writer.WriteEncodedInt( m_ToTItemsTurnedIn ); - writer.Write( m_ToTTotalMonsterFame ); //This ain't going to be a small #. + writer.Write( LastValorLoss ); + writer.WriteEncodedInt( ToTItemsTurnedIn ); + writer.Write( ToTTotalMonsterFame ); //This ain't going to be a small #. - writer.WriteEncodedInt( m_AllianceMessageHue ); - writer.WriteEncodedInt( m_GuildMessageHue ); + writer.WriteEncodedInt( AllianceMessageHue ); + writer.WriteEncodedInt( GuildMessageHue ); writer.WriteEncodedInt( m_GuildRank.Rank ); - writer.Write( m_LastOnline ); + writer.Write( LastOnline ); - writer.WriteEncodedInt( (int) m_SolenFriendship ); + writer.WriteEncodedInt( (int) SolenFriendship ); - QuestSerializer.Serialize( m_Quest, writer ); + QuestSerializer.Serialize( Quest, writer ); - if ( m_DoneQuests == null ) + if ( DoneQuests == null ) { writer.WriteEncodedInt( (int) 0 ); } else { - writer.WriteEncodedInt( (int) m_DoneQuests.Count ); + writer.WriteEncodedInt( (int) DoneQuests.Count ); - for ( int i = 0; i < m_DoneQuests.Count; ++i ) + for ( int i = 0; i < DoneQuests.Count; ++i ) { - QuestRestartInfo restartInfo = m_DoneQuests[i]; + QuestRestartInfo restartInfo = DoneQuests[i]; QuestSerializer.Write( (Type) restartInfo.QuestType, QuestSystem.QuestTypes, writer ); writer.Write( (DateTime) restartInfo.RestartTime ); } } - writer.WriteEncodedInt( (int) m_Profession ); + writer.WriteEncodedInt( (int) Profession ); - writer.WriteDeltaTime( m_LastCompassionLoss ); + writer.WriteDeltaTime( LastCompassionLoss ); - writer.WriteEncodedInt( m_CompassionGains ); + writer.WriteEncodedInt( CompassionGains ); - if ( m_CompassionGains > 0 ) - writer.WriteDeltaTime( m_NextCompassionDay ); + if ( CompassionGains > 0 ) + writer.WriteDeltaTime( NextCompassionDay ); - m_BOBFilter.Serialize( writer ); + BOBFilter.Serialize( writer ); bool useMods = ( m_HairModID != -1 || m_BeardModID != -1 ); @@ -3645,24 +3514,24 @@ namespace Server.Mobiles writer.Write( SavagePaintExpiration ); - writer.Write( (int) m_NpcGuild ); - writer.Write( (DateTime) m_NpcGuildJoinTime ); - writer.Write( (TimeSpan) m_NpcGuildGameTime ); + writer.Write( (int) NpcGuild ); + writer.Write( (DateTime) NpcGuildJoinTime ); + writer.Write( (TimeSpan) NpcGuildGameTime ); - writer.Write( m_PermaFlags, true ); + writer.Write( PermaFlags, true ); writer.Write( NextTailorBulkOrder ); writer.Write( NextSmithBulkOrder ); - writer.WriteDeltaTime( m_LastJusticeLoss ); - writer.Write( m_JusticeProtectors, true ); + writer.WriteDeltaTime( LastJusticeLoss ); + writer.Write( JusticeProtectors, true ); - writer.WriteDeltaTime( m_LastSacrificeGain ); - writer.WriteDeltaTime( m_LastSacrificeLoss ); - writer.Write( m_AvailableResurrects ); + writer.WriteDeltaTime( LastSacrificeGain ); + writer.WriteDeltaTime( LastSacrificeLoss ); + writer.Write( AvailableResurrects ); - writer.Write( (int) m_Flags ); + writer.Write( (int) Flags ); writer.Write( m_LongTermElapse ); writer.Write( m_ShortTermElapse ); @@ -3704,7 +3573,7 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public DateTime SessionStart => m_SessionStart; + public DateTime SessionStart { get; private set; } [CommandProperty( AccessLevel.GameMaster )] public TimeSpan GameTime @@ -3712,7 +3581,7 @@ namespace Server.Mobiles get { if ( NetState != null ) - return m_GameTime + (DateTime.UtcNow - m_SessionStart); + return m_GameTime + (DateTime.UtcNow - SessionStart); return m_GameTime; } } @@ -3722,10 +3591,10 @@ namespace Server.Mobiles if ( m is CharacterStatue statue ) statue.OnRequestedAnimation( this ); - if ( m is PlayerMobile mobile && mobile.m_VisList.Contains( this ) ) + if ( m is PlayerMobile mobile && mobile.VisibilityList.Contains( this ) ) return true; - if ( m_DuelContext != null && m_DuelPlayer != null && !m_DuelContext.Finished && m_DuelContext.m_Tournament != null && !m_DuelPlayer.Eliminated ) + if ( DuelContext != null && m_DuelPlayer != null && !DuelContext.Finished && DuelContext.m_Tournament != null && !m_DuelPlayer.Eliminated ) { Mobile owner = m; @@ -3737,7 +3606,7 @@ namespace Server.Mobiles owner = master; } - if ( m.AccessLevel == AccessLevel.Player && owner is PlayerMobile pm && pm.DuelContext != m_DuelContext ) + if ( m.AccessLevel == AccessLevel.Player && owner is PlayerMobile pm && pm.DuelContext != DuelContext ) return false; } @@ -3759,7 +3628,7 @@ namespace Server.Mobiles public override bool CanSee( Item item ) { - if ( m_DesignContext != null && m_DesignContext.Foundation.IsHiddenToCustomizer( item ) ) + if ( DesignContext != null && DesignContext.Foundation.IsHiddenToCustomizer( item ) ) return false; return base.CanSee( item ); @@ -3891,13 +3760,7 @@ namespace Server.Mobiles return true; } - private bool m_BedrollLogout; - - public bool BedrollLogout - { - get => m_BedrollLogout; - set => m_BedrollLogout = value; - } + public bool BedrollLogout { get; set; } [CommandProperty( AccessLevel.GameMaster )] public override bool Paralyzed @@ -3915,47 +3778,39 @@ namespace Server.Mobiles } #region Ethics - private Ethics.Player m_EthicPlayer; [CommandProperty( AccessLevel.GameMaster )] - public Ethics.Player EthicPlayer - { - get => m_EthicPlayer; - set => m_EthicPlayer = value; - } + public Ethics.Player EthicPlayer { get; set; } + #endregion #region Factions - private PlayerState m_FactionPlayerState; - public PlayerState FactionPlayerState - { - get => m_FactionPlayerState; - set => m_FactionPlayerState = value; - } + public PlayerState FactionPlayerState { get; set; } + #endregion #region Dueling - private Engines.ConPVP.DuelContext m_DuelContext; + private Engines.ConPVP.DuelPlayer m_DuelPlayer; - public Engines.ConPVP.DuelContext DuelContext => m_DuelContext; + public Engines.ConPVP.DuelContext DuelContext { get; private set; } public Engines.ConPVP.DuelPlayer DuelPlayer { get => m_DuelPlayer; set { - bool wasInTourny = ( m_DuelContext != null && !m_DuelContext.Finished && m_DuelContext.m_Tournament != null ); + bool wasInTourny = ( DuelContext != null && !DuelContext.Finished && DuelContext.m_Tournament != null ); m_DuelPlayer = value; if ( m_DuelPlayer == null ) - m_DuelContext = null; + DuelContext = null; else - m_DuelContext = m_DuelPlayer.Participant.Context; + DuelContext = m_DuelPlayer.Participant.Context; - bool isInTourny = ( m_DuelContext != null && !m_DuelContext.Finished && m_DuelContext.m_Tournament != null ); + bool isInTourny = ( DuelContext != null && !DuelContext.Finished && DuelContext.m_Tournament != null ); if ( wasInTourny != isInTourny ) SendEverything(); @@ -3964,44 +3819,25 @@ namespace Server.Mobiles #endregion #region Quests - private QuestSystem m_Quest; - private List m_DoneQuests; - private SolenFriendship m_SolenFriendship; - public QuestSystem Quest - { - get => m_Quest; - set => m_Quest = value; - } + public QuestSystem Quest { get; set; } - public List DoneQuests - { - get => m_DoneQuests; - set => m_DoneQuests = value; - } + public List DoneQuests { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public SolenFriendship SolenFriendship - { - get => m_SolenFriendship; - set => m_SolenFriendship = value; - } + public SolenFriendship SolenFriendship { get; set; } + #endregion #region MyRunUO Invalidation - private bool m_ChangedMyRunUO; - public bool ChangedMyRunUO - { - get => m_ChangedMyRunUO; - set => m_ChangedMyRunUO = value; - } + public bool ChangedMyRunUO { get; set; } public void InvalidateMyRunUO() { - if ( !Deleted && !m_ChangedMyRunUO ) + if ( !Deleted && !ChangedMyRunUO ) { - m_ChangedMyRunUO = true; + ChangedMyRunUO = true; Engines.MyRunUO.MyRunUO.QueueMobileUpdate( this ); } } @@ -4071,8 +3907,8 @@ namespace Server.Mobiles public override void OnDelete() { - m_ReceivedHonorContext?.Cancel(); - m_SentHonorContext?.Cancel(); + ReceivedHonorContext?.Cancel(); + SentHonorContext?.Cancel(); InvalidateMyRunUO(); } @@ -4139,7 +3975,6 @@ namespace Server.Mobiles #region Enemy of One private Type m_EnemyOfOneType; - private bool m_WaitingForEnemy; public Type EnemyOfOneType { @@ -4158,11 +3993,7 @@ namespace Server.Mobiles } } - public bool WaitingForEnemy - { - get => m_WaitingForEnemy; - set => m_WaitingForEnemy = value; - } + public bool WaitingForEnemy { get; set; } private void DeltaEnemies( Type oldType, Type newType ) { @@ -4248,77 +4079,42 @@ namespace Server.Mobiles #endregion #region Virtues - private DateTime m_LastSacrificeGain; - private DateTime m_LastSacrificeLoss; - private int m_AvailableResurrects; - public DateTime LastSacrificeGain{ get => m_LastSacrificeGain; - set => m_LastSacrificeGain = value; - } - public DateTime LastSacrificeLoss{ get => m_LastSacrificeLoss; - set => m_LastSacrificeLoss = value; - } + public DateTime LastSacrificeGain { get; set; } + + public DateTime LastSacrificeLoss { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int AvailableResurrects{ get => m_AvailableResurrects; - set => m_AvailableResurrects = value; - } + public int AvailableResurrects { get; set; } private DateTime m_NextJustAward; - private DateTime m_LastJusticeLoss; - private List m_JusticeProtectors; - public DateTime LastJusticeLoss{ get => m_LastJusticeLoss; - set => m_LastJusticeLoss = value; - } - public List JusticeProtectors { get => m_JusticeProtectors; - set => m_JusticeProtectors = value; - } + public DateTime LastJusticeLoss { get; set; } - private DateTime m_LastCompassionLoss; - private DateTime m_NextCompassionDay; - private int m_CompassionGains; + public List JusticeProtectors { get; set; } + + public DateTime LastCompassionLoss { get; set; } - public DateTime LastCompassionLoss{ get => m_LastCompassionLoss; - set => m_LastCompassionLoss = value; - } [CommandProperty( AccessLevel.GameMaster )] - public DateTime NextCompassionDay{ get => m_NextCompassionDay; - set => m_NextCompassionDay = value; - } + public DateTime NextCompassionDay { get; set; } + [CommandProperty( AccessLevel.GameMaster )] - public int CompassionGains{ get => m_CompassionGains; - set => m_CompassionGains = value; - } + public int CompassionGains { get; set; } - private DateTime m_LastValorLoss; + public DateTime LastValorLoss { get; set; } - public DateTime LastValorLoss { get => m_LastValorLoss; - set => m_LastValorLoss = value; - } - - private DateTime m_LastHonorLoss; - private DateTime m_LastHonorUse; - private bool m_HonorActive; - private HonorContext m_ReceivedHonorContext; - private HonorContext m_SentHonorContext; public DateTime m_hontime; - public DateTime LastHonorLoss{ get => m_LastHonorLoss; - set => m_LastHonorLoss = value; - } - public DateTime LastHonorUse{ get => m_LastHonorUse; - set => m_LastHonorUse = value; - } - public bool HonorActive{ get => m_HonorActive; - set => m_HonorActive = value; - } - public HonorContext ReceivedHonorContext{ get => m_ReceivedHonorContext; - set => m_ReceivedHonorContext = value; - } - public HonorContext SentHonorContext{ get => m_SentHonorContext; - set => m_SentHonorContext = value; - } + public DateTime LastHonorLoss { get; set; } + + public DateTime LastHonorUse { get; set; } + + public bool HonorActive { get; set; } + + public HonorContext ReceivedHonorContext { get; set; } + + public HonorContext SentHonorContext { get; set; } + #endregion #region Young system @@ -4340,12 +4136,12 @@ namespace Server.Mobiles } #region Ethics - if ( m_EthicPlayer != null ) + if ( EthicPlayer != null ) { if ( suffix.Length == 0 ) - suffix = m_EthicPlayer.Ethic.Definition.Adjunct.String; + suffix = EthicPlayer.Ethic.Definition.Adjunct.String; else - suffix = string.Concat( suffix, " ", m_EthicPlayer.Ethic.Definition.Adjunct.String ); + suffix = string.Concat( suffix, " ", EthicPlayer.Ethic.Definition.Adjunct.String ); } #endregion @@ -4519,18 +4315,17 @@ namespace Server.Mobiles #endregion #region Speech log - private SpeechLog m_SpeechLog; - public SpeechLog SpeechLog => m_SpeechLog; + public SpeechLog SpeechLog { get; private set; } public override void OnSpeech( SpeechEventArgs e ) { if ( SpeechLog.Enabled && NetState != null ) { - if ( m_SpeechLog == null ) - m_SpeechLog = new SpeechLog(); + if ( SpeechLog == null ) + SpeechLog = new SpeechLog(); - m_SpeechLog.Add( e.Mobile, e.Speech ); + SpeechLog.Add( e.Mobile, e.Speech ); } } @@ -4571,15 +4366,9 @@ namespace Server.Mobiles private class TitleInfo { - private int m_Value; - private DateTime m_LastDecay; + public int Value { get; set; } - public int Value { get => m_Value; - set => m_Value = value; - } - public DateTime LastDecay { get => m_LastDecay; - set => m_LastDecay = value; - } + public DateTime LastDecay { get; set; } public TitleInfo() { @@ -4593,8 +4382,8 @@ namespace Server.Mobiles { case 0: { - m_Value = reader.ReadEncodedInt(); - m_LastDecay = reader.ReadDateTime(); + Value = reader.ReadEncodedInt(); + LastDecay = reader.ReadDateTime(); break; } } @@ -4604,15 +4393,13 @@ namespace Server.Mobiles { writer.WriteEncodedInt( (int)0 ); // version - writer.WriteEncodedInt( info.m_Value ); - writer.Write( info.m_LastDecay ); + writer.WriteEncodedInt( info.Value ); + writer.Write( info.LastDecay ); } } private TitleInfo[] m_Values; - private int m_Harrower; //Harrower titles do NOT decay - public int GetValue( ChampionSpawnType type ) { return GetValue( (int)type ); @@ -4749,9 +4536,7 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public int Harrower { get => m_Harrower; - set => m_Harrower = value; - } + public int Harrower { get; set; } public ChampionTitleInfo() { @@ -4765,7 +4550,7 @@ namespace Server.Mobiles { case 0: { - m_Harrower = reader.ReadEncodedInt(); + Harrower = reader.ReadEncodedInt(); int length = reader.ReadEncodedInt(); m_Values = new TitleInfo[length]; @@ -4794,7 +4579,7 @@ namespace Server.Mobiles { writer.WriteEncodedInt( (int)0 ); // version - writer.WriteEncodedInt( titles.m_Harrower ); + writer.WriteEncodedInt( titles.Harrower ); int length = titles.m_Values.Length; writer.WriteEncodedInt( length ); @@ -4843,7 +4628,7 @@ namespace Server.Mobiles count++; } - t.m_Harrower = Math.Max( count, t.m_Harrower ); //Harrower titles never decay. + t.Harrower = Math.Max( count, t.Harrower ); //Harrower titles never decay. } } @@ -5016,14 +4801,14 @@ namespace Server.Mobiles pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully happy Stabled.Add( pet ); - m_AutoStabled.Add( pet ); + AutoStabled.Add( pet ); } } } public void ClaimAutoStabledPets() { - if ( !Core.SE || m_AutoStabled.Count <= 0 ) + if ( !Core.SE || AutoStabled.Count <= 0 ) return; if ( !Alive ) @@ -5032,9 +4817,9 @@ namespace Server.Mobiles return; } - for ( int i = m_AutoStabled.Count - 1; i >= 0; --i ) + for ( int i = AutoStabled.Count - 1; i >= 0; --i ) { - BaseCreature pet = m_AutoStabled[i] as BaseCreature; + BaseCreature pet = AutoStabled[i] as BaseCreature; if ( pet == null || pet.Deleted ) { @@ -5073,7 +4858,7 @@ namespace Server.Mobiles } } - m_AutoStabled.Clear(); + AutoStabled.Clear(); } } } diff --git a/Scripts/Mobiles/Special/Harrower.cs b/Scripts/Mobiles/Special/Harrower.cs index bbd2404cb..9b9f3cde5 100644 --- a/Scripts/Mobiles/Special/Harrower.cs +++ b/Scripts/Mobiles/Special/Harrower.cs @@ -46,13 +46,11 @@ namespace Server.Mobiles new SpawnEntry( new Point3D( 5579, 1858, 0 ), new Point3D( 2499, 919, 0 ) ) // Covetous }; - private static ArrayList m_Instances = new ArrayList(); - - public static ArrayList Instances => m_Instances; + public static ArrayList Instances { get; } = new ArrayList(); public static Harrower Spawn( Point3D platLoc, Map platMap ) { - if ( m_Instances.Count > 0 ) + if ( Instances.Count > 0 ) return null; SpawnEntry entry = m_Entries[Utility.Random( m_Entries.Length )]; @@ -66,14 +64,14 @@ namespace Server.Mobiles return harrower; } - public static bool CanSpawn => ( m_Instances.Count == 0 ); + public static bool CanSpawn => ( Instances.Count == 0 ); public override string DefaultName => "the harrower"; [Constructible] public Harrower() : base( AIType.AI_Mage, FightMode.Closest, 18, 1, 0.2, 0.4 ) { - m_Instances.Add( this ); + Instances.Add( this ); BodyValue = 146; SetStr( 900, 1000 ); @@ -200,12 +198,12 @@ namespace Server.Mobiles public Harrower( Serial serial ) : base( serial ) { - m_Instances.Add( this ); + Instances.Add( this ); } public override void OnAfterDelete() { - m_Instances.Remove( this ); + Instances.Remove( this ); base.OnAfterDelete(); } diff --git a/Scripts/Mobiles/Special/HarrowerTentacles.cs b/Scripts/Mobiles/Special/HarrowerTentacles.cs index 89c0c84a0..46172881e 100644 --- a/Scripts/Mobiles/Special/HarrowerTentacles.cs +++ b/Scripts/Mobiles/Special/HarrowerTentacles.cs @@ -6,16 +6,11 @@ namespace Server.Mobiles public class HarrowerTentacles : BaseCreature { public override string CorpseName => "a tentacles corpse"; - private Mobile m_Harrower; private DrainTimer m_Timer; [CommandProperty( AccessLevel.GameMaster )] - public Mobile Harrower - { - get => m_Harrower; - set => m_Harrower = value; - } + public Mobile Harrower { get; set; } public override string DefaultName => "tentacles of the harrower"; @@ -26,7 +21,7 @@ namespace Server.Mobiles public HarrowerTentacles( Mobile harrower ) : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 ) { - m_Harrower = harrower; + Harrower = harrower; Body = 129; SetStr( 901, 1000 ); @@ -119,7 +114,7 @@ namespace Server.Mobiles writer.Write( (int) 0 ); // version - writer.Write( m_Harrower ); + writer.Write( Harrower ); } public override void Deserialize( GenericReader reader ) @@ -132,7 +127,7 @@ namespace Server.Mobiles { case 0: { - m_Harrower = reader.ReadMobile(); + Harrower = reader.ReadMobile(); m_Timer = new DrainTimer( this ); m_Timer.Start(); diff --git a/Scripts/Mobiles/Special/Neira.cs b/Scripts/Mobiles/Special/Neira.cs index 6650fffb0..ab1599b1b 100644 --- a/Scripts/Mobiles/Special/Neira.cs +++ b/Scripts/Mobiles/Special/Neira.cs @@ -143,10 +143,9 @@ namespace Server.Mobiles private class VirtualMountItem : Item, IMountItem { - private Mobile m_Rider; private VirtualMount m_Mount; - public Mobile Rider => m_Rider; + public Mobile Rider { get; private set; } public VirtualMountItem( Mobile mob ) : base( 0x3EBB ) @@ -155,7 +154,7 @@ namespace Server.Mobiles Movable = false; - m_Rider = mob; + Rider = mob; m_Mount = new VirtualMount( this ); } @@ -173,7 +172,7 @@ namespace Server.Mobiles writer.Write( (int)0 ); // version - writer.Write( (Mobile)m_Rider ); + writer.Write( (Mobile)Rider ); } public override void Deserialize( GenericReader reader ) @@ -182,9 +181,9 @@ namespace Server.Mobiles int version = reader.ReadInt(); - m_Rider = reader.ReadMobile(); + Rider = reader.ReadMobile(); - if ( m_Rider == null ) + if ( Rider == null ) Delete(); } } diff --git a/Scripts/Mobiles/Townfolk/BaseEscortable.cs b/Scripts/Mobiles/Townfolk/BaseEscortable.cs index 9bbac3921..d6bd09f63 100644 --- a/Scripts/Mobiles/Townfolk/BaseEscortable.cs +++ b/Scripts/Mobiles/Townfolk/BaseEscortable.cs @@ -229,9 +229,7 @@ namespace Server.Mobiles return false; } - private static Hashtable m_EscortTable = new Hashtable(); - - public static Hashtable EscortTable => m_EscortTable; + public static Hashtable EscortTable { get; } = new Hashtable(); public virtual bool AcceptEscorter(Mobile m) { @@ -245,7 +243,7 @@ namespace Server.Mobiles if (escorter != null || !m.Alive) return false; - BaseEscortable escortable = (BaseEscortable)m_EscortTable[m]; + BaseEscortable escortable = (BaseEscortable)EscortTable[m]; if (escortable != null && !escortable.Deleted && escortable.GetEscorter() == m) { @@ -268,7 +266,7 @@ namespace Server.Mobiles ((PlayerMobile)m).LastEscortTime = DateTime.UtcNow; Say("Lead on! Payment will be made when we arrive in {0}.", (dest.Name == "Ocllo" && m.Map == Map.Trammel) ? "Haven" : dest.Name); - m_EscortTable[m] = this; + EscortTable[m] = this; StartFollow(); return true; } @@ -387,7 +385,7 @@ namespace Server.Mobiles Say(1005653); // Hmmm. I seem to have lost my master. SetControlMaster(null); - m_EscortTable.Remove(master); + EscortTable.Remove(master); Timer.DelayCall(TimeSpan.FromSeconds(5.0), Delete); return null; @@ -449,7 +447,7 @@ namespace Server.Mobiles StopFollow(); SetControlMaster(null); - m_EscortTable.Remove(escorter); + EscortTable.Remove(escorter); BeginDelete(); Misc.Titles.AwardFame(escorter, 10, true); @@ -645,13 +643,11 @@ namespace Server.Mobiles public class EscortDestinationInfo { - private string m_Name; - private Region m_Region; //private Rectangle2D[] m_Bounds; - public string Name => m_Name; + public string Name { get; } - public Region Region => m_Region; + public Region Region { get; } /*public Rectangle2D[] Bounds { @@ -660,13 +656,13 @@ namespace Server.Mobiles public bool Contains(Point3D p) { - return m_Region.Contains(p); + return Region.Contains(p); } public EscortDestinationInfo(string name, Region region) { - m_Name = name; - m_Region = region; + Name = name; + Region = region; } private static Hashtable m_Table; diff --git a/Scripts/Mobiles/Townfolk/TownCrier.cs b/Scripts/Mobiles/Townfolk/TownCrier.cs index 4c47a2f83..c007021ac 100644 --- a/Scripts/Mobiles/Townfolk/TownCrier.cs +++ b/Scripts/Mobiles/Townfolk/TownCrier.cs @@ -44,46 +44,44 @@ namespace Server.Mobiles } } - public bool IsEmpty => ( m_Entries == null || m_Entries.Count == 0 ); + public bool IsEmpty => ( Entries == null || Entries.Count == 0 ); public GlobalTownCrierEntryList() { } - private List m_Entries; - - public List Entries => m_Entries; + public List Entries { get; private set; } public TownCrierEntry GetRandomEntry() { - if ( m_Entries == null || m_Entries.Count == 0 ) + if ( Entries == null || Entries.Count == 0 ) return null; - for ( int i = m_Entries.Count - 1; m_Entries != null && i >= 0; --i ) + for ( int i = Entries.Count - 1; Entries != null && i >= 0; --i ) { - if ( i >= m_Entries.Count ) + if ( i >= Entries.Count ) continue; - TownCrierEntry tce = m_Entries[i]; + TownCrierEntry tce = Entries[i]; if ( tce.Expired ) RemoveEntry( tce ); } - if ( m_Entries == null || m_Entries.Count == 0 ) + if ( Entries == null || Entries.Count == 0 ) return null; - return m_Entries[Utility.Random( m_Entries.Count )]; + return Entries[Utility.Random( Entries.Count )]; } public TownCrierEntry AddEntry( string[] lines, TimeSpan duration ) { - if ( m_Entries == null ) - m_Entries = new List(); + if ( Entries == null ) + Entries = new List(); TownCrierEntry tce = new TownCrierEntry( lines, duration ); - m_Entries.Add( tce ); + Entries.Add( tce ); List instances = TownCrier.Instances; @@ -95,35 +93,34 @@ namespace Server.Mobiles public void RemoveEntry( TownCrierEntry tce ) { - if ( m_Entries == null ) + if ( Entries == null ) return; - m_Entries.Remove( tce ); + Entries.Remove( tce ); - if ( m_Entries.Count == 0 ) - m_Entries = null; + if ( Entries.Count == 0 ) + Entries = null; } } public class TownCrierEntry { - private string[] m_Lines; - private DateTime m_ExpireTime; + public string[] Lines { get; } - public string[] Lines => m_Lines; - public DateTime ExpireTime => m_ExpireTime; - public bool Expired => ( DateTime.UtcNow >= m_ExpireTime ); + public DateTime ExpireTime { get; } + + public bool Expired => ( DateTime.UtcNow >= ExpireTime ); public TownCrierEntry( string[] lines, TimeSpan duration ) { - m_Lines = lines; + Lines = lines; if ( duration < TimeSpan.Zero ) duration = TimeSpan.Zero; else if ( duration > TimeSpan.FromDays( 365.0 ) ) duration = TimeSpan.FromDays( 365.0 ); - m_ExpireTime = DateTime.UtcNow + duration; + ExpireTime = DateTime.UtcNow + duration; } } @@ -318,35 +315,34 @@ namespace Server.Mobiles public class TownCrier : Mobile, ITownCrierEntryList { - private List m_Entries; private Timer m_NewsTimer; private Timer m_AutoShoutTimer; - public List Entries => m_Entries; + public List Entries { get; private set; } public TownCrierEntry GetRandomEntry() { - if ( m_Entries == null || m_Entries.Count == 0 ) + if ( Entries == null || Entries.Count == 0 ) return GlobalTownCrierEntryList.Instance.GetRandomEntry(); - for ( int i = m_Entries.Count - 1; m_Entries != null && i >= 0; --i ) + for ( int i = Entries.Count - 1; Entries != null && i >= 0; --i ) { - if ( i >= m_Entries.Count ) + if ( i >= Entries.Count ) continue; - TownCrierEntry tce = m_Entries[i]; + TownCrierEntry tce = Entries[i]; if ( tce.Expired ) RemoveEntry( tce ); } - if ( m_Entries == null || m_Entries.Count == 0 ) + if ( Entries == null || Entries.Count == 0 ) return GlobalTownCrierEntryList.Instance.GetRandomEntry(); TownCrierEntry entry = GlobalTownCrierEntryList.Instance.GetRandomEntry(); if ( entry == null || Utility.RandomBool() ) - entry = m_Entries[Utility.Random( m_Entries.Count )]; + entry = Entries[Utility.Random( Entries.Count )]; return entry; } @@ -359,12 +355,12 @@ namespace Server.Mobiles public TownCrierEntry AddEntry( string[] lines, TimeSpan duration ) { - if ( m_Entries == null ) - m_Entries = new List(); + if ( Entries == null ) + Entries = new List(); TownCrierEntry tce = new TownCrierEntry( lines, duration ); - m_Entries.Add( tce ); + Entries.Add( tce ); if ( m_AutoShoutTimer == null ) m_AutoShoutTimer = Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), TimeSpan.FromMinutes( 1.0 ), AutoShout_Callback ); @@ -374,15 +370,15 @@ namespace Server.Mobiles public void RemoveEntry( TownCrierEntry tce ) { - if ( m_Entries == null ) + if ( Entries == null ) return; - m_Entries.Remove( tce ); + Entries.Remove( tce ); - if ( m_Entries.Count == 0 ) - m_Entries = null; + if ( Entries.Count == 0 ) + Entries = null; - if ( m_Entries == null && GlobalTownCrierEntryList.Instance.IsEmpty ) + if ( Entries == null && GlobalTownCrierEntryList.Instance.IsEmpty ) { m_AutoShoutTimer?.Stop(); @@ -461,14 +457,12 @@ namespace Server.Mobiles } } - private static List m_Instances = new List(); - - public static List Instances => m_Instances; + public static List Instances { get; } = new List(); [Constructible] public TownCrier() { - m_Instances.Add( this ); + Instances.Add( this ); InitStats( 100, 100, 25 ); @@ -525,13 +519,13 @@ namespace Server.Mobiles public override void OnDelete() { - m_Instances.Remove( this ); + Instances.Remove( this ); base.OnDelete(); } public TownCrier( Serial serial ) : base( serial ) { - m_Instances.Add( this ); + Instances.Add( this ); } public override void Serialize( GenericWriter writer ) diff --git a/Scripts/Mobiles/Vendors/AnimalBuy.cs b/Scripts/Mobiles/Vendors/AnimalBuy.cs index b2c57235d..de189059e 100644 --- a/Scripts/Mobiles/Vendors/AnimalBuy.cs +++ b/Scripts/Mobiles/Vendors/AnimalBuy.cs @@ -4,17 +4,15 @@ namespace Server.Mobiles { public class AnimalBuyInfo : GenericBuyInfo { - private int m_ControlSlots; - public AnimalBuyInfo( int controlSlots, Type type, int price, int amount, int itemID, int hue ) : this( controlSlots, null, type, price, amount, itemID, hue ) { } public AnimalBuyInfo( int controlSlots, string name, Type type, int price, int amount, int itemID, int hue ) : base( name, type, price, amount, itemID, hue ) { - m_ControlSlots = controlSlots; + ControlSlots = controlSlots; } - public override int ControlSlots => m_ControlSlots; + public override int ControlSlots { get; } } } \ No newline at end of file diff --git a/Scripts/Mobiles/Vendors/BaseVendor.cs b/Scripts/Mobiles/Vendors/BaseVendor.cs index eaa11c81d..5ca6ed04e 100644 --- a/Scripts/Mobiles/Vendors/BaseVendor.cs +++ b/Scripts/Mobiles/Vendors/BaseVendor.cs @@ -30,10 +30,6 @@ namespace Server.Mobiles private ArrayList m_ArmorBuyInfo = new ArrayList(); private ArrayList m_ArmorSellInfo = new ArrayList(); - private DateTime m_LastRestock; - - private DateTime m_NextTrickOrTreat; - public override bool CanTeach => true; public override bool BardImmune => true; @@ -48,9 +44,7 @@ namespace Server.Mobiles public override bool IsInvulnerable => true; - public virtual DateTime NextTrickOrTreat { get => m_NextTrickOrTreat; - set => m_NextTrickOrTreat = value; - } + public virtual DateTime NextTrickOrTreat { get; set; } public override bool ShowFameTitle => false; @@ -178,7 +172,7 @@ namespace Server.Mobiles pack.Visible = false; AddItem( pack ); - m_LastRestock = DateTime.UtcNow; + LastRestock = DateTime.UtcNow; } public BaseVendor( Serial serial ) @@ -186,11 +180,7 @@ namespace Server.Mobiles { } - public DateTime LastRestock - { - get => m_LastRestock; - set => m_LastRestock = value; - } + public DateTime LastRestock { get; set; } public virtual TimeSpan RestockDelay => TimeSpan.FromHours( 1 ); @@ -214,7 +204,7 @@ namespace Server.Mobiles protected void LoadSBInfo() { - m_LastRestock = DateTime.UtcNow; + LastRestock = DateTime.UtcNow; for ( int i = 0; i < m_ArmorBuyInfo.Count; ++i ) { @@ -491,7 +481,7 @@ namespace Server.Mobiles public virtual void Restock() { - m_LastRestock = DateTime.UtcNow; + LastRestock = DateTime.UtcNow; IBuyItemInfo[] buyInfo = GetBuyInfo(); @@ -515,7 +505,7 @@ namespace Server.Mobiles return; } - if ( DateTime.UtcNow - m_LastRestock > RestockDelay ) + if ( DateTime.UtcNow - LastRestock > RestockDelay ) Restock(); UpdateBuyInfo(); diff --git a/Scripts/Mobiles/Vendors/GenericBuy.cs b/Scripts/Mobiles/Vendors/GenericBuy.cs index a23f8cf90..c3b0a26d2 100644 --- a/Scripts/Mobiles/Vendors/GenericBuy.cs +++ b/Scripts/Mobiles/Vendors/GenericBuy.cs @@ -101,13 +101,8 @@ namespace Server.Mobiles } } - private Type m_Type; - private string m_Name; private int m_Price; - private int m_MaxAmount, m_Amount; - private int m_ItemID; - private int m_Hue; - private object[] m_Args; + private int m_Amount; private IEntity m_DisplayEntity; public virtual int ControlSlots => 0; @@ -137,49 +132,39 @@ namespace Server.Mobiles bool canCache = CanCacheDisplay; if ( canCache ) - m_DisplayEntity = DisplayCache.Cache.Lookup( m_Type ); + m_DisplayEntity = DisplayCache.Cache.Lookup( Type ); if ( m_DisplayEntity == null || IsDeleted( m_DisplayEntity ) ) m_DisplayEntity = GetEntity(); - DisplayCache.Cache.Store( m_Type, m_DisplayEntity, canCache ); + DisplayCache.Cache.Store( Type, m_DisplayEntity, canCache ); return m_DisplayEntity; } - public Type Type - { - get => m_Type; - set => m_Type = value; - } + public Type Type { get; set; } - public string Name - { - get => m_Name; - set => m_Name = value; - } + public string Name { get; set; } - public int DefaultPrice => m_PriceScalar; - - private int m_PriceScalar; + public int DefaultPrice { get; private set; } public int PriceScalar { - get => m_PriceScalar; - set => m_PriceScalar = value; + get => DefaultPrice; + set => DefaultPrice = value; } public int Price { get { - if ( m_PriceScalar != 0 ) + if ( DefaultPrice != 0 ) { if ( m_Price > 5000000 ) { long price = m_Price; - price *= m_PriceScalar; + price *= DefaultPrice; price += 50; price /= 100; @@ -189,7 +174,7 @@ namespace Server.Mobiles return (int)price; } - return ( ((m_Price * m_PriceScalar) + 50) / 100 ); + return ( ((m_Price * DefaultPrice) + 50) / 100 ); } return m_Price; @@ -197,17 +182,9 @@ namespace Server.Mobiles set => m_Price = value; } - public int ItemID - { - get => m_ItemID; - set => m_ItemID = value; - } + public int ItemID { get; set; } - public int Hue - { - get => m_Hue; - set => m_Hue = value; - } + public int Hue { get; set; } public int Amount { @@ -215,17 +192,9 @@ namespace Server.Mobiles set{ if ( value < 0 ) value = 0; m_Amount = value; } } - public int MaxAmount - { - get => m_MaxAmount; - set => m_MaxAmount = value; - } + public int MaxAmount { get; set; } - public object[] Args - { - get => m_Args; - set => m_Args = value; - } + public object[] Args { get; set; } public GenericBuyInfo( Type type, int price, int amount, int itemID, int hue ) : this( null, type, price, amount, itemID, hue, null ) { @@ -241,26 +210,26 @@ namespace Server.Mobiles public GenericBuyInfo( string name, Type type, int price, int amount, int itemID, int hue, object[] args ) { - m_Type = type; + Type = type; m_Price = price; - m_MaxAmount = m_Amount = amount; - m_ItemID = itemID; - m_Hue = hue; - m_Args = args; + MaxAmount = m_Amount = amount; + ItemID = itemID; + Hue = hue; + Args = args; if ( name == null ) - m_Name = itemID < 0x4000 ? (1020000 + itemID).ToString() : (1078872 + itemID).ToString(); + Name = itemID < 0x4000 ? (1020000 + itemID).ToString() : (1078872 + itemID).ToString(); else - m_Name = name; + Name = name; } //get a new instance of an object (we just bought it) public virtual IEntity GetEntity() { - if ( m_Args == null || m_Args.Length == 0 ) - return (IEntity)Activator.CreateInstance( m_Type ); + if ( Args == null || Args.Length == 0 ) + return (IEntity)Activator.CreateInstance( Type ); - return (IEntity)Activator.CreateInstance( m_Type, m_Args ); + return (IEntity)Activator.CreateInstance( Type, Args ); //return (Item)Activator.CreateInstance( m_Type ); } @@ -311,11 +280,11 @@ namespace Server.Mobiles if ( Core.ML && Obj_Disp is Item && !( Obj_Disp as Item ).Stackable ) { - m_MaxAmount = Math.Min( 20, m_MaxAmount ); + MaxAmount = Math.Min( 20, MaxAmount ); } else { - m_MaxAmount = Math.Min( 999, m_MaxAmount * 2 ); + MaxAmount = Math.Min( 999, MaxAmount * 2 ); } } else @@ -326,7 +295,7 @@ namespace Server.Mobiles * there's clearly a demand and we should not cut down on the stock. */ - int halfQuantity = m_MaxAmount; + int halfQuantity = MaxAmount; if ( halfQuantity >= 999 ) halfQuantity = 640; @@ -334,10 +303,10 @@ namespace Server.Mobiles halfQuantity /= 2; if ( m_Amount >= halfQuantity ) - m_MaxAmount = halfQuantity; + MaxAmount = halfQuantity; } - m_Amount = m_MaxAmount; + m_Amount = MaxAmount; } } } diff --git a/Scripts/Mobiles/Vendors/NPC/CustomHairstylist.cs b/Scripts/Mobiles/Vendors/NPC/CustomHairstylist.cs index 4cf7ebff9..e2323f7bd 100644 --- a/Scripts/Mobiles/Vendors/NPC/CustomHairstylist.cs +++ b/Scripts/Mobiles/Vendors/NPC/CustomHairstylist.cs @@ -7,8 +7,7 @@ namespace Server.Mobiles { public class CustomHairstylist : BaseVendor { - private List m_SBInfos = new List(); - protected override List SBInfos => m_SBInfos; + protected override List SBInfos { get; } = new List(); public override bool ClickTitle => false; @@ -92,36 +91,34 @@ namespace Server.Mobiles public class HairstylistBuyInfo { - private int m_Title; - private string m_TitleString; - private int m_Price; - private bool m_FacialHair; - private Type m_GumpType; - private object[] m_GumpArgs; + public int Title { get; } - public int Title => m_Title; - public string TitleString => m_TitleString; - public int Price => m_Price; - public bool FacialHair => m_FacialHair; - public Type GumpType => m_GumpType; - public object[] GumpArgs => m_GumpArgs; + public string TitleString { get; } + + public int Price { get; } + + public bool FacialHair { get; } + + public Type GumpType { get; } + + public object[] GumpArgs { get; } public HairstylistBuyInfo( int title, int price, bool facialHair, Type gumpType, object[] args ) { - m_Title = title; - m_Price = price; - m_FacialHair = facialHair; - m_GumpType = gumpType; - m_GumpArgs = args; + Title = title; + Price = price; + FacialHair = facialHair; + GumpType = gumpType; + GumpArgs = args; } public HairstylistBuyInfo( string title, int price, bool facialHair, Type gumpType, object[] args ) { - m_TitleString = title; - m_Price = price; - m_FacialHair = facialHair; - m_GumpType = gumpType; - m_GumpArgs = args; + TitleString = title; + Price = price; + FacialHair = facialHair; + GumpType = gumpType; + GumpArgs = args; } } @@ -229,26 +226,24 @@ namespace Server.Mobiles public class ChangeHairHueEntry { - private string m_Name; - private int[] m_Hues; + public string Name { get; } - public string Name => m_Name; - public int[] Hues => m_Hues; + public int[] Hues { get; } public ChangeHairHueEntry( string name, int[] hues ) { - m_Name = name; - m_Hues = hues; + Name = name; + Hues = hues; } public ChangeHairHueEntry( string name, int start, int count ) { - m_Name = name; + Name = name; - m_Hues = new int[count]; + Hues = new int[count]; for ( int i = 0; i < count; ++i ) - m_Hues[i] = start + i; + Hues[i] = start + i; } public static readonly ChangeHairHueEntry[] BrightEntries = { @@ -386,21 +381,20 @@ namespace Server.Mobiles public class ChangeHairstyleEntry { - private int m_ItemID; - private int m_GumpID; - private int m_X, m_Y; + public int ItemID { get; } - public int ItemID => m_ItemID; - public int GumpID => m_GumpID; - public int X => m_X; - public int Y => m_Y; + public int GumpID { get; } + + public int X { get; } + + public int Y { get; } public ChangeHairstyleEntry( int gumpID, int x, int y, int itemID ) { - m_GumpID = gumpID; - m_X = x; - m_Y = y; - m_ItemID = itemID; + GumpID = gumpID; + X = x; + Y = y; + ItemID = itemID; } public static readonly ChangeHairstyleEntry[] HairEntries = { diff --git a/Scripts/Mobiles/Vendors/NPC/Guildmasters/BaseGuildmaster.cs b/Scripts/Mobiles/Vendors/NPC/Guildmasters/BaseGuildmaster.cs index 3cb98675b..deb9e7dc8 100644 --- a/Scripts/Mobiles/Vendors/NPC/Guildmasters/BaseGuildmaster.cs +++ b/Scripts/Mobiles/Vendors/NPC/Guildmasters/BaseGuildmaster.cs @@ -7,8 +7,7 @@ namespace Server.Mobiles { public abstract class BaseGuildmaster : BaseVendor { - private List m_SBInfos = new List(); - protected override List SBInfos => m_SBInfos; + protected override List SBInfos { get; } = new List(); public override bool IsActiveVendor => false; diff --git a/Scripts/Mobiles/Vendors/PlayerBarkeeper.cs b/Scripts/Mobiles/Vendors/PlayerBarkeeper.cs index 97b503891..0433265d3 100644 --- a/Scripts/Mobiles/Vendors/PlayerBarkeeper.cs +++ b/Scripts/Mobiles/Vendors/PlayerBarkeeper.cs @@ -84,20 +84,14 @@ namespace Server.Mobiles public class BarkeeperRumor { - private string m_Message; - private string m_Keyword; + public string Message { get; set; } - public string Message{ get => m_Message; - set => m_Message = value; - } - public string Keyword{ get => m_Keyword; - set => m_Keyword = value; - } + public string Keyword { get; set; } public BarkeeperRumor( string message, string keyword ) { - m_Message = message; - m_Keyword = keyword; + Message = message; + Keyword = keyword; } public static BarkeeperRumor Deserialize( GenericReader reader ) @@ -117,8 +111,8 @@ namespace Server.Mobiles else { writer.Write( true ); - writer.Write( rumor.m_Message ); - writer.Write( rumor.m_Keyword ); + writer.Write( rumor.Message ); + writer.Write( rumor.Keyword ); } } } @@ -142,18 +136,10 @@ namespace Server.Mobiles public class PlayerBarkeeper : BaseVendor { - private Mobile m_Owner; private BaseHouse m_House; - private string m_TipMessage; - - private BarkeeperRumor[] m_Rumors; [CommandProperty( AccessLevel.GameMaster )] - public Mobile Owner - { - get => m_Owner; - set => m_Owner = value; - } + public Mobile Owner { get; set; } public BaseHouse House { @@ -169,11 +155,7 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public string TipMessage - { - get => m_TipMessage; - set => m_TipMessage = value; - } + public string TipMessage { get; set; } public override bool IsActiveBuyer => false; public override bool IsActiveSeller => ( m_SBInfos.Count > 0 ); @@ -181,7 +163,7 @@ namespace Server.Mobiles public override bool DisallowAllMoves => true; public override bool NoHouseRestrictions => true; - public BarkeeperRumor[] Rumors => m_Rumors; + public BarkeeperRumor[] Rumors { get; private set; } public override VendorShoeType ShoeType => Utility.RandomBool() ? VendorShoeType.ThighBoots : VendorShoeType.Boots; @@ -217,9 +199,9 @@ namespace Server.Mobiles public PlayerBarkeeper( Mobile owner, BaseHouse house ) : base( "the barkeeper" ) { - m_Owner = owner; + Owner = owner; House = house; - m_Rumors = new BarkeeperRumor[3]; + Rumors = new BarkeeperRumor[3]; LoadSBInfo(); } @@ -295,9 +277,9 @@ namespace Server.Mobiles } } - for ( int i = 0; i < m_Rumors.Length; ++i ) + for ( int i = 0; i < Rumors.Length; ++i ) { - BarkeeperRumor rumor = m_Rumors[i]; + BarkeeperRumor rumor = Rumors[i]; string keyword = rumor?.Keyword; @@ -329,7 +311,7 @@ namespace Server.Mobiles } else { - string tip = m_TipMessage; + string tip = TipMessage; if ( tip == null || (tip = tip.Trim()).Length == 0 ) { @@ -357,7 +339,7 @@ namespace Server.Mobiles if ( from.AccessLevel > AccessLevel.GameMaster ) return true; - return ( m_Owner == from ); + return ( Owner == from ); } public override void GetContextMenuEntries( Mobile from, List list ) @@ -383,7 +365,7 @@ namespace Server.Mobiles public void BeginChangeRumor( Mobile from, int index ) { - if ( index < 0 || index >= m_Rumors.Length ) + if ( index < 0 || index >= Rumors.Length ) return; from.Prompt = new ChangeRumorMessagePrompt( this, index ); @@ -392,13 +374,13 @@ namespace Server.Mobiles public void EndChangeRumor( Mobile from, int index, string text ) { - if ( index < 0 || index >= m_Rumors.Length ) + if ( index < 0 || index >= Rumors.Length ) return; - if ( m_Rumors[index] == null ) - m_Rumors[index] = new BarkeeperRumor( text, null ); + if ( Rumors[index] == null ) + Rumors[index] = new BarkeeperRumor( text, null ); else - m_Rumors[index].Message = text; + Rumors[index].Message = text; from.Prompt = new ChangeRumorKeywordPrompt( this, index ); PrivateOverheadMessage( MessageType.Regular, 0x3B2, false, "What keyword should a guest say to me to get this news?", from.NetState ); @@ -406,23 +388,23 @@ namespace Server.Mobiles public void EndChangeKeyword( Mobile from, int index, string text ) { - if ( index < 0 || index >= m_Rumors.Length ) + if ( index < 0 || index >= Rumors.Length ) return; - if ( m_Rumors[index] == null ) - m_Rumors[index] = new BarkeeperRumor( null, text ); + if ( Rumors[index] == null ) + Rumors[index] = new BarkeeperRumor( null, text ); else - m_Rumors[index].Keyword = text; + Rumors[index].Keyword = text; PrivateOverheadMessage( MessageType.Regular, 0x3B2, false, "I'll pass on the message.", from.NetState ); } public void RemoveRumor( Mobile from, int index ) { - if ( index < 0 || index >= m_Rumors.Length ) + if ( index < 0 || index >= Rumors.Length ) return; - m_Rumors[index] = null; + Rumors[index] = null; } public void BeginChangeTip( Mobile from ) @@ -433,13 +415,13 @@ namespace Server.Mobiles public void EndChangeTip( Mobile from, string text ) { - m_TipMessage = text; + TipMessage = text; PrivateOverheadMessage( MessageType.Regular, 0x3B2, false, "I'll say that to anyone who gives me a good tip.", from.NetState ); } public void RemoveTip( Mobile from ) { - m_TipMessage = null; + TipMessage = null; } public void BeginChangeTitle( Mobile from ) @@ -511,14 +493,14 @@ namespace Server.Mobiles writer.Write( (Item) m_House ); - writer.Write( (Mobile) m_Owner ); + writer.Write( (Mobile) Owner ); - writer.WriteEncodedInt( (int) m_Rumors.Length ); + writer.WriteEncodedInt( (int) Rumors.Length ); - for ( int i = 0; i < m_Rumors.Length; ++i ) - BarkeeperRumor.Serialize( writer, m_Rumors[i] ); + for ( int i = 0; i < Rumors.Length; ++i ) + BarkeeperRumor.Serialize( writer, Rumors[i] ); - writer.Write( (string) m_TipMessage ); + writer.Write( (string) TipMessage ); } public override void Deserialize( GenericReader reader ) @@ -537,14 +519,14 @@ namespace Server.Mobiles } case 0: { - m_Owner = reader.ReadMobile(); + Owner = reader.ReadMobile(); - m_Rumors = new BarkeeperRumor[reader.ReadEncodedInt()]; + Rumors = new BarkeeperRumor[reader.ReadEncodedInt()]; - for ( int i = 0; i < m_Rumors.Length; ++i ) - m_Rumors[i] = BarkeeperRumor.Deserialize( reader ); + for ( int i = 0; i < Rumors.Length; ++i ) + Rumors[i] = BarkeeperRumor.Deserialize( reader ); - m_TipMessage = reader.ReadString(); + TipMessage = reader.ReadString(); break; } diff --git a/Scripts/Mobiles/Vendors/PlayerVendor.cs b/Scripts/Mobiles/Vendors/PlayerVendor.cs index 0bb7a5917..a8fe8077e 100644 --- a/Scripts/Mobiles/Vendors/PlayerVendor.cs +++ b/Scripts/Mobiles/Vendors/PlayerVendor.cs @@ -21,24 +21,20 @@ namespace Server.Mobiles public class VendorItem { - private Item m_Item; - private int m_Price; private string m_Description; - private DateTime m_Created; - private bool m_Valid; + public Item Item { get; } - public Item Item => m_Item; - public int Price => m_Price; + public int Price { get; } public string FormattedPrice { get { if ( Core.ML ) - return m_Price.ToString( "N0", CultureInfo.GetCultureInfo( "en-US" ) ); + return Price.ToString( "N0", CultureInfo.GetCultureInfo( "en-US" ) ); - return m_Price.ToString(); + return Price.ToString(); } } @@ -57,31 +53,31 @@ namespace Server.Mobiles } } - public DateTime Created => m_Created; + public DateTime Created { get; } public bool IsForSale => Price >= 0; public bool IsForFree => Price == 0; - public bool Valid => m_Valid; + public bool Valid { get; private set; } public VendorItem( Item item, int price, string description, DateTime created ) { - m_Item = item; - m_Price = price; + Item = item; + Price = price; if ( description != null ) m_Description = description; else m_Description = ""; - m_Created = created; + Created = created; - m_Valid = true; + Valid = true; } public void Invalidate() { - m_Valid = false; + Valid = false; } } @@ -269,18 +265,11 @@ namespace Server.Mobiles { private Dictionary m_SellItems; - private Mobile m_Owner; private BaseHouse m_House; - private int m_BankAccount; - private int m_HoldGold; - private string m_ShopName; private Timer m_PayTimer; - private DateTime m_NextPayTime; - - private PlayerVendorPlaceholder m_Placeholder; public PlayerVendor( Mobile owner, BaseHouse house ) { @@ -289,13 +278,13 @@ namespace Server.Mobiles if ( BaseHouse.NewVendorSystem ) { - m_BankAccount = 0; - m_HoldGold = 4; + BankAccount = 0; + HoldGold = 4; } else { - m_BankAccount = 1000; - m_HoldGold = 0; + BankAccount = 1000; + HoldGold = 0; } ShopName = "Shop Not Yet Named"; @@ -316,7 +305,7 @@ namespace Server.Mobiles m_PayTimer = new PayTimer( this, delay ); m_PayTimer.Start(); - m_NextPayTime = DateTime.UtcNow + delay; + NextPayTime = DateTime.UtcNow + delay; } public PlayerVendor( Serial serial ) : base( serial ) @@ -331,12 +320,12 @@ namespace Server.Mobiles writer.Write( (bool) BaseHouse.NewVendorSystem ); writer.Write( (string) m_ShopName ); - writer.WriteDeltaTime( (DateTime) m_NextPayTime ); + writer.WriteDeltaTime( (DateTime) NextPayTime ); writer.Write( (Item) House ); - writer.Write( (Mobile) m_Owner ); - writer.Write( (int) m_BankAccount ); - writer.Write( (int) m_HoldGold ); + writer.Write( (Mobile) Owner ); + writer.Write( (int) BankAccount ); + writer.Write( (int) HoldGold ); writer.Write( (int) m_SellItems.Count ); foreach ( VendorItem vi in m_SellItems.Values ) @@ -364,16 +353,16 @@ namespace Server.Mobiles { newVendorSystem = reader.ReadBool(); m_ShopName = reader.ReadString(); - m_NextPayTime = reader.ReadDeltaTime(); + NextPayTime = reader.ReadDeltaTime(); House = (BaseHouse) reader.ReadItem(); goto case 0; } case 0: { - m_Owner = reader.ReadMobile(); - m_BankAccount = reader.ReadInt(); - m_HoldGold = reader.ReadInt(); + Owner = reader.ReadMobile(); + BankAccount = reader.ReadInt(); + HoldGold = reader.ReadInt(); int count = reader.ReadInt(); @@ -415,19 +404,19 @@ namespace Server.Mobiles Timer.DelayCall( TimeSpan.Zero, FixDresswear ); } - m_NextPayTime = DateTime.UtcNow + PayTimer.GetInterval(); + NextPayTime = DateTime.UtcNow + PayTimer.GetInterval(); if ( newVendorSystemActivated ) { - m_HoldGold += m_BankAccount; - m_BankAccount = 0; + HoldGold += BankAccount; + BankAccount = 0; } } if ( version < 2 && RawStr == 75 && RawDex == 75 && RawInt == 75 ) InitStats( 100, 100, 25 ); - TimeSpan delay = m_NextPayTime - DateTime.UtcNow; + TimeSpan delay = NextPayTime - DateTime.UtcNow; m_PayTimer = new PayTimer( this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero ); m_PayTimer.Start(); @@ -503,25 +492,13 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public Mobile Owner - { - get => m_Owner; - set => m_Owner = value; - } + public Mobile Owner { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int BankAccount - { - get => m_BankAccount; - set => m_BankAccount = value; - } + public int BankAccount { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int HoldGold - { - get => m_HoldGold; - set => m_HoldGold = value; - } + public int HoldGold { get; set; } [CommandProperty( AccessLevel.GameMaster )] public string ShopName @@ -539,13 +516,9 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public DateTime NextPayTime => m_NextPayTime; + public DateTime NextPayTime { get; private set; } - public PlayerVendorPlaceholder Placeholder - { - get => m_Placeholder; - set => m_Placeholder = value; - } + public PlayerVendorPlaceholder Placeholder { get; set; } public BaseHouse House { @@ -1354,7 +1327,7 @@ namespace Server.Mobiles protected override void OnTick() { - m_Vendor.m_NextPayTime = DateTime.UtcNow + Interval; + m_Vendor.NextPayTime = DateTime.UtcNow + Interval; int pay; int totalGold; @@ -1624,18 +1597,17 @@ namespace Server.Mobiles public class PlayerVendorPlaceholder : Item { - private PlayerVendor m_Vendor; private ExpireTimer m_Timer; [CommandProperty( AccessLevel.GameMaster )] - public PlayerVendor Vendor => m_Vendor; + public PlayerVendor Vendor { get; private set; } public PlayerVendorPlaceholder( PlayerVendor vendor ) : base( 0x1F28 ) { Hue = 0x672; Movable = false; - m_Vendor = vendor; + Vendor = vendor; m_Timer = new ExpireTimer( this ); m_Timer.Start(); @@ -1649,8 +1621,8 @@ namespace Server.Mobiles { base.GetProperties( list ); - if ( m_Vendor != null ) - list.Add( 1062498, m_Vendor.Name ); // reserved for vendor ~1_NAME~ + if ( Vendor != null ) + list.Add( 1062498, Vendor.Name ); // reserved for vendor ~1_NAME~ } public void RestartTimer() @@ -1678,10 +1650,10 @@ namespace Server.Mobiles public override void OnDelete() { - if ( m_Vendor != null && !m_Vendor.Deleted ) + if ( Vendor != null && !Vendor.Deleted ) { - m_Vendor.MoveToWorld( Location, Map ); - m_Vendor.Placeholder = null; + Vendor.MoveToWorld( Location, Map ); + Vendor.Placeholder = null; } } @@ -1691,7 +1663,7 @@ namespace Server.Mobiles writer.WriteEncodedInt( (int) 0 ); - writer.Write( (Mobile) m_Vendor ); + writer.Write( (Mobile) Vendor ); } public override void Deserialize( GenericReader reader ) @@ -1700,7 +1672,7 @@ namespace Server.Mobiles int version = reader.ReadEncodedInt(); - m_Vendor = (PlayerVendor) reader.ReadMobile(); + Vendor = (PlayerVendor) reader.ReadMobile(); Timer.DelayCall( TimeSpan.Zero, Delete ); } diff --git a/Scripts/Mobiles/Vendors/RentedVendor.cs b/Scripts/Mobiles/Vendors/RentedVendor.cs index 5faf82ab7..cdbd7369d 100644 --- a/Scripts/Mobiles/Vendors/RentedVendor.cs +++ b/Scripts/Mobiles/Vendors/RentedVendor.cs @@ -17,11 +17,9 @@ namespace Server.Mobiles new VendorRentalDuration( TimeSpan.FromDays( 28.0 ), 1062364 ) // 1 Month }; - private TimeSpan m_Duration; - private int m_Name; + public TimeSpan Duration { get; } - public TimeSpan Duration => m_Duration; - public int Name => m_Name; + public int Name { get; } public int ID { @@ -39,34 +37,25 @@ namespace Server.Mobiles private VendorRentalDuration( TimeSpan duration, int name ) { - m_Duration = duration; - m_Name = name; + Duration = duration; + Name = name; } } public class RentedVendor : PlayerVendor { - private VendorRentalDuration m_RentalDuration; - private int m_RentalPrice; - private bool m_LandlordRenew; - private bool m_RenterRenew; - private int m_RenewalPrice; - - private int m_RentalGold; - - private DateTime m_RentalExpireTime; private Timer m_RentalExpireTimer; public RentedVendor( Mobile owner, BaseHouse house, VendorRentalDuration duration, int rentalPrice, bool landlordRenew, int rentalGold ) : base( owner, house ) { - m_RentalDuration = duration; - m_RentalPrice = m_RenewalPrice = rentalPrice; - m_LandlordRenew = landlordRenew; - m_RenterRenew = false; + RentalDuration = duration; + RentalPrice = RenewalPrice = rentalPrice; + LandlordRenew = landlordRenew; + RenterRenew = false; - m_RentalGold = rentalGold; + RentalGold = rentalGold; - m_RentalExpireTime = DateTime.UtcNow + duration.Duration; + RentalExpireTime = DateTime.UtcNow + duration.Duration; m_RentalExpireTimer = new RentalExpireTimer( this, duration.Duration ); m_RentalExpireTimer.Start(); } @@ -75,48 +64,28 @@ namespace Server.Mobiles { } - public VendorRentalDuration RentalDuration => m_RentalDuration; + public VendorRentalDuration RentalDuration { get; private set; } [CommandProperty( AccessLevel.GameMaster )] - public int RentalPrice - { - get => m_RentalPrice; - set => m_RentalPrice = value; - } + public int RentalPrice { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool LandlordRenew - { - get => m_LandlordRenew; - set => m_LandlordRenew = value; - } + public bool LandlordRenew { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool RenterRenew - { - get => m_RenterRenew; - set => m_RenterRenew = value; - } + public bool RenterRenew { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool Renew => LandlordRenew && RenterRenew && House != null && House.DecayType != DecayType.Condemned; [CommandProperty( AccessLevel.GameMaster )] - public int RenewalPrice - { - get => m_RenewalPrice; - set => m_RenewalPrice = value; - } + public int RenewalPrice { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int RentalGold - { - get => m_RentalGold; - set => m_RentalGold = value; - } + public int RentalGold { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public DateTime RentalExpireTime => m_RentalExpireTime; + public DateTime RentalExpireTime { get; private set; } public override bool IsOwner( Mobile m ) { @@ -340,16 +309,16 @@ namespace Server.Mobiles writer.WriteEncodedInt( 0 ); // version - writer.WriteEncodedInt( m_RentalDuration.ID ); + writer.WriteEncodedInt( RentalDuration.ID ); - writer.Write( (int) m_RentalPrice ); - writer.Write( (bool) m_LandlordRenew ); - writer.Write( (bool) m_RenterRenew ); - writer.Write( (int) m_RenewalPrice ); + writer.Write( (int) RentalPrice ); + writer.Write( (bool) LandlordRenew ); + writer.Write( (bool) RenterRenew ); + writer.Write( (int) RenewalPrice ); - writer.Write( (int) m_RentalGold ); + writer.Write( (int) RentalGold ); - writer.WriteDeltaTime( (DateTime) m_RentalExpireTime ); + writer.WriteDeltaTime( (DateTime) RentalExpireTime ); } public override void Deserialize( GenericReader reader ) @@ -360,20 +329,20 @@ namespace Server.Mobiles int durationID = reader.ReadEncodedInt(); if ( durationID < VendorRentalDuration.Instances.Length ) - m_RentalDuration = VendorRentalDuration.Instances[durationID]; + RentalDuration = VendorRentalDuration.Instances[durationID]; else - m_RentalDuration = VendorRentalDuration.Instances[0]; + RentalDuration = VendorRentalDuration.Instances[0]; - m_RentalPrice = reader.ReadInt(); - m_LandlordRenew = reader.ReadBool(); - m_RenterRenew = reader.ReadBool(); - m_RenewalPrice = reader.ReadInt(); + RentalPrice = reader.ReadInt(); + LandlordRenew = reader.ReadBool(); + RenterRenew = reader.ReadBool(); + RenewalPrice = reader.ReadInt(); - m_RentalGold = reader.ReadInt(); + RentalGold = reader.ReadInt(); - m_RentalExpireTime = reader.ReadDeltaTime(); + RentalExpireTime = reader.ReadDeltaTime(); - TimeSpan delay = m_RentalExpireTime - DateTime.UtcNow; + TimeSpan delay = RentalExpireTime - DateTime.UtcNow; m_RentalExpireTimer = new RentalExpireTimer( this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero ); m_RentalExpireTimer.Start(); } @@ -400,7 +369,7 @@ namespace Server.Mobiles m_Vendor.RentalPrice = renewalPrice; - m_Vendor.m_RentalExpireTime = DateTime.UtcNow + m_Vendor.RentalDuration.Duration; + m_Vendor.RentalExpireTime = DateTime.UtcNow + m_Vendor.RentalDuration.Duration; } else { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBChainmailArmor.cs b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBChainmailArmor.cs index 7d39b907c..cf610f9aa 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBChainmailArmor.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBChainmailArmor.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBChainmailArmor: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBChainmailArmor() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBHelmetArmor.cs b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBHelmetArmor.cs index ff3915ae2..97468a773 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBHelmetArmor.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBHelmetArmor.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBHelmetArmor: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBHelmetArmor() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBLeatherArmor.cs b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBLeatherArmor.cs index 59f205b18..430cb2e96 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBLeatherArmor.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBLeatherArmor.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBLeatherArmor: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBLeatherArmor() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBMetalShields.cs b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBMetalShields.cs index 43b718c0a..b8d10a9ed 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBMetalShields.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBMetalShields.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBMetalShields : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBMetalShields() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBPlateArmor.cs b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBPlateArmor.cs index 45b0c69f3..9661859f4 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBPlateArmor.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBPlateArmor.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBPlateArmor: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBPlateArmor() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBRingmailArmor.cs b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBRingmailArmor.cs index 9599737df..b6d711319 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBRingmailArmor.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBRingmailArmor.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBRingmailArmor: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBRingmailArmor() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBStuddedArmor.cs b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBStuddedArmor.cs index bb0f9a6e1..57a0d4c0b 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBStuddedArmor.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBStuddedArmor.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBStuddedArmor: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBStuddedArmor() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBWoodenShields.cs b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBWoodenShields.cs index fecb2f71f..4e4761f49 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Armors/SBWoodenShields.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Armors/SBWoodenShields.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBWoodenShields: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBWoodenShields() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBAlchemist.cs b/Scripts/Mobiles/Vendors/SBInfo/SBAlchemist.cs index 3c0fc1500..89fd2ac8a 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBAlchemist.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBAlchemist.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBAlchemist : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBAlchemist() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBAnimalTrainer.cs b/Scripts/Mobiles/Vendors/SBInfo/SBAnimalTrainer.cs index cef9380a2..8db403177 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBAnimalTrainer.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBAnimalTrainer.cs @@ -4,15 +4,13 @@ namespace Server.Mobiles { public class SBAnimalTrainer : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBAnimalTrainer() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBArchitect.cs b/Scripts/Mobiles/Vendors/SBInfo/SBArchitect.cs index cfd5e37c0..7ba2e23b7 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBArchitect.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBArchitect.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBArchitect : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBArchitect() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBBaker.cs b/Scripts/Mobiles/Vendors/SBInfo/SBBaker.cs index 66dceb416..eb6e63c69 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBBaker.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBBaker.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBBaker : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBBaker() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBBanker.cs b/Scripts/Mobiles/Vendors/SBInfo/SBBanker.cs index 828013914..22da9420e 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBBanker.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBBanker.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBBanker : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBBanker() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBBard.cs b/Scripts/Mobiles/Vendors/SBInfo/SBBard.cs index 183f321e7..729c8007c 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBBard.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBBard.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBBard: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBBard() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBBarkeeper.cs b/Scripts/Mobiles/Vendors/SBInfo/SBBarkeeper.cs index edd17581d..43fe689cc 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBBarkeeper.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBBarkeeper.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBBarkeeper : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBBarkeeper() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBBeekeeper.cs b/Scripts/Mobiles/Vendors/SBInfo/SBBeekeeper.cs index f76b38e82..42aa05cc9 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBBeekeeper.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBBeekeeper.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBBeekeeper : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBBeekeeper() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBBlacksmith.cs b/Scripts/Mobiles/Vendors/SBInfo/SBBlacksmith.cs index 73e43822d..8be5b3384 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBBlacksmith.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBBlacksmith.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBBlacksmith : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBBlacksmith() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBBowyer.cs b/Scripts/Mobiles/Vendors/SBInfo/SBBowyer.cs index b49209e15..9b2a17806 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBBowyer.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBBowyer.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBBowyer : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBBowyer() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBButcher.cs b/Scripts/Mobiles/Vendors/SBInfo/SBButcher.cs index 42508c986..51eabfef1 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBButcher.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBButcher.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBButcher : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBButcher() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBCarpenter.cs b/Scripts/Mobiles/Vendors/SBInfo/SBCarpenter.cs index 6ddfa1c05..b65a63196 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBCarpenter.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBCarpenter.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBCarpenter: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBCarpenter() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBCobbler.cs b/Scripts/Mobiles/Vendors/SBInfo/SBCobbler.cs index 9afce54fd..7b81dcab0 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBCobbler.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBCobbler.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBCobbler : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBCobbler() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBCook.cs b/Scripts/Mobiles/Vendors/SBInfo/SBCook.cs index 43eee95c7..688a8154e 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBCook.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBCook.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBCook : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBCook() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBFarmer.cs b/Scripts/Mobiles/Vendors/SBInfo/SBFarmer.cs index 60d40c9fa..7e4382fef 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBFarmer.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBFarmer.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBFarmer : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBFarmer() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBFisherman.cs b/Scripts/Mobiles/Vendors/SBInfo/SBFisherman.cs index 0b717fd07..ae47755af 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBFisherman.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBFisherman.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBFisherman : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBFisherman() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBFortuneTeller.cs b/Scripts/Mobiles/Vendors/SBInfo/SBFortuneTeller.cs index 15bf9819a..cfdf3249e 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBFortuneTeller.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBFortuneTeller.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBFortuneTeller : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBFortuneTeller() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBFurtrader.cs b/Scripts/Mobiles/Vendors/SBInfo/SBFurtrader.cs index e4b22aaba..a78b68dbb 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBFurtrader.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBFurtrader.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBFurtrader : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBFurtrader() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBGlassblower.cs b/Scripts/Mobiles/Vendors/SBInfo/SBGlassblower.cs index efdba88f9..bde160e79 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBGlassblower.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBGlassblower.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBGlassblower : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBGlassblower() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBHairStylist.cs b/Scripts/Mobiles/Vendors/SBInfo/SBHairStylist.cs index 823e17920..6a49582a3 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBHairStylist.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBHairStylist.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBHairStylist : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBHairStylist() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBHealer.cs b/Scripts/Mobiles/Vendors/SBInfo/SBHealer.cs index e7dcb9de6..5953533de 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBHealer.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBHealer.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBHealer : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBHealer() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBHerbalist.cs b/Scripts/Mobiles/Vendors/SBInfo/SBHerbalist.cs index 5dfb1d206..4d57cb507 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBHerbalist.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBHerbalist.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBHerbalist : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBHerbalist() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBHolyMage.cs b/Scripts/Mobiles/Vendors/SBInfo/SBHolyMage.cs index d46b5d51f..1f22d69a8 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBHolyMage.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBHolyMage.cs @@ -6,15 +6,13 @@ namespace Server.Mobiles { public class SBHolyMage : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBHolyMage() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBHouseDeed.cs b/Scripts/Mobiles/Vendors/SBInfo/SBHouseDeed.cs index 33ea31d1b..a7c3eb94a 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBHouseDeed.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBHouseDeed.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBHouseDeed: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBHouseDeed() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBInnKeeper.cs b/Scripts/Mobiles/Vendors/SBInfo/SBInnKeeper.cs index d3e02d51b..d8a76d464 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBInnKeeper.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBInnKeeper.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBInnKeeper : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBInnKeeper() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBJewel.cs b/Scripts/Mobiles/Vendors/SBInfo/SBJewel.cs index e0ef5c0ef..4176e87b5 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBJewel.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBJewel.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBJewel: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBJewel() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBKeeperOfChivalry.cs b/Scripts/Mobiles/Vendors/SBInfo/SBKeeperOfChivalry.cs index 821f6f677..2c77c416a 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBKeeperOfChivalry.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBKeeperOfChivalry.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBKeeperOfChivalry : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBKeeperOfChivalry() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBLeatherWorker.cs b/Scripts/Mobiles/Vendors/SBInfo/SBLeatherWorker.cs index 372ddf57a..a58ec85b9 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBLeatherWorker.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBLeatherWorker.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBLeatherWorker: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBLeatherWorker() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBMage.cs b/Scripts/Mobiles/Vendors/SBInfo/SBMage.cs index 36e45f126..17f8e25e6 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBMage.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBMage.cs @@ -6,15 +6,13 @@ namespace Server.Mobiles { public class SBMage : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBMage() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBMapmaker.cs b/Scripts/Mobiles/Vendors/SBInfo/SBMapmaker.cs index 3049a42e1..73d9db4d7 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBMapmaker.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBMapmaker.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBMapmaker : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBMapmaker() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBMiller.cs b/Scripts/Mobiles/Vendors/SBInfo/SBMiller.cs index 8fbd66b45..46b02fe77 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBMiller.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBMiller.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBMiller : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBMiller() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBMiner.cs b/Scripts/Mobiles/Vendors/SBInfo/SBMiner.cs index 1c66722e6..7e01d9c86 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBMiner.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBMiner.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBMiner: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBMiner() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBMonk.cs b/Scripts/Mobiles/Vendors/SBInfo/SBMonk.cs index 641037c2e..06aaf76e9 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBMonk.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBMonk.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBMonk : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBMonk() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBNinja.cs b/Scripts/Mobiles/Vendors/SBInfo/SBNinja.cs index f09f151c8..229befd9f 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBNinja.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBNinja.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBNinja : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBNinja() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBPlayerBarkeeper.cs b/Scripts/Mobiles/Vendors/SBInfo/SBPlayerBarkeeper.cs index 48b97c4a1..ffe6f1d70 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBPlayerBarkeeper.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBPlayerBarkeeper.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBPlayerBarkeeper : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBPlayerBarkeeper() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBProvisioner.cs b/Scripts/Mobiles/Vendors/SBInfo/SBProvisioner.cs index 0f0161ce8..d3d0bfb00 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBProvisioner.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBProvisioner.cs @@ -6,15 +6,13 @@ namespace Server.Mobiles { public class SBProvisioner : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBProvisioner() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBRancher.cs b/Scripts/Mobiles/Vendors/SBInfo/SBRancher.cs index b99093101..53b135ea9 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBRancher.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBRancher.cs @@ -4,15 +4,13 @@ namespace Server.Mobiles { public class SBRancher : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBRancher() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBRanger.cs b/Scripts/Mobiles/Vendors/SBInfo/SBRanger.cs index f20409068..7eb4aae23 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBRanger.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBRanger.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBRanger : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBRanger() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBRealEstateBroker.cs b/Scripts/Mobiles/Vendors/SBInfo/SBRealEstateBroker.cs index 914cef6d4..acc8c7e0b 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBRealEstateBroker.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBRealEstateBroker.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBRealEstateBroker : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBRealEstateBroker() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBSECook.cs b/Scripts/Mobiles/Vendors/SBInfo/SBSECook.cs index ea92d17b0..7a4ae45a2 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBSECook.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBSECook.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBSECook: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBSECook() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBSEHats.cs b/Scripts/Mobiles/Vendors/SBInfo/SBSEHats.cs index 5a576bee6..14401c6c8 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBSEHats.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBSEHats.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBSEHats: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBSEHats() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBSamurai.cs b/Scripts/Mobiles/Vendors/SBInfo/SBSamurai.cs index dde3eb0e3..7d6c9d946 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBSamurai.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBSamurai.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBSamurai : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBSamurai() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBScribe.cs b/Scripts/Mobiles/Vendors/SBInfo/SBScribe.cs index b7de83771..08704ecf4 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBScribe.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBScribe.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBScribe: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBScribe() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBShipwright.cs b/Scripts/Mobiles/Vendors/SBInfo/SBShipwright.cs index 0ce3afa84..036fbdd9b 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBShipwright.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBShipwright.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBShipwright : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBShipwright() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBSmithTools.cs b/Scripts/Mobiles/Vendors/SBInfo/SBSmithTools.cs index bb6d189ad..556218f49 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBSmithTools.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBSmithTools.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBSmithTools: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBSmithTools() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBStoneCrafter.cs b/Scripts/Mobiles/Vendors/SBInfo/SBStoneCrafter.cs index 55dcb99d3..b68f58080 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBStoneCrafter.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBStoneCrafter.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBStoneCrafter : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBStoneCrafter() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBTailor.cs b/Scripts/Mobiles/Vendors/SBInfo/SBTailor.cs index 8b47f20b5..7a7c211e2 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBTailor.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBTailor.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBTailor: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBTailor() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBTanner.cs b/Scripts/Mobiles/Vendors/SBInfo/SBTanner.cs index 784e60d9a..c10d7f942 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBTanner.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBTanner.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBTanner : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBTanner() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBTavernKeeper.cs b/Scripts/Mobiles/Vendors/SBInfo/SBTavernKeeper.cs index c0d9da456..f3c454865 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBTavernKeeper.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBTavernKeeper.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBTavernKeeper : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBTavernKeeper() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBThief.cs b/Scripts/Mobiles/Vendors/SBInfo/SBThief.cs index 1a3d7f13c..375bbbc1d 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBThief.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBThief.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBThief : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBThief() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBTinker.cs b/Scripts/Mobiles/Vendors/SBInfo/SBTinker.cs index 792b63386..96dc8fccf 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBTinker.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBTinker.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBTinker: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBTinker() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBVagabond.cs b/Scripts/Mobiles/Vendors/SBInfo/SBVagabond.cs index c2f6b818e..4bc39b2bc 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBVagabond.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBVagabond.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBVagabond : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBVagabond() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBVarietyDealer.cs b/Scripts/Mobiles/Vendors/SBInfo/SBVarietyDealer.cs index 1db6c5dbd..d295347b6 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBVarietyDealer.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBVarietyDealer.cs @@ -6,15 +6,13 @@ namespace Server.Mobiles { public class SBVarietyDealer : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBVarietyDealer() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBVeterinarian.cs b/Scripts/Mobiles/Vendors/SBInfo/SBVeterinarian.cs index 8d4e800db..8d05e974b 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBVeterinarian.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBVeterinarian.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBVeterinarian : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBVeterinarian() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBWaiter.cs b/Scripts/Mobiles/Vendors/SBInfo/SBWaiter.cs index 9e7147b66..adfcbb1ca 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBWaiter.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBWaiter.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBWaiter : SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBWaiter() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBWeaponSmith.cs b/Scripts/Mobiles/Vendors/SBInfo/SBWeaponSmith.cs index 49d2eceaf..ffc56ba94 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBWeaponSmith.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBWeaponSmith.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBWeaponSmith: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBWeaponSmith() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBWeaver.cs b/Scripts/Mobiles/Vendors/SBInfo/SBWeaver.cs index 398f22904..ed6e5c36c 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBWeaver.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBWeaver.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBWeaver: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBWeaver() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEArmor.cs b/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEArmor.cs index 8bd8ee4e3..c8cfa18c5 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEArmor.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEArmor.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBSEArmor: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBSEArmor() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEBowyer.cs b/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEBowyer.cs index 44dfe828a..a8837d74a 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEBowyer.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEBowyer.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBSEBowyer: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBSEBowyer() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SE/SBSECarpenter.cs b/Scripts/Mobiles/Vendors/SBInfo/SE/SBSECarpenter.cs index e9cb6f66e..6258f1e50 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SE/SBSECarpenter.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SE/SBSECarpenter.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBSECarpenter: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBSECarpenter() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEFood.cs b/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEFood.cs index 42bdbc6db..40f30c236 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEFood.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEFood.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBSEFood: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBSEFood() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SE/SBSELeatherArmor.cs b/Scripts/Mobiles/Vendors/SBInfo/SE/SBSELeatherArmor.cs index 33ea6b19d..cc5a6c969 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SE/SBSELeatherArmor.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SE/SBSELeatherArmor.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBSELeatherArmor: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBSELeatherArmor() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEWeapons.cs b/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEWeapons.cs index 36e97dcea..79d9a0a27 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEWeapons.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SE/SBSEWeapons.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBSEWeapons: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBSEWeapons() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBAxeWeapon.cs b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBAxeWeapon.cs index 6a5984afd..95ac3f25b 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBAxeWeapon.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBAxeWeapon.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBAxeWeapon: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBAxeWeapon() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBKnifeWeapon.cs b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBKnifeWeapon.cs index d5ea085c5..d112fe6b0 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBKnifeWeapon.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBKnifeWeapon.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBKnifeWeapon: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBKnifeWeapon() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBMaceWeapon.cs b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBMaceWeapon.cs index 13e2423cc..415fa20b5 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBMaceWeapon.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBMaceWeapon.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBMaceWeapon: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBMaceWeapon() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBPoleArmWeapon.cs b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBPoleArmWeapon.cs index bbda2c094..96540ee17 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBPoleArmWeapon.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBPoleArmWeapon.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBPoleArmWeapon: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBPoleArmWeapon() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBRangedWeapon.cs b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBRangedWeapon.cs index 77e4757d0..926deef63 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBRangedWeapon.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBRangedWeapon.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBRangedWeapon: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBRangedWeapon() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBSpearForkWeapon.cs b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBSpearForkWeapon.cs index 598eab138..702afd1ab 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBSpearForkWeapon.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBSpearForkWeapon.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBSpearForkWeapon: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBSpearForkWeapon() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBStavesWeapon.cs b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBStavesWeapon.cs index e06b983bd..be4f2e736 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBStavesWeapon.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBStavesWeapon.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBStavesWeapon: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBStavesWeapon() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBSwordWeapon.cs b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBSwordWeapon.cs index 9db7b078a..eb71e08c9 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBSwordWeapon.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBSwordWeapon.cs @@ -5,15 +5,13 @@ namespace Server.Mobiles { public class SBSwordWeapon: SBInfo { - private List m_BuyInfo = new InternalBuyInfo(); - private IShopSellInfo m_SellInfo = new InternalSellInfo(); - public SBSwordWeapon() { } - public override IShopSellInfo SellInfo => m_SellInfo; - public override List BuyInfo => m_BuyInfo; + public override IShopSellInfo SellInfo { get; } = new InternalSellInfo(); + + public override List BuyInfo { get; } = new InternalBuyInfo(); public class InternalBuyInfo : List { diff --git a/Scripts/Mobiles/Vendors/VendorInventory.cs b/Scripts/Mobiles/Vendors/VendorInventory.cs index bf6cf227f..9491b8b9f 100644 --- a/Scripts/Mobiles/Vendors/VendorInventory.cs +++ b/Scripts/Mobiles/Vendors/VendorInventory.cs @@ -8,69 +8,40 @@ namespace Server.Mobiles { public static readonly TimeSpan GracePeriod = TimeSpan.FromDays( 7.0 ); - private BaseHouse m_House; - private string m_VendorName; - private string m_ShopName; - private Mobile m_Owner; - - private List m_Items; - private int m_Gold; - - private DateTime m_ExpireTime; private Timer m_ExpireTimer; public VendorInventory( BaseHouse house, Mobile owner, string vendorName, string shopName ) { - m_House = house; - m_Owner = owner; - m_VendorName = vendorName; - m_ShopName = shopName; + House = house; + Owner = owner; + VendorName = vendorName; + ShopName = shopName; - m_Items = new List(); + Items = new List(); - m_ExpireTime = DateTime.UtcNow + GracePeriod; + ExpireTime = DateTime.UtcNow + GracePeriod; m_ExpireTimer = new ExpireTimer( this, GracePeriod ); m_ExpireTimer.Start(); } - public BaseHouse House - { - get => m_House; - set => m_House = value; - } + public BaseHouse House { get; set; } - public string VendorName - { - get => m_VendorName; - set => m_VendorName = value; - } + public string VendorName { get; set; } - public string ShopName - { - get => m_ShopName; - set => m_ShopName = value; - } + public string ShopName { get; set; } - public Mobile Owner - { - get => m_Owner; - set => m_Owner = value; - } + public Mobile Owner { get; set; } - public List Items => m_Items; + public List Items { get; } - public int Gold - { - get => m_Gold; - set => m_Gold = value; - } + public int Gold { get; set; } - public DateTime ExpireTime => m_ExpireTime; + public DateTime ExpireTime { get; } public void AddItem( Item item ) { item.Internalize(); - m_Items.Add( item ); + Items.Add( item ); } public void Delete() @@ -92,38 +63,38 @@ namespace Server.Mobiles { writer.WriteEncodedInt( 0 ); // version - writer.Write( (Mobile) m_Owner ); - writer.Write( (string) m_VendorName ); - writer.Write( (string) m_ShopName ); + writer.Write( (Mobile) Owner ); + writer.Write( (string) VendorName ); + writer.Write( (string) ShopName ); - writer.Write( m_Items, true ); - writer.Write( (int) m_Gold ); + writer.Write( Items, true ); + writer.Write( (int) Gold ); - writer.WriteDeltaTime( m_ExpireTime ); + writer.WriteDeltaTime( ExpireTime ); } public VendorInventory( BaseHouse house, GenericReader reader ) { - m_House = house; + House = house; int version = reader.ReadEncodedInt(); - m_Owner = reader.ReadMobile(); - m_VendorName = reader.ReadString(); - m_ShopName = reader.ReadString(); + Owner = reader.ReadMobile(); + VendorName = reader.ReadString(); + ShopName = reader.ReadString(); - m_Items = reader.ReadStrongItemList(); - m_Gold = reader.ReadInt(); + Items = reader.ReadStrongItemList(); + Gold = reader.ReadInt(); - m_ExpireTime = reader.ReadDeltaTime(); + ExpireTime = reader.ReadDeltaTime(); - if ( m_Items.Count == 0 && m_Gold == 0 ) + if ( Items.Count == 0 && Gold == 0 ) { Timer.DelayCall( TimeSpan.Zero, Delete ); } else { - TimeSpan delay = m_ExpireTime - DateTime.UtcNow; + TimeSpan delay = ExpireTime - DateTime.UtcNow; m_ExpireTimer = new ExpireTimer( this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero ); m_ExpireTimer.Start(); } diff --git a/Scripts/Multis/BaseHouse.cs b/Scripts/Multis/BaseHouse.cs index 9d5c2fb40..ff337ec34 100644 --- a/Scripts/Multis/BaseHouse.cs +++ b/Scripts/Multis/BaseHouse.cs @@ -26,19 +26,14 @@ namespace Server.Multis #region Dynamic decay system private DecayLevel m_CurrentStage; - private DateTime m_NextDecayStage; [CommandProperty( AccessLevel.GameMaster )] - public DateTime NextDecayStage - { - get => m_NextDecayStage; - set => m_NextDecayStage = value; - } + public DateTime NextDecayStage { get; set; } public void ResetDynamicDecay() { m_CurrentStage = DecayLevel.Ageless; - m_NextDecayStage = DateTime.MinValue; + NextDecayStage = DateTime.MinValue; } public void SetDynamicDecay( DecayLevel level ) @@ -46,9 +41,9 @@ namespace Server.Multis m_CurrentStage = level; if ( DynamicDecay.Decays( level ) ) - m_NextDecayStage = DateTime.UtcNow + DynamicDecay.GetRandomDuration( level ); + NextDecayStage = DateTime.UtcNow + DynamicDecay.GetRandomDuration( level ); else - m_NextDecayStage = DateTime.MinValue; + NextDecayStage = DateTime.MinValue; } #endregion @@ -56,26 +51,15 @@ namespace Server.Multis public static void Decay_OnTick() { - for ( int i = 0; i < m_AllHouses.Count; ++i ) - m_AllHouses[i].CheckDecay(); - } - - private DateTime m_LastRefreshed; - private bool m_RestrictDecay; - - [CommandProperty( AccessLevel.GameMaster )] - public DateTime LastRefreshed - { - get => m_LastRefreshed; - set => m_LastRefreshed = value; + for ( int i = 0; i < AllHouses.Count; ++i ) + AllHouses[i].CheckDecay(); } [CommandProperty( AccessLevel.GameMaster )] - public bool RestrictDecay - { - get => m_RestrictDecay; - set => m_RestrictDecay = value; - } + public DateTime LastRefreshed { get; set; } + + [CommandProperty( AccessLevel.GameMaster )] + public bool RestrictDecay { get; set; } public virtual TimeSpan DecayPeriod => TimeSpan.FromDays( 5.0 ); @@ -83,7 +67,7 @@ namespace Server.Multis { get { - if ( m_RestrictDecay || !DecayEnabled || DecayPeriod == TimeSpan.Zero ) + if ( RestrictDecay || !DecayEnabled || DecayPeriod == TimeSpan.Zero ) return DecayType.Ageless; if ( m_Owner == null ) @@ -170,14 +154,14 @@ namespace Server.Multis if ( DynamicDecay.Enabled ) ResetDynamicDecay(); - m_LastRefreshed = DateTime.UtcNow; + LastRefreshed = DateTime.UtcNow; result = DecayLevel.Ageless; } else if ( DynamicDecay.Enabled ) { DecayLevel stage = m_CurrentStage; - if ( stage == DecayLevel.Ageless || ( DynamicDecay.Decays( stage ) && m_NextDecayStage <= DateTime.UtcNow ) ) + if ( stage == DecayLevel.Ageless || ( DynamicDecay.Decays( stage ) && NextDecayStage <= DateTime.UtcNow ) ) SetDynamicDecay( ++stage ); if ( stage == DecayLevel.Collapsed && ( HasRentedVendors || VendorInventories.Count > 0 ) ) @@ -194,8 +178,8 @@ namespace Server.Multis { m_LastDecayLevel = result; - if ( m_Sign != null && !m_Sign.GettingProperties ) - m_Sign.InvalidateProperties(); + if ( Sign != null && !Sign.GettingProperties ) + Sign.InvalidateProperties(); } return result; @@ -204,7 +188,7 @@ namespace Server.Multis public DecayLevel GetOldDecayLevel() { - TimeSpan timeAfterRefresh = DateTime.UtcNow - m_LastRefreshed; + TimeSpan timeAfterRefresh = DateTime.UtcNow - LastRefreshed; int percent = (int) ((timeAfterRefresh.Ticks * 1000) / DecayPeriod.Ticks); if ( percent >= 1000 ) // 100.0% @@ -230,12 +214,12 @@ namespace Server.Multis DecayLevel oldLevel = DecayLevel; - m_LastRefreshed = DateTime.UtcNow; + LastRefreshed = DateTime.UtcNow; if ( DynamicDecay.Enabled ) ResetDynamicDecay(); - m_Sign?.InvalidateProperties(); + Sign?.InvalidateProperties(); return ( oldLevel > DecayLevel.LikeNew ); } @@ -284,40 +268,10 @@ namespace Server.Multis private bool m_Public; private HouseRegion m_Region; - private HouseSign m_Sign; private TrashBarrel m_Trash; - private ArrayList m_Doors; private Mobile m_Owner; - private ArrayList m_Access; - private ArrayList m_Bans; - private ArrayList m_CoOwners; - private ArrayList m_Friends; - - private ArrayList m_PlayerVendors = new ArrayList(); - private ArrayList m_PlayerBarkeepers = new ArrayList(); - - private ArrayList m_LockDowns; - private ArrayList m_VendorRentalContracts; - private ArrayList m_Secures; - - private ArrayList m_Addons; - - private ArrayList m_VendorInventories = new ArrayList(); - private ArrayList m_RelocatedEntities = new ArrayList(); - - private MovingCrate m_MovingCrate; - private ArrayList m_InternalizedVendors; - - private int m_MaxLockDowns; - private int m_MaxSecures; - private int m_Price; - - private int m_Visits; - - private DateTime m_BuiltOn, m_LastTraded; - private Point3D m_RelativeBanLocation; private static Dictionary> m_Table = new Dictionary>(); @@ -358,7 +312,7 @@ namespace Server.Multis fromLockdowns = 0; fromMovingCrate = 0; - ArrayList list = m_Secures; + ArrayList list = Secures; if ( list != null ) { @@ -949,8 +903,8 @@ namespace Server.Multis v += GetLockdowns(); - if ( m_Secures != null ) - v += m_Secures.Count; + if ( Secures != null ) + v += Secures.Count; if ( !NewVendorSystem ) v += PlayerVendors.Count * 10; @@ -1187,12 +1141,12 @@ namespace Server.Multis public SecureAccessResult CheckSecureAccess( Mobile m, Item item ) { - if ( m_Secures == null || !(item is Container) ) + if ( Secures == null || !(item is Container) ) return SecureAccessResult.Insecure; - for ( int i = 0; i < m_Secures.Count; ++i ) + for ( int i = 0; i < Secures.Count; ++i ) { - SecureInfo info = (SecureInfo)m_Secures[i]; + SecureInfo info = (SecureInfo)Secures[i]; if ( info.Item == item ) return HasSecureAccess( m, info.Level ) ? SecureAccessResult.Accessible : SecureAccessResult.Inaccessible; @@ -1201,36 +1155,34 @@ namespace Server.Multis return SecureAccessResult.Insecure; } - private static List m_AllHouses = new List(); - - public static List AllHouses => m_AllHouses; + public static List AllHouses { get; } = new List(); public BaseHouse( int multiID, Mobile owner, int MaxLockDown, int MaxSecure ) : base( multiID ) { - m_AllHouses.Add( this ); + AllHouses.Add( this ); - m_LastRefreshed = DateTime.UtcNow; + LastRefreshed = DateTime.UtcNow; - m_BuiltOn = DateTime.UtcNow; - m_LastTraded = DateTime.MinValue; + BuiltOn = DateTime.UtcNow; + LastTraded = DateTime.MinValue; - m_Doors = new ArrayList(); - m_LockDowns = new ArrayList(); - m_Secures = new ArrayList(); - m_Addons = new ArrayList(); + Doors = new ArrayList(); + LockDowns = new ArrayList(); + Secures = new ArrayList(); + Addons = new ArrayList(); - m_CoOwners = new ArrayList(); - m_Friends = new ArrayList(); - m_Bans = new ArrayList(); - m_Access = new ArrayList(); + CoOwners = new ArrayList(); + Friends = new ArrayList(); + Bans = new ArrayList(); + Access = new ArrayList(); - m_VendorRentalContracts = new ArrayList(); - m_InternalizedVendors = new ArrayList(); + VendorRentalContracts = new ArrayList(); + InternalizedVendors = new ArrayList(); m_Owner = owner; - m_MaxLockDowns = MaxLockDown; - m_MaxSecures = MaxSecure; + MaxLockDowns = MaxLockDown; + MaxSecures = MaxSecure; m_RelativeBanLocation = BaseBanLocation; @@ -1251,22 +1203,22 @@ namespace Server.Multis public BaseHouse( Serial serial ) : base( serial ) { - m_AllHouses.Add( this ); + AllHouses.Add( this ); } public override void OnMapChange() { - if ( m_LockDowns == null ) + if ( LockDowns == null ) return; UpdateRegion(); - if ( m_Sign != null && !m_Sign.Deleted ) - m_Sign.Map = Map; + if ( Sign != null && !Sign.Deleted ) + Sign.Map = Map; - if ( m_Doors != null ) + if ( Doors != null ) { - foreach ( Item item in m_Doors ) + foreach ( Item item in Doors ) item.Map = Map; } @@ -1281,8 +1233,8 @@ namespace Server.Multis public virtual void ChangeSignType( int itemID ) { - if ( m_Sign != null ) - m_Sign.ItemID = itemID; + if ( Sign != null ) + Sign.ItemID = itemID; } public abstract Rectangle2D[] Area{ get; } @@ -1305,21 +1257,21 @@ namespace Server.Multis public override void OnLocationChange( Point3D oldLocation ) { - if ( m_LockDowns == null ) + if ( LockDowns == null ) return; int x = base.Location.X - oldLocation.X; int y = base.Location.Y - oldLocation.Y; int z = base.Location.Z - oldLocation.Z; - if ( m_Sign != null && !m_Sign.Deleted ) - m_Sign.Location = new Point3D( m_Sign.X + x, m_Sign.Y + y, m_Sign.Z + z ); + if ( Sign != null && !Sign.Deleted ) + Sign.Location = new Point3D( Sign.X + x, Sign.Y + y, Sign.Z + z ); UpdateRegion(); - if ( m_Doors != null ) + if ( Doors != null ) { - foreach ( Item item in m_Doors ) + foreach ( Item item in Doors ) { if ( !item.Deleted ) item.Location = new Point3D( item.X + x, item.Y + y, item.Z + z ); @@ -1479,7 +1431,7 @@ namespace Server.Multis public void AddDoor( BaseDoor door, int xoff, int yoff, int zoff ) { door.MoveToWorld( new Point3D( xoff+X, yoff+Y, zoff+Z ), Map ); - m_Doors.Add( door ); + Doors.Add( door ); } public void AddTrashBarrel( Mobile from ) @@ -1487,9 +1439,9 @@ namespace Server.Multis if ( !IsActive ) return; - for ( int i = 0; m_Doors != null && i < m_Doors.Count; ++i ) + for ( int i = 0; Doors != null && i < Doors.Count; ++i ) { - BaseDoor door = m_Doors[i] as BaseDoor; + BaseDoor door = Doors[i] as BaseDoor; Point3D p = door.Location; if ( door.Open ) @@ -1524,8 +1476,8 @@ namespace Server.Multis public void SetSign( int xoff, int yoff, int zoff ) { - m_Sign = new HouseSign( this ); - m_Sign.MoveToWorld( new Point3D( X + xoff, Y + yoff, Z + zoff ), Map ); + Sign = new HouseSign( this ); + Sign.MoveToWorld( new Point3D( X + xoff, Y + yoff, Z + zoff ), Map ); } private void SetLockdown( Item i, bool locked ) @@ -1535,7 +1487,7 @@ namespace Server.Multis private void SetLockdown( Item i, bool locked, bool checkContains ) { - if ( m_LockDowns == null ) + if ( LockDowns == null ) return; #region Mondain's Legacy @@ -1556,14 +1508,14 @@ namespace Server.Multis } else { - if ( !checkContains || !m_LockDowns.Contains( i ) ) - m_LockDowns.Add( i ); + if ( !checkContains || !LockDowns.Contains( i ) ) + LockDowns.Add( i ); } } else { VendorRentalContracts.Remove( i ); - m_LockDowns.Remove( i ); + LockDowns.Remove( i ); } if ( !locked ) @@ -1613,7 +1565,7 @@ namespace Server.Multis { m.SendLocalizedMessage( 501736 ); // You must lockdown the container first! } - else if ( !(item is VendorRentalContract) && ( IsAosRules ? (!CheckAosLockdowns( amt ) || !CheckAosStorage( amt )) : (LockDownCount + amt) > m_MaxLockDowns ) ) + else if ( !(item is VendorRentalContract) && ( IsAosRules ? (!CheckAosLockdowns( amt ) || !CheckAosStorage( amt )) : (LockDownCount + amt) > MaxLockDowns ) ) { m.SendLocalizedMessage( 1005379 );//That would exceed the maximum lock down limit for this house } @@ -1623,7 +1575,7 @@ namespace Server.Multis return true; } } - else if ( m_LockDowns.IndexOf( item ) != -1 ) + else if ( LockDowns.IndexOf( item ) != -1 ) { m.LocalOverheadMessage( MessageType.Regular, 0x3E9, 1005526 ); //That is already locked down return true; @@ -1756,7 +1708,7 @@ namespace Server.Multis public bool CheckTransferPosition( Mobile from, Mobile to ) { bool isValid = true; - Item sign = m_Sign; + Item sign = Sign; Point3D p = sign?.GetWorldLocation() ?? Point3D.Zero; if ( from.Map != Map || to.Map != Map ) @@ -1926,7 +1878,7 @@ namespace Server.Multis public void AddSecure( Mobile m, Item item ) { - if ( m_Secures == null || !IsOwner( m ) || !IsActive ) + if ( Secures == null || !IsOwner( m ) || !IsActive ) return; if ( !IsInside( item ) ) @@ -1945,9 +1897,9 @@ namespace Server.Multis { SecureInfo info = null; - for ( int i = 0; info == null && i < m_Secures.Count; ++i ) - if ( ((SecureInfo)m_Secures[i]).Item == item ) - info = (SecureInfo)m_Secures[i]; + for ( int i = 0; info == null && i < Secures.Count; ++i ) + if ( ((SecureInfo)Secures[i]).Item == item ) + info = (SecureInfo)Secures[i]; if ( info != null ) { @@ -1983,8 +1935,8 @@ namespace Server.Multis item.IsLockedDown = false; item.IsSecure = true; - m_Secures.Add( info ); - m_LockDowns.Remove( item ); + Secures.Add( info ); + LockDowns.Remove( item ); item.Movable = false; m.CloseGump( typeof ( SetSecureLevelGump ) ); @@ -2034,12 +1986,12 @@ namespace Server.Multis public void ReleaseSecure( Mobile m, Item item ) { - if ( m_Secures == null || !IsOwner( m ) || item is StrongBox || !IsActive ) + if ( Secures == null || !IsOwner( m ) || item is StrongBox || !IsActive ) return; - for ( int i = 0; i < m_Secures.Count; ++i ) + for ( int i = 0; i < Secures.Count; ++i ) { - SecureInfo info = (SecureInfo)m_Secures[i]; + SecureInfo info = (SecureInfo)Secures[i]; if ( info.Item == item && HasSecureAccess( m, info.Level ) ) { @@ -2055,7 +2007,7 @@ namespace Server.Multis item.Movable = true; item.SetLastMoved(); item.PublicOverheadMessage( MessageType.Label, 0x3B2, 501656 );//[no longer secure] - m_Secures.RemoveAt( i ); + Secures.RemoveAt( i ); return; } } @@ -2076,13 +2028,13 @@ namespace Server.Multis return; } - if ( IsAosRules ? !CheckAosLockdowns( 1 ) : ((LockDownCount + 1) > m_MaxLockDowns) ) + if ( IsAosRules ? !CheckAosLockdowns( 1 ) : ((LockDownCount + 1) > MaxLockDowns) ) { from.SendLocalizedMessage( 1005379 );//That would exceed the maximum lock down limit for this house return; } - foreach ( SecureInfo info in m_Secures ) + foreach ( SecureInfo info in Secures ) { Container c = info.Item; @@ -2093,9 +2045,9 @@ namespace Server.Multis } } - for ( int i = 0; m_Doors != null && i < m_Doors.Count; ++i ) + for ( int i = 0; Doors != null && i < Doors.Count; ++i ) { - BaseDoor door = m_Doors[i] as BaseDoor; + BaseDoor door = Doors[i] as BaseDoor; Point3D p = door.Location; if ( door.Open ) @@ -2115,13 +2067,13 @@ namespace Server.Multis sb.Movable = false; sb.IsLockedDown = false; sb.IsSecure = true; - m_Secures.Add( new SecureInfo( sb, SecureLevel.CoOwners ) ); + Secures.Add( new SecureInfo( sb, SecureLevel.CoOwners ) ); sb.MoveToWorld( from.Location, from.Map ); } public void Kick( Mobile from, Mobile targ ) { - if ( !IsFriend( from ) || m_Friends == null ) + if ( !IsFriend( from ) || Friends == null ) return; if ( targ.AccessLevel > AccessLevel.Player && from.AccessLevel <= targ.AccessLevel ) @@ -2157,12 +2109,12 @@ namespace Server.Multis public void RemoveAccess( Mobile from, Mobile targ ) { - if ( !IsFriend( from ) || m_Access == null ) + if ( !IsFriend( from ) || Access == null ) return; - if ( m_Access.Contains( targ ) ) + if ( Access.Contains( targ ) ) { - m_Access.Remove( targ ); + Access.Remove( targ ); if ( !HasAccess( targ ) && IsInside( targ ) ) { @@ -2176,12 +2128,12 @@ namespace Server.Multis public void RemoveBan( Mobile from, Mobile targ ) { - if ( !IsCoOwner( from ) || m_Bans == null ) + if ( !IsCoOwner( from ) || Bans == null ) return; - if ( m_Bans.Contains( targ ) ) + if ( Bans.Contains( targ ) ) { - m_Bans.Remove( targ ); + Bans.Remove( targ ); from.SendLocalizedMessage( 501297 ); // The ban is lifted. } @@ -2189,7 +2141,7 @@ namespace Server.Multis public void Ban( Mobile from, Mobile targ ) { - if ( !IsFriend( from ) || m_Bans == null ) + if ( !IsFriend( from ) || Bans == null ) return; if ( targ.AccessLevel > AccessLevel.Player && from.AccessLevel <= targ.AccessLevel ) @@ -2204,7 +2156,7 @@ namespace Server.Multis { from.SendLocalizedMessage( 501351 ); // You cannot eject a vendor. } - else if ( m_Bans.Count >= MaxBans ) + else if ( Bans.Count >= MaxBans ) { from.SendLocalizedMessage( 501355 ); // The ban limit for this house has been reached! } @@ -2226,7 +2178,7 @@ namespace Server.Multis } else { - m_Bans.Add( targ ); + Bans.Add( targ ); from.SendLocalizedMessage( 1042839, targ.Name ); // ~1_PLAYER_NAME~ has been banned from this house. targ.SendLocalizedMessage( 501340 ); // You have been banned from this house. @@ -2237,7 +2189,7 @@ namespace Server.Multis public void GrantAccess( Mobile from, Mobile targ ) { - if ( !IsFriend( from ) || m_Access == null ) + if ( !IsFriend( from ) || Access == null ) return; if ( HasAccess( targ ) ) @@ -2254,7 +2206,7 @@ namespace Server.Multis } else { - m_Access.Add( targ ); + Access.Add( targ ); targ.SendLocalizedMessage( 1060735 ); // You have been granted access to this house. } @@ -2262,14 +2214,14 @@ namespace Server.Multis public void AddCoOwner( Mobile from, Mobile targ ) { - if ( !IsOwner( from ) || m_CoOwners == null || m_Friends == null ) + if ( !IsOwner( from ) || CoOwners == null || Friends == null ) return; if ( IsOwner( targ ) ) { from.SendLocalizedMessage( 501360 ); // This person is already the house owner! } - else if ( m_Friends.Contains( targ ) ) + else if ( Friends.Contains( targ ) ) { from.SendLocalizedMessage( 501361 ); // This person is a friend of the house. Remove them first. } @@ -2285,17 +2237,17 @@ namespace Server.Multis { from.SendLocalizedMessage( 501367 ); // This person is banned! Unban them first. } - else if ( m_CoOwners.Count >= MaxCoOwners ) + else if ( CoOwners.Count >= MaxCoOwners ) { from.SendLocalizedMessage( 501368 ); // Your co-owner list is full! } - else if ( m_CoOwners.Contains( targ ) ) + else if ( CoOwners.Contains( targ ) ) { from.SendLocalizedMessage( 501369 ); // This person is already on your co-owner list! } else { - m_CoOwners.Add( targ ); + CoOwners.Add( targ ); targ.Delta( MobileDelta.Noto ); targ.SendLocalizedMessage( 501343 ); // You have been made a co-owner of this house. @@ -2304,19 +2256,19 @@ namespace Server.Multis public void RemoveCoOwner( Mobile from, Mobile targ ) { - if ( !IsOwner( from ) || m_CoOwners == null ) + if ( !IsOwner( from ) || CoOwners == null ) return; - if ( m_CoOwners.Contains( targ ) ) + if ( CoOwners.Contains( targ ) ) { - m_CoOwners.Remove( targ ); + CoOwners.Remove( targ ); targ.Delta( MobileDelta.Noto ); from.SendLocalizedMessage( 501299 ); // Co-owner removed from list. targ.SendLocalizedMessage( 501300 ); // You have been removed as a house co-owner. - foreach ( SecureInfo info in m_Secures ) + foreach ( SecureInfo info in Secures ) { Container c = info.Item; @@ -2324,7 +2276,7 @@ namespace Server.Multis { c.IsLockedDown = false; c.IsSecure = false; - m_Secures.Remove( info ); + Secures.Remove( info ); c.Destroy(); break; } @@ -2334,14 +2286,14 @@ namespace Server.Multis public void AddFriend( Mobile from, Mobile targ ) { - if ( !IsCoOwner( from ) || m_Friends == null || m_CoOwners == null ) + if ( !IsCoOwner( from ) || Friends == null || CoOwners == null ) return; if ( IsOwner( targ ) ) { from.SendLocalizedMessage( 501370 ); // This person is already an owner of the house! } - else if ( m_CoOwners.Contains( targ ) ) + else if ( CoOwners.Contains( targ ) ) { from.SendLocalizedMessage( 501369 ); // This person is already on your co-owner list! } @@ -2353,17 +2305,17 @@ namespace Server.Multis { from.SendLocalizedMessage( 501374 ); // This person is banned! Unban them first. } - else if ( m_Friends.Count >= MaxFriends ) + else if ( Friends.Count >= MaxFriends ) { from.SendLocalizedMessage( 501375 ); // Your friends list is full! } - else if ( m_Friends.Contains( targ ) ) + else if ( Friends.Contains( targ ) ) { from.SendLocalizedMessage( 501376 ); // This person is already on your friends list! } else { - m_Friends.Add( targ ); + Friends.Add( targ ); targ.Delta( MobileDelta.Noto ); targ.SendLocalizedMessage( 501337 ); // You have been made a friend of this house. @@ -2372,12 +2324,12 @@ namespace Server.Multis public void RemoveFriend( Mobile from, Mobile targ ) { - if ( !IsCoOwner( from ) || m_Friends == null ) + if ( !IsCoOwner( from ) || Friends == null ) return; - if ( m_Friends.Contains( targ ) ) + if ( Friends.Contains( targ ) ) { - m_Friends.Remove( targ ); + Friends.Remove( targ ); targ.Delta( MobileDelta.Noto ); @@ -2399,16 +2351,16 @@ namespace Server.Multis else { writer.Write( (int) m_CurrentStage ); - writer.Write( m_NextDecayStage ); + writer.Write( NextDecayStage ); } writer.Write( (Point3D) m_RelativeBanLocation ); - writer.WriteItemList( m_VendorRentalContracts, true ); - writer.WriteMobileList( m_InternalizedVendors, true ); + writer.WriteItemList( VendorRentalContracts, true ); + writer.WriteMobileList( InternalizedVendors, true ); - writer.WriteEncodedInt( m_RelocatedEntities.Count ); - foreach ( RelocatedEntity relEntity in m_RelocatedEntities ) + writer.WriteEncodedInt( RelocatedEntities.Count ); + foreach ( RelocatedEntity relEntity in RelocatedEntities ) { writer.Write( (Point3D) relEntity.RelativeLocation ); @@ -2418,31 +2370,31 @@ namespace Server.Multis writer.Write( (int) relEntity.Entity.Serial ); } - writer.WriteEncodedInt( m_VendorInventories.Count ); - for ( int i = 0; i < m_VendorInventories.Count; i++ ) + writer.WriteEncodedInt( VendorInventories.Count ); + for ( int i = 0; i < VendorInventories.Count; i++ ) { - VendorInventory inventory = (VendorInventory) m_VendorInventories[i]; + VendorInventory inventory = (VendorInventory) VendorInventories[i]; inventory.Serialize( writer ); } - writer.Write( (DateTime) m_LastRefreshed ); - writer.Write( (bool) m_RestrictDecay ); + writer.Write( (DateTime) LastRefreshed ); + writer.Write( (bool) RestrictDecay ); - writer.Write( (int) m_Visits ); + writer.Write( (int) Visits ); - writer.Write( (int) m_Price ); + writer.Write( (int) Price ); - writer.WriteMobileList( m_Access ); + writer.WriteMobileList( Access ); - writer.Write( m_BuiltOn ); - writer.Write( m_LastTraded ); + writer.Write( BuiltOn ); + writer.Write( LastTraded ); - writer.WriteItemList( m_Addons, true ); + writer.WriteItemList( Addons, true ); - writer.Write( m_Secures.Count ); + writer.Write( Secures.Count ); - for ( int i = 0; i < m_Secures.Count; ++i ) - ((SecureInfo)m_Secures[i]).Serialize( writer ); + for ( int i = 0; i < Secures.Count; ++i ) + ((SecureInfo)Secures[i]).Serialize( writer ); writer.Write( m_Public ); @@ -2457,24 +2409,24 @@ namespace Server.Multis writer.Write( rect ); }*/ - writer.WriteMobileList( m_CoOwners, true ); - writer.WriteMobileList( m_Friends, true ); - writer.WriteMobileList( m_Bans, true ); + writer.WriteMobileList( CoOwners, true ); + writer.WriteMobileList( Friends, true ); + writer.WriteMobileList( Bans, true ); - writer.Write( m_Sign ); + writer.Write( Sign ); writer.Write( m_Trash ); - writer.WriteItemList( m_Doors, true ); - writer.WriteItemList( m_LockDowns, true ); + writer.WriteItemList( Doors, true ); + writer.WriteItemList( LockDowns, true ); //writer.WriteItemList( m_Secures, true ); - writer.Write( (int) m_MaxLockDowns ); - writer.Write( (int) m_MaxSecures ); + writer.Write( (int) MaxLockDowns ); + writer.Write( (int) MaxSecures ); // Items in locked down containers that aren't locked down themselves must decay! - for ( int i = 0; i < m_LockDowns.Count; ++i ) + for ( int i = 0; i < LockDowns.Count; ++i ) { - Item item = (Item)m_LockDowns[i]; + Item item = (Item)LockDowns[i]; if ( item is Container && !(item is BaseBoard || item is Aquarium || item is FishBowl) ) { @@ -2509,7 +2461,7 @@ namespace Server.Multis if ( stage != -1 ) { m_CurrentStage = (DecayLevel)stage; - m_NextDecayStage = reader.ReadDateTime(); + NextDecayStage = reader.ReadDateTime(); loadedDynamicDecay = true; } @@ -2523,8 +2475,8 @@ namespace Server.Multis case 13: // removed ban location serialization case 12: { - m_VendorRentalContracts = reader.ReadItemList(); - m_InternalizedVendors = reader.ReadMobileList(); + VendorRentalContracts = reader.ReadItemList(); + InternalizedVendors = reader.ReadMobileList(); int relocatedCount = reader.ReadEncodedInt(); for ( int i = 0; i < relocatedCount; i++ ) @@ -2533,56 +2485,56 @@ namespace Server.Multis IEntity entity = World.FindEntity( reader.ReadInt() ); if ( entity != null ) - m_RelocatedEntities.Add( new RelocatedEntity( entity, relLocation ) ); + RelocatedEntities.Add( new RelocatedEntity( entity, relLocation ) ); } int inventoryCount = reader.ReadEncodedInt(); for ( int i = 0; i < inventoryCount; i++ ) { VendorInventory inventory = new VendorInventory( this, reader ); - m_VendorInventories.Add( inventory ); + VendorInventories.Add( inventory ); } goto case 11; } case 11: { - m_LastRefreshed = reader.ReadDateTime(); - m_RestrictDecay = reader.ReadBool(); + LastRefreshed = reader.ReadDateTime(); + RestrictDecay = reader.ReadBool(); goto case 10; } case 10: // just a signal for updates case 9: { - m_Visits = reader.ReadInt(); + Visits = reader.ReadInt(); goto case 8; } case 8: { - m_Price = reader.ReadInt(); + Price = reader.ReadInt(); goto case 7; } case 7: { - m_Access = reader.ReadMobileList(); + Access = reader.ReadMobileList(); goto case 6; } case 6: { - m_BuiltOn = reader.ReadDateTime(); - m_LastTraded = reader.ReadDateTime(); + BuiltOn = reader.ReadDateTime(); + LastTraded = reader.ReadDateTime(); goto case 5; } case 5: // just removed fields case 4: { - m_Addons = reader.ReadItemList(); + Addons = reader.ReadItemList(); goto case 3; } case 3: { count = reader.ReadInt(); - m_Secures = new ArrayList( count ); + Secures = new ArrayList( count ); for ( int i = 0; i < count; ++i ) { @@ -2591,7 +2543,7 @@ namespace Server.Multis if ( info.Item != null ) { info.Item.IsSecure = true; - m_Secures.Add( info ); + Secures.Add( info ); } } @@ -2615,18 +2567,18 @@ namespace Server.Multis if ( version < 12 ) { - m_VendorRentalContracts = new ArrayList(); - m_InternalizedVendors = new ArrayList(); + VendorRentalContracts = new ArrayList(); + InternalizedVendors = new ArrayList(); } if ( version < 4 ) - m_Addons = new ArrayList(); + Addons = new ArrayList(); if ( version < 7 ) - m_Access = new ArrayList(); + Access = new ArrayList(); if ( version < 8 ) - m_Price = DefaultPrice; + Price = DefaultPrice; m_Owner = reader.ReadMobile(); @@ -2640,26 +2592,26 @@ namespace Server.Multis UpdateRegion(); - m_CoOwners = reader.ReadMobileList(); - m_Friends = reader.ReadMobileList(); - m_Bans = reader.ReadMobileList(); + CoOwners = reader.ReadMobileList(); + Friends = reader.ReadMobileList(); + Bans = reader.ReadMobileList(); - m_Sign = reader.ReadItem() as HouseSign; + Sign = reader.ReadItem() as HouseSign; m_Trash = reader.ReadItem() as TrashBarrel; - m_Doors = reader.ReadItemList(); - m_LockDowns = reader.ReadItemList(); + Doors = reader.ReadItemList(); + LockDowns = reader.ReadItemList(); - for ( int i = 0; i < m_LockDowns.Count; ++i ) - ((Item)m_LockDowns[i]).IsLockedDown = true; + for ( int i = 0; i < LockDowns.Count; ++i ) + ((Item)LockDowns[i]).IsLockedDown = true; - for ( int i = 0; i < m_VendorRentalContracts.Count; ++i ) - ((Item)m_VendorRentalContracts[i]).IsLockedDown = true; + for ( int i = 0; i < VendorRentalContracts.Count; ++i ) + ((Item)VendorRentalContracts[i]).IsLockedDown = true; if ( version < 3 ) { ArrayList items = reader.ReadItemList(); - m_Secures = new ArrayList( items.Count ); + Secures = new ArrayList( items.Count ); for ( int i = 0; i < items.Count; ++i ) { @@ -2668,13 +2620,13 @@ namespace Server.Multis if ( c != null ) { c.IsSecure = true; - m_Secures.Add( new SecureInfo( c, SecureLevel.CoOwners ) ); + Secures.Add( new SecureInfo( c, SecureLevel.CoOwners ) ); } } } - m_MaxLockDowns = reader.ReadInt(); - m_MaxSecures = reader.ReadInt(); + MaxLockDowns = reader.ReadInt(); + MaxSecures = reader.ReadInt(); if ( (Map == null || Map == Map.Internal) && Location == Point3D.Zero ) Delete(); @@ -2706,7 +2658,7 @@ namespace Server.Multis } if ( version < 11 ) - m_LastRefreshed = DateTime.UtcNow + TimeSpan.FromHours( 24 * Utility.RandomDouble() ); + LastRefreshed = DateTime.UtcNow + TimeSpan.FromHours( 24 * Utility.RandomDouble() ); if ( DynamicDecay.Enabled && !loadedDynamicDecay ) { @@ -2723,7 +2675,7 @@ namespace Server.Multis if ( RelocatedEntities.Count > 0 ) Timer.DelayCall( TimeSpan.Zero, RestoreRelocatedEntities ); - if ( m_Owner == null && m_Friends.Count == 0 && m_CoOwners.Count == 0 ) + if ( m_Owner == null && Friends.Count == 0 && CoOwners.Count == 0 ) Timer.DelayCall( TimeSpan.FromSeconds( 10.0 ), Delete ); } } @@ -2732,9 +2684,9 @@ namespace Server.Multis { ArrayList lockDowns = new ArrayList(); - for ( int i = 0; m_LockDowns != null && i < m_LockDowns.Count; ++i ) + for ( int i = 0; LockDowns != null && i < LockDowns.Count; ++i ) { - Item item = (Item)m_LockDowns[i]; + Item item = (Item)LockDowns[i]; if ( item is Container ) lockDowns.Add( item ); @@ -2818,16 +2770,12 @@ namespace Server.Multis m_Owner.Delta( MobileDelta.Noto ); } - m_Sign?.InvalidateProperties(); + Sign?.InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] - public int Visits - { - get => m_Visits; - set => m_Visits = value; - } + public int Visits { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool Public @@ -2842,17 +2790,13 @@ namespace Server.Multis if ( !m_Public ) // Privatizing the house, change to brass sign ChangeSignType( 0xBD2 ); - m_Sign?.InvalidateProperties(); + Sign?.InvalidateProperties(); } } } [CommandProperty( AccessLevel.GameMaster )] - public int MaxSecures - { - get => m_MaxSecures; - set => m_MaxSecures = value; - } + public int MaxSecures { get; set; } [CommandProperty( AccessLevel.GameMaster )] public Point3D BanLocation @@ -2882,40 +2826,30 @@ namespace Server.Multis } [CommandProperty( AccessLevel.GameMaster )] - public int MaxLockDowns - { - get => m_MaxLockDowns; - set => m_MaxLockDowns = value; - } + public int MaxLockDowns { get; set; } public Region Region => m_Region; - public ArrayList CoOwners{ get => m_CoOwners; - set => m_CoOwners = value; - } - public ArrayList Friends{ get => m_Friends; - set => m_Friends = value; - } - public ArrayList Access{ get => m_Access; - set => m_Access = value; - } - public ArrayList Bans{ get => m_Bans; - set => m_Bans = value; - } - public ArrayList Doors{ get => m_Doors; - set => m_Doors = value; - } + public ArrayList CoOwners { get; set; } + + public ArrayList Friends { get; set; } + + public ArrayList Access { get; set; } + + public ArrayList Bans { get; set; } + + public ArrayList Doors { get; set; } public int GetLockdowns() { int count = 0; - if ( m_LockDowns != null ) + if ( LockDowns != null ) { - for ( int i = 0; i < m_LockDowns.Count; ++i ) + for ( int i = 0; i < LockDowns.Count; ++i ) { - if ( m_LockDowns[i] is Item ) + if ( LockDowns[i] is Item ) { - Item item = (Item)m_LockDowns[i]; + Item item = (Item)LockDowns[i]; if ( !(item is Container) ) count += item.TotalItems; @@ -2936,11 +2870,11 @@ namespace Server.Multis count += GetLockdowns(); - if ( m_Secures != null ) + if ( Secures != null ) { - for ( int i = 0; i < m_Secures.Count; ++i ) + for ( int i = 0; i < Secures.Count; ++i ) { - SecureInfo info = (SecureInfo)m_Secures[i]; + SecureInfo info = (SecureInfo)Secures[i]; if ( info.Item.Deleted ) continue; @@ -2961,11 +2895,11 @@ namespace Server.Multis { int count = 0; - if ( m_Secures != null ) + if ( Secures != null ) { - for ( int i = 0; i < m_Secures.Count; i++ ) + for ( int i = 0; i < Secures.Count; i++ ) { - SecureInfo info = (SecureInfo)m_Secures[i]; + SecureInfo info = (SecureInfo)Secures[i]; if ( info.Item.Deleted ) continue; @@ -2978,35 +2912,31 @@ namespace Server.Multis } } - public ArrayList Addons{ get => m_Addons; - set => m_Addons = value; - } - public ArrayList LockDowns => m_LockDowns; - public ArrayList Secures => m_Secures; - public HouseSign Sign{ get => m_Sign; - set => m_Sign = value; - } - public ArrayList PlayerVendors => m_PlayerVendors; - public ArrayList PlayerBarkeepers => m_PlayerBarkeepers; - public ArrayList VendorRentalContracts => m_VendorRentalContracts; - public ArrayList VendorInventories => m_VendorInventories; - public ArrayList RelocatedEntities => m_RelocatedEntities; - public MovingCrate MovingCrate{ get => m_MovingCrate; - set => m_MovingCrate = value; - } - public ArrayList InternalizedVendors => m_InternalizedVendors; + public ArrayList Addons { get; set; } - public DateTime BuiltOn - { - get => m_BuiltOn; - set => m_BuiltOn = value; - } + public ArrayList LockDowns { get; private set; } - public DateTime LastTraded - { - get => m_LastTraded; - set => m_LastTraded = value; - } + public ArrayList Secures { get; private set; } + + public HouseSign Sign { get; set; } + + public ArrayList PlayerVendors { get; } = new ArrayList(); + + public ArrayList PlayerBarkeepers { get; } = new ArrayList(); + + public ArrayList VendorRentalContracts { get; private set; } + + public ArrayList VendorInventories { get; } = new ArrayList(); + + public ArrayList RelocatedEntities { get; } = new ArrayList(); + + public MovingCrate MovingCrate { get; set; } + + public ArrayList InternalizedVendors { get; private set; } + + public DateTime BuiltOn { get; set; } + + public DateTime LastTraded { get; set; } public override void OnDelete() { @@ -3065,27 +2995,27 @@ namespace Server.Multis m_Region = null; } - m_Sign?.Delete(); + Sign?.Delete(); m_Trash?.Delete(); - if ( m_Doors != null ) + if ( Doors != null ) { - for ( int i = 0; i < m_Doors.Count; ++i ) + for ( int i = 0; i < Doors.Count; ++i ) { - Item item = (Item)m_Doors[i]; + Item item = (Item)Doors[i]; item?.Delete(); } - m_Doors.Clear(); + Doors.Clear(); } - if ( m_LockDowns != null ) + if ( LockDowns != null ) { - for ( int i = 0; i < m_LockDowns.Count; ++i ) + for ( int i = 0; i < LockDowns.Count; ++i ) { - Item item = (Item)m_LockDowns[i]; + Item item = (Item)LockDowns[i]; if ( item != null ) { @@ -3096,7 +3026,7 @@ namespace Server.Multis } } - m_LockDowns.Clear(); + LockDowns.Clear(); } if ( VendorRentalContracts != null ) @@ -3117,11 +3047,11 @@ namespace Server.Multis VendorRentalContracts.Clear(); } - if ( m_Secures != null ) + if ( Secures != null ) { - for ( int i = 0; i < m_Secures.Count; ++i ) + for ( int i = 0; i < Secures.Count; ++i ) { - SecureInfo info = (SecureInfo)m_Secures[i]; + SecureInfo info = (SecureInfo)Secures[i]; if ( info.Item is StrongBox ) { @@ -3136,14 +3066,14 @@ namespace Server.Multis } } - m_Secures.Clear(); + Secures.Clear(); } - if ( m_Addons != null ) + if ( Addons != null ) { - for ( int i = 0; i < m_Addons.Count; ++i ) + for ( int i = 0; i < Addons.Count; ++i ) { - Item item = (Item)m_Addons[i]; + Item item = (Item)Addons[i]; if ( item != null ) { @@ -3180,7 +3110,7 @@ namespace Server.Multis } } - m_Addons.Clear(); + Addons.Clear(); } ArrayList inventories = new ArrayList( VendorInventories ); @@ -3192,7 +3122,7 @@ namespace Server.Multis KillVendors(); - m_AllHouses.Remove( this ); + AllHouses.Remove( this ); } public static bool HasHouse( Mobile m ) @@ -3243,10 +3173,10 @@ namespace Server.Multis public bool IsCoOwner( Mobile m ) { - if ( m == null || m_CoOwners == null ) + if ( m == null || CoOwners == null ) return false; - if ( IsOwner( m ) || m_CoOwners.Contains( m ) ) + if ( IsOwner( m ) || CoOwners.Contains( m ) ) return true; return !IsAosRules && AccountHandler.CheckAccount( m, m_Owner ); @@ -3262,13 +3192,13 @@ namespace Server.Multis public void RemoveKeys( Mobile m ) { - if ( m_Doors != null ) + if ( Doors != null ) { uint keyValue = 0; - for ( int i = 0; keyValue == 0 && i < m_Doors.Count; ++i ) + for ( int i = 0; keyValue == 0 && i < Doors.Count; ++i ) { - BaseDoor door = m_Doors[i] as BaseDoor; + BaseDoor door = Doors[i] as BaseDoor; if ( door != null ) keyValue = door.KeyValue; @@ -3282,11 +3212,11 @@ namespace Server.Multis { uint keyValue = CreateKeys( m ); - if ( m_Doors != null ) + if ( Doors != null ) { - for ( int i = 0; i < m_Doors.Count; ++i ) + for ( int i = 0; i < Doors.Count; ++i ) { - BaseDoor door = m_Doors[i] as BaseDoor; + BaseDoor door = Doors[i] as BaseDoor; if ( door != null ) door.KeyValue = keyValue; @@ -3296,11 +3226,11 @@ namespace Server.Multis public void RemoveLocks() { - if ( m_Doors != null ) + if ( Doors != null ) { - for (int i=0;i 0; [CommandProperty( AccessLevel.GameMaster )] - public int Price{ get => m_Price; - set => m_Price = value; - } + public int Price { get; set; } public virtual HouseDeed GetDeed() { @@ -3330,22 +3258,22 @@ namespace Server.Multis public bool IsFriend( Mobile m ) { - if ( m == null || m_Friends == null ) + if ( m == null || Friends == null ) return false; - return ( IsCoOwner( m ) || m_Friends.Contains( m ) ); + return ( IsCoOwner( m ) || Friends.Contains( m ) ); } public bool IsBanned( Mobile m ) { - if ( m == null || m == Owner || m.AccessLevel > AccessLevel.Player || m_Bans == null ) + if ( m == null || m == Owner || m.AccessLevel > AccessLevel.Player || Bans == null ) return false; Account theirAccount = m.Account as Account; - for ( int i = 0; i < m_Bans.Count; ++i ) + for ( int i = 0; i < Bans.Count; ++i ) { - Mobile c = (Mobile)m_Bans[i]; + Mobile c = (Mobile)Bans[i]; if ( c == m ) return true; @@ -3364,7 +3292,7 @@ namespace Server.Multis if ( m == null ) return false; - if ( m.AccessLevel > AccessLevel.Player || IsFriend( m ) || ( m_Access != null && m_Access.Contains( m ) ) ) + if ( m.AccessLevel > AccessLevel.Player || IsFriend( m ) || ( Access != null && Access.Contains( m ) ) ) return true; if ( m is BaseCreature ) @@ -3384,7 +3312,7 @@ namespace Server.Multis if ( m == null ) return false; - if ( m.AccessLevel > AccessLevel.Player || IsFriend( m ) || ( m_Access != null && m_Access.Contains( m ) ) ) + if ( m.AccessLevel > AccessLevel.Player || IsFriend( m ) || ( Access != null && Access.Contains( m ) ) ) return true; } } @@ -3397,10 +3325,10 @@ namespace Server.Multis if ( check == null ) return false; - if ( m_LockDowns == null ) + if ( LockDowns == null ) return false; - return ( m_LockDowns.Contains( check ) || VendorRentalContracts.Contains( check ) ); + return ( LockDowns.Contains( check ) || VendorRentalContracts.Contains( check ) ); } public new bool IsSecure( Item item ) @@ -3408,13 +3336,13 @@ namespace Server.Multis if ( item == null ) return false; - if ( m_Secures == null ) + if ( Secures == null ) return false; bool contains = false; - for ( int i = 0; !contains && i < m_Secures.Count; ++i ) - contains = ( ((SecureInfo)m_Secures[i]).Item == item ); + for ( int i = 0; !contains && i < Secures.Count; ++i ) + contains = ( ((SecureInfo)Secures[i]).Item == item ); return contains; } @@ -3482,46 +3410,39 @@ namespace Server.Multis public class SecureInfo : ISecurable { - private Container m_Item; - private SecureLevel m_Level; + public Container Item { get; } - public Container Item => m_Item; - public SecureLevel Level{ get => m_Level; - set => m_Level = value; - } + public SecureLevel Level { get; set; } public SecureInfo( Container item, SecureLevel level ) { - m_Item = item; - m_Level = level; + Item = item; + Level = level; } public SecureInfo( GenericReader reader ) { - m_Item = reader.ReadItem() as Container; - m_Level = (SecureLevel)reader.ReadByte(); + Item = reader.ReadItem() as Container; + Level = (SecureLevel)reader.ReadByte(); } public void Serialize( GenericWriter writer ) { - writer.Write( m_Item ); - writer.Write( (byte) m_Level ); + writer.Write( Item ); + writer.Write( (byte) Level ); } } public class RelocatedEntity { - private IEntity m_Entity; - private Point3D m_RelativeLocation; + public IEntity Entity { get; } - public IEntity Entity => m_Entity; - - public Point3D RelativeLocation => m_RelativeLocation; + public Point3D RelativeLocation { get; } public RelocatedEntity( IEntity entity, Point3D relativeLocation ) { - m_Entity = entity; - m_RelativeLocation = relativeLocation; + Entity = entity; + RelativeLocation = relativeLocation; } } diff --git a/Scripts/Multis/Boats/BaseBoat.cs b/Scripts/Multis/Boats/BaseBoat.cs index 960555ffb..ddf910260 100644 --- a/Scripts/Multis/Boats/BaseBoat.cs +++ b/Scripts/Multis/Boats/BaseBoat.cs @@ -35,55 +35,31 @@ namespace Server.Multis return null; } - private Hold m_Hold; - private TillerMan m_TillerMan; - private Mobile m_Owner; - private Direction m_Facing; - private Direction m_Moving; - private int m_Speed; private int m_ClientSpeed; - private bool m_Anchored; private string m_ShipName; - private BoatOrder m_Order; - - private MapItem m_MapItem; - private int m_NextNavPoint; - - private Plank m_PPlank, m_SPlank; - private DateTime m_DecayTime; private Timer m_TurnTimer; private Timer m_MoveTimer; [CommandProperty( AccessLevel.GameMaster )] - public Hold Hold{ get => m_Hold; - set => m_Hold = value; - } + public Hold Hold { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TillerMan TillerMan{ get => m_TillerMan; - set => m_TillerMan = value; - } + public TillerMan TillerMan { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Plank PPlank{ get => m_PPlank; - set => m_PPlank = value; - } + public Plank PPlank { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Plank SPlank{ get => m_SPlank; - set => m_SPlank = value; - } + public Plank SPlank { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Mobile Owner{ get => m_Owner; - set => m_Owner = value; - } + public Mobile Owner { get; set; } [CommandProperty( AccessLevel.GameMaster )] public Direction Facing{ get => m_Facing; @@ -91,48 +67,36 @@ namespace Server.Multis } [CommandProperty( AccessLevel.GameMaster )] - public Direction Moving{ get => m_Moving; - set => m_Moving = value; - } + public Direction Moving { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool IsMoving => ( m_MoveTimer != null ); [CommandProperty( AccessLevel.GameMaster )] - public int Speed{ get => m_Speed; - set => m_Speed = value; - } + public int Speed { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool Anchored{ get => m_Anchored; - set => m_Anchored = value; - } + public bool Anchored { get; set; } [CommandProperty( AccessLevel.GameMaster )] public string ShipName{ get => m_ShipName; set{ m_ShipName = value; - m_TillerMan?.InvalidateProperties(); + TillerMan?.InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] - public BoatOrder Order{ get => m_Order; - set => m_Order = value; - } + public BoatOrder Order { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public MapItem MapItem{ get => m_MapItem; - set => m_MapItem = value; - } + public MapItem MapItem { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int NextNavPoint{ get => m_NextNavPoint; - set => m_NextNavPoint = value; - } + public int NextNavPoint { get; set; } [CommandProperty( AccessLevel.GameMaster )] public DateTime TimeOfDecay{ get => m_DecayTime; set{ m_DecayTime = value; - m_TillerMan?.InvalidateProperties(); + TillerMan?.InvalidateProperties(); } } public int Status @@ -173,30 +137,28 @@ namespace Server.Multis public virtual BaseDockedBoat DockedBoat => null; - private static List m_Instances = new List(); - - public static List Boats => m_Instances; + public static List Boats { get; } = new List(); public BaseBoat() : base( 0x0 ) { m_DecayTime = DateTime.UtcNow + BoatDecayDelay; - m_TillerMan = new TillerMan( this ); - m_Hold = new Hold( this ); + TillerMan = new TillerMan( this ); + Hold = new Hold( this ); - m_PPlank = new Plank( this, PlankSide.Port, 0 ); - m_SPlank = new Plank( this, PlankSide.Starboard, 0 ); + PPlank = new Plank( this, PlankSide.Port, 0 ); + SPlank = new Plank( this, PlankSide.Starboard, 0 ); - m_PPlank.MoveToWorld( new Point3D( X + PortOffset.X, Y + PortOffset.Y, Z ), Map ); - m_SPlank.MoveToWorld( new Point3D( X + StarboardOffset.X, Y + StarboardOffset.Y, Z ), Map ); + PPlank.MoveToWorld( new Point3D( X + PortOffset.X, Y + PortOffset.Y, Z ), Map ); + SPlank.MoveToWorld( new Point3D( X + StarboardOffset.X, Y + StarboardOffset.Y, Z ), Map ); Facing = Direction.North; - m_NextNavPoint = -1; + NextNavPoint = -1; Movable = false; - m_Instances.Add( this ); + Boats.Add( this ); } public BaseBoat( Serial serial ) : base( serial ) @@ -212,32 +174,32 @@ namespace Server.Multis public void UpdateComponents() { - if ( m_PPlank != null ) + if ( PPlank != null ) { - m_PPlank.MoveToWorld( GetRotatedLocation( PortOffset.X, PortOffset.Y ), Map ); - m_PPlank.SetFacing( m_Facing ); + PPlank.MoveToWorld( GetRotatedLocation( PortOffset.X, PortOffset.Y ), Map ); + PPlank.SetFacing( m_Facing ); } - if ( m_SPlank != null ) + if ( SPlank != null ) { - m_SPlank.MoveToWorld( GetRotatedLocation( StarboardOffset.X, StarboardOffset.Y ), Map ); - m_SPlank.SetFacing( m_Facing ); + SPlank.MoveToWorld( GetRotatedLocation( StarboardOffset.X, StarboardOffset.Y ), Map ); + SPlank.SetFacing( m_Facing ); } int xOffset = 0, yOffset = 0; Movement.Movement.Offset( m_Facing, ref xOffset, ref yOffset ); - if ( m_TillerMan != null ) + if ( TillerMan != null ) { - m_TillerMan.Location = new Point3D( X + (xOffset * TillerManDistance) + (m_Facing == Direction.North ? 1 : 0), Y + (yOffset * TillerManDistance), m_TillerMan.Z ); - m_TillerMan.SetFacing( m_Facing ); - m_TillerMan.InvalidateProperties(); + TillerMan.Location = new Point3D( X + (xOffset * TillerManDistance) + (m_Facing == Direction.North ? 1 : 0), Y + (yOffset * TillerManDistance), TillerMan.Z ); + TillerMan.SetFacing( m_Facing ); + TillerMan.InvalidateProperties(); } - if ( m_Hold != null ) + if ( Hold != null ) { - m_Hold.Location = new Point3D( X + (xOffset * HoldDistance), Y + (yOffset * HoldDistance), m_Hold.Z ); - m_Hold.SetFacing( m_Facing ); + Hold.Location = new Point3D( X + (xOffset * HoldDistance), Y + (yOffset * HoldDistance), Hold.Z ); + Hold.SetFacing( m_Facing ); } } @@ -247,19 +209,19 @@ namespace Server.Multis writer.Write( (int) 3 ); - writer.Write( (Item) m_MapItem ); - writer.Write( (int) m_NextNavPoint ); + writer.Write( (Item) MapItem ); + writer.Write( (int) NextNavPoint ); writer.Write( (int) m_Facing ); writer.WriteDeltaTime( m_DecayTime ); - writer.Write( m_Owner ); - writer.Write( m_PPlank ); - writer.Write( m_SPlank ); - writer.Write( m_TillerMan ); - writer.Write( m_Hold ); - writer.Write( m_Anchored ); + writer.Write( Owner ); + writer.Write( PPlank ); + writer.Write( SPlank ); + writer.Write( TillerMan ); + writer.Write( Hold ); + writer.Write( Anchored ); writer.Write( m_ShipName ); CheckDecay(); @@ -275,8 +237,8 @@ namespace Server.Multis { case 3: { - m_MapItem = (MapItem) reader.ReadItem(); - m_NextNavPoint = reader.ReadInt(); + MapItem = (MapItem) reader.ReadItem(); + NextNavPoint = reader.ReadInt(); goto case 2; } @@ -295,7 +257,7 @@ namespace Server.Multis case 0: { if ( version < 3 ) - m_NextNavPoint = -1; + NextNavPoint = -1; if ( version < 2 ) { @@ -309,12 +271,12 @@ namespace Server.Multis m_Facing = Direction.West; } - m_Owner = reader.ReadMobile(); - m_PPlank = reader.ReadItem() as Plank; - m_SPlank = reader.ReadItem() as Plank; - m_TillerMan = reader.ReadItem() as TillerMan; - m_Hold = reader.ReadItem() as Hold; - m_Anchored = reader.ReadBool(); + Owner = reader.ReadMobile(); + PPlank = reader.ReadItem() as Plank; + SPlank = reader.ReadItem() as Plank; + TillerMan = reader.ReadItem() as TillerMan; + Hold = reader.ReadItem() as Hold; + Anchored = reader.ReadBool(); m_ShipName = reader.ReadString(); if ( version < 1) @@ -324,18 +286,18 @@ namespace Server.Multis } } - m_Instances.Add( this ); + Boats.Add( this ); } public void RemoveKeys( Mobile m ) { uint keyValue = 0; - if ( m_PPlank != null ) - keyValue = m_PPlank.KeyValue; + if ( PPlank != null ) + keyValue = PPlank.KeyValue; - if ( keyValue == 0 && m_SPlank != null ) - keyValue = m_SPlank.KeyValue; + if ( keyValue == 0 && SPlank != null ) + keyValue = SPlank.KeyValue; Key.RemoveKeys( m, keyValue ); } @@ -370,49 +332,49 @@ namespace Server.Multis public override void OnAfterDelete() { - m_TillerMan?.Delete(); + TillerMan?.Delete(); - m_Hold?.Delete(); + Hold?.Delete(); - m_PPlank?.Delete(); + PPlank?.Delete(); - m_SPlank?.Delete(); + SPlank?.Delete(); m_TurnTimer?.Stop(); m_MoveTimer?.Stop(); - m_Instances.Remove( this ); + Boats.Remove( this ); } public override void OnLocationChange( Point3D old ) { - if ( m_TillerMan != null ) - m_TillerMan.Location = new Point3D( X + (m_TillerMan.X - old.X), Y + (m_TillerMan.Y - old.Y), Z + (m_TillerMan.Z - old.Z ) ); + if ( TillerMan != null ) + TillerMan.Location = new Point3D( X + (TillerMan.X - old.X), Y + (TillerMan.Y - old.Y), Z + (TillerMan.Z - old.Z ) ); - if ( m_Hold != null ) - m_Hold.Location = new Point3D( X + (m_Hold.X - old.X), Y + (m_Hold.Y - old.Y), Z + (m_Hold.Z - old.Z ) ); + if ( Hold != null ) + Hold.Location = new Point3D( X + (Hold.X - old.X), Y + (Hold.Y - old.Y), Z + (Hold.Z - old.Z ) ); - if ( m_PPlank != null ) - m_PPlank.Location = new Point3D( X + (m_PPlank.X - old.X), Y + (m_PPlank.Y - old.Y), Z + (m_PPlank.Z - old.Z ) ); + if ( PPlank != null ) + PPlank.Location = new Point3D( X + (PPlank.X - old.X), Y + (PPlank.Y - old.Y), Z + (PPlank.Z - old.Z ) ); - if ( m_SPlank != null ) - m_SPlank.Location = new Point3D( X + (m_SPlank.X - old.X), Y + (m_SPlank.Y - old.Y), Z + (m_SPlank.Z - old.Z ) ); + if ( SPlank != null ) + SPlank.Location = new Point3D( X + (SPlank.X - old.X), Y + (SPlank.Y - old.Y), Z + (SPlank.Z - old.Z ) ); } public override void OnMapChange() { - if ( m_TillerMan != null ) - m_TillerMan.Map = Map; + if ( TillerMan != null ) + TillerMan.Map = Map; - if ( m_Hold != null ) - m_Hold.Map = Map; + if ( Hold != null ) + Hold.Map = Map; - if ( m_PPlank != null ) - m_PPlank.Map = Map; + if ( PPlank != null ) + PPlank.Map = Map; - if ( m_SPlank != null ) - m_SPlank.Map = Map; + if ( SPlank != null ) + SPlank.Map = Map; } public bool CanCommand( Mobile m ) @@ -429,10 +391,10 @@ namespace Server.Multis public bool CheckKey( uint keyValue ) { - if ( m_SPlank != null && m_SPlank.KeyValue == keyValue ) + if ( SPlank != null && SPlank.KeyValue == keyValue ) return true; - if ( m_PPlank != null && m_PPlank.KeyValue == keyValue ) + if ( PPlank != null && PPlank.KeyValue == keyValue ) return true; return false; @@ -488,7 +450,7 @@ namespace Server.Multis { m_DecayTime = DateTime.UtcNow + BoatDecayDelay; - m_TillerMan?.InvalidateProperties(); + TillerMan?.InvalidateProperties(); } private class DecayTimer : Timer @@ -543,20 +505,20 @@ namespace Server.Multis if ( CheckDecay() ) return false; - if ( m_Anchored ) + if ( Anchored ) { if ( message ) - m_TillerMan?.Say( 501445 ); // Ar, the anchor was already dropped sir. + TillerMan?.Say( 501445 ); // Ar, the anchor was already dropped sir. return false; } StopMove( false ); - m_Anchored = true; + Anchored = true; if ( message ) - m_TillerMan?.Say( 501444 ); // Ar, anchor dropped sir. + TillerMan?.Say( 501444 ); // Ar, anchor dropped sir. return true; } @@ -566,18 +528,18 @@ namespace Server.Multis if ( CheckDecay() ) return false; - if ( !m_Anchored ) + if ( !Anchored ) { if ( message ) - m_TillerMan?.Say( 501447 ); // Ar, the anchor has not been dropped sir. + TillerMan?.Say( 501447 ); // Ar, the anchor has not been dropped sir. return false; } - m_Anchored = false; + Anchored = false; if ( message ) - m_TillerMan?.Say( 501446 ); // Ar, anchor raised sir. + TillerMan?.Say( 501446 ); // Ar, anchor raised sir. return true; } @@ -594,7 +556,7 @@ namespace Server.Multis if ( StartMove( dir, speed, clientSpeed, interval, false, true ) ) { - m_TillerMan?.Say( 501429 ); // Aye aye sir. + TillerMan?.Say( 501429 ); // Aye aye sir. return true; } @@ -613,7 +575,7 @@ namespace Server.Multis if ( StartMove( dir, speed, 0x1, interval, true, true ) ) { - m_TillerMan?.Say( 501429 ); // Aye aye sir. + TillerMan?.Say( 501429 ); // Aye aye sir. return true; } @@ -626,14 +588,14 @@ namespace Server.Multis if ( CheckDecay() ) return; - if ( from.AccessLevel < AccessLevel.GameMaster && from != m_Owner ) + if ( from.AccessLevel < AccessLevel.GameMaster && from != Owner ) { - m_TillerMan?.Say( Utility.Random( 1042876, 4 ) ); // Arr, don't do that! | Arr, leave me alone! | Arr, watch what thour'rt doing, matey! | Arr! Do that again and I’ll throw ye overhead! + TillerMan?.Say( Utility.Random( 1042876, 4 ) ); // Arr, don't do that! | Arr, leave me alone! | Arr, watch what thour'rt doing, matey! | Arr! Do that again and I’ll throw ye overhead! return; } - m_TillerMan?.Say( 502580 ); // What dost thou wish to name thy ship? + TillerMan?.Say( 502580 ); // What dost thou wish to name thy ship? from.Prompt = new RenameBoatPrompt( this ); } @@ -643,16 +605,16 @@ namespace Server.Multis if ( Deleted || CheckDecay() ) return; - if ( from.AccessLevel < AccessLevel.GameMaster && from != m_Owner ) + if ( from.AccessLevel < AccessLevel.GameMaster && from != Owner ) { - m_TillerMan?.Say( 1042880 ); // Arr! Only the owner of the ship may change its name! + TillerMan?.Say( 1042880 ); // Arr! Only the owner of the ship may change its name! return; } if ( !from.Alive ) { - m_TillerMan?.Say( 502582 ); // You appear to be dead. + TillerMan?.Say( 502582 ); // You appear to be dead. return; } @@ -676,13 +638,13 @@ namespace Server.Multis return DryDockResult.Dead; Container pack = from.Backpack; - if ( (m_SPlank == null || !Key.ContainsKey( pack, m_SPlank.KeyValue )) && (m_PPlank == null || !Key.ContainsKey( pack, m_PPlank.KeyValue )) ) + if ( (SPlank == null || !Key.ContainsKey( pack, SPlank.KeyValue )) && (PPlank == null || !Key.ContainsKey( pack, PPlank.KeyValue )) ) return DryDockResult.NoKey; - if ( !m_Anchored ) + if ( !Anchored ) return DryDockResult.NotAnchored; - if ( m_Hold != null && m_Hold.Items.Count > 0 ) + if ( Hold != null && Hold.Items.Count > 0 ) return DryDockResult.Hold; Map map = Map; @@ -760,16 +722,16 @@ namespace Server.Multis if ( CheckDecay() ) return; - if ( e.Mobile.AccessLevel < AccessLevel.GameMaster && e.Mobile != m_Owner ) + if ( e.Mobile.AccessLevel < AccessLevel.GameMaster && e.Mobile != Owner ) { - m_TillerMan?.Say( 1042880 ); // Arr! Only the owner of the ship may change its name! + TillerMan?.Say( 1042880 ); // Arr! Only the owner of the ship may change its name! return; } if ( !e.Mobile.Alive ) { - m_TillerMan?.Say( 502582 ); // You appear to be dead. + TillerMan?.Say( 502582 ); // You appear to be dead. return; } @@ -795,18 +757,18 @@ namespace Server.Multis if ( m_ShipName == newName ) { - m_TillerMan?.Say( 502531 ); // Yes, sir. + TillerMan?.Say( 502531 ); // Yes, sir. return; } ShipName = newName; - if ( m_TillerMan != null && m_ShipName != null ) - m_TillerMan.Say( 1042885, m_ShipName ); // This ship is now called the ~1_NEW_SHIP_NAME~. + if ( TillerMan != null && m_ShipName != null ) + TillerMan.Say( 1042885, m_ShipName ); // This ship is now called the ~1_NEW_SHIP_NAME~. else { - m_TillerMan?.Say( 502534 ); // This ship now has no name. + TillerMan?.Say( 502534 ); // This ship now has no name. } } @@ -815,41 +777,41 @@ namespace Server.Multis if ( CheckDecay() ) return; - if ( m.AccessLevel < AccessLevel.GameMaster && m != m_Owner ) + if ( m.AccessLevel < AccessLevel.GameMaster && m != Owner ) { - m_TillerMan?.Say( 1042880 ); // Arr! Only the owner of the ship may change its name! + TillerMan?.Say( 1042880 ); // Arr! Only the owner of the ship may change its name! return; } if ( !m.Alive ) { - m_TillerMan?.Say( 502582 ); // You appear to be dead. + TillerMan?.Say( 502582 ); // You appear to be dead. return; } if ( m_ShipName == null ) { - m_TillerMan?.Say( 502526 ); // Ar, this ship has no name. + TillerMan?.Say( 502526 ); // Ar, this ship has no name. return; } ShipName = null; - m_TillerMan?.Say( 502534 ); // This ship now has no name. + TillerMan?.Say( 502534 ); // This ship now has no name. } public void GiveName( Mobile m ) { - if ( m_TillerMan == null || CheckDecay() ) + if ( TillerMan == null || CheckDecay() ) return; if ( m_ShipName == null ) - m_TillerMan.Say( 502526 ); // Ar, this ship has no name. + TillerMan.Say( 502526 ); // Ar, this ship has no name. else - m_TillerMan.Say( 1042881, m_ShipName ); // This is the ~1_BOAT_NAME~. + TillerMan.Say( 1042881, m_ShipName ); // This is the ~1_BOAT_NAME~. } public void GiveNavPoint() @@ -1052,10 +1014,10 @@ namespace Server.Multis if ( CheckDecay() ) return false; - if ( m_Anchored ) + if ( Anchored ) { if ( message ) - m_TillerMan.Say( 501419 ); // Ar, the anchor is down sir! + TillerMan.Say( 501419 ); // Ar, the anchor is down sir! return false; } @@ -1088,10 +1050,10 @@ namespace Server.Multis if ( CheckDecay() ) return false; - if ( m_Anchored ) + if ( Anchored ) { if ( message ) - m_TillerMan.Say( 501419 ); // Ar, the anchor is down sir! + TillerMan.Say( 501419 ); // Ar, the anchor is down sir! return false; } @@ -1101,7 +1063,7 @@ namespace Server.Multis return true; } if ( message ) - m_TillerMan.Say( 501423 ); // Ar, can't turn sir. + TillerMan.Say( 501423 ); // Ar, can't turn sir. return false; } @@ -1131,18 +1093,18 @@ namespace Server.Multis if ( CheckDecay() ) return false; - if ( m_Anchored ) + if ( Anchored ) { if ( message ) - m_TillerMan?.Say( 501419 ); // Ar, the anchor is down sir! + TillerMan?.Say( 501419 ); // Ar, the anchor is down sir! return false; } - m_Moving = dir; - m_Speed = speed; + Moving = dir; + Speed = speed; m_ClientSpeed = clientSpeed; - m_Order = BoatOrder.Move; + Order = BoatOrder.Move; m_MoveTimer?.Stop(); @@ -1160,19 +1122,19 @@ namespace Server.Multis if ( m_MoveTimer == null ) { if ( message ) - m_TillerMan?.Say( 501443 ); // Er, the ship is not moving sir. + TillerMan?.Say( 501443 ); // Er, the ship is not moving sir. return false; } - m_Moving = Direction.North; - m_Speed = 0; + Moving = Direction.North; + Speed = 0; m_ClientSpeed = 0; m_MoveTimer.Stop(); m_MoveTimer = null; if ( message ) - m_TillerMan?.Say( 501429 ); // Aye aye sir. + TillerMan?.Say( 501429 ); // Aye aye sir. return true; } @@ -1271,16 +1233,16 @@ namespace Server.Multis if ( base.Contains( x, y ) ) return true; - if ( m_TillerMan != null && x == m_TillerMan.X && y == m_TillerMan.Y ) + if ( TillerMan != null && x == TillerMan.X && y == TillerMan.Y ) return true; - if ( m_Hold != null && x == m_Hold.X && y == m_Hold.Y ) + if ( Hold != null && x == Hold.X && y == Hold.Y ) return true; - if ( m_PPlank != null && x == m_PPlank.X && y == m_PPlank.Y ) + if ( PPlank != null && x == PPlank.X && y == PPlank.Y ) return true; - if ( m_SPlank != null && x == m_SPlank.X && y == m_SPlank.Y ) + if ( SPlank != null && x == SPlank.X && y == SPlank.Y ) return true; return false; @@ -1335,8 +1297,8 @@ namespace Server.Multis if ( Order == BoatOrder.Move ) { - dir = m_Moving; - speed = m_Speed; + dir = Moving; + speed = Speed; clientSpeed = m_ClientSpeed; } else if ( MapItem == null || MapItem.Deleted ) @@ -1417,10 +1379,10 @@ namespace Server.Multis if ( map == null || Deleted || CheckDecay() ) return false; - if ( m_Anchored ) + if ( Anchored ) { if ( message ) - m_TillerMan?.Say( 501419 ); // Ar, the anchor is down sir! + TillerMan?.Say( 501419 ); // Ar, the anchor is down sir! return false; } @@ -1436,7 +1398,7 @@ namespace Server.Multis if ( i == 1 ) { if ( message ) - m_TillerMan?.Say( 501424 ); // Ar, we've stopped sir. + TillerMan?.Say( 501424 ); // Ar, we've stopped sir. return false; } @@ -1475,7 +1437,7 @@ namespace Server.Multis if ( !CanFit( new Point3D( newX + (j * rx), newY + (j * ry), Z ), Map, ItemID ) ) { if ( message ) - m_TillerMan?.Say( 501424 ); // Ar, we've stopped sir. + TillerMan?.Say( 501424 ); // Ar, we've stopped sir. return false; } @@ -1494,10 +1456,10 @@ namespace Server.Multis { List toMove = GetMovingEntities(); - SafeAdd( m_TillerMan, toMove ); - SafeAdd( m_Hold, toMove ); - SafeAdd( m_PPlank, toMove ); - SafeAdd( m_SPlank, toMove ); + SafeAdd( TillerMan, toMove ); + SafeAdd( Hold, toMove ); + SafeAdd( PPlank, toMove ); + SafeAdd( SPlank, toMove ); // Packet must be sent before actual locations are changed foreach ( NetState ns in Map.GetClientsInRange( Location, GetMaxUpdateRange() ) ) @@ -1634,27 +1596,27 @@ namespace Server.Multis m_Facing = facing; - m_TillerMan?.SetFacing( facing ); + TillerMan?.SetFacing( facing ); - m_Hold?.SetFacing( facing ); + Hold?.SetFacing( facing ); - m_PPlank?.SetFacing( facing ); + PPlank?.SetFacing( facing ); - m_SPlank?.SetFacing( facing ); + SPlank?.SetFacing( facing ); List toMove = GetMovingEntities(); - toMove.Add( m_PPlank ); - toMove.Add( m_SPlank ); + toMove.Add( PPlank ); + toMove.Add( SPlank ); int xOffset = 0, yOffset = 0; Movement.Movement.Offset( facing, ref xOffset, ref yOffset ); - if ( m_TillerMan != null ) - m_TillerMan.Location = new Point3D( X + (xOffset * TillerManDistance) + (facing == Direction.North ? 1 : 0), Y + (yOffset * TillerManDistance), m_TillerMan.Z ); + if ( TillerMan != null ) + TillerMan.Location = new Point3D( X + (xOffset * TillerManDistance) + (facing == Direction.North ? 1 : 0), Y + (yOffset * TillerManDistance), TillerMan.Z ); - if ( m_Hold != null ) - m_Hold.Location = new Point3D( X + (xOffset * HoldDistance), Y + (yOffset * HoldDistance), m_Hold.Z ); + if ( Hold != null ) + Hold.Location = new Point3D( X + (xOffset * HoldDistance), Y + (yOffset * HoldDistance), Hold.Z ); int count = (int)(m_Facing - old) & 0x7; count /= 2; @@ -1708,8 +1670,8 @@ namespace Server.Multis public static void UpdateAllComponents() { - for ( int i = m_Instances.Count - 1; i >= 0; --i ) - m_Instances[i].UpdateComponents(); + for ( int i = Boats.Count - 1; i >= 0; --i ) + Boats[i].UpdateComponents(); } public static void Initialize() diff --git a/Scripts/Multis/Boats/BaseBoatDeed.cs b/Scripts/Multis/Boats/BaseBoatDeed.cs index 989119336..c3f744c38 100644 --- a/Scripts/Multis/Boats/BaseBoatDeed.cs +++ b/Scripts/Multis/Boats/BaseBoatDeed.cs @@ -7,18 +7,11 @@ namespace Server.Multis { public abstract class BaseBoatDeed : Item { - private int m_MultiID; - private Point3D m_Offset; + [CommandProperty( AccessLevel.GameMaster )] + public int MultiID { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int MultiID{ get => m_MultiID; - set => m_MultiID = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public Point3D Offset{ get => m_Offset; - set => m_Offset = value; - } + public Point3D Offset { get; set; } public BaseBoatDeed( int id, Point3D offset ) : base( 0x14F2 ) { @@ -27,8 +20,8 @@ namespace Server.Multis if ( !Core.AOS ) LootType = LootType.Newbied; - m_MultiID = id; - m_Offset = offset; + MultiID = id; + Offset = offset; } public BaseBoatDeed( Serial serial ) : base( serial ) @@ -41,8 +34,8 @@ namespace Server.Multis writer.Write( (int) 0 ); // version - writer.Write( m_MultiID ); - writer.Write( m_Offset ); + writer.Write( MultiID ); + writer.Write( Offset ); } public override void Deserialize( GenericReader reader ) @@ -55,8 +48,8 @@ namespace Server.Multis { case 0: { - m_MultiID = reader.ReadInt(); - m_Offset = reader.ReadPoint3D(); + MultiID = reader.ReadInt(); + Offset = reader.ReadPoint3D(); break; } @@ -124,7 +117,7 @@ namespace Server.Multis if ( boat == null ) return; - p = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z ); + p = new Point3D( p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z ); if ( BaseBoat.IsValidLocation( p, map ) && boat.CanFit( p, map, boat.ItemID ) ) { diff --git a/Scripts/Multis/Boats/BaseDockedBoat.cs b/Scripts/Multis/Boats/BaseDockedBoat.cs index 38dc4a582..033d6fa35 100644 --- a/Scripts/Multis/Boats/BaseDockedBoat.cs +++ b/Scripts/Multis/Boats/BaseDockedBoat.cs @@ -6,19 +6,13 @@ namespace Server.Multis { public abstract class BaseDockedBoat : Item { - private int m_MultiID; - private Point3D m_Offset; private string m_ShipName; [CommandProperty( AccessLevel.GameMaster )] - public int MultiID{ get => m_MultiID; - set => m_MultiID = value; - } + public int MultiID { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Point3D Offset{ get => m_Offset; - set => m_Offset = value; - } + public Point3D Offset { get; set; } [CommandProperty( AccessLevel.GameMaster )] public string ShipName{ get => m_ShipName; @@ -29,8 +23,8 @@ namespace Server.Multis Weight = 1.0; LootType = LootType.Blessed; - m_MultiID = id; - m_Offset = offset; + MultiID = id; + Offset = offset; m_ShipName = boat.ShipName; } @@ -45,8 +39,8 @@ namespace Server.Multis writer.Write( (int) 1 ); // version - writer.Write( m_MultiID ); - writer.Write( m_Offset ); + writer.Write( MultiID ); + writer.Write( Offset ); writer.Write( m_ShipName ); } @@ -61,8 +55,8 @@ namespace Server.Multis case 1: case 0: { - m_MultiID = reader.ReadInt(); - m_Offset = reader.ReadPoint3D(); + MultiID = reader.ReadInt(); + Offset = reader.ReadPoint3D(); m_ShipName = reader.ReadString(); if ( version == 0 ) @@ -134,7 +128,7 @@ namespace Server.Multis if ( boat == null ) return; - p = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z ); + p = new Point3D( p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z ); if ( BaseBoat.IsValidLocation( p, map ) && boat.CanFit( p, map, boat.ItemID ) && map != Map.Ilshenar && map != Map.Malas ) { diff --git a/Scripts/Multis/Boats/Plank.cs b/Scripts/Multis/Boats/Plank.cs index a7bc898c9..164e54e4d 100644 --- a/Scripts/Multis/Boats/Plank.cs +++ b/Scripts/Multis/Boats/Plank.cs @@ -8,19 +8,14 @@ namespace Server.Items public class Plank : Item, ILockable { - private BaseBoat m_Boat; - private PlankSide m_Side; - private bool m_Locked; - private uint m_KeyValue; - private Timer m_CloseTimer; public Plank( BaseBoat boat, PlankSide side, uint keyValue ) : base( 0x3EB1 + (int)side ) { - m_Boat = boat; - m_Side = side; - m_KeyValue = keyValue; - m_Locked = true; + Boat = boat; + Side = side; + KeyValue = keyValue; + Locked = true; Movable = false; } @@ -35,10 +30,10 @@ namespace Server.Items writer.Write( (int) 0 );//version - writer.Write( m_Boat ); - writer.Write( (int) m_Side ); - writer.Write( m_Locked ); - writer.Write( m_KeyValue ); + writer.Write( Boat ); + writer.Write( (int) Side ); + writer.Write( Locked ); + writer.Write( KeyValue ); } public override void Deserialize( GenericReader reader ) @@ -51,12 +46,12 @@ namespace Server.Items { case 0: { - m_Boat = reader.ReadItem() as BaseBoat; - m_Side = (PlankSide) reader.ReadInt(); - m_Locked = reader.ReadBool(); - m_KeyValue = reader.ReadUInt(); + Boat = reader.ReadItem() as BaseBoat; + Side = (PlankSide) reader.ReadInt(); + Locked = reader.ReadBool(); + KeyValue = reader.ReadUInt(); - if ( m_Boat == null ) + if ( Boat == null ) Delete(); break; @@ -71,30 +66,22 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public BaseBoat Boat{ get => m_Boat; - set => m_Boat = value; - } + public BaseBoat Boat { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public PlankSide Side{ get => m_Side; - set => m_Side = value; - } + public PlankSide Side { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public bool Locked{ get => m_Locked; - set => m_Locked = value; - } + public bool Locked { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public uint KeyValue{ get => m_KeyValue; - set => m_KeyValue = value; - } + public uint KeyValue { get; set; } [CommandProperty( AccessLevel.GameMaster )] public bool IsOpen => ( ItemID == 0x3ED5 || ItemID == 0x3ED4 || ItemID == 0x3E84 || ItemID == 0x3E89 ); [CommandProperty( AccessLevel.GameMaster )] - public bool Starboard => ( m_Side == PlankSide.Starboard ); + public bool Starboard => ( Side == PlankSide.Starboard ); public void SetFacing( Direction dir ) { @@ -138,7 +125,7 @@ namespace Server.Items case 0x3E85: ItemID = 0x3E84; break; } - m_Boat?.Refresh(); + Boat?.Refresh(); } public override bool OnMoveOver( Mobile from ) @@ -148,7 +135,7 @@ namespace Server.Items if ( from is BaseFactionGuard ) return false; - if ( (from.Direction & Direction.Running) != 0 || (m_Boat != null && !m_Boat.Contains( from )) ) + if ( (from.Direction & Direction.Running) != 0 || (Boat != null && !Boat.Contains( from )) ) return true; Map map = Map; @@ -238,7 +225,7 @@ namespace Server.Items case 0x3E84: ItemID = 0x3E85; break; } - m_Boat?.Refresh(); + Boat?.Refresh(); } public override void OnDoubleClickDead( Mobile from ) @@ -248,12 +235,12 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if ( m_Boat == null ) + if ( Boat == null ) return; if ( from.InRange( GetWorldLocation(), 8 ) ) { - if ( m_Boat.Contains( from ) ) + if ( Boat.Contains( from ) ) { if ( IsOpen ) Close(); diff --git a/Scripts/Multis/ComponentVerification.cs b/Scripts/Multis/ComponentVerification.cs index 0231c8883..a2b26025d 100644 --- a/Scripts/Multis/ComponentVerification.cs +++ b/Scripts/Multis/ComponentVerification.cs @@ -117,9 +117,8 @@ namespace Server.Multis } private ColumnInfo[] m_Columns; - private DataRecord[] m_Records; - public DataRecord[] Records => m_Records; + public DataRecord[] Records { get; } public int GetColumnID( string name ) { @@ -174,7 +173,7 @@ namespace Server.Multis records.Add( new DataRecord( this, data ) ); } - m_Records = records.ToArray(); + Records = records.ToArray(); } } @@ -196,16 +195,14 @@ namespace Server.Multis public class DataRecord { - private Spreadsheet m_Spreadsheet; - private object[] m_Data; + public Spreadsheet Spreadsheet { get; } - public Spreadsheet Spreadsheet => m_Spreadsheet; - public object[] Data => m_Data; + public object[] Data { get; } public DataRecord( Spreadsheet ss, object[] data ) { - m_Spreadsheet = ss; - m_Data = data; + Spreadsheet = ss; + Data = data; } public int GetInt32( string name ) @@ -231,7 +228,7 @@ namespace Server.Multis return this[name] as string; } - public object this[string name] => this[m_Spreadsheet.GetColumnID( name )]; + public object this[string name] => this[Spreadsheet.GetColumnID( name )]; public object this[int id] { @@ -240,7 +237,7 @@ namespace Server.Multis if ( id < 0 ) return null; - return m_Data[id]; + return Data[id]; } } } diff --git a/Scripts/Multis/Deeds.cs b/Scripts/Multis/Deeds.cs index 8c84ff99b..1c2378738 100644 --- a/Scripts/Multis/Deeds.cs +++ b/Scripts/Multis/Deeds.cs @@ -42,30 +42,19 @@ namespace Server.Multis.Deeds public abstract class HouseDeed : Item { - private int m_MultiID; - private Point3D m_Offset; + [CommandProperty( AccessLevel.GameMaster )] + public int MultiID { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int MultiID - { - get => m_MultiID; - set => m_MultiID = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public Point3D Offset - { - get => m_Offset; - set => m_Offset = value; - } + public Point3D Offset { get; set; } public HouseDeed( int id, Point3D offset ) : base( 0x14F0 ) { Weight = 1.0; LootType = LootType.Newbied; - m_MultiID = id; - m_Offset = offset; + MultiID = id; + Offset = offset; } public HouseDeed( Serial serial ) : base( serial ) @@ -78,9 +67,9 @@ namespace Server.Multis.Deeds writer.Write( (int) 1 ); // version - writer.Write( m_Offset ); + writer.Write( Offset ); - writer.Write( m_MultiID ); + writer.Write( MultiID ); } public override void Deserialize( GenericReader reader ) @@ -93,13 +82,13 @@ namespace Server.Multis.Deeds { case 1: { - m_Offset = reader.ReadPoint3D(); + Offset = reader.ReadPoint3D(); goto case 0; } case 0: { - m_MultiID = reader.ReadInt(); + MultiID = reader.ReadInt(); break; } @@ -148,8 +137,8 @@ namespace Server.Multis.Deeds else { ArrayList toMove; - Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z ); - HousePlacementResult res = HousePlacement.Check( from, m_MultiID, center, out toMove ); + Point3D center = new Point3D( p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z ); + HousePlacementResult res = HousePlacement.Check( from, MultiID, center, out toMove ); switch ( res ) { diff --git a/Scripts/Multis/DynamicDecay.cs b/Scripts/Multis/DynamicDecay.cs index 7117e26c0..fa426428d 100644 --- a/Scripts/Multis/DynamicDecay.cs +++ b/Scripts/Multis/DynamicDecay.cs @@ -51,17 +51,14 @@ namespace Server.Multis public class DecayStageInfo { - private TimeSpan m_MinDuration; - private TimeSpan m_MaxDuration; + public TimeSpan MinDuration { get; } - public TimeSpan MinDuration => m_MinDuration; - - public TimeSpan MaxDuration => m_MaxDuration; + public TimeSpan MaxDuration { get; } public DecayStageInfo( TimeSpan min, TimeSpan max ) { - m_MinDuration = min; - m_MaxDuration = max; + MinDuration = min; + MaxDuration = max; } } } diff --git a/Scripts/Multis/HouseFoundation.cs b/Scripts/Multis/HouseFoundation.cs index 81aecdcaf..68c172ae6 100644 --- a/Scripts/Multis/HouseFoundation.cs +++ b/Scripts/Multis/HouseFoundation.cs @@ -29,29 +29,20 @@ namespace Server.Multis private DesignState m_Current; // State which is currently visible. private DesignState m_Design; // State of current design. private DesignState m_Backup; // State at last user backup. - private Item m_SignHanger; // Item hanging the sign. - private Item m_Signpost; // Item supporting the hanger. - private int m_SignpostGraphic; // ItemID number of the chosen signpost. - private int m_LastRevision; // Latest revision number. - private List m_Fixtures; // List of fixtures (teleporters and doors) associated with this house. - private FoundationType m_Type; // Graphic type of this foundation. - private Mobile m_Customizer; // Who is currently customizing this -or- null if not customizing. - public FoundationType Type { get => m_Type; - set => m_Type = value; - } - public int LastRevision { get => m_LastRevision; - set => m_LastRevision = value; - } - public List Fixtures => m_Fixtures; - public Item SignHanger => m_SignHanger; - public Item Signpost => m_Signpost; - public int SignpostGraphic { get => m_SignpostGraphic; - set => m_SignpostGraphic = value; - } - public Mobile Customizer { get => m_Customizer; - set => m_Customizer = value; - } + public FoundationType Type { get; set; } + + public int LastRevision { get; set; } + + public List Fixtures { get; private set; } + + public Item SignHanger { get; private set; } + + public Item Signpost { get; private set; } + + public int SignpostGraphic { get; set; } + + public Mobile Customizer { get; set; } public override bool IsAosRules => true; @@ -61,7 +52,7 @@ namespace Server.Multis public bool IsFixture( Item item ) { - return (m_Fixtures != null && m_Fixtures.Contains( item )); + return (Fixtures != null && Fixtures.Contains( item )); } public override MultiComponentList Components @@ -124,21 +115,21 @@ namespace Server.Multis { base.OnAfterDelete(); - m_SignHanger?.Delete(); + SignHanger?.Delete(); - m_Signpost?.Delete(); + Signpost?.Delete(); - if ( m_Fixtures == null ) + if ( Fixtures == null ) return; - for( int i = 0; i < m_Fixtures.Count; ++i ) + for( int i = 0; i < Fixtures.Count; ++i ) { - Item item = m_Fixtures[i]; + Item item = Fixtures[i]; item?.Delete(); } - m_Fixtures.Clear(); + Fixtures.Clear(); } public override void OnLocationChange( Point3D oldLocation ) @@ -149,16 +140,16 @@ namespace Server.Multis int y = Location.Y - oldLocation.Y; int z = Location.Z - oldLocation.Z; - m_SignHanger?.MoveToWorld( new Point3D( m_SignHanger.X + x, m_SignHanger.Y + y, m_SignHanger.Z + z ), Map ); + SignHanger?.MoveToWorld( new Point3D( SignHanger.X + x, SignHanger.Y + y, SignHanger.Z + z ), Map ); - m_Signpost?.MoveToWorld( new Point3D( m_Signpost.X + x, m_Signpost.Y + y, m_Signpost.Z + z ), Map ); + Signpost?.MoveToWorld( new Point3D( Signpost.X + x, Signpost.Y + y, Signpost.Z + z ), Map ); - if ( m_Fixtures == null ) + if ( Fixtures == null ) return; - for( int i = 0; i < m_Fixtures.Count; ++i ) + for( int i = 0; i < Fixtures.Count; ++i ) { - Item item = m_Fixtures[i]; + Item item = Fixtures[i]; if ( Doors.Contains( item ) ) continue; @@ -171,39 +162,39 @@ namespace Server.Multis { base.OnMapChange(); - if ( m_SignHanger != null ) - m_SignHanger.Map = Map; + if ( SignHanger != null ) + SignHanger.Map = Map; - if ( m_Signpost != null ) - m_Signpost.Map = Map; + if ( Signpost != null ) + Signpost.Map = Map; - if ( m_Fixtures == null ) + if ( Fixtures == null ) return; - for( int i = 0; i < m_Fixtures.Count; ++i ) - m_Fixtures[i].Map = Map; + for( int i = 0; i < Fixtures.Count; ++i ) + Fixtures[i].Map = Map; } public void ClearFixtures( Mobile from ) { - if ( m_Fixtures == null ) + if ( Fixtures == null ) return; RemoveKeys( from ); - for( int i = 0; i < m_Fixtures.Count; ++i ) + for( int i = 0; i < Fixtures.Count; ++i ) { - m_Fixtures[i].Delete(); - Doors.Remove( m_Fixtures[i] ); + Fixtures[i].Delete(); + Doors.Remove( Fixtures[i] ); } - m_Fixtures.Clear(); + Fixtures.Clear(); } public void AddFixtures( Mobile from, MultiTileEntry[] list ) { - if ( m_Fixtures == null ) - m_Fixtures = new List(); + if ( Fixtures == null ) + Fixtures = new List(); uint keyValue = 0; @@ -401,22 +392,22 @@ namespace Server.Multis door.KeyValue = keyValue; AddDoor( door, mte.m_OffsetX, mte.m_OffsetY, mte.m_OffsetZ ); - m_Fixtures.Add( door ); + Fixtures.Add( door ); } } } - for( int i = 0; i < m_Fixtures.Count; ++i ) + for( int i = 0; i < Fixtures.Count; ++i ) { - Item fixture = m_Fixtures[i]; + Item fixture = Fixtures[i]; if ( fixture is HouseTeleporter ) { HouseTeleporter tp = (HouseTeleporter)fixture; - for( int j = 1; j <= m_Fixtures.Count; ++j ) + for( int j = 1; j <= Fixtures.Count; ++j ) { - HouseTeleporter check = m_Fixtures[(i + j) % m_Fixtures.Count] as HouseTeleporter; + HouseTeleporter check = Fixtures[(i + j) % Fixtures.Count] as HouseTeleporter; if ( check != null && check.ItemID == tp.ItemID ) { @@ -452,9 +443,9 @@ namespace Server.Multis case DoorFacing.WestSS: linkFacing = DoorFacing.WestSN; xOffset = 0; yOffset = -1; break; } - for( int j = i + 1; j < m_Fixtures.Count; ++j ) + for( int j = i + 1; j < Fixtures.Count; ++j ) { - BaseHouseDoor check = m_Fixtures[j] as BaseHouseDoor; + BaseHouseDoor check = Fixtures[j] as BaseHouseDoor; if ( check != null && check.Link == null && check.Facing == linkFacing && (check.X - door.X) == xOffset && (check.Y - door.Y) == yOffset && (check.Z == door.Z) ) { @@ -477,7 +468,7 @@ namespace Server.Multis public void AddFixture( Item item, MultiTileEntry mte ) { - m_Fixtures.Add( item ); + Fixtures.Add( item ); item.MoveToWorld( new Point3D( X + mte.m_OffsetX, Y + mte.m_OffsetY, Z + mte.m_OffsetZ ), Map ); } @@ -555,7 +546,7 @@ namespace Server.Multis int yCenter = mcl.Center.Y; int y = mcl.Height - 1; - ApplyFoundation( m_Type, mcl ); + ApplyFoundation( Type, mcl ); for( int x = 1; x < mcl.Width; ++x ) mcl.Add( 0x751, x - xCenter, y - yCenter, 0 ); @@ -584,19 +575,19 @@ namespace Server.Multis if ( CheckWall( mcl, x, y ) ) { - m_Signpost?.Delete(); + Signpost?.Delete(); - m_Signpost = null; + Signpost = null; } - else if ( m_Signpost == null ) + else if ( Signpost == null ) { - m_Signpost = new Static( m_SignpostGraphic ); - m_Signpost.MoveToWorld( new Point3D( X + x, Y + y, Z + 7 ), Map ); + Signpost = new Static( SignpostGraphic ); + Signpost.MoveToWorld( new Point3D( X + x, Y + y, Z + 7 ), Map ); } else { - m_Signpost.ItemID = m_SignpostGraphic; - m_Signpost.MoveToWorld( new Point3D( X + x, Y + y, Z + 7 ), Map ); + Signpost.ItemID = SignpostGraphic; + Signpost.MoveToWorld( new Point3D( X + x, Y + y, Z + 7 ), Map ); } } @@ -624,15 +615,15 @@ namespace Server.Multis public HouseFoundation( Mobile owner, int multiID, int maxLockdowns, int maxSecures ) : base( multiID, owner, maxLockdowns, maxSecures ) { - m_SignpostGraphic = 9; + SignpostGraphic = 9; - m_Fixtures = new List(); + Fixtures = new List(); int x = Components.Min.X; int y = Components.Height - 1 - Components.Center.Y; - m_SignHanger = new Static( 0xB98 ); - m_SignHanger.MoveToWorld( new Point3D( X + x, Y + y, Z + 7 ), Map ); + SignHanger = new Static( 0xB98 ); + SignHanger.MoveToWorld( new Point3D( X + x, Y + y, Z + 7 ), Map ); CheckSignpost(); @@ -697,15 +688,15 @@ namespace Server.Multis { writer.Write( (int)5 ); // version - writer.Write( m_Signpost ); - writer.Write( (int)m_SignpostGraphic ); + writer.Write( Signpost ); + writer.Write( (int)SignpostGraphic ); - writer.Write( (int)m_Type ); + writer.Write( (int)Type ); - writer.Write( m_SignHanger ); + writer.Write( SignHanger ); - writer.Write( (int)m_LastRevision ); - writer.Write( m_Fixtures, true ); + writer.Write( (int)LastRevision ); + writer.Write( Fixtures, true ); CurrentState.Serialize( writer ); DesignState.Serialize( writer ); @@ -727,20 +718,20 @@ namespace Server.Multis case 5: case 4: { - m_Signpost = reader.ReadItem(); - m_SignpostGraphic = reader.ReadInt(); + Signpost = reader.ReadItem(); + SignpostGraphic = reader.ReadInt(); goto case 3; } case 3: { - m_Type = (FoundationType)reader.ReadInt(); + Type = (FoundationType)reader.ReadInt(); goto case 2; } case 2: { - m_SignHanger = reader.ReadItem(); + SignHanger = reader.ReadItem(); goto case 1; } @@ -754,13 +745,13 @@ namespace Server.Multis case 0: { if ( version < 3 ) - m_Type = FoundationType.Stone; + Type = FoundationType.Stone; if ( version < 4 ) - m_SignpostGraphic = 9; + SignpostGraphic = 9; - m_LastRevision = reader.ReadInt(); - m_Fixtures = reader.ReadStrongItemList(); + LastRevision = reader.ReadInt(); + Fixtures = reader.ReadStrongItemList(); m_Current = new DesignState( this, reader ); m_Design = new DesignState( this, reader ); @@ -775,7 +766,7 @@ namespace Server.Multis public bool IsHiddenToCustomizer( Item item ) { - return ( item == m_Signpost || item == m_SignHanger || item == Sign || IsFixture( item ) ); + return ( item == Signpost || item == SignHanger || item == Sign || IsFixture( item ) ); } public static void Initialize() @@ -1677,10 +1668,6 @@ namespace Server.Multis public class DesignState { - private HouseFoundation m_Foundation; - private MultiComponentList m_Components; - private MultiTileEntry[] m_Fixtures; - private int m_Revision; private Packet m_PacketCache; public Packet PacketCache @@ -1697,34 +1684,35 @@ namespace Server.Multis } } - public HouseFoundation Foundation => m_Foundation; - public MultiComponentList Components => m_Components; - public MultiTileEntry[] Fixtures => m_Fixtures; - public int Revision { get => m_Revision; - set => m_Revision = value; - } + public HouseFoundation Foundation { get; } + + public MultiComponentList Components { get; } + + public MultiTileEntry[] Fixtures { get; private set; } + + public int Revision { get; set; } public DesignState( HouseFoundation foundation, MultiComponentList components ) { - m_Foundation = foundation; - m_Components = components; - m_Fixtures = new MultiTileEntry[0]; + Foundation = foundation; + Components = components; + Fixtures = new MultiTileEntry[0]; } public DesignState( DesignState toCopy ) { - m_Foundation = toCopy.m_Foundation; - m_Components = new MultiComponentList( toCopy.m_Components ); - m_Revision = toCopy.m_Revision; - m_Fixtures = new MultiTileEntry[toCopy.m_Fixtures.Length]; + Foundation = toCopy.Foundation; + Components = new MultiComponentList( toCopy.Components ); + Revision = toCopy.Revision; + Fixtures = new MultiTileEntry[toCopy.Fixtures.Length]; - for( int i = 0; i < m_Fixtures.Length; ++i ) - m_Fixtures[i] = toCopy.m_Fixtures[i]; + for( int i = 0; i < Fixtures.Length; ++i ) + Fixtures[i] = toCopy.Fixtures[i]; } public DesignState( HouseFoundation foundation, GenericReader reader ) { - m_Foundation = foundation; + Foundation = foundation; int version = reader.ReadInt(); @@ -1732,22 +1720,22 @@ namespace Server.Multis { case 0: { - m_Components = new MultiComponentList( reader ); + Components = new MultiComponentList( reader ); int length = reader.ReadInt(); - m_Fixtures = new MultiTileEntry[length]; + Fixtures = new MultiTileEntry[length]; for( int i = 0; i < length; ++i ) { - m_Fixtures[i].m_ItemID = reader.ReadUShort(); - m_Fixtures[i].m_OffsetX = reader.ReadShort(); - m_Fixtures[i].m_OffsetY = reader.ReadShort(); - m_Fixtures[i].m_OffsetZ = reader.ReadShort(); - m_Fixtures[i].m_Flags = reader.ReadInt(); + Fixtures[i].m_ItemID = reader.ReadUShort(); + Fixtures[i].m_OffsetX = reader.ReadShort(); + Fixtures[i].m_OffsetY = reader.ReadShort(); + Fixtures[i].m_OffsetZ = reader.ReadShort(); + Fixtures[i].m_Flags = reader.ReadInt(); } - m_Revision = reader.ReadInt(); + Revision = reader.ReadInt(); break; } @@ -1758,13 +1746,13 @@ namespace Server.Multis { writer.Write( (int)0 ); // version - m_Components.Serialize( writer ); + Components.Serialize( writer ); - writer.Write( (int)m_Fixtures.Length ); + writer.Write( (int)Fixtures.Length ); - for( int i = 0; i < m_Fixtures.Length; ++i ) + for( int i = 0; i < Fixtures.Length; ++i ) { - MultiTileEntry ent = m_Fixtures[i]; + MultiTileEntry ent = Fixtures[i]; writer.Write( (ushort)ent.m_ItemID ); writer.Write( (short)ent.m_OffsetX ); @@ -1773,14 +1761,14 @@ namespace Server.Multis writer.Write( (int)ent.m_Flags ); } - writer.Write( (int)m_Revision ); + writer.Write( (int)Revision ); } public void OnRevised() { lock( this ) { - m_Revision = ++m_Foundation.LastRevision; + Revision = ++Foundation.LastRevision; m_PacketCache?.Release(); @@ -1790,7 +1778,7 @@ namespace Server.Multis public void SendGeneralInfoTo( NetState state ) { - state?.Send( new DesignStateGeneral( m_Foundation, this ) ); + state?.Send( new DesignStateGeneral( Foundation, this ) ); } public void SendDetailedInfoTo( NetState state ) @@ -1800,7 +1788,7 @@ namespace Server.Multis lock( this ) { if ( m_PacketCache == null ) - DesignStateDetailed.SendDetails( state, m_Foundation, this ); + DesignStateDetailed.SendDetails( state, Foundation, this ); else state.Send( m_PacketCache ); } @@ -1811,21 +1799,21 @@ namespace Server.Multis { OnRevised(); - for( int i = 0; i < m_Fixtures.Length; ++i ) + for( int i = 0; i < Fixtures.Length; ++i ) { - MultiTileEntry mte = m_Fixtures[i]; + MultiTileEntry mte = Fixtures[i]; - m_Components.Add( mte.m_ItemID, mte.m_OffsetX, mte.m_OffsetY, mte.m_OffsetZ ); + Components.Add( mte.m_ItemID, mte.m_OffsetX, mte.m_OffsetY, mte.m_OffsetZ ); } - m_Fixtures = new MultiTileEntry[0]; + Fixtures = new MultiTileEntry[0]; } public void MeltFixtures() { OnRevised(); - MultiTileEntry[] list = m_Components.List; + MultiTileEntry[] list = Components.List; int length = 0; for( int i = list.Length - 1; i >= 0; --i ) @@ -1836,7 +1824,7 @@ namespace Server.Multis ++length; } - m_Fixtures = new MultiTileEntry[length]; + Fixtures = new MultiTileEntry[length]; for( int i = list.Length - 1; i >= 0; --i ) { @@ -1844,8 +1832,8 @@ namespace Server.Multis if ( IsFixture( mte.m_ItemID ) ) { - m_Fixtures[--length] = mte; - m_Components.Remove( mte.m_ItemID, mte.m_OffsetX, mte.m_OffsetY, mte.m_OffsetZ ); + Fixtures[--length] = mte; + Components.Remove( mte.m_ItemID, mte.m_OffsetX, mte.m_OffsetY, mte.m_OffsetZ ); } } } @@ -1975,31 +1963,26 @@ namespace Server.Multis public class DesignContext { - private HouseFoundation m_Foundation; - private int m_Level; + public HouseFoundation Foundation { get; } - public HouseFoundation Foundation => m_Foundation; - public int Level { get => m_Level; - set => m_Level = value; - } - public int MaxLevels => m_Foundation.MaxLevels; + public int Level { get; set; } + + public int MaxLevels => Foundation.MaxLevels; public DesignContext( HouseFoundation foundation ) { - m_Foundation = foundation; - m_Level = 1; + Foundation = foundation; + Level = 1; } - private static Dictionary m_Table = new Dictionary(); - - public static Dictionary Table => m_Table; + public static Dictionary Table { get; } = new Dictionary(); public static DesignContext Find( Mobile from ) { if ( from == null ) return null; - m_Table.TryGetValue( from, out DesignContext d ); + Table.TryGetValue( from, out DesignContext d ); return d; } @@ -2022,7 +2005,7 @@ namespace Server.Multis DesignContext c = new DesignContext( foundation ); - m_Table[from] = c; + Table[from] = c; if ( from is PlayerMobile ) ((PlayerMobile)from).DesignContext = c; @@ -2063,7 +2046,7 @@ namespace Server.Multis if ( context == null ) return; - m_Table.Remove( from ); + Table.Remove( from ); if ( from is PlayerMobile ) ((PlayerMobile)from).DesignContext = null; diff --git a/Scripts/Multis/HousePlacementTool.cs b/Scripts/Multis/HousePlacementTool.cs index ce7262fdf..68e29594e 100644 --- a/Scripts/Multis/HousePlacementTool.cs +++ b/Scripts/Multis/HousePlacementTool.cs @@ -270,42 +270,39 @@ namespace Server.Items public class HousePlacementEntry { - private Type m_Type; - private int m_Description; private int m_Storage; private int m_Lockdowns; private int m_NewStorage; private int m_NewLockdowns; - private int m_Vendors; - private int m_Cost; - private int m_MultiID; - private Point3D m_Offset; - public Type Type => m_Type; + public Type Type { get; } + + public int Description { get; } - public int Description => m_Description; public int Storage => BaseHouse.NewVendorSystem ? m_NewStorage : m_Storage; public int Lockdowns => BaseHouse.NewVendorSystem ? m_NewLockdowns : m_Lockdowns; - public int Vendors => m_Vendors; - public int Cost => m_Cost; + public int Vendors { get; } - public int MultiID => m_MultiID; - public Point3D Offset => m_Offset; + public int Cost { get; } + + public int MultiID { get; } + + public Point3D Offset { get; } public HousePlacementEntry( Type type, int description, int storage, int lockdowns, int newStorage, int newLockdowns, int vendors, int cost, int xOffset, int yOffset, int zOffset, int multiID ) { - m_Type = type; - m_Description = description; + Type = type; + Description = description; m_Storage = storage; m_Lockdowns = lockdowns; m_NewStorage = newStorage; m_NewLockdowns = newLockdowns; - m_Vendors = vendors; - m_Cost = cost; + Vendors = vendors; + Cost = cost; - m_Offset = new Point3D( xOffset, yOffset, zOffset ); + Offset = new Point3D( xOffset, yOffset, zOffset ); - m_MultiID = multiID; + MultiID = multiID; } public BaseHouse ConstructHouse( Mobile from ) @@ -314,14 +311,14 @@ namespace Server.Items { object[] args; - if ( m_Type == typeof( HouseFoundation ) ) - args = new object[4]{ from, m_MultiID, m_Storage, m_Lockdowns }; - else if ( m_Type == typeof( SmallOldHouse ) || m_Type == typeof( SmallShop ) || m_Type == typeof( TwoStoryHouse ) ) - args = new object[2]{ from, m_MultiID }; + if ( Type == typeof( HouseFoundation ) ) + args = new object[4]{ from, MultiID, m_Storage, m_Lockdowns }; + else if ( Type == typeof( SmallOldHouse ) || Type == typeof( SmallShop ) || Type == typeof( TwoStoryHouse ) ) + args = new object[2]{ from, MultiID }; else args = new object[1]{ from }; - return Activator.CreateInstance( m_Type, args ) as BaseHouse; + return Activator.CreateInstance( Type, args ) as BaseHouse; } catch { @@ -360,7 +357,7 @@ namespace Server.Items ArrayList toMove; //Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z ); - HousePlacementResult res = HousePlacement.Check( from, m_MultiID, center, out toMove ); + HousePlacementResult res = HousePlacement.Check( from, MultiID, center, out toMove ); switch ( res ) { @@ -377,17 +374,17 @@ namespace Server.Items if ( house == null ) return; - house.Price = m_Cost; + house.Price = Cost; if ( from.AccessLevel >= AccessLevel.GameMaster ) { - from.SendMessage( "{0} gold would have been withdrawn from your bank if you were not a GM.", m_Cost.ToString() ); + from.SendMessage( "{0} gold would have been withdrawn from your bank if you were not a GM.", Cost.ToString() ); } else { - if ( Banker.Withdraw( from, m_Cost ) ) + if ( Banker.Withdraw( from, Cost ) ) { - from.SendLocalizedMessage( 1060398, m_Cost.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box. + from.SendLocalizedMessage( 1060398, Cost.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box. } else { @@ -451,8 +448,8 @@ namespace Server.Items return false; ArrayList toMove; - Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z ); - HousePlacementResult res = HousePlacement.Check( from, m_MultiID, center, out toMove ); + Point3D center = new Point3D( p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z ); + HousePlacementResult res = HousePlacement.Check( from, MultiID, center, out toMove ); switch ( res ) { @@ -466,7 +463,7 @@ namespace Server.Items { from.SendLocalizedMessage( 1011576 ); // This is a valid location. - PreviewHouse prev = new PreviewHouse( m_MultiID ); + PreviewHouse prev = new PreviewHouse( MultiID ); MultiComponentList mcl = prev.Components; @@ -556,9 +553,9 @@ namespace Server.Items { m_Table = new Hashtable(); - FillTable( m_ClassicHouses ); - FillTable( m_TwoStoryFoundations ); - FillTable( m_ThreeStoryFoundations ); + FillTable( ClassicHouses ); + FillTable( TwoStoryFoundations ); + FillTable( ThreeStoryFoundations ); } public static HousePlacementEntry Find( BaseHouse house ) @@ -578,7 +575,7 @@ namespace Server.Items { HousePlacementEntry e = (HousePlacementEntry)list[i]; - if ( e.m_MultiID == house.ItemID ) + if ( e.MultiID == house.ItemID ) return e; } } @@ -601,11 +598,11 @@ namespace Server.Items { HousePlacementEntry e = entries[i]; - object obj = m_Table[e.m_Type]; + object obj = m_Table[e.Type]; if ( obj == null ) { - m_Table[e.m_Type] = e; + m_Table[e.Type] = e; } else if ( obj is HousePlacementEntry ) { @@ -614,7 +611,7 @@ namespace Server.Items list.Add( obj ); list.Add( e ); - m_Table[e.m_Type] = list; + m_Table[e.Type] = list; } else if ( obj is ArrayList ) { @@ -625,11 +622,11 @@ namespace Server.Items Hashtable table = new Hashtable(); for ( int j = 0; j < list.Count; ++j ) - table[((HousePlacementEntry)list[j]).m_MultiID] = list[j]; + table[((HousePlacementEntry)list[j]).MultiID] = list[j]; - table[e.m_MultiID] = e; + table[e.MultiID] = e; - m_Table[e.m_Type] = table; + m_Table[e.Type] = table; } else { @@ -638,148 +635,145 @@ namespace Server.Items } else if ( obj is Hashtable ) { - ((Hashtable)obj)[e.m_MultiID] = e; + ((Hashtable)obj)[e.MultiID] = e; } } } - private static HousePlacementEntry[] m_ClassicHouses = { - new HousePlacementEntry( typeof( SmallOldHouse ), 1011303, 425, 212, 489, 244, 10, 37000, 0, 4, 0, 0x0064 ), - new HousePlacementEntry( typeof( SmallOldHouse ), 1011304, 425, 212, 489, 244, 10, 37000, 0, 4, 0, 0x0066 ), - new HousePlacementEntry( typeof( SmallOldHouse ), 1011305, 425, 212, 489, 244, 10, 36750, 0, 4, 0, 0x0068 ), - new HousePlacementEntry( typeof( SmallOldHouse ), 1011306, 425, 212, 489, 244, 10, 35250, 0, 4, 0, 0x006A ), - new HousePlacementEntry( typeof( SmallOldHouse ), 1011307, 425, 212, 489, 244, 10, 36750, 0, 4, 0, 0x006C ), - new HousePlacementEntry( typeof( SmallOldHouse ), 1011308, 425, 212, 489, 244, 10, 36750, 0, 4, 0, 0x006E ), - new HousePlacementEntry( typeof( SmallShop ), 1011321, 425, 212, 489, 244, 10, 50500, -1, 4, 0, 0x00A0 ), - new HousePlacementEntry( typeof( SmallShop ), 1011322, 425, 212, 489, 244, 10, 52500, 0, 4, 0, 0x00A2 ), - new HousePlacementEntry( typeof( SmallTower ), 1011317, 580, 290, 667, 333, 14, 73500, 3, 4, 0, 0x0098 ), - new HousePlacementEntry( typeof( TwoStoryVilla ), 1011319, 1100, 550, 1265, 632, 24, 113750, 3, 6, 0, 0x009E ), - new HousePlacementEntry( typeof( SandStonePatio ), 1011320, 850, 425, 1265, 632, 24, 76500, -1, 4, 0, 0x009C ), - new HousePlacementEntry( typeof( LogCabin ), 1011318, 1100, 550, 1265, 632, 24, 81750, 1, 6, 0, 0x009A ), - new HousePlacementEntry( typeof( GuildHouse ), 1011309, 1370, 685, 1576, 788, 28, 131500, -1, 7, 0, 0x0074 ), - new HousePlacementEntry( typeof( TwoStoryHouse ), 1011310, 1370, 685, 1576, 788, 28, 162750, -3, 7, 0, 0x0076 ), - new HousePlacementEntry( typeof( TwoStoryHouse ), 1011311, 1370, 685, 1576, 788, 28, 162000, -3, 7, 0, 0x0078 ), - new HousePlacementEntry( typeof( LargePatioHouse ), 1011315, 1370, 685, 1576, 788, 28, 129250, -4, 7, 0, 0x008C ), - new HousePlacementEntry( typeof( LargeMarbleHouse ), 1011316, 1370, 685, 1576, 788, 28, 160500, -4, 7, 0, 0x0096 ), - new HousePlacementEntry( typeof( Tower ), 1011312, 2119, 1059, 2437, 1218, 42, 366500, 0, 7, 0, 0x007A ), - new HousePlacementEntry( typeof( Keep ), 1011313, 2625, 1312, 3019, 1509, 52, 572750, 0, 11, 0, 0x007C ), - new HousePlacementEntry( typeof( Castle ), 1011314, 4076, 2038, 4688, 2344, 78, 865250, 0, 16, 0, 0x007E ) - }; - - public static HousePlacementEntry[] ClassicHouses => m_ClassicHouses; + public static HousePlacementEntry[] ClassicHouses { get; } = + { + new HousePlacementEntry( typeof( SmallOldHouse ), 1011303, 425, 212, 489, 244, 10, 37000, 0, 4, 0, 0x0064 ), + new HousePlacementEntry( typeof( SmallOldHouse ), 1011304, 425, 212, 489, 244, 10, 37000, 0, 4, 0, 0x0066 ), + new HousePlacementEntry( typeof( SmallOldHouse ), 1011305, 425, 212, 489, 244, 10, 36750, 0, 4, 0, 0x0068 ), + new HousePlacementEntry( typeof( SmallOldHouse ), 1011306, 425, 212, 489, 244, 10, 35250, 0, 4, 0, 0x006A ), + new HousePlacementEntry( typeof( SmallOldHouse ), 1011307, 425, 212, 489, 244, 10, 36750, 0, 4, 0, 0x006C ), + new HousePlacementEntry( typeof( SmallOldHouse ), 1011308, 425, 212, 489, 244, 10, 36750, 0, 4, 0, 0x006E ), + new HousePlacementEntry( typeof( SmallShop ), 1011321, 425, 212, 489, 244, 10, 50500, -1, 4, 0, 0x00A0 ), + new HousePlacementEntry( typeof( SmallShop ), 1011322, 425, 212, 489, 244, 10, 52500, 0, 4, 0, 0x00A2 ), + new HousePlacementEntry( typeof( SmallTower ), 1011317, 580, 290, 667, 333, 14, 73500, 3, 4, 0, 0x0098 ), + new HousePlacementEntry( typeof( TwoStoryVilla ), 1011319, 1100, 550, 1265, 632, 24, 113750, 3, 6, 0, 0x009E ), + new HousePlacementEntry( typeof( SandStonePatio ), 1011320, 850, 425, 1265, 632, 24, 76500, -1, 4, 0, 0x009C ), + new HousePlacementEntry( typeof( LogCabin ), 1011318, 1100, 550, 1265, 632, 24, 81750, 1, 6, 0, 0x009A ), + new HousePlacementEntry( typeof( GuildHouse ), 1011309, 1370, 685, 1576, 788, 28, 131500, -1, 7, 0, 0x0074 ), + new HousePlacementEntry( typeof( TwoStoryHouse ), 1011310, 1370, 685, 1576, 788, 28, 162750, -3, 7, 0, 0x0076 ), + new HousePlacementEntry( typeof( TwoStoryHouse ), 1011311, 1370, 685, 1576, 788, 28, 162000, -3, 7, 0, 0x0078 ), + new HousePlacementEntry( typeof( LargePatioHouse ), 1011315, 1370, 685, 1576, 788, 28, 129250, -4, 7, 0, 0x008C ), + new HousePlacementEntry( typeof( LargeMarbleHouse ), 1011316, 1370, 685, 1576, 788, 28, 160500, -4, 7, 0, 0x0096 ), + new HousePlacementEntry( typeof( Tower ), 1011312, 2119, 1059, 2437, 1218, 42, 366500, 0, 7, 0, 0x007A ), + new HousePlacementEntry( typeof( Keep ), 1011313, 2625, 1312, 3019, 1509, 52, 572750, 0, 11, 0, 0x007C ), + new HousePlacementEntry( typeof( Castle ), 1011314, 4076, 2038, 4688, 2344, 78, 865250, 0, 16, 0, 0x007E ) + }; - private static HousePlacementEntry[] m_TwoStoryFoundations = { - new HousePlacementEntry( typeof( HouseFoundation ), 1060241, 425, 212, 489, 244, 10, 30500, 0, 4, 0, 0x13EC ), // 7x7 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060242, 580, 290, 667, 333, 14, 34500, 0, 5, 0, 0x13ED ), // 7x8 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060243, 650, 325, 748, 374, 16, 38500, 0, 5, 0, 0x13EE ), // 7x9 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060244, 700, 350, 805, 402, 16, 42500, 0, 6, 0, 0x13EF ), // 7x10 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060245, 750, 375, 863, 431, 16, 46500, 0, 6, 0, 0x13F0 ), // 7x11 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060246, 800, 400, 920, 460, 18, 50500, 0, 7, 0, 0x13F1 ), // 7x12 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060253, 580, 290, 667, 333, 14, 34500, 0, 4, 0, 0x13F8 ), // 8x7 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060254, 650, 325, 748, 374, 16, 39000, 0, 5, 0, 0x13F9 ), // 8x8 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060255, 700, 350, 805, 402, 16, 43500, 0, 5, 0, 0x13FA ), // 8x9 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060256, 750, 375, 863, 431, 16, 48000, 0, 6, 0, 0x13FB ), // 8x10 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060257, 800, 400, 920, 460, 18, 52500, 0, 6, 0, 0x13FC ), // 8x11 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060258, 850, 425, 1265, 632, 24, 57000, 0, 7, 0, 0x13FD ), // 8x12 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060259, 1100, 550, 1265, 632, 24, 61500, 0, 7, 0, 0x13FE ), // 8x13 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060265, 650, 325, 748, 374, 16, 38500, 0, 4, 0, 0x1404 ), // 9x7 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060266, 700, 350, 805, 402, 16, 43500, 0, 5, 0, 0x1405 ), // 9x8 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060267, 750, 375, 863, 431, 16, 48500, 0, 5, 0, 0x1406 ), // 9x9 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060268, 800, 400, 920, 460, 18, 53500, 0, 6, 0, 0x1407 ), // 9x10 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060269, 850, 425, 1265, 632, 24, 58500, 0, 6, 0, 0x1408 ), // 9x11 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060270, 1100, 550, 1265, 632, 24, 63500, 0, 7, 0, 0x1409 ), // 9x12 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060271, 1100, 550, 1265, 632, 24, 68500, 0, 7, 0, 0x140A ), // 9x13 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060277, 700, 350, 805, 402, 16, 42500, 0, 4, 0, 0x1410 ), // 10x7 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060278, 750, 375, 863, 431, 16, 48000, 0, 5, 0, 0x1411 ), // 10x8 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060279, 800, 400, 920, 460, 18, 53500, 0, 5, 0, 0x1412 ), // 10x9 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060280, 850, 425, 1265, 632, 24, 59000, 0, 6, 0, 0x1413 ), // 10x10 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060281, 1100, 550, 1265, 632, 24, 64500, 0, 6, 0, 0x1414 ), // 10x11 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060282, 1100, 550, 1265, 632, 24, 70000, 0, 7, 0, 0x1415 ), // 10x12 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060283, 1150, 575, 1323, 661, 24, 75500, 0, 7, 0, 0x1416 ), // 10x13 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060289, 750, 375, 863, 431, 16, 46500, 0, 4, 0, 0x141C ), // 11x7 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060290, 800, 400, 920, 460, 18, 52500, 0, 5, 0, 0x141D ), // 11x8 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060291, 850, 425, 1265, 632, 24, 58500, 0, 5, 0, 0x141E ), // 11x9 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060292, 1100, 550, 1265, 632, 24, 64500, 0, 6, 0, 0x141F ), // 11x10 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060293, 1100, 550, 1265, 632, 24, 70500, 0, 6, 0, 0x1420 ), // 11x11 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060294, 1150, 575, 1323, 661, 24, 76500, 0, 7, 0, 0x1421 ), // 11x12 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060295, 1200, 600, 1380, 690, 26, 82500, 0, 7, 0, 0x1422 ), // 11x13 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060301, 800, 400, 920, 460, 18, 50500, 0, 4, 0, 0x1428 ), // 12x7 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060302, 850, 425, 1265, 632, 24, 57000, 0, 5, 0, 0x1429 ), // 12x8 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060303, 1100, 550, 1265, 632, 24, 63500, 0, 5, 0, 0x142A ), // 12x9 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060304, 1100, 550, 1265, 632, 24, 70000, 0, 6, 0, 0x142B ), // 12x10 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060305, 1150, 575, 1323, 661, 24, 76500, 0, 6, 0, 0x142C ), // 12x11 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060306, 1200, 600, 1380, 690, 26, 83000, 0, 7, 0, 0x142D ), // 12x12 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060307, 1250, 625, 1438, 719, 26, 89500, 0, 7, 0, 0x142E ), // 12x13 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060314, 1100, 550, 1265, 632, 24, 61500, 0, 5, 0, 0x1435 ), // 13x8 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060315, 1100, 550, 1265, 632, 24, 68500, 0, 5, 0, 0x1436 ), // 13x9 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060316, 1150, 575, 1323, 661, 24, 75500, 0, 6, 0, 0x1437 ), // 13x10 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060317, 1200, 600, 1380, 690, 26, 82500, 0, 6, 0, 0x1438 ), // 13x11 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060318, 1250, 625, 1438, 719, 26, 89500, 0, 7, 0, 0x1439 ), // 13x12 2-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060319, 1300, 650, 1495, 747, 28, 96500, 0, 7, 0, 0x143A ) // 13x13 2-Story Customizable House - }; - - public static HousePlacementEntry[] TwoStoryFoundations => m_TwoStoryFoundations; + public static HousePlacementEntry[] TwoStoryFoundations { get; } = + { + new HousePlacementEntry( typeof( HouseFoundation ), 1060241, 425, 212, 489, 244, 10, 30500, 0, 4, 0, 0x13EC ), // 7x7 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060242, 580, 290, 667, 333, 14, 34500, 0, 5, 0, 0x13ED ), // 7x8 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060243, 650, 325, 748, 374, 16, 38500, 0, 5, 0, 0x13EE ), // 7x9 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060244, 700, 350, 805, 402, 16, 42500, 0, 6, 0, 0x13EF ), // 7x10 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060245, 750, 375, 863, 431, 16, 46500, 0, 6, 0, 0x13F0 ), // 7x11 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060246, 800, 400, 920, 460, 18, 50500, 0, 7, 0, 0x13F1 ), // 7x12 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060253, 580, 290, 667, 333, 14, 34500, 0, 4, 0, 0x13F8 ), // 8x7 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060254, 650, 325, 748, 374, 16, 39000, 0, 5, 0, 0x13F9 ), // 8x8 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060255, 700, 350, 805, 402, 16, 43500, 0, 5, 0, 0x13FA ), // 8x9 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060256, 750, 375, 863, 431, 16, 48000, 0, 6, 0, 0x13FB ), // 8x10 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060257, 800, 400, 920, 460, 18, 52500, 0, 6, 0, 0x13FC ), // 8x11 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060258, 850, 425, 1265, 632, 24, 57000, 0, 7, 0, 0x13FD ), // 8x12 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060259, 1100, 550, 1265, 632, 24, 61500, 0, 7, 0, 0x13FE ), // 8x13 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060265, 650, 325, 748, 374, 16, 38500, 0, 4, 0, 0x1404 ), // 9x7 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060266, 700, 350, 805, 402, 16, 43500, 0, 5, 0, 0x1405 ), // 9x8 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060267, 750, 375, 863, 431, 16, 48500, 0, 5, 0, 0x1406 ), // 9x9 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060268, 800, 400, 920, 460, 18, 53500, 0, 6, 0, 0x1407 ), // 9x10 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060269, 850, 425, 1265, 632, 24, 58500, 0, 6, 0, 0x1408 ), // 9x11 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060270, 1100, 550, 1265, 632, 24, 63500, 0, 7, 0, 0x1409 ), // 9x12 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060271, 1100, 550, 1265, 632, 24, 68500, 0, 7, 0, 0x140A ), // 9x13 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060277, 700, 350, 805, 402, 16, 42500, 0, 4, 0, 0x1410 ), // 10x7 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060278, 750, 375, 863, 431, 16, 48000, 0, 5, 0, 0x1411 ), // 10x8 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060279, 800, 400, 920, 460, 18, 53500, 0, 5, 0, 0x1412 ), // 10x9 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060280, 850, 425, 1265, 632, 24, 59000, 0, 6, 0, 0x1413 ), // 10x10 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060281, 1100, 550, 1265, 632, 24, 64500, 0, 6, 0, 0x1414 ), // 10x11 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060282, 1100, 550, 1265, 632, 24, 70000, 0, 7, 0, 0x1415 ), // 10x12 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060283, 1150, 575, 1323, 661, 24, 75500, 0, 7, 0, 0x1416 ), // 10x13 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060289, 750, 375, 863, 431, 16, 46500, 0, 4, 0, 0x141C ), // 11x7 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060290, 800, 400, 920, 460, 18, 52500, 0, 5, 0, 0x141D ), // 11x8 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060291, 850, 425, 1265, 632, 24, 58500, 0, 5, 0, 0x141E ), // 11x9 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060292, 1100, 550, 1265, 632, 24, 64500, 0, 6, 0, 0x141F ), // 11x10 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060293, 1100, 550, 1265, 632, 24, 70500, 0, 6, 0, 0x1420 ), // 11x11 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060294, 1150, 575, 1323, 661, 24, 76500, 0, 7, 0, 0x1421 ), // 11x12 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060295, 1200, 600, 1380, 690, 26, 82500, 0, 7, 0, 0x1422 ), // 11x13 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060301, 800, 400, 920, 460, 18, 50500, 0, 4, 0, 0x1428 ), // 12x7 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060302, 850, 425, 1265, 632, 24, 57000, 0, 5, 0, 0x1429 ), // 12x8 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060303, 1100, 550, 1265, 632, 24, 63500, 0, 5, 0, 0x142A ), // 12x9 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060304, 1100, 550, 1265, 632, 24, 70000, 0, 6, 0, 0x142B ), // 12x10 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060305, 1150, 575, 1323, 661, 24, 76500, 0, 6, 0, 0x142C ), // 12x11 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060306, 1200, 600, 1380, 690, 26, 83000, 0, 7, 0, 0x142D ), // 12x12 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060307, 1250, 625, 1438, 719, 26, 89500, 0, 7, 0, 0x142E ), // 12x13 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060314, 1100, 550, 1265, 632, 24, 61500, 0, 5, 0, 0x1435 ), // 13x8 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060315, 1100, 550, 1265, 632, 24, 68500, 0, 5, 0, 0x1436 ), // 13x9 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060316, 1150, 575, 1323, 661, 24, 75500, 0, 6, 0, 0x1437 ), // 13x10 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060317, 1200, 600, 1380, 690, 26, 82500, 0, 6, 0, 0x1438 ), // 13x11 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060318, 1250, 625, 1438, 719, 26, 89500, 0, 7, 0, 0x1439 ), // 13x12 2-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060319, 1300, 650, 1495, 747, 28, 96500, 0, 7, 0, 0x143A ) // 13x13 2-Story Customizable House + }; - private static HousePlacementEntry[] m_ThreeStoryFoundations = { - new HousePlacementEntry( typeof( HouseFoundation ), 1060272, 1150, 575, 1323, 661, 24, 73500, 0, 8, 0, 0x140B ), // 9x14 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060284, 1200, 600, 1380, 690, 26, 81000, 0, 8, 0, 0x1417 ), // 10x14 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060285, 1250, 625, 1438, 719, 26, 86500, 0, 8, 0, 0x1418 ), // 10x15 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060296, 1250, 625, 1438, 719, 26, 88500, 0, 8, 0, 0x1423 ), // 11x14 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060297, 1300, 650, 1495, 747, 28, 94500, 0, 8, 0, 0x1424 ), // 11x15 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060298, 1350, 675, 1553, 776, 28, 100500, 0, 9, 0, 0x1425 ), // 11x16 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060308, 1300, 650, 1495, 747, 28, 96000, 0, 8, 0, 0x142F ), // 12x14 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060309, 1350, 675, 1553, 776, 28, 102500, 0, 8, 0, 0x1430 ), // 12x15 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060310, 1370, 685, 1576, 788, 28, 109000, 0, 9, 0, 0x1431 ), // 12x16 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060311, 1370, 685, 1576, 788, 28, 115500, 0, 9, 0, 0x1432 ), // 12x17 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060320, 1350, 675, 1553, 776, 28, 103500, 0, 8, 0, 0x143B ), // 13x14 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060321, 1370, 685, 1576, 788, 28, 110500, 0, 8, 0, 0x143C ), // 13x15 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060322, 1370, 685, 1576, 788, 28, 117500, 0, 9, 0, 0x143D ), // 13x16 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060323, 2119, 1059, 2437, 1218, 42, 124500, 0, 9, 0, 0x143E ), // 13x17 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060324, 2119, 1059, 2437, 1218, 42, 131500, 0, 10, 0, 0x143F ), // 13x18 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060327, 1150, 575, 1323, 661, 24, 73500, 0, 5, 0, 0x1442 ), // 14x9 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060328, 1200, 600, 1380, 690, 26, 81000, 0, 6, 0, 0x1443 ), // 14x10 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060329, 1250, 625, 1438, 719, 26, 88500, 0, 6, 0, 0x1444 ), // 14x11 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060330, 1300, 650, 1495, 747, 28, 96000, 0, 7, 0, 0x1445 ), // 14x12 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060331, 1350, 675, 1553, 776, 28, 103500, 0, 7, 0, 0x1446 ), // 14x13 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060332, 1370, 685, 1576, 788, 28, 111000, 0, 8, 0, 0x1447 ), // 14x14 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060333, 1370, 685, 1576, 788, 28, 118500, 0, 8, 0, 0x1448 ), // 14x15 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060334, 2119, 1059, 2437, 1218, 42, 126000, 0, 9, 0, 0x1449 ), // 14x16 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060335, 2119, 1059, 2437, 1218, 42, 133500, 0, 9, 0, 0x144A ), // 14x17 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060336, 2119, 1059, 2437, 1218, 42, 141000, 0, 10, 0, 0x144B ), // 14x18 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060340, 1250, 625, 1438, 719, 26, 86500, 0, 6, 0, 0x144F ), // 15x10 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060341, 1300, 650, 1495, 747, 28, 94500, 0, 6, 0, 0x1450 ), // 15x11 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060342, 1350, 675, 1553, 776, 28, 102500, 0, 7, 0, 0x1451 ), // 15x12 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060343, 1370, 685, 1576, 788, 28, 110500, 0, 7, 0, 0x1452 ), // 15x13 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060344, 1370, 685, 1576, 788, 28, 118500, 0, 8, 0, 0x1453 ), // 15x14 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060345, 2119, 1059, 2437, 1218, 42, 126500, 0, 8, 0, 0x1454 ), // 15x15 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060346, 2119, 1059, 2437, 1218, 42, 134500, 0, 9, 0, 0x1455 ), // 15x16 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060347, 2119, 1059, 2437, 1218, 42, 142500, 0, 9, 0, 0x1456 ), // 15x17 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060348, 2119, 1059, 2437, 1218, 42, 150500, 0, 10, 0, 0x1457 ), // 15x18 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060353, 1350, 675, 1553, 776, 28, 100500, 0, 6, 0, 0x145C ), // 16x11 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060354, 1370, 685, 1576, 788, 28, 109000, 0, 7, 0, 0x145D ), // 16x12 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060355, 1370, 685, 1576, 788, 28, 117500, 0, 7, 0, 0x145E ), // 16x13 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060356, 2119, 1059, 2437, 1218, 42, 126000, 0, 8, 0, 0x145F ), // 16x14 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060357, 2119, 1059, 2437, 1218, 42, 134500, 0, 8, 0, 0x1460 ), // 16x15 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060358, 2119, 1059, 2437, 1218, 42, 143000, 0, 9, 0, 0x1461 ), // 16x16 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060359, 2119, 1059, 2437, 1218, 42, 151500, 0, 9, 0, 0x1462 ), // 16x17 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060360, 2119, 1059, 2437, 1218, 42, 160000, 0, 10, 0, 0x1463 ), // 16x18 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060366, 1370, 685, 1576, 788, 28, 115500, 0, 7, 0, 0x1469 ), // 17x12 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060367, 2119, 1059, 2437, 1218, 42, 124500, 0, 7, 0, 0x146A ), // 17x13 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060368, 2119, 1059, 2437, 1218, 42, 133500, 0, 8, 0, 0x146B ), // 17x14 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060369, 2119, 1059, 2437, 1218, 42, 142500, 0, 8, 0, 0x146C ), // 17x15 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060370, 2119, 1059, 2437, 1218, 42, 151500, 0, 9, 0, 0x146D ), // 17x16 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060371, 2119, 1059, 2437, 1218, 42, 160500, 0, 9, 0, 0x146E ), // 17x17 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060372, 2119, 1059, 2437, 1218, 42, 169500, 0, 10, 0, 0x146F ), // 17x18 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060379, 2119, 1059, 2437, 1218, 42, 131500, 0, 7, 0, 0x1476 ), // 18x13 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060380, 2119, 1059, 2437, 1218, 42, 141000, 0, 8, 0, 0x1477 ), // 18x14 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060381, 2119, 1059, 2437, 1218, 42, 150500, 0, 8, 0, 0x1478 ), // 18x15 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060382, 2119, 1059, 2437, 1218, 42, 160000, 0, 9, 0, 0x1479 ), // 18x16 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060383, 2119, 1059, 2437, 1218, 42, 169500, 0, 9, 0, 0x147A ), // 18x17 3-Story Customizable House - new HousePlacementEntry( typeof( HouseFoundation ), 1060384, 2119, 1059, 2437, 1218, 42, 179000, 0, 10, 0, 0x147B ) // 18x18 3-Story Customizable House - }; - - public static HousePlacementEntry[] ThreeStoryFoundations => m_ThreeStoryFoundations; + public static HousePlacementEntry[] ThreeStoryFoundations { get; } = + { + new HousePlacementEntry( typeof( HouseFoundation ), 1060272, 1150, 575, 1323, 661, 24, 73500, 0, 8, 0, 0x140B ), // 9x14 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060284, 1200, 600, 1380, 690, 26, 81000, 0, 8, 0, 0x1417 ), // 10x14 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060285, 1250, 625, 1438, 719, 26, 86500, 0, 8, 0, 0x1418 ), // 10x15 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060296, 1250, 625, 1438, 719, 26, 88500, 0, 8, 0, 0x1423 ), // 11x14 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060297, 1300, 650, 1495, 747, 28, 94500, 0, 8, 0, 0x1424 ), // 11x15 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060298, 1350, 675, 1553, 776, 28, 100500, 0, 9, 0, 0x1425 ), // 11x16 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060308, 1300, 650, 1495, 747, 28, 96000, 0, 8, 0, 0x142F ), // 12x14 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060309, 1350, 675, 1553, 776, 28, 102500, 0, 8, 0, 0x1430 ), // 12x15 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060310, 1370, 685, 1576, 788, 28, 109000, 0, 9, 0, 0x1431 ), // 12x16 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060311, 1370, 685, 1576, 788, 28, 115500, 0, 9, 0, 0x1432 ), // 12x17 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060320, 1350, 675, 1553, 776, 28, 103500, 0, 8, 0, 0x143B ), // 13x14 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060321, 1370, 685, 1576, 788, 28, 110500, 0, 8, 0, 0x143C ), // 13x15 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060322, 1370, 685, 1576, 788, 28, 117500, 0, 9, 0, 0x143D ), // 13x16 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060323, 2119, 1059, 2437, 1218, 42, 124500, 0, 9, 0, 0x143E ), // 13x17 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060324, 2119, 1059, 2437, 1218, 42, 131500, 0, 10, 0, 0x143F ), // 13x18 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060327, 1150, 575, 1323, 661, 24, 73500, 0, 5, 0, 0x1442 ), // 14x9 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060328, 1200, 600, 1380, 690, 26, 81000, 0, 6, 0, 0x1443 ), // 14x10 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060329, 1250, 625, 1438, 719, 26, 88500, 0, 6, 0, 0x1444 ), // 14x11 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060330, 1300, 650, 1495, 747, 28, 96000, 0, 7, 0, 0x1445 ), // 14x12 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060331, 1350, 675, 1553, 776, 28, 103500, 0, 7, 0, 0x1446 ), // 14x13 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060332, 1370, 685, 1576, 788, 28, 111000, 0, 8, 0, 0x1447 ), // 14x14 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060333, 1370, 685, 1576, 788, 28, 118500, 0, 8, 0, 0x1448 ), // 14x15 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060334, 2119, 1059, 2437, 1218, 42, 126000, 0, 9, 0, 0x1449 ), // 14x16 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060335, 2119, 1059, 2437, 1218, 42, 133500, 0, 9, 0, 0x144A ), // 14x17 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060336, 2119, 1059, 2437, 1218, 42, 141000, 0, 10, 0, 0x144B ), // 14x18 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060340, 1250, 625, 1438, 719, 26, 86500, 0, 6, 0, 0x144F ), // 15x10 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060341, 1300, 650, 1495, 747, 28, 94500, 0, 6, 0, 0x1450 ), // 15x11 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060342, 1350, 675, 1553, 776, 28, 102500, 0, 7, 0, 0x1451 ), // 15x12 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060343, 1370, 685, 1576, 788, 28, 110500, 0, 7, 0, 0x1452 ), // 15x13 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060344, 1370, 685, 1576, 788, 28, 118500, 0, 8, 0, 0x1453 ), // 15x14 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060345, 2119, 1059, 2437, 1218, 42, 126500, 0, 8, 0, 0x1454 ), // 15x15 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060346, 2119, 1059, 2437, 1218, 42, 134500, 0, 9, 0, 0x1455 ), // 15x16 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060347, 2119, 1059, 2437, 1218, 42, 142500, 0, 9, 0, 0x1456 ), // 15x17 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060348, 2119, 1059, 2437, 1218, 42, 150500, 0, 10, 0, 0x1457 ), // 15x18 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060353, 1350, 675, 1553, 776, 28, 100500, 0, 6, 0, 0x145C ), // 16x11 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060354, 1370, 685, 1576, 788, 28, 109000, 0, 7, 0, 0x145D ), // 16x12 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060355, 1370, 685, 1576, 788, 28, 117500, 0, 7, 0, 0x145E ), // 16x13 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060356, 2119, 1059, 2437, 1218, 42, 126000, 0, 8, 0, 0x145F ), // 16x14 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060357, 2119, 1059, 2437, 1218, 42, 134500, 0, 8, 0, 0x1460 ), // 16x15 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060358, 2119, 1059, 2437, 1218, 42, 143000, 0, 9, 0, 0x1461 ), // 16x16 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060359, 2119, 1059, 2437, 1218, 42, 151500, 0, 9, 0, 0x1462 ), // 16x17 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060360, 2119, 1059, 2437, 1218, 42, 160000, 0, 10, 0, 0x1463 ), // 16x18 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060366, 1370, 685, 1576, 788, 28, 115500, 0, 7, 0, 0x1469 ), // 17x12 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060367, 2119, 1059, 2437, 1218, 42, 124500, 0, 7, 0, 0x146A ), // 17x13 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060368, 2119, 1059, 2437, 1218, 42, 133500, 0, 8, 0, 0x146B ), // 17x14 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060369, 2119, 1059, 2437, 1218, 42, 142500, 0, 8, 0, 0x146C ), // 17x15 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060370, 2119, 1059, 2437, 1218, 42, 151500, 0, 9, 0, 0x146D ), // 17x16 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060371, 2119, 1059, 2437, 1218, 42, 160500, 0, 9, 0, 0x146E ), // 17x17 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060372, 2119, 1059, 2437, 1218, 42, 169500, 0, 10, 0, 0x146F ), // 17x18 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060379, 2119, 1059, 2437, 1218, 42, 131500, 0, 7, 0, 0x1476 ), // 18x13 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060380, 2119, 1059, 2437, 1218, 42, 141000, 0, 8, 0, 0x1477 ), // 18x14 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060381, 2119, 1059, 2437, 1218, 42, 150500, 0, 8, 0, 0x1478 ), // 18x15 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060382, 2119, 1059, 2437, 1218, 42, 160000, 0, 9, 0, 0x1479 ), // 18x16 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060383, 2119, 1059, 2437, 1218, 42, 169500, 0, 9, 0, 0x147A ), // 18x17 3-Story Customizable House + new HousePlacementEntry( typeof( HouseFoundation ), 1060384, 2119, 1059, 2437, 1218, 42, 179000, 0, 10, 0, 0x147B ) // 18x18 3-Story Customizable House + }; } } diff --git a/Scripts/Multis/HouseSign.cs b/Scripts/Multis/HouseSign.cs index 6a0bf900c..291074c06 100644 --- a/Scripts/Multis/HouseSign.cs +++ b/Scripts/Multis/HouseSign.cs @@ -7,13 +7,10 @@ namespace Server.Multis { public class HouseSign : Item { - private BaseHouse m_Owner; - private Mobile m_OrgOwner; - public HouseSign( BaseHouse owner ) : base( 0xBD2 ) { - m_Owner = owner; - m_OrgOwner = m_Owner.Owner; + Owner = owner; + OriginalOwner = Owner.Owner; Movable = false; } @@ -29,24 +26,24 @@ namespace Server.Multis return Name; } - public BaseHouse Owner => m_Owner; + public BaseHouse Owner { get; private set; } [CommandProperty( AccessLevel.GameMaster )] public bool RestrictDecay { - get => ( m_Owner != null && m_Owner.RestrictDecay ); - set{ if ( m_Owner != null ) m_Owner.RestrictDecay = value; } + get => ( Owner != null && Owner.RestrictDecay ); + set{ if ( Owner != null ) Owner.RestrictDecay = value; } } [CommandProperty( AccessLevel.GameMaster )] - public Mobile OriginalOwner => m_OrgOwner; + public Mobile OriginalOwner { get; private set; } public override void OnAfterDelete() { base.OnAfterDelete(); - if ( m_Owner != null && !m_Owner.Deleted ) - m_Owner.Delete(); + if ( Owner != null && !Owner.Deleted ) + Owner.Delete(); } public override void AddNameProperty(ObjectPropertyList list) @@ -56,24 +53,22 @@ namespace Server.Multis public override bool ForceShowProperties => ObjectPropertyList.Enabled; - private bool m_GettingProperties; - - public bool GettingProperties => m_GettingProperties; + public bool GettingProperties { get; private set; } public override void GetProperties( ObjectPropertyList list ) { base.GetProperties( list ); list.Add( 1061639, Utility.FixHtml( GetName() ) ); // Name: ~1_NAME~ - list.Add( 1061640, (m_Owner?.Owner == null) ? "nobody" : m_Owner.Owner.Name ); // Owner: ~1_OWNER~ + list.Add( 1061640, (Owner?.Owner == null) ? "nobody" : Owner.Owner.Name ); // Owner: ~1_OWNER~ - if ( m_Owner != null ) + if ( Owner != null ) { - list.Add( m_Owner.Public ? 1061641 : 1061642 ); // This House is Open to the Public : This is a Private Home + list.Add( Owner.Public ? 1061641 : 1061642 ); // This House is Open to the Public : This is a Private Home - m_GettingProperties = true; - DecayLevel level = m_Owner.DecayLevel; - m_GettingProperties = false; + GettingProperties = true; + DecayLevel level = Owner.DecayLevel; + GettingProperties = false; if ( level == DecayLevel.DemolitionPending ) { @@ -91,11 +86,11 @@ namespace Server.Multis public override void OnSingleClick( Mobile from ) { - if ( m_Owner != null && BaseHouse.DecayEnabled && m_Owner.DecayPeriod != TimeSpan.Zero ) + if ( Owner != null && BaseHouse.DecayEnabled && Owner.DecayPeriod != TimeSpan.Zero ) { string message; - switch ( m_Owner.DecayLevel ) + switch ( Owner.DecayLevel ) { case DecayLevel.Ageless: message = "ageless"; break; case DecayLevel.Fairly: message = "fairly worn"; break; @@ -114,40 +109,40 @@ namespace Server.Multis public void ShowSign( Mobile m ) { - if ( m_Owner != null ) + if ( Owner != null ) { - if ( m_Owner.IsFriend( m ) && m.AccessLevel < AccessLevel.GameMaster ) + if ( Owner.IsFriend( m ) && m.AccessLevel < AccessLevel.GameMaster ) { #region Mondain's Legacy - if ( ( Core.ML && m_Owner.IsOwner( m ) ) || !Core.ML ) - m_Owner.RefreshDecay(); + if ( ( Core.ML && Owner.IsOwner( m ) ) || !Core.ML ) + Owner.RefreshDecay(); #endregion if ( !Core.AOS ) m.SendLocalizedMessage( 501293 ); // Welcome back to the house, friend! } - if ( m_Owner.IsAosRules ) - m.SendGump( new HouseGumpAOS( HouseGumpPageAOS.Information, m, m_Owner ) ); + if ( Owner.IsAosRules ) + m.SendGump( new HouseGumpAOS( HouseGumpPageAOS.Information, m, Owner ) ); else - m.SendGump( new HouseGump( m, m_Owner ) ); + m.SendGump( new HouseGump( m, Owner ) ); } } public void ClaimGump_Callback( Mobile from, bool okay, object state ) { - if ( okay && m_Owner != null && m_Owner.Owner == null && m_Owner.DecayLevel != DecayLevel.DemolitionPending ) + if ( okay && Owner != null && Owner.Owner == null && Owner.DecayLevel != DecayLevel.DemolitionPending ) { bool canClaim = false; - if ( m_Owner.CoOwners == null || m_Owner.CoOwners.Count == 0 ) - canClaim = m_Owner.IsFriend( from ); + if ( Owner.CoOwners == null || Owner.CoOwners.Count == 0 ) + canClaim = Owner.IsFriend( from ); else - canClaim = m_Owner.IsCoOwner( from ); + canClaim = Owner.IsCoOwner( from ); if ( canClaim && !BaseHouse.HasAccountHouse( from ) ) { - m_Owner.Owner = from; - m_Owner.LastTraded = DateTime.UtcNow; + Owner.Owner = from; + Owner.LastTraded = DateTime.UtcNow; } } @@ -156,17 +151,17 @@ namespace Server.Multis public override void OnDoubleClick( Mobile m ) { - if ( m_Owner == null ) + if ( Owner == null ) return; - if ( m.AccessLevel < AccessLevel.GameMaster && m_Owner.Owner == null && m_Owner.DecayLevel != DecayLevel.DemolitionPending ) + if ( m.AccessLevel < AccessLevel.GameMaster && Owner.Owner == null && Owner.DecayLevel != DecayLevel.DemolitionPending ) { bool canClaim = false; - if ( m_Owner.CoOwners == null || m_Owner.CoOwners.Count == 0 ) - canClaim = m_Owner.IsFriend( m ); + if ( Owner.CoOwners == null || Owner.CoOwners.Count == 0 ) + canClaim = Owner.IsFriend( m ); else - canClaim = m_Owner.IsCoOwner( m ); + canClaim = Owner.IsCoOwner( m ); if ( canClaim && !BaseHouse.HasAccountHouse( m ) ) { @@ -260,8 +255,8 @@ namespace Server.Multis writer.Write( (int) 0 ); // version - writer.Write( m_Owner ); - writer.Write( m_OrgOwner ); + writer.Write( Owner ); + writer.Write( OriginalOwner ); } public override void Deserialize( GenericReader reader ) @@ -274,8 +269,8 @@ namespace Server.Multis { case 0: { - m_Owner = reader.ReadItem() as BaseHouse; - m_OrgOwner = reader.ReadMobile(); + Owner = reader.ReadItem() as BaseHouse; + OriginalOwner = reader.ReadMobile(); break; } diff --git a/Scripts/Multis/HouseTeleporter.cs b/Scripts/Multis/HouseTeleporter.cs index 084c70ce8..ee7e891cc 100644 --- a/Scripts/Multis/HouseTeleporter.cs +++ b/Scripts/Multis/HouseTeleporter.cs @@ -8,22 +8,11 @@ namespace Server.Items { public class HouseTeleporter : Item, ISecurable { - private Item m_Target; - private SecureLevel m_Level; + [CommandProperty( AccessLevel.GameMaster )] + public Item Target { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public Item Target - { - get => m_Target; - set => m_Target = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public SecureLevel Level - { - get => m_Level; - set => m_Level = value; - } + public SecureLevel Level { get; set; } [Constructible] public HouseTeleporter( int itemID ) : this( itemID, null ) @@ -34,9 +23,9 @@ namespace Server.Items { Movable = false; - m_Level = SecureLevel.Anyone; + Level = SecureLevel.Anyone; - m_Target = target; + Target = target; } public bool CheckAccess( Mobile m ) @@ -46,12 +35,12 @@ namespace Server.Items if ( house != null && (house.Public ? house.IsBanned( m ) : !house.HasAccess( m )) ) return false; - return ( house != null && house.HasSecureAccess( m, m_Level ) ); + return ( house != null && house.HasSecureAccess( m, Level ) ); } public override bool OnMoveOver( Mobile m ) { - if ( m_Target != null && !m_Target.Deleted ) + if ( Target != null && !Target.Deleted ) { if ( CheckAccess( m ) ) { @@ -85,9 +74,9 @@ namespace Server.Items writer.Write( (int) 1 ); // version - writer.Write( (int) m_Level ); + writer.Write( (int) Level ); - writer.Write( (Item) m_Target ); + writer.Write( (Item) Target ); } public override void Deserialize( GenericReader reader ) @@ -100,15 +89,15 @@ namespace Server.Items { case 1: { - m_Level = (SecureLevel)reader.ReadInt(); + Level = (SecureLevel)reader.ReadInt(); goto case 0; } case 0: { - m_Target = reader.ReadItem(); + Target = reader.ReadItem(); if ( version < 0 ) - m_Level = SecureLevel.Anyone; + Level = SecureLevel.Anyone; break; } @@ -152,7 +141,7 @@ namespace Server.Items protected override void OnTick() { - Item target = m_Teleporter.m_Target; + Item target = m_Teleporter.Target; if ( target != null && !target.Deleted ) { diff --git a/Scripts/Multis/MovingCrate.cs b/Scripts/Multis/MovingCrate.cs index d1caf8953..624fea87d 100644 --- a/Scripts/Multis/MovingCrate.cs +++ b/Scripts/Multis/MovingCrate.cs @@ -15,15 +15,9 @@ namespace Server.Multis public override int LabelNumber => 1061690; // Packing Crate - private BaseHouse m_House; - private Timer m_InternalizeTimer; - public BaseHouse House - { - get => m_House; - set => m_House = value; - } + public BaseHouse House { get; set; } public override int DefaultMaxItems => 0; public override int DefaultMaxWeight => 0; @@ -33,7 +27,7 @@ namespace Server.Multis Hue = 0x8A5; Movable = false; - m_House = house; + House = house; } public MovingCrate( Serial serial ) : base( serial ) @@ -225,7 +219,7 @@ namespace Server.Multis writer.WriteEncodedInt( 1 ); - writer.Write( (Item) m_House ); + writer.Write( (Item) House ); } public override void Deserialize( GenericReader reader ) @@ -234,11 +228,11 @@ namespace Server.Multis int version = reader.ReadEncodedInt(); - m_House = reader.ReadItem() as BaseHouse; + House = reader.ReadItem() as BaseHouse; - if ( m_House != null ) + if ( House != null ) { - m_House.MovingCrate = this; + House.MovingCrate = this; Timer.DelayCall( TimeSpan.Zero, Hide ); } else diff --git a/Scripts/Regions/BaseRegion.cs b/Scripts/Regions/BaseRegion.cs index 8a24c1f9e..1dfa7aa3e 100644 --- a/Scripts/Regions/BaseRegion.cs +++ b/Scripts/Regions/BaseRegion.cs @@ -29,19 +29,15 @@ namespace Server.Regions } private string m_RuneName; - private bool m_NoLogoutDelay; private SpawnEntry[] m_Spawns; - private SpawnZLevel m_SpawnZLevel; private bool m_ExcludeFromParentSpawns; public string RuneName{ get => m_RuneName; set => m_RuneName = value; } - public bool NoLogoutDelay{ get => m_NoLogoutDelay; - set => m_NoLogoutDelay = value; - } + public bool NoLogoutDelay { get; set; } public SpawnEntry[] Spawns { @@ -58,9 +54,7 @@ namespace Server.Regions } } - public SpawnZLevel SpawnZLevel{ get => m_SpawnZLevel; - set => m_SpawnZLevel = value; - } + public SpawnZLevel SpawnZLevel { get; set; } public bool ExcludeFromParentSpawns{ get => m_ExcludeFromParentSpawns; set => m_ExcludeFromParentSpawns = value; @@ -90,7 +84,7 @@ namespace Server.Regions public override TimeSpan GetLogoutDelay( Mobile m ) { - if ( m_NoLogoutDelay ) + if ( NoLogoutDelay ) { if ( m.Aggressors.Count == 0 && m.Aggressed.Count == 0 && !m.Criminal ) return TimeSpan.Zero; @@ -363,7 +357,7 @@ namespace Server.Regions } int z; - switch ( m_SpawnZLevel ) + switch ( SpawnZLevel ) { case SpawnZLevel.Lowest: { @@ -499,7 +493,7 @@ namespace Server.Regions bool logoutDelayActive = true; ReadBoolean( xml["logoutDelay"], "active", ref logoutDelayActive, false ); - m_NoLogoutDelay = !logoutDelayActive; + NoLogoutDelay = !logoutDelayActive; XmlElement spawning = xml["spawning"]; @@ -509,7 +503,7 @@ namespace Server.Regions SpawnZLevel zLevel = SpawnZLevel.Lowest; ReadEnum( spawning, "zLevel", ref zLevel, false ); - m_SpawnZLevel = zLevel; + SpawnZLevel = zLevel; List list = new List(); diff --git a/Scripts/Regions/DungeonRegion.cs b/Scripts/Regions/DungeonRegion.cs index 8371204a4..92ffb7ced 100644 --- a/Scripts/Regions/DungeonRegion.cs +++ b/Scripts/Regions/DungeonRegion.cs @@ -7,14 +7,11 @@ namespace Server.Regions public override bool YoungProtected => false; private Point3D m_EntranceLocation; - private Map m_EntranceMap; public Point3D EntranceLocation{ get => m_EntranceLocation; set => m_EntranceLocation = value; } - public Map EntranceMap{ get => m_EntranceMap; - set => m_EntranceMap = value; - } + public Map EntranceMap { get; set; } public DungeonRegion( XmlElement xml, Map map, Region parent ) : base( xml, map, parent ) { @@ -24,7 +21,7 @@ namespace Server.Regions ReadMap( entrEl, "map", ref entrMap, false ); if ( ReadPoint3D( entrEl, entrMap, ref m_EntranceLocation, false ) ) - m_EntranceMap = entrMap; + EntranceMap = entrMap; } public override bool AllowHousing( Mobile from, Point3D p ) diff --git a/Scripts/Regions/GuardedRegion.cs b/Scripts/Regions/GuardedRegion.cs index 5310aaf07..dcf62da8c 100644 --- a/Scripts/Regions/GuardedRegion.cs +++ b/Scripts/Regions/GuardedRegion.cs @@ -10,15 +10,12 @@ namespace Server.Regions { private static object[] m_GuardParams = new object[1]; private Type m_GuardType; - private bool m_Disabled; - public bool Disabled{ get => m_Disabled; - set => m_Disabled = value; - } + public bool Disabled { get; set; } public virtual bool IsDisabled() { - return m_Disabled; + return Disabled; } public static void Initialize() diff --git a/Scripts/Regions/HouseRegion.cs b/Scripts/Regions/HouseRegion.cs index e6a06cc16..6dca86132 100644 --- a/Scripts/Regions/HouseRegion.cs +++ b/Scripts/Regions/HouseRegion.cs @@ -10,8 +10,6 @@ namespace Server.Regions { public static readonly int HousePriority = DefaultPriority + 1; - private BaseHouse m_House; - public static void Initialize() { EventSink.Login += OnLogin; @@ -27,7 +25,7 @@ namespace Server.Regions public HouseRegion( BaseHouse house ) : base( null, house.Map, HousePriority, GetArea( house ) ) { - m_House = house; + House = house; Point3D ban = house.RelativeBanLocation; @@ -69,7 +67,7 @@ namespace Server.Regions public override bool CheckAccessibility( Item item, Mobile from ) { - return m_House.CheckAccessibility( item, from ); + return House.CheckAccessibility( item, from ); } private bool m_Recursion; @@ -87,37 +85,37 @@ namespace Server.Regions if ( m is BaseCreature && ((BaseCreature)m).NoHouseRestrictions ) { } - else if ( m is BaseCreature && ((BaseCreature)m).IsHouseSummonable && !(BaseCreature.Summoning || m_House.IsInside( oldLocation, 16 )) ) + else if ( m is BaseCreature && ((BaseCreature)m).IsHouseSummonable && !(BaseCreature.Summoning || House.IsInside( oldLocation, 16 )) ) { } - else if ( (m_House.Public || !m_House.IsAosRules) && m_House.IsBanned( m ) && m_House.IsInside( m ) ) + else if ( (House.Public || !House.IsAosRules) && House.IsBanned( m ) && House.IsInside( m ) ) { - m.Location = m_House.BanLocation; + m.Location = House.BanLocation; if ( !Core.SE ) m.SendLocalizedMessage( 501284 ); // You may not enter. } - else if ( m_House.IsAosRules && !m_House.Public && !m_House.HasAccess( m ) && m_House.IsInside( m ) ) + else if ( House.IsAosRules && !House.Public && !House.HasAccess( m ) && House.IsInside( m ) ) { - m.Location = m_House.BanLocation; + m.Location = House.BanLocation; if ( !Core.SE ) m.SendLocalizedMessage( 501284 ); // You may not enter. } - else if ( m_House.IsCombatRestricted( m ) && m_House.IsInside( m ) && !m_House.IsInside( oldLocation, 16 ) ) + else if ( House.IsCombatRestricted( m ) && House.IsInside( m ) && !House.IsInside( oldLocation, 16 ) ) { - m.Location = m_House.BanLocation; + m.Location = House.BanLocation; m.SendLocalizedMessage( 1061637 ); // You are not allowed to access this. } else { - HouseFoundation foundation = m_House as HouseFoundation; + HouseFoundation foundation = House as HouseFoundation; - if ( foundation?.Customizer != null && foundation.Customizer != m && m_House.IsInside( m ) ) - m.Location = m_House.BanLocation; + if ( foundation?.Customizer != null && foundation.Customizer != m && House.IsInside( m ) ) + m.Location = House.BanLocation; } - if ( m_House.InternalizedVendors.Count > 0 && m_House.IsInside( m ) && !m_House.IsInside( oldLocation, 16 ) && m_House.IsOwner( m ) && m.Alive && !m.HasGump( typeof( NoticeGump ) ) ) + if ( House.InternalizedVendors.Count > 0 && House.IsInside( m ) && !House.IsInside( oldLocation, 16 ) && House.IsOwner( m ) && m.Alive && !m.HasGump( typeof( NoticeGump ) ) ) { /* This house has been customized recently, and vendors that work out of this * house have been temporarily relocated. You must now put your vendors back to work. @@ -143,44 +141,44 @@ namespace Server.Regions { return false; } - else if ( from is BaseCreature && ((BaseCreature)from).IsHouseSummonable && !(BaseCreature.Summoning || m_House.IsInside( oldLocation, 16 )) ) + else if ( from is BaseCreature && ((BaseCreature)from).IsHouseSummonable && !(BaseCreature.Summoning || House.IsInside( oldLocation, 16 )) ) { return false; } - else if ( from is BaseCreature && !((BaseCreature)from).Controlled && m_House.IsAosRules && !m_House.Public) + else if ( from is BaseCreature && !((BaseCreature)from).Controlled && House.IsAosRules && !House.Public) { return false; } - else if ( (m_House.Public || !m_House.IsAosRules) && m_House.IsBanned( from ) && m_House.IsInside( newLocation, 16 ) ) + else if ( (House.Public || !House.IsAosRules) && House.IsBanned( from ) && House.IsInside( newLocation, 16 ) ) { - from.Location = m_House.BanLocation; + from.Location = House.BanLocation; if ( !Core.SE ) from.SendLocalizedMessage( 501284 ); // You may not enter. return false; } - else if ( m_House.IsAosRules && !m_House.Public && !m_House.HasAccess( from ) && m_House.IsInside( newLocation, 16 ) ) + else if ( House.IsAosRules && !House.Public && !House.HasAccess( from ) && House.IsInside( newLocation, 16 ) ) { if ( !Core.SE ) from.SendLocalizedMessage( 501284 ); // You may not enter. return false; } - else if ( m_House.IsCombatRestricted( from ) && !m_House.IsInside( oldLocation, 16 ) && m_House.IsInside( newLocation, 16 ) ) + else if ( House.IsCombatRestricted( from ) && !House.IsInside( oldLocation, 16 ) && House.IsInside( newLocation, 16 ) ) { from.SendLocalizedMessage( 1061637 ); // You are not allowed to access this. return false; } else { - HouseFoundation foundation = m_House as HouseFoundation; + HouseFoundation foundation = House as HouseFoundation; - if ( foundation?.Customizer != null && foundation.Customizer != from && m_House.IsInside( newLocation, 16 ) ) + if ( foundation?.Customizer != null && foundation.Customizer != from && House.IsInside( newLocation, 16 ) ) return false; } - if ( m_House.InternalizedVendors.Count > 0 && m_House.IsInside( from ) && !m_House.IsInside( oldLocation, 16 ) && m_House.IsOwner( from ) && from.Alive && !from.HasGump( typeof( NoticeGump ) ) ) + if ( House.InternalizedVendors.Count > 0 && House.IsInside( from ) && !House.IsInside( oldLocation, 16 ) && House.IsOwner( from ) && from.Alive && !from.HasGump( typeof( NoticeGump ) ) ) { /* This house has been customized recently, and vendors that work out of this * house have been temporarily relocated. You must now put your vendors back to work. @@ -196,7 +194,7 @@ namespace Server.Regions public override bool OnDecay( Item item ) { - if ( (m_House.IsLockedDown( item ) || m_House.IsSecure( item )) && m_House.IsInside( item ) ) + if ( (House.IsLockedDown( item ) || House.IsSecure( item )) && House.IsInside( item ) ) return false; return base.OnDecay(item ); } @@ -205,7 +203,7 @@ namespace Server.Regions public override TimeSpan GetLogoutDelay( Mobile m ) { - if ( m_House.IsFriend( m ) && m_House.IsInside( m ) ) + if ( House.IsFriend( m ) && House.IsInside( m ) ) { for ( int i = 0; i < m.Aggressed.Count; ++i ) { @@ -226,11 +224,11 @@ namespace Server.Regions base.OnSpeech( e ); Mobile from = e.Mobile; - Item sign = m_House.Sign; + Item sign = House.Sign; - bool isOwner = m_House.IsOwner( from ); - bool isCoOwner = isOwner || m_House.IsCoOwner( from ); - bool isFriend = isCoOwner || m_House.IsFriend( from ); + bool isOwner = House.IsOwner( from ); + bool isCoOwner = isOwner || House.IsCoOwner( from ); + bool isFriend = isCoOwner || House.IsFriend( from ); if ( !isFriend ) return; @@ -244,7 +242,7 @@ namespace Server.Regions { from.SendLocalizedMessage( 500295 ); // you are too far away to do that. } - else if ( DateTime.UtcNow <= m_House.BuiltOn.AddHours ( 1 ) ) + else if ( DateTime.UtcNow <= House.BuiltOn.AddHours ( 1 ) ) { from.SendLocalizedMessage( 1080178 ); // You must wait one hour between each house demolition. } @@ -252,7 +250,7 @@ namespace Server.Regions { from.CloseGump( typeof( ConfirmHouseResize ) ); from.CloseGump( typeof( HouseGumpAOS ) ); - from.SendGump( new ConfirmHouseResize( from, m_House ) ); + from.SendGump( new ConfirmHouseResize( from, House ) ); } else { @@ -260,14 +258,14 @@ namespace Server.Regions } } - if ( !m_House.IsInside( from ) || !m_House.IsActive ) + if ( !House.IsInside( from ) || !House.IsActive ) return; if ( e.HasKeyword( 0x33 ) ) // remove thyself { if ( isFriend ) { from.SendLocalizedMessage( 501326 ); // Target the individual to eject from this house. - from.Target = new HouseKickTarget( m_House ); + from.Target = new HouseKickTarget( House ); } else { @@ -280,14 +278,14 @@ namespace Server.Regions { from.SendLocalizedMessage( 502094 ); // You must be in your house to do this. } - else if ( !m_House.Public && m_House.IsAosRules ) + else if ( !House.Public && House.IsAosRules ) { from.SendLocalizedMessage( 1062521 ); // You cannot ban someone from a private house. Revoke their access instead. } else { from.SendLocalizedMessage( 501325 ); // Target the individual to ban from this house. - from.Target = new HouseBanTarget( true, m_House ); + from.Target = new HouseBanTarget( true, House ); } } else if ( e.HasKeyword( 0x23 ) ) // I wish to lock this down @@ -295,7 +293,7 @@ namespace Server.Regions if ( isCoOwner ) { from.SendLocalizedMessage( 502097 ); // Lock what down? - from.Target = new LockdownTarget( false, m_House ); + from.Target = new LockdownTarget( false, House ); } else if ( isFriend ) { @@ -311,7 +309,7 @@ namespace Server.Regions if ( isCoOwner ) { from.SendLocalizedMessage( 502100 ); // Choose the item you wish to release - from.Target = new LockdownTarget( true, m_House ); + from.Target = new LockdownTarget( true, House ); } else if ( isFriend ) { @@ -327,7 +325,7 @@ namespace Server.Regions if ( isOwner ) { from.SendLocalizedMessage( 502103 ); // Choose the item you wish to secure - from.Target = new SecureTarget( false, m_House ); + from.Target = new SecureTarget( false, House ); } else { @@ -339,7 +337,7 @@ namespace Server.Regions if ( isOwner ) { from.SendLocalizedMessage( 502106 ); // Choose the item you wish to unsecure - from.Target = new SecureTarget( true, m_House ); + from.Target = new SecureTarget( true, House ); } else { @@ -354,7 +352,7 @@ namespace Server.Regions } else if ( isCoOwner ) { - m_House.AddStrongBox( from ); + House.AddStrongBox( from ); } else if ( isFriend ) { @@ -369,7 +367,7 @@ namespace Server.Regions { if ( isCoOwner ) { - m_House.AddTrashBarrel( from ); + House.AddTrashBarrel( from ); } else if ( isFriend ) { @@ -388,7 +386,7 @@ namespace Server.Regions { Container c = (Container)o; - SecureAccessResult res = m_House.CheckSecureAccess( from, c ); + SecureAccessResult res = House.CheckSecureAccess( from, c ); switch ( res ) { @@ -407,15 +405,15 @@ namespace Server.Regions { Item item = (Item)o; - if ( m_House.IsLockedDown( item ) ) + if ( House.IsLockedDown( item ) ) item.LabelTo( from, 501643 ); // [locked down] - else if ( m_House.IsSecure( item ) ) + else if ( House.IsSecure( item ) ) item.LabelTo( from, 501644 ); // [locked down & secure] } return base.OnSingleClick( from, o ); } - public BaseHouse House => m_House; + public BaseHouse House { get; } } } diff --git a/Scripts/Regions/Spawning/SpawnDefinition.cs b/Scripts/Regions/Spawning/SpawnDefinition.cs index 9519a8763..6cee51b5a 100644 --- a/Scripts/Regions/Spawning/SpawnDefinition.cs +++ b/Scripts/Regions/Spawning/SpawnDefinition.cs @@ -77,10 +77,9 @@ namespace Server.Regions public abstract class SpawnType : SpawnDefinition { - private Type m_Type; private bool m_Init; - public Type Type => m_Type; + public Type Type { get; } public abstract int Height{ get; } public abstract bool Land{ get; } @@ -88,7 +87,7 @@ namespace Server.Regions protected SpawnType( Type type ) { - m_Type = type; + Type = type; m_Init = false; } @@ -124,7 +123,7 @@ namespace Server.Regions { for ( int i = 0; i < types.Length; i++ ) { - if ( types[i] == m_Type ) + if ( types[i] == Type ) return true; } @@ -254,56 +253,50 @@ namespace Server.Regions public class SpawnTreasureChest : SpawnItem { - private int m_ItemID; - private BaseTreasureChest.TreasureLevel m_Level; + public int ItemID { get; } - public int ItemID => m_ItemID; - public BaseTreasureChest.TreasureLevel Level => m_Level; + public BaseTreasureChest.TreasureLevel Level { get; } public SpawnTreasureChest( int itemID, BaseTreasureChest.TreasureLevel level ) : base( typeof( BaseTreasureChest ) ) { - m_ItemID = itemID; - m_Level = level; + ItemID = itemID; + Level = level; } protected override void Init() { - m_Height = TileData.ItemTable[m_ItemID & TileData.MaxItemValue].Height; + m_Height = TileData.ItemTable[ItemID & TileData.MaxItemValue].Height; } protected override Item CreateItem() { - return new BaseTreasureChest( m_ItemID, m_Level ); + return new BaseTreasureChest( ItemID, Level ); } } public class SpawnGroupElement { - private SpawnDefinition m_SpawnDefinition; - private int m_Weight; + public SpawnDefinition SpawnDefinition { get; } - public SpawnDefinition SpawnDefinition => m_SpawnDefinition; - public int Weight => m_Weight; + public int Weight { get; } public SpawnGroupElement( SpawnDefinition spawnDefinition, int weight ) { - m_SpawnDefinition = spawnDefinition; - m_Weight = weight; + SpawnDefinition = spawnDefinition; + Weight = weight; } } public class SpawnGroup : SpawnDefinition { - private static Hashtable m_Table = new Hashtable(); - - public static Hashtable Table => m_Table; + public static Hashtable Table { get; } = new Hashtable(); public static void Register( SpawnGroup group ) { - if ( m_Table.Contains( group.Name ) ) + if ( Table.Contains( group.Name ) ) Console.WriteLine( "Warning: Double SpawnGroup name '{0}'", group.Name ); else - m_Table[group.Name] = group; + Table[group.Name] = group; } static SpawnGroup() @@ -357,17 +350,16 @@ namespace Server.Regions } } - private string m_Name; - private SpawnGroupElement[] m_Elements; private int m_TotalWeight; - public string Name => m_Name; - public SpawnGroupElement[] Elements => m_Elements; + public string Name { get; } + + public SpawnGroupElement[] Elements { get; } public SpawnGroup( string name, SpawnGroupElement[] elements ) { - m_Name = name; - m_Elements = elements; + Name = name; + Elements = elements; m_TotalWeight = 0; for ( int i = 0; i < elements.Length; i++ ) @@ -378,9 +370,9 @@ namespace Server.Regions { int index = Utility.Random( m_TotalWeight ); - for ( int i = 0; i < m_Elements.Length; i++ ) + for ( int i = 0; i < Elements.Length; i++ ) { - SpawnGroupElement element = m_Elements[i]; + SpawnGroupElement element = Elements[i]; if ( index < element.Weight ) return element.SpawnDefinition.Spawn( entry ); @@ -393,9 +385,9 @@ namespace Server.Regions public override bool CanSpawn( params Type[] types ) { - for ( int i = 0; i < m_Elements.Length; i++ ) + for ( int i = 0; i < Elements.Length; i++ ) { - if ( m_Elements[i].SpawnDefinition.CanSpawn( types ) ) + if ( Elements[i].SpawnDefinition.CanSpawn( types ) ) return true; } diff --git a/Scripts/Regions/Spawning/SpawnEntry.cs b/Scripts/Regions/Spawning/SpawnEntry.cs index 044664a2a..d9e440476 100644 --- a/Scripts/Regions/Spawning/SpawnEntry.cs +++ b/Scripts/Regions/Spawning/SpawnEntry.cs @@ -11,9 +11,7 @@ namespace Server.Regions public static readonly TimeSpan DefaultMinSpawnTime = TimeSpan.FromMinutes( 2.0 ); public static readonly TimeSpan DefaultMaxSpawnTime = TimeSpan.FromMinutes( 5.0 ); - private static Hashtable m_Table = new Hashtable(); - - public static Hashtable Table => m_Table; + public static Hashtable Table { get; } = new Hashtable(); // When a creature's AI is deactivated (PlayerRangeSensitive optimization) does it return home? @@ -28,83 +26,81 @@ namespace Server.Regions public static readonly Direction InvalidDirection = Direction.Running; - private int m_ID; - private BaseRegion m_Region; - private Point3D m_Home; - private int m_Range; - private Direction m_Direction; - private SpawnDefinition m_Definition; - private List m_SpawnedObjects; - private int m_Max; - private TimeSpan m_MinSpawnTime; - private TimeSpan m_MaxSpawnTime; - private bool m_Running; - private DateTime m_NextSpawn; private Timer m_SpawnTimer; - public int ID => m_ID; - public BaseRegion Region => m_Region; - Region ISpawner.Region => m_Region; - public Point3D HomeLocation => m_Home; - public int HomeRange => m_Range; - public Direction Direction => m_Direction; - public SpawnDefinition Definition => m_Definition; - public List SpawnedObjects => m_SpawnedObjects; - public int Max => m_Max; - public TimeSpan MinSpawnTime => m_MinSpawnTime; - public TimeSpan MaxSpawnTime => m_MaxSpawnTime; - public bool Running => m_Running; + public int ID { get; } - public bool Complete => m_SpawnedObjects.Count >= m_Max; - public bool Spawning => m_Running && !Complete; + public BaseRegion Region { get; } + + Region ISpawner.Region => Region; + public Point3D HomeLocation { get; } + + public int HomeRange { get; } + + public Direction Direction { get; } + + public SpawnDefinition Definition { get; } + + public List SpawnedObjects { get; } + + public int Max { get; private set; } + + public TimeSpan MinSpawnTime { get; } + + public TimeSpan MaxSpawnTime { get; } + + public bool Running { get; private set; } + + public bool Complete => SpawnedObjects.Count >= Max; + public bool Spawning => Running && !Complete; public SpawnEntry( int id, BaseRegion region, Point3D home, int range, Direction direction, SpawnDefinition definition, int max, TimeSpan minSpawnTime, TimeSpan maxSpawnTime ) { - m_ID = id; - m_Region = region; - m_Home = home; - m_Range = range; - m_Direction = direction; - m_Definition = definition; - m_SpawnedObjects = new List(); - m_Max = max; - m_MinSpawnTime = minSpawnTime; - m_MaxSpawnTime = maxSpawnTime; - m_Running = false; + ID = id; + Region = region; + HomeLocation = home; + HomeRange = range; + Direction = direction; + Definition = definition; + SpawnedObjects = new List(); + Max = max; + MinSpawnTime = minSpawnTime; + MaxSpawnTime = maxSpawnTime; + Running = false; - if ( m_Table.Contains( id ) ) + if ( Table.Contains( id ) ) Console.WriteLine( "Warning: double SpawnEntry ID '{0}'", id ); else - m_Table[id] = this; + Table[id] = this; } public Point3D RandomSpawnLocation( int spawnHeight, bool land, bool water ) { - return m_Region.RandomSpawnLocation( spawnHeight, land, water, m_Home, m_Range ); + return Region.RandomSpawnLocation( spawnHeight, land, water, HomeLocation, HomeRange ); } public void Start() { - if ( m_Running ) + if ( Running ) return; - m_Running = true; + Running = true; CheckTimer(); } public void Stop() { - if ( !m_Running ) + if ( !Running ) return; - m_Running = false; + Running = false; CheckTimer(); } private void Spawn() { - ISpawnable spawn = m_Definition.Spawn(this); + ISpawnable spawn = Definition.Spawn(this); if ( spawn != null ) Add( spawn ); @@ -112,7 +108,7 @@ namespace Server.Regions private void Add( ISpawnable spawn ) { - m_SpawnedObjects.Add( spawn ); + SpawnedObjects.Add( spawn ); spawn.Spawner = this; @@ -122,15 +118,15 @@ namespace Server.Regions void ISpawner.Remove( ISpawnable spawn ) { - m_SpawnedObjects.Remove( spawn ); + SpawnedObjects.Remove( spawn ); CheckTimer(); } private TimeSpan RandomTime() { - int min = (int) m_MinSpawnTime.TotalSeconds; - int max = (int) m_MaxSpawnTime.TotalSeconds; + int min = (int) MinSpawnTime.TotalSeconds; + int max = (int) MaxSpawnTime.TotalSeconds; int rand = Utility.RandomMinMax( min, max ); return TimeSpan.FromSeconds( rand ); @@ -156,7 +152,7 @@ namespace Server.Regions private void TimerCallback() { - int amount = Math.Max( (m_Max - m_SpawnedObjects.Count) / 3, 1 ); + int amount = Math.Max( (Max - SpawnedObjects.Count) / 3, 1 ); for ( int i = 0; i < amount; i++ ) Spawn(); @@ -169,13 +165,13 @@ namespace Server.Regions { InternalDeleteSpawnedObjects(); - m_Running = false; + Running = false; CheckTimer(); } private void InternalDeleteSpawnedObjects() { - foreach ( ISpawnable spawnable in m_SpawnedObjects ) + foreach ( ISpawnable spawnable in SpawnedObjects ) { spawnable.Spawner = null; @@ -185,23 +181,23 @@ namespace Server.Regions spawnable.Delete(); } - m_SpawnedObjects.Clear(); + SpawnedObjects.Clear(); } public void Respawn() { InternalDeleteSpawnedObjects(); - for ( int i = 0; !Complete && i < m_Max; i++ ) + for ( int i = 0; !Complete && i < Max; i++ ) Spawn(); - m_Running = true; + Running = true; CheckTimer(); } public void Delete() { - m_Max = 0; + Max = 0; InternalDeleteSpawnedObjects(); if ( m_SpawnTimer != null ) @@ -210,24 +206,24 @@ namespace Server.Regions m_SpawnTimer = null; } - if ( m_Table[m_ID] == this ) - m_Table.Remove( m_ID ); + if ( Table[ID] == this ) + Table.Remove( ID ); } public void Serialize( GenericWriter writer ) { - writer.Write( (int) m_SpawnedObjects.Count ); + writer.Write( (int) SpawnedObjects.Count ); - for ( int i = 0; i < m_SpawnedObjects.Count; i++ ) + for ( int i = 0; i < SpawnedObjects.Count; i++ ) { - ISpawnable spawn = m_SpawnedObjects[i]; + ISpawnable spawn = SpawnedObjects[i]; int serial = spawn.Serial; writer.Write( (int) serial ); } - writer.Write( (bool) m_Running ); + writer.Write( (bool) Running ); if ( m_SpawnTimer != null ) { @@ -253,7 +249,7 @@ namespace Server.Regions Add(spawnableEntity); } - m_Running = reader.ReadBool(); + Running = reader.ReadBool(); if ( reader.ReadBool() ) { @@ -355,7 +351,7 @@ namespace Server.Regions [Description( "Respawns all regions and sets the spawners as running." )] private static void RespawnAllRegions_OnCommand( CommandEventArgs args ) { - foreach ( SpawnEntry entry in m_Table.Values ) + foreach ( SpawnEntry entry in Table.Values ) { entry.Respawn(); } @@ -382,7 +378,7 @@ namespace Server.Regions [Description( "Deletes all spawned objects of every regions and sets the spawners as not running." )] private static void DelAllRegionSpawns_OnCommand( CommandEventArgs args ) { - foreach ( SpawnEntry entry in m_Table.Values ) + foreach ( SpawnEntry entry in Table.Values ) { entry.DeleteSpawnedObjects(); } @@ -409,7 +405,7 @@ namespace Server.Regions [Description( "Sets the region spawners of all regions as running." )] private static void StartAllRegionSpawns_OnCommand( CommandEventArgs args ) { - foreach ( SpawnEntry entry in m_Table.Values ) + foreach ( SpawnEntry entry in Table.Values ) { entry.Start(); } @@ -436,7 +432,7 @@ namespace Server.Regions [Description( "Sets the region spawners of all regions as not running." )] private static void StopAllRegionSpawns_OnCommand( CommandEventArgs args ) { - foreach ( SpawnEntry entry in m_Table.Values ) + foreach ( SpawnEntry entry in Table.Values ) { entry.Stop(); } diff --git a/Scripts/Skills/AnimalTaming.cs b/Scripts/Skills/AnimalTaming.cs index e2afadf79..d437f7dd2 100644 --- a/Scripts/Skills/AnimalTaming.cs +++ b/Scripts/Skills/AnimalTaming.cs @@ -18,13 +18,7 @@ namespace Server.SkillHandlers SkillInfo.Table[(int)SkillName.AnimalTaming].Callback = OnUse; } - private static bool m_DisableMessage; - - public static bool DisableMessage - { - get => m_DisableMessage; - set => m_DisableMessage = value; - } + public static bool DisableMessage { get; set; } public static TimeSpan OnUse( Mobile m ) { @@ -33,7 +27,7 @@ namespace Server.SkillHandlers m.Target = new InternalTarget(); m.RevealingAction(); - if ( !m_DisableMessage ) + if ( !DisableMessage ) m.SendLocalizedMessage( 502789 ); // Tame which animal? return TimeSpan.FromHours( 6.0 ); diff --git a/Scripts/Skills/Hiding.cs b/Scripts/Skills/Hiding.cs index 83f1395df..40f06c383 100644 --- a/Scripts/Skills/Hiding.cs +++ b/Scripts/Skills/Hiding.cs @@ -6,13 +6,7 @@ namespace Server.SkillHandlers { public class Hiding { - private static bool m_CombatOverride; - - public static bool CombatOverride - { - get => m_CombatOverride; - set => m_CombatOverride = value; - } + public static bool CombatOverride { get; set; } public static void Initialize() { @@ -61,12 +55,12 @@ namespace Server.SkillHandlers //int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10); int range = Math.Min( (int)((100 - m.Skills[SkillName.Hiding].Value)/2) + 8, 18 ); //Cap of 18 not OSI-exact, intentional difference - bool badCombat = ( !m_CombatOverride && m.Combatant != null && m.InRange( m.Combatant.Location, range ) && m.Combatant.InLOS( m ) ); + bool badCombat = ( !CombatOverride && m.Combatant != null && m.InRange( m.Combatant.Location, range ) && m.Combatant.InLOS( m ) ); bool ok = ( !badCombat /*&& m.CheckSkill( SkillName.Hiding, 0.0 - bonus, 100.0 - bonus )*/ ); if ( ok ) { - if ( !m_CombatOverride ) + if ( !CombatOverride ) { foreach ( Mobile check in m.GetMobilesInRange( range ) ) { diff --git a/Scripts/Skills/Stealing.cs b/Scripts/Skills/Stealing.cs index 786ce3e05..d99875563 100644 --- a/Scripts/Skills/Stealing.cs +++ b/Scripts/Skills/Stealing.cs @@ -401,25 +401,23 @@ namespace Server.SkillHandlers { public static readonly TimeSpan StealTime = TimeSpan.FromMinutes( 2.0 ); - private Item m_Stolen; - private Mobile m_Thief; - private Mobile m_Victim; - private DateTime m_Expires; + public Item Stolen { get; } - public Item Stolen => m_Stolen; - public Mobile Thief => m_Thief; - public Mobile Victim => m_Victim; - public DateTime Expires => m_Expires; + public Mobile Thief { get; } - public bool IsExpired => ( DateTime.UtcNow >= m_Expires ); + public Mobile Victim { get; } + + public DateTime Expires { get; private set; } + + public bool IsExpired => ( DateTime.UtcNow >= Expires ); public StolenItem( Item stolen, Mobile thief, Mobile victim ) { - m_Stolen = stolen; - m_Thief = thief; - m_Victim = victim; + Stolen = stolen; + Thief = thief; + Victim = victim; - m_Expires = DateTime.UtcNow + StealTime; + Expires = DateTime.UtcNow + StealTime; } private static Queue m_Queue = new Queue(); @@ -444,9 +442,9 @@ namespace Server.SkillHandlers foreach ( StolenItem si in m_Queue ) { - if ( si.m_Stolen == item && !si.IsExpired ) + if ( si.Stolen == item && !si.IsExpired ) { - victim = si.m_Victim; + victim = si.Victim; return true; } } @@ -460,14 +458,14 @@ namespace Server.SkillHandlers foreach ( StolenItem si in m_Queue ) { - if ( si.m_Stolen.RootParent == corpse && si.m_Victim != null && !si.IsExpired ) + if ( si.Stolen.RootParent == corpse && si.Victim != null && !si.IsExpired ) { - if ( si.m_Victim.AddToBackpack( si.m_Stolen ) ) - si.m_Victim.SendLocalizedMessage( 1010464 ); // the item that was stolen is returned to you. + if ( si.Victim.AddToBackpack( si.Stolen ) ) + si.Victim.SendLocalizedMessage( 1010464 ); // the item that was stolen is returned to you. else - si.m_Victim.SendLocalizedMessage( 1010463 ); // the item that was stolen from you falls to the ground. + si.Victim.SendLocalizedMessage( 1010463 ); // the item that was stolen from you falls to the ground. - si.m_Expires = DateTime.UtcNow; // such a hack + si.Expires = DateTime.UtcNow; // such a hack } } } diff --git a/Scripts/Skills/Stealth.cs b/Scripts/Skills/Stealth.cs index 72468f1b4..6c75de487 100644 --- a/Scripts/Skills/Stealth.cs +++ b/Scripts/Skills/Stealth.cs @@ -13,21 +13,21 @@ namespace Server.SkillHandlers public static double HidingRequirement => ( Core.ML ? 30.0 : ( Core.SE ? 50.0 : 80.0 ) ); - public static int[,] ArmorTable => m_ArmorTable; - private static int[,] m_ArmorTable = { - // Gorget Gloves Helmet Arms Legs Chest Shield - /* Cloth */ { 0, 0, 0, 0, 0, 0, 0 }, - /* Leather */ { 0, 0, 0, 0, 0, 0, 0 }, - /* Studded */ { 2, 2, 0, 4, 6, 10, 0 }, - /* Bone */ { 0, 5, 10, 10, 15, 25, 0 }, - /* Spined */ { 0, 0, 0, 0, 0, 0, 0 }, - /* Horned */ { 0, 0, 0, 0, 0, 0, 0 }, - /* Barbed */ { 0, 0, 0, 0, 0, 0, 0 }, - /* Ring */ { 0, 5, 0, 10, 15, 25, 0 }, - /* Chain */ { 0, 0, 10, 0, 15, 25, 0 }, - /* Plate */ { 5, 5, 10, 10, 15, 25, 0 }, - /* Dragon */ { 0, 5, 10, 10, 15, 25, 0 } - }; + public static int[,] ArmorTable { get; } = + { + // Gorget Gloves Helmet Arms Legs Chest Shield + /* Cloth */ { 0, 0, 0, 0, 0, 0, 0 }, + /* Leather */ { 0, 0, 0, 0, 0, 0, 0 }, + /* Studded */ { 2, 2, 0, 4, 6, 10, 0 }, + /* Bone */ { 0, 5, 10, 10, 15, 25, 0 }, + /* Spined */ { 0, 0, 0, 0, 0, 0, 0 }, + /* Horned */ { 0, 0, 0, 0, 0, 0, 0 }, + /* Barbed */ { 0, 0, 0, 0, 0, 0, 0 }, + /* Ring */ { 0, 5, 0, 10, 15, 25, 0 }, + /* Chain */ { 0, 0, 10, 0, 15, 25, 0 }, + /* Plate */ { 5, 5, 10, 10, 15, 25, 0 }, + /* Dragon */ { 0, 5, 10, 10, 15, 25, 0 } + }; public static int GetArmorRating( Mobile m ) { @@ -46,11 +46,11 @@ namespace Server.SkillHandlers int materialType = (int)armor.MaterialType; int bodyPosition = (int)armor.BodyPosition; - if ( materialType >= m_ArmorTable.GetLength( 0 ) || bodyPosition >= m_ArmorTable.GetLength( 1 ) ) + if ( materialType >= ArmorTable.GetLength( 0 ) || bodyPosition >= ArmorTable.GetLength( 1 ) ) continue; if ( armor.ArmorAttributes.MageArmor == 0 ) - ar += m_ArmorTable[materialType, bodyPosition]; + ar += ArmorTable[materialType, bodyPosition]; } return ar; diff --git a/Scripts/SpecialSystems/Engines/PreventInaccess.cs b/Scripts/SpecialSystems/Engines/PreventInaccess.cs index 4d654c0fb..1979074fd 100644 --- a/Scripts/SpecialSystems/Engines/PreventInaccess.cs +++ b/Scripts/SpecialSystems/Engines/PreventInaccess.cs @@ -74,16 +74,14 @@ namespace Server.Misc private class LocationInfo { - private Point3D m_Location; - private Map m_Map; + public Point3D Location { get; } - public Point3D Location => m_Location; - public Map Map => m_Map; + public Map Map { get; } public LocationInfo( Point3D loc, Map map ) { - m_Location = loc; - m_Map = map; + Location = loc; + Map = map; } } } diff --git a/Scripts/Spells/Base/SpecialMove.cs b/Scripts/Spells/Base/SpecialMove.cs index d683643ab..6ab4efa53 100644 --- a/Scripts/Spells/Base/SpecialMove.cs +++ b/Scripts/Spells/Base/SpecialMove.cs @@ -187,9 +187,7 @@ namespace Server.Spells m.CheckSkill( MoveSkill, RequiredSkill, RequiredSkill + 37.5 ); } - private static Dictionary m_Table = new Dictionary(); - - public static Dictionary Table => m_Table; + public static Dictionary Table { get; } = new Dictionary(); public static void ClearAllMoves( Mobile m ) { @@ -215,7 +213,7 @@ namespace Server.Spells return null; } - m_Table.TryGetValue( m, out SpecialMove move ); + Table.TryGetValue( m, out SpecialMove move ); if ( move != null && move.ValidatesDuringHit && !move.Validate( m ) ) { @@ -251,7 +249,7 @@ namespace Server.Spells { WeaponAbility.ClearCurrentAbility( m ); - m_Table[m] = move; + Table[m] = move; move.OnUse( m ); @@ -268,7 +266,7 @@ namespace Server.Spells public static void ClearCurrentMove( Mobile m ) { - m_Table.TryGetValue( m, out SpecialMove move ); + Table.TryGetValue( m, out SpecialMove move ); if ( move != null ) { @@ -280,7 +278,7 @@ namespace Server.Spells m.Send( new ToggleSpecialAbility( moveID + 1, false ) ); } - m_Table.Remove( m ); + Table.Remove( m ); } public SpecialMove() @@ -341,16 +339,14 @@ namespace Server.Spells public class SpecialMoveContext { - private Timer m_Timer; - private Type m_Type; + public Timer Timer { get; } - public Timer Timer => m_Timer; - public Type Type => m_Type; + public Type Type { get; } public SpecialMoveContext( Timer timer, Type type ) { - m_Timer = timer; - m_Type = type; + Timer = timer; + Type = type; } } } diff --git a/Scripts/Spells/Base/Spell.cs b/Scripts/Spells/Base/Spell.cs index 0380d64e2..7d6f5d128 100644 --- a/Scripts/Spells/Base/Spell.cs +++ b/Scripts/Spells/Base/Spell.cs @@ -14,22 +14,18 @@ namespace Server.Spells { public abstract class Spell : ISpell { - private Mobile m_Caster; - private Item m_Scroll; - private SpellInfo m_Info; - private SpellState m_State; - private long m_StartCastTime; + public SpellState State { get; set; } - public SpellState State{ get => m_State; - set => m_State = value; - } - public Mobile Caster => m_Caster; - public SpellInfo Info => m_Info; - public string Name => m_Info.Name; - public string Mantra => m_Info.Mantra; - public Type[] Reagents => m_Info.Reagents; - public Item Scroll => m_Scroll; - public long StartCastTime => m_StartCastTime; + public Mobile Caster { get; } + + public SpellInfo Info { get; } + + public string Name => Info.Name; + public string Mantra => Info.Mantra; + public Type[] Reagents => Info.Reagents; + public Item Scroll { get; } + + public long StartCastTime { get; private set; } private static TimeSpan NextSpellDelay = TimeSpan.FromSeconds( 0.75 ); private static TimeSpan AnimateDelay = TimeSpan.FromSeconds( 1.5 ); @@ -96,14 +92,14 @@ namespace Server.Spells public void HarmfulSpell( Mobile m ) { - (m as BaseCreature)?.OnHarmfulSpell( m_Caster ); + (m as BaseCreature)?.OnHarmfulSpell( Caster ); } public Spell( Mobile caster, Item scroll, SpellInfo info ) { - m_Caster = caster; - m_Scroll = scroll; - m_Info = info; + Caster = caster; + Scroll = scroll; + Info = info; } public virtual int GetNewAosDamage( int bonus, int dice, int sides, Mobile singleTarget ) @@ -126,14 +122,14 @@ namespace Server.Spells int damage = Utility.Dice( dice, sides, bonus ) * 100; int damageBonus = 0; - int inscribeSkill = GetInscribeFixed( m_Caster ); + int inscribeSkill = GetInscribeFixed( Caster ); int inscribeBonus = (inscribeSkill + (1000 * (inscribeSkill / 1000))) / 200; damageBonus += inscribeBonus; int intBonus = Caster.Int / 10; damageBonus += intBonus; - int sdiBonus = AosAttributes.GetValue( m_Caster, AosAttribute.SpellDamage ); + int sdiBonus = AosAttributes.GetValue( Caster, AosAttribute.SpellDamage ); // PvP spell damage increase cap of 15% from an item�s magic property if ( playerVsPlayer && sdiBonus > 15 ) sdiBonus = 15; @@ -147,7 +143,7 @@ namespace Server.Spells damage = AOS.Scale( damage, 100 + damageBonus ); - int evalSkill = GetDamageFixed( m_Caster ); + int evalSkill = GetDamageFixed( Caster ); int evalScale = 30 + ((9 * evalSkill) / 100); damage = AOS.Scale( damage, evalScale ); @@ -157,7 +153,7 @@ namespace Server.Spells return damage / 100; } - public virtual bool IsCasting => m_State == SpellState.Casting; + public virtual bool IsCasting => State == SpellState.Casting; public virtual void OnCasterHurt() { @@ -167,7 +163,7 @@ namespace Server.Spells if ( IsCasting ) { - object o = ProtectionSpell.Registry[m_Caster]; + object o = ProtectionSpell.Registry[Caster]; bool disturb = true; if ( o is double ) @@ -195,7 +191,7 @@ namespace Server.Spells { if ( IsCasting && BlocksMovement ) { - m_Caster.SendLocalizedMessage( 500111 ); // You are frozen and can not move. + Caster.SendLocalizedMessage( 500111 ); // You are frozen and can not move. return false; } @@ -212,7 +208,7 @@ namespace Server.Spells public virtual bool OnCasterUsingObject( object o ) { - if ( m_State == SpellState.Sequencing ) + if ( State == SpellState.Sequencing ) Disturb( DisturbType.UseRequest ); return true; @@ -220,26 +216,26 @@ namespace Server.Spells public virtual bool OnCastInTown( Region r ) { - return m_Info.AllowTown; + return Info.AllowTown; } public virtual bool ConsumeReagents() { - if ( m_Scroll != null || !m_Caster.Player ) + if ( Scroll != null || !Caster.Player ) return true; - if ( AosAttributes.GetValue( m_Caster, AosAttribute.LowerRegCost ) > Utility.Random( 100 ) ) + if ( AosAttributes.GetValue( Caster, AosAttribute.LowerRegCost ) > Utility.Random( 100 ) ) return true; - if ( Engines.ConPVP.DuelContext.IsFreeConsume( m_Caster ) ) + if ( Engines.ConPVP.DuelContext.IsFreeConsume( Caster ) ) return true; - Container pack = m_Caster.Backpack; + Container pack = Caster.Backpack; if ( pack == null ) return false; - if ( pack.ConsumeTotal( m_Info.Reagents, m_Info.Amounts ) == -1 ) + if ( pack.ConsumeTotal( Info.Reagents, Info.Amounts ) == -1 ) return true; return false; @@ -286,7 +282,7 @@ namespace Server.Spells if ( !Core.AOS ) //EvalInt stuff for AoS is handled elsewhere { - double casterEI = m_Caster.Skills[DamageSkill].Value; + double casterEI = Caster.Skills[DamageSkill].Value; double targetRS = target.Skills[SkillName.MagicResist].Value; /* @@ -302,20 +298,20 @@ namespace Server.Spells scalar = (1.0 + ((casterEI - targetRS) / 200.0)); // magery damage bonus, -25% at 0 skill, +0% at 100 skill, +5% at 120 skill - scalar += (m_Caster.Skills[CastSkill].Value - 100.0) / 400.0; + scalar += (Caster.Skills[CastSkill].Value - 100.0) / 400.0; if ( !target.Player && !target.Body.IsHuman /*&& !Core.AOS*/ ) scalar *= 2.0; // Double magery damage to monsters/animals if not AOS } - (target as BaseCreature)?.AlterDamageScalarFrom( m_Caster, ref scalar ); + (target as BaseCreature)?.AlterDamageScalarFrom( Caster, ref scalar ); - (m_Caster as BaseCreature)?.AlterDamageScalarTo( target, ref scalar ); + (Caster as BaseCreature)?.AlterDamageScalarTo( target, ref scalar ); if ( Core.SE ) scalar *= GetSlayerDamageScalar( target ); - target.Region.SpellDamageScalar( m_Caster, target, ref scalar ); + target.Region.SpellDamageScalar( Caster, target, ref scalar ); if ( Evasion.CheckSpellEvasion( target ) ) //Only single target spells an be evaded scalar = 0; @@ -325,7 +321,7 @@ namespace Server.Spells public virtual double GetSlayerDamageScalar( Mobile defender ) { - Spellbook atkBook = Spellbook.FindEquippedSpellbook( m_Caster ); + Spellbook atkBook = Spellbook.FindEquippedSpellbook( Caster ); double scalar = 1.0; if ( atkBook != null ) @@ -359,7 +355,7 @@ namespace Server.Spells SlayerEntry defSlayer = SlayerGroup.GetEntryByName( defISlayer.Slayer ); SlayerEntry defSlayer2 = SlayerGroup.GetEntryByName( defISlayer.Slayer2 ); - if ( defSlayer != null && defSlayer.Group.OppositionSuperSlays( m_Caster ) || defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays( m_Caster ) ) + if ( defSlayer != null && defSlayer.Group.OppositionSuperSlays( Caster ) || defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays( Caster ) ) scalar = 2.0; } @@ -368,16 +364,16 @@ namespace Server.Spells public virtual void DoFizzle() { - m_Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502632 ); // The spell fizzles. + Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502632 ); // The spell fizzles. - if ( m_Caster.Player ) + if ( Caster.Player ) { if ( Core.AOS ) - m_Caster.FixedParticles( 0x3735, 1, 30, 9503, EffectLayer.Waist ); + Caster.FixedParticles( 0x3735, 1, 30, 9503, EffectLayer.Waist ); else - m_Caster.FixedEffect( 0x3735, 6, 30 ); + Caster.FixedEffect( 0x3735, 6, 30 ); - m_Caster.PlaySound( 0x5C ); + Caster.PlaySound( 0x5C ); } } @@ -391,7 +387,7 @@ namespace Server.Spells public virtual bool CheckDisturb( DisturbType type, bool firstCircle, bool resistable ) { - if ( resistable && m_Scroll is BaseWand ) + if ( resistable && Scroll is BaseWand ) return false; return true; @@ -402,13 +398,13 @@ namespace Server.Spells if ( !CheckDisturb( type, firstCircle, resistable ) ) return; - if ( m_State == SpellState.Casting ) + if ( State == SpellState.Casting ) { if ( !firstCircle && !Core.AOS && this is MagerySpell && ((MagerySpell)this).Circle == SpellCircle.First ) return; - m_State = SpellState.None; - m_Caster.Spell = null; + State = SpellState.None; + Caster.Spell = null; OnDisturb( type, true ); @@ -416,38 +412,38 @@ namespace Server.Spells m_AnimTimer?.Stop(); - if ( Core.AOS && m_Caster.Player && type == DisturbType.Hurt ) + if ( Core.AOS && Caster.Player && type == DisturbType.Hurt ) DoHurtFizzle(); - m_Caster.NextSpellTime = Core.TickCount + (int)GetDisturbRecovery().TotalMilliseconds; + Caster.NextSpellTime = Core.TickCount + (int)GetDisturbRecovery().TotalMilliseconds; } - else if ( m_State == SpellState.Sequencing ) + else if ( State == SpellState.Sequencing ) { if ( !firstCircle && !Core.AOS && this is MagerySpell && ((MagerySpell)this).Circle == SpellCircle.First ) return; - m_State = SpellState.None; - m_Caster.Spell = null; + State = SpellState.None; + Caster.Spell = null; OnDisturb( type, false ); - Target.Cancel( m_Caster ); + Target.Cancel( Caster ); - if ( Core.AOS && m_Caster.Player && type == DisturbType.Hurt ) + if ( Core.AOS && Caster.Player && type == DisturbType.Hurt ) DoHurtFizzle(); } } public virtual void DoHurtFizzle() { - m_Caster.FixedEffect( 0x3735, 6, 30 ); - m_Caster.PlaySound( 0x5C ); + Caster.FixedEffect( 0x3735, 6, 30 ); + Caster.PlaySound( 0x5C ); } public virtual void OnDisturb( DisturbType type, bool message ) { if ( message ) - m_Caster.SendLocalizedMessage( 500641 ); // Your concentration is disturbed, thus ruining thy spell. + Caster.SendLocalizedMessage( 500641 ); // Your concentration is disturbed, thus ruining thy spell. } public virtual bool CheckCast() @@ -457,75 +453,75 @@ namespace Server.Spells public virtual void SayMantra() { - if ( m_Scroll is BaseWand ) + if ( Scroll is BaseWand ) return; - if ( m_Info.Mantra != null && m_Info.Mantra.Length > 0 && m_Caster.Player ) - m_Caster.PublicOverheadMessage( MessageType.Spell, m_Caster.SpeechHue, true, m_Info.Mantra, false ); + if ( Info.Mantra != null && Info.Mantra.Length > 0 && Caster.Player ) + Caster.PublicOverheadMessage( MessageType.Spell, Caster.SpeechHue, true, Info.Mantra, false ); } public virtual bool BlockedByHorrificBeast => true; public virtual bool BlockedByAnimalForm => true; public virtual bool BlocksMovement => true; - public virtual bool CheckNextSpellTime => !(m_Scroll is BaseWand); + public virtual bool CheckNextSpellTime => !(Scroll is BaseWand); public bool Cast() { - m_StartCastTime = Core.TickCount; + StartCastTime = Core.TickCount; - if ( Core.AOS && m_Caster.Spell is Spell && ((Spell)m_Caster.Spell).State == SpellState.Sequencing ) - ((Spell)m_Caster.Spell).Disturb( DisturbType.NewCast ); + if ( Core.AOS && Caster.Spell is Spell && ((Spell)Caster.Spell).State == SpellState.Sequencing ) + ((Spell)Caster.Spell).Disturb( DisturbType.NewCast ); - if ( !m_Caster.CheckAlive() ) + if ( !Caster.CheckAlive() ) { return false; } - if ( m_Scroll is BaseWand && m_Caster.Spell != null && m_Caster.Spell.IsCasting ) + if ( Scroll is BaseWand && Caster.Spell != null && Caster.Spell.IsCasting ) { - m_Caster.SendLocalizedMessage( 502643 ); // You can not cast a spell while frozen. + Caster.SendLocalizedMessage( 502643 ); // You can not cast a spell while frozen. } - else if ( m_Caster.Spell != null && m_Caster.Spell.IsCasting ) + else if ( Caster.Spell != null && Caster.Spell.IsCasting ) { - m_Caster.SendLocalizedMessage( 502642 ); // You are already casting a spell. + Caster.SendLocalizedMessage( 502642 ); // You are already casting a spell. } - else if ( BlockedByHorrificBeast && TransformationSpellHelper.UnderTransformation( m_Caster, typeof( HorrificBeastSpell ) ) || ( BlockedByAnimalForm && AnimalForm.UnderTransformation( m_Caster ) )) + else if ( BlockedByHorrificBeast && TransformationSpellHelper.UnderTransformation( Caster, typeof( HorrificBeastSpell ) ) || ( BlockedByAnimalForm && AnimalForm.UnderTransformation( Caster ) )) { - m_Caster.SendLocalizedMessage( 1061091 ); // You cannot cast that spell in this form. + Caster.SendLocalizedMessage( 1061091 ); // You cannot cast that spell in this form. } - else if ( !(m_Scroll is BaseWand) && (m_Caster.Paralyzed || m_Caster.Frozen) ) + else if ( !(Scroll is BaseWand) && (Caster.Paralyzed || Caster.Frozen) ) { - m_Caster.SendLocalizedMessage( 502643 ); // You can not cast a spell while frozen. + Caster.SendLocalizedMessage( 502643 ); // You can not cast a spell while frozen. } - else if (CheckNextSpellTime && Core.TickCount - m_Caster.NextSpellTime < 0) + else if (CheckNextSpellTime && Core.TickCount - Caster.NextSpellTime < 0) { - m_Caster.SendLocalizedMessage( 502644 ); // You have not yet recovered from casting a spell. + Caster.SendLocalizedMessage( 502644 ); // You have not yet recovered from casting a spell. } - else if ( m_Caster is PlayerMobile && ( (PlayerMobile) m_Caster ).PeacedUntil > DateTime.UtcNow ) + else if ( Caster is PlayerMobile && ( (PlayerMobile) Caster ).PeacedUntil > DateTime.UtcNow ) { - m_Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed. + Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed. } #region Dueling - else if ( (m_Caster as PlayerMobile)?.DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast( m_Caster, this ) ) + else if ( (Caster as PlayerMobile)?.DuelContext != null && !((PlayerMobile)Caster).DuelContext.AllowSpellCast( Caster, this ) ) { } #endregion - else if ( m_Caster.Mana >= ScaleMana( GetMana() ) ) + else if ( Caster.Mana >= ScaleMana( GetMana() ) ) { - if ( m_Caster.Spell == null && m_Caster.CheckSpellCast( this ) && CheckCast() && m_Caster.Region.OnBeginSpellCast( m_Caster, this ) ) + if ( Caster.Spell == null && Caster.CheckSpellCast( this ) && CheckCast() && Caster.Region.OnBeginSpellCast( Caster, this ) ) { - m_State = SpellState.Casting; - m_Caster.Spell = this; + State = SpellState.Casting; + Caster.Spell = this; - if ( !( m_Scroll is BaseWand ) && RevealOnCast ) - m_Caster.RevealingAction(); + if ( !( Scroll is BaseWand ) && RevealOnCast ) + Caster.RevealingAction(); SayMantra(); TimeSpan castDelay = GetCastDelay(); - if ( ShowHandMovement && ( m_Caster.Body.IsHuman || ( m_Caster.Player && m_Caster.Body.IsMonster ) ) ) + if ( ShowHandMovement && ( Caster.Body.IsHuman || ( Caster.Player && Caster.Body.IsMonster ) ) ) { int count = (int)Math.Ceiling( castDelay.TotalSeconds / AnimateDelay.TotalSeconds ); @@ -535,18 +531,18 @@ namespace Server.Spells m_AnimTimer.Start(); } - if ( m_Info.LeftHandEffect > 0 ) - Caster.FixedParticles( 0, 10, 5, m_Info.LeftHandEffect, EffectLayer.LeftHand ); + if ( Info.LeftHandEffect > 0 ) + Caster.FixedParticles( 0, 10, 5, Info.LeftHandEffect, EffectLayer.LeftHand ); - if ( m_Info.RightHandEffect > 0 ) - Caster.FixedParticles( 0, 10, 5, m_Info.RightHandEffect, EffectLayer.RightHand ); + if ( Info.RightHandEffect > 0 ) + Caster.FixedParticles( 0, 10, 5, Info.RightHandEffect, EffectLayer.RightHand ); } if ( ClearHandsOnCast ) - m_Caster.ClearHands(); + Caster.ClearHands(); if ( Core.ML ) - WeaponAbility.ClearCurrentAbility( m_Caster ); + WeaponAbility.ClearCurrentAbility( Caster ); m_CastTimer = new CastTimer( this, castDelay ); //m_CastTimer.Start(); @@ -566,7 +562,7 @@ namespace Server.Spells } else { - m_Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502625 ); // Insufficient mana + Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502625 ); // Insufficient mana } return false; @@ -585,7 +581,7 @@ namespace Server.Spells public virtual bool CheckFizzle() { - if ( m_Scroll is BaseWand ) + if ( Scroll is BaseWand ) return true; double minSkill, maxSkill; @@ -608,7 +604,7 @@ namespace Server.Spells scalar = 1.0; // Lower Mana Cost = 40% - int lmc = AosAttributes.GetValue( m_Caster, AosAttribute.LowerManaCost ); + int lmc = AosAttributes.GetValue( Caster, AosAttribute.LowerManaCost ); if ( lmc > 40 ) lmc = 40; @@ -622,7 +618,7 @@ namespace Server.Spells if ( Core.AOS ) return TimeSpan.Zero; - double delay = 1.0 - Math.Sqrt((Core.TickCount - m_StartCastTime) / 1000.0 / GetCastDelay().TotalSeconds); + double delay = 1.0 - Math.Sqrt((Core.TickCount - StartCastTime) / 1000.0 / GetCastDelay().TotalSeconds); if ( delay < 0.2 ) delay = 0.2; @@ -640,9 +636,9 @@ namespace Server.Spells if ( !Core.AOS ) return NextSpellDelay; - int fcr = AosAttributes.GetValue( m_Caster, AosAttribute.CastRecovery ); + int fcr = AosAttributes.GetValue( Caster, AosAttribute.CastRecovery ); - fcr -= ThunderstormSpell.GetCastRecoveryMalus( m_Caster ); + fcr -= ThunderstormSpell.GetCastRecoveryMalus( Caster ); int fcrDelay = -(CastRecoveryFastScalar * fcr); @@ -667,7 +663,7 @@ namespace Server.Spells public virtual TimeSpan GetCastDelay() { - if ( m_Scroll is BaseWand ) + if ( Scroll is BaseWand ) return Core.ML ? CastDelayBase : TimeSpan.Zero; // TODO: Should FC apply to wands? // Faster casting cap of 2 (if not using the protection spell) @@ -676,19 +672,19 @@ namespace Server.Spells // Paladins with magery of 70.0 or above are subject to a faster casting cap of 2 int fcMax = 4; - if ( CastSkill == SkillName.Magery || CastSkill == SkillName.Necromancy || ( CastSkill == SkillName.Chivalry && m_Caster.Skills[SkillName.Magery].Value >= 70.0 ) ) + if ( CastSkill == SkillName.Magery || CastSkill == SkillName.Necromancy || ( CastSkill == SkillName.Chivalry && Caster.Skills[SkillName.Magery].Value >= 70.0 ) ) fcMax = 2; - int fc = AosAttributes.GetValue( m_Caster, AosAttribute.CastSpeed ); + int fc = AosAttributes.GetValue( Caster, AosAttribute.CastSpeed ); if ( fc > fcMax ) fc = fcMax; - if ( ProtectionSpell.Registry.Contains( m_Caster ) ) + if ( ProtectionSpell.Registry.Contains( Caster ) ) fc -= 2; - if ( EssenceOfWindSpell.IsDebuffed( m_Caster ) ) - fc -= EssenceOfWindSpell.GetFCMalus( m_Caster ); + if ( EssenceOfWindSpell.IsDebuffed( Caster ) ) + fc -= EssenceOfWindSpell.GetFCMalus( Caster ); TimeSpan baseDelay = CastDelayBase; @@ -706,10 +702,10 @@ namespace Server.Spells public virtual void FinishSequence() { - m_State = SpellState.None; + State = SpellState.None; - if ( m_Caster.Spell == this ) - m_Caster.Spell = null; + if ( Caster.Spell == this ) + Caster.Spell = null; } public virtual int ComputeKarmaAward() @@ -721,59 +717,59 @@ namespace Server.Spells { int mana = ScaleMana( GetMana() ); - if ( m_Caster.Deleted || !m_Caster.Alive || m_Caster.Spell != this || m_State != SpellState.Sequencing ) + if ( Caster.Deleted || !Caster.Alive || Caster.Spell != this || State != SpellState.Sequencing ) { DoFizzle(); } - else if ( m_Scroll != null && !(m_Scroll is Runebook) && (m_Scroll.Amount <= 0 || m_Scroll.Deleted || m_Scroll.RootParent != m_Caster || (m_Scroll is BaseWand && (((BaseWand)m_Scroll).Charges <= 0 || m_Scroll.Parent != m_Caster))) ) + else if ( Scroll != null && !(Scroll is Runebook) && (Scroll.Amount <= 0 || Scroll.Deleted || Scroll.RootParent != Caster || (Scroll is BaseWand && (((BaseWand)Scroll).Charges <= 0 || Scroll.Parent != Caster))) ) { DoFizzle(); } else if ( !ConsumeReagents() ) { - m_Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502630 ); // More reagents are needed for this spell. + Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502630 ); // More reagents are needed for this spell. } - else if ( m_Caster.Mana < mana ) + else if ( Caster.Mana < mana ) { - m_Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502625 ); // Insufficient mana for this spell. + Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502625 ); // Insufficient mana for this spell. } - else if ( Core.AOS && (m_Caster.Frozen || m_Caster.Paralyzed) ) + else if ( Core.AOS && (Caster.Frozen || Caster.Paralyzed) ) { - m_Caster.SendLocalizedMessage( 502646 ); // You cannot cast a spell while frozen. + Caster.SendLocalizedMessage( 502646 ); // You cannot cast a spell while frozen. DoFizzle(); } - else if ( m_Caster is PlayerMobile && ((PlayerMobile) m_Caster).PeacedUntil > DateTime.UtcNow ) + else if ( Caster is PlayerMobile && ((PlayerMobile) Caster).PeacedUntil > DateTime.UtcNow ) { - m_Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed. + Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed. DoFizzle(); } else if ( CheckFizzle() ) { - m_Caster.Mana -= mana; + Caster.Mana -= mana; - if ( m_Scroll is SpellScroll ) - m_Scroll.Consume(); - else if ( m_Scroll is BaseWand ) + if ( Scroll is SpellScroll ) + Scroll.Consume(); + else if ( Scroll is BaseWand ) { - ((BaseWand)m_Scroll).ConsumeCharge( m_Caster ); - m_Caster.RevealingAction(); + ((BaseWand)Scroll).ConsumeCharge( Caster ); + Caster.RevealingAction(); } - if ( m_Scroll is BaseWand ) + if ( Scroll is BaseWand ) { - bool m = m_Scroll.Movable; + bool m = Scroll.Movable; - m_Scroll.Movable = false; + Scroll.Movable = false; if ( ClearHandsOnCast ) - m_Caster.ClearHands(); + Caster.ClearHands(); - m_Scroll.Movable = m; + Scroll.Movable = m; } else { if ( ClearHandsOnCast ) - m_Caster.ClearHands(); + Caster.ClearHands(); } int karma = ComputeKarmaAward(); @@ -781,17 +777,17 @@ namespace Server.Spells if ( karma != 0 ) Misc.Titles.AwardKarma( Caster, karma, true ); - if ( TransformationSpellHelper.UnderTransformation( m_Caster, typeof( VampiricEmbraceSpell ) ) ) + if ( TransformationSpellHelper.UnderTransformation( Caster, typeof( VampiricEmbraceSpell ) ) ) { bool garlic = false; - for ( int i = 0; !garlic && i < m_Info.Reagents.Length; ++i ) - garlic = ( m_Info.Reagents[i] == Reagent.Garlic ); + for ( int i = 0; !garlic && i < Info.Reagents.Length; ++i ) + garlic = ( Info.Reagents[i] == Reagent.Garlic ); if ( garlic ) { - m_Caster.SendLocalizedMessage( 1061651 ); // The garlic burns you! - AOS.Damage( m_Caster, Utility.RandomMinMax( 17, 23 ), 100, 0, 0, 0, 0 ); + Caster.SendLocalizedMessage( 1061651 ); // The garlic burns you! + AOS.Damage( Caster, Utility.RandomMinMax( 17, 23 ), 100, 0, 0, 0, 0 ); } } @@ -814,7 +810,7 @@ namespace Server.Spells { if ( !target.Alive && !allowDead ) { - m_Caster.SendLocalizedMessage( 501857 ); // This spell won't work on that! + Caster.SendLocalizedMessage( 501857 ); // This spell won't work on that! return false; } @@ -830,7 +826,7 @@ namespace Server.Spells { if ( !target.Alive ) { - m_Caster.SendLocalizedMessage( 501857 ); // This spell won't work on that! + Caster.SendLocalizedMessage( 501857 ); // This spell won't work on that! return false; } @@ -855,16 +851,16 @@ namespace Server.Spells protected override void OnTick() { - if ( m_Spell.State != SpellState.Casting || m_Spell.m_Caster.Spell != m_Spell ) + if ( m_Spell.State != SpellState.Casting || m_Spell.Caster.Spell != m_Spell ) { Stop(); return; } - if ( !m_Spell.Caster.Mounted && m_Spell.m_Info.Action >= 0 ) + if ( !m_Spell.Caster.Mounted && m_Spell.Info.Action >= 0 ) { if ( m_Spell.Caster.Body.IsHuman ) - m_Spell.Caster.Animate( m_Spell.m_Info.Action, 7, 1, true, false, 0 ); + m_Spell.Caster.Animate( m_Spell.Info.Action, 7, 1, true, false, 0 ); else if ( m_Spell.Caster.Player && m_Spell.Caster.Body.IsMonster ) m_Spell.Caster.Animate( 12, 7, 1, true, false, 0 ); } @@ -887,25 +883,25 @@ namespace Server.Spells protected override void OnTick() { - if ( m_Spell?.m_Caster == null ) + if ( m_Spell?.Caster == null ) { return; } - if ( m_Spell.m_State == SpellState.Casting && m_Spell.m_Caster.Spell == m_Spell ) + if ( m_Spell.State == SpellState.Casting && m_Spell.Caster.Spell == m_Spell ) { - m_Spell.m_State = SpellState.Sequencing; + m_Spell.State = SpellState.Sequencing; m_Spell.m_CastTimer = null; - m_Spell.m_Caster.OnSpellCast( m_Spell ); - m_Spell.m_Caster.Region?.OnSpellCast( m_Spell.m_Caster, m_Spell ); - m_Spell.m_Caster.NextSpellTime = Core.TickCount + (int)m_Spell.GetCastRecovery().TotalMilliseconds; // Spell.NextSpellDelay; + m_Spell.Caster.OnSpellCast( m_Spell ); + m_Spell.Caster.Region?.OnSpellCast( m_Spell.Caster, m_Spell ); + m_Spell.Caster.NextSpellTime = Core.TickCount + (int)m_Spell.GetCastRecovery().TotalMilliseconds; // Spell.NextSpellDelay; - Target originalTarget = m_Spell.m_Caster.Target; + Target originalTarget = m_Spell.Caster.Target; m_Spell.OnCast(); - if ( m_Spell.m_Caster.Player && m_Spell.m_Caster.Target != originalTarget && m_Spell.Caster.Target != null ) - m_Spell.m_Caster.Target.BeginTimeout( m_Spell.m_Caster, TimeSpan.FromSeconds( 30.0 ) ); + if ( m_Spell.Caster.Player && m_Spell.Caster.Target != originalTarget && m_Spell.Caster.Target != null ) + m_Spell.Caster.Target.BeginTimeout( m_Spell.Caster, TimeSpan.FromSeconds( 30.0 ) ); m_Spell.m_CastTimer = null; } diff --git a/Scripts/Spells/Base/SpellHelper.cs b/Scripts/Spells/Base/SpellHelper.cs index c81e5397f..047a9927e 100644 --- a/Scripts/Spells/Base/SpellHelper.cs +++ b/Scripts/Spells/Base/SpellHelper.cs @@ -278,13 +278,7 @@ namespace Server.Spells return TimeSpan.FromSeconds( caster.Skills[SkillName.Magery].Value * 1.2 ); } - private static bool m_DisableSkillCheck; - - public static bool DisableSkillCheck - { - get => m_DisableSkillCheck; - set => m_DisableSkillCheck = value; - } + public static bool DisableSkillCheck { get; set; } public static double GetOffsetScalar( Mobile caster, Mobile target, bool curse ) { @@ -307,7 +301,7 @@ namespace Server.Spells { if ( Core.AOS ) { - if ( !m_DisableSkillCheck ) + if ( !DisableSkillCheck ) { caster.CheckSkill( SkillName.EvalInt, 0.0, 120.0 ); @@ -1387,22 +1381,20 @@ namespace Server.Spells public class TransformContext { - private Timer m_Timer; - private List m_Mods; - private Type m_Type; - private ITransformationSpell m_Spell; + public Timer Timer { get; } - public Timer Timer => m_Timer; - public List Mods => m_Mods; - public Type Type => m_Type; - public ITransformationSpell Spell => m_Spell; + public List Mods { get; } + + public Type Type { get; } + + public ITransformationSpell Spell { get; } public TransformContext( Timer timer, List mods, Type type, ITransformationSpell spell ) { - m_Timer = timer; - m_Mods = mods; - m_Type = type; - m_Spell = spell; + Timer = timer; + Mods = mods; + Type = type; + Spell = spell; } } diff --git a/Scripts/Spells/Base/SpellInfo.cs b/Scripts/Spells/Base/SpellInfo.cs index 18c14482b..d3f5b3134 100644 --- a/Scripts/Spells/Base/SpellInfo.cs +++ b/Scripts/Spells/Base/SpellInfo.cs @@ -4,14 +4,6 @@ namespace Server.Spells { public class SpellInfo { - private string m_Name; - private string m_Mantra; - private Type[] m_Reagents; - private int[] m_Amounts; - private int m_Action; - private bool m_AllowTown; - private int m_LeftHandEffect, m_RightHandEffect; - public SpellInfo( string name, string mantra, params Type[] regs ) : this( name, mantra, 16, 0, 0, true, regs ) { } @@ -38,44 +30,35 @@ namespace Server.Spells public SpellInfo( string name, string mantra, int action, int leftHandEffect, int rightHandEffect, bool allowTown, params Type[] regs ) { - m_Name = name; - m_Mantra = mantra; - m_Action = action; - m_Reagents = regs; - m_AllowTown = allowTown; + Name = name; + Mantra = mantra; + Action = action; + Reagents = regs; + AllowTown = allowTown; - m_LeftHandEffect = leftHandEffect; - m_RightHandEffect = rightHandEffect; + LeftHandEffect = leftHandEffect; + RightHandEffect = rightHandEffect; - m_Amounts = new int[regs.Length]; + Amounts = new int[regs.Length]; for ( int i = 0; i < regs.Length; ++i ) - m_Amounts[i] = 1; + Amounts[i] = 1; } - public int Action{ get => m_Action; - set => m_Action = value; - } - public bool AllowTown{ get => m_AllowTown; - set => m_AllowTown = value; - } - public int[] Amounts{ get => m_Amounts; - set => m_Amounts = value; - } - public string Mantra{ get => m_Mantra; - set => m_Mantra = value; - } - public string Name{ get => m_Name; - set => m_Name = value; - } - public Type[] Reagents{ get => m_Reagents; - set => m_Reagents = value; - } - public int LeftHandEffect{ get => m_LeftHandEffect; - set => m_LeftHandEffect = value; - } - public int RightHandEffect{ get => m_RightHandEffect; - set => m_RightHandEffect = value; - } + public int Action { get; set; } + + public bool AllowTown { get; set; } + + public int[] Amounts { get; set; } + + public string Mantra { get; set; } + + public string Name { get; set; } + + public Type[] Reagents { get; set; } + + public int LeftHandEffect { get; set; } + + public int RightHandEffect { get; set; } } } \ No newline at end of file diff --git a/Scripts/Spells/Base/SpellRegistry.cs b/Scripts/Spells/Base/SpellRegistry.cs index 67525faa5..7c8d60b98 100644 --- a/Scripts/Spells/Base/SpellRegistry.cs +++ b/Scripts/Spells/Base/SpellRegistry.cs @@ -37,8 +37,7 @@ namespace Server.Spells private static Dictionary m_IDsFromTypes = new Dictionary( m_Types.Length ); - private static Dictionary m_SpecialMoves = new Dictionary(); - public static Dictionary SpecialMoves => m_SpecialMoves; + public static Dictionary SpecialMoves { get; } = new Dictionary(); public static int GetRegistryNumber( ISpell s ) { @@ -84,7 +83,7 @@ namespace Server.Spells } if ( spm != null ) - m_SpecialMoves.Add( spellID, spm ); + SpecialMoves.Add( spellID, spm ); } } @@ -95,10 +94,10 @@ namespace Server.Spells Type t = m_Types[spellID]; - if ( t == null || !t.IsSubclassOf( typeof( SpecialMove ) ) || !m_SpecialMoves.ContainsKey( spellID ) ) + if ( t == null || !t.IsSubclassOf( typeof( SpecialMove ) ) || !SpecialMoves.ContainsKey( spellID ) ) return null; - return m_SpecialMoves[spellID]; + return SpecialMoves[spellID]; } private static object[] m_Params = new object[2]; diff --git a/Scripts/Spells/First/CreateFood.cs b/Scripts/Spells/First/CreateFood.cs index e9e27941f..05e236605 100644 --- a/Scripts/Spells/First/CreateFood.cs +++ b/Scripts/Spells/First/CreateFood.cs @@ -58,20 +58,14 @@ namespace Server.Spells.First public class FoodInfo { - private Type m_Type; - private string m_Name; + public Type Type { get; set; } - public Type Type{ get => m_Type; - set => m_Type = value; - } - public string Name{ get => m_Name; - set => m_Name = value; - } + public string Name { get; set; } public FoodInfo( Type type, string name ) { - m_Type = type; - m_Name = name; + Type = type; + Name = name; } public Item Create() @@ -80,7 +74,7 @@ namespace Server.Spells.First try { - item = (Item)Activator.CreateInstance( m_Type ); + item = (Item)Activator.CreateInstance( Type ); } catch { diff --git a/Scripts/Spells/Necromancy/SummonFamiliar.cs b/Scripts/Spells/Necromancy/SummonFamiliar.cs index 6b5cec59f..a8c8ce0ea 100644 --- a/Scripts/Spells/Necromancy/SummonFamiliar.cs +++ b/Scripts/Spells/Necromancy/SummonFamiliar.cs @@ -26,13 +26,11 @@ namespace Server.Spells.Necromancy { } - private static Hashtable m_Table = new Hashtable(); - - public static Hashtable Table => m_Table; + public static Hashtable Table { get; } = new Hashtable(); public override bool CheckCast() { - BaseCreature check = (BaseCreature)m_Table[Caster]; + BaseCreature check = (BaseCreature)Table[Caster]; if ( check != null && !check.Deleted ) { @@ -48,41 +46,38 @@ namespace Server.Spells.Necromancy if ( CheckSequence() ) { Caster.CloseGump( typeof( SummonFamiliarGump ) ); - Caster.SendGump( new SummonFamiliarGump( Caster, m_Entries, this ) ); + Caster.SendGump( new SummonFamiliarGump( Caster, Entries, this ) ); } FinishSequence(); } - private static SummonFamiliarEntry[] m_Entries = { - new SummonFamiliarEntry( typeof( HordeMinionFamiliar ), 1060146, 30.0, 30.0 ), // Horde Minion - new SummonFamiliarEntry( typeof( ShadowWispFamiliar ), 1060142, 50.0, 50.0 ), // Shadow Wisp - new SummonFamiliarEntry( typeof( DarkWolfFamiliar ), 1060143, 60.0, 60.0 ), // Dark Wolf - new SummonFamiliarEntry( typeof( DeathAdder ), 1060145, 80.0, 80.0 ), // Death Adder - new SummonFamiliarEntry( typeof( VampireBatFamiliar ), 1060144, 100.0, 100.0 ) // Vampire Bat - }; - - public static SummonFamiliarEntry[] Entries => m_Entries; + public static SummonFamiliarEntry[] Entries { get; } = + { + new SummonFamiliarEntry( typeof( HordeMinionFamiliar ), 1060146, 30.0, 30.0 ), // Horde Minion + new SummonFamiliarEntry( typeof( ShadowWispFamiliar ), 1060142, 50.0, 50.0 ), // Shadow Wisp + new SummonFamiliarEntry( typeof( DarkWolfFamiliar ), 1060143, 60.0, 60.0 ), // Dark Wolf + new SummonFamiliarEntry( typeof( DeathAdder ), 1060145, 80.0, 80.0 ), // Death Adder + new SummonFamiliarEntry( typeof( VampireBatFamiliar ), 1060144, 100.0, 100.0 ) // Vampire Bat + }; } public class SummonFamiliarEntry { - private Type m_Type; - private object m_Name; - private double m_ReqNecromancy; - private double m_ReqSpiritSpeak; + public Type Type { get; } - public Type Type => m_Type; - public object Name => m_Name; - public double ReqNecromancy => m_ReqNecromancy; - public double ReqSpiritSpeak => m_ReqSpiritSpeak; + public object Name { get; } + + public double ReqNecromancy { get; } + + public double ReqSpiritSpeak { get; } public SummonFamiliarEntry( Type type, object name, double reqNecromancy, double reqSpiritSpeak ) { - m_Type = type; - m_Name = name; - m_ReqNecromancy = reqNecromancy; - m_ReqSpiritSpeak = reqSpiritSpeak; + Type = type; + Name = name; + ReqNecromancy = reqNecromancy; + ReqSpiritSpeak = reqSpiritSpeak; } } diff --git a/Scripts/Spells/Ninjitsu/AnimalForm.cs b/Scripts/Spells/Ninjitsu/AnimalForm.cs index 93ae0fbb2..e8e9f9f2a 100644 --- a/Scripts/Spells/Ninjitsu/AnimalForm.cs +++ b/Scripts/Spells/Ninjitsu/AnimalForm.cs @@ -126,7 +126,7 @@ namespace Server.Spells.Ninjitsu if (GetLastAnimalForm(Caster) == -1 || !skipGump) { Caster.CloseGump(typeof(AnimalFormGump)); - Caster.SendGump(new AnimalFormGump(Caster, m_Entries, this)); + Caster.SendGump(new AnimalFormGump(Caster, Entries, this)); } else { @@ -177,10 +177,10 @@ namespace Server.Spells.Ninjitsu public static MorphResult Morph(Mobile m, int entryID) { - if (entryID < 0 || entryID >= m_Entries.Length) + if (entryID < 0 || entryID >= Entries.Length) return MorphResult.Fail; - AnimalFormEntry entry = m_Entries[entryID]; + AnimalFormEntry entry = Entries[entryID]; m_LastAnimalForms[m] = entryID; //On OSI, it's the last /attempted/ one not the last succeeded one @@ -320,30 +320,29 @@ namespace Server.Spells.Ninjitsu public class AnimalFormEntry { - private Type m_Type; - private TextDefinition m_Name; - private int m_ItemID; - private int m_Hue; - private int m_Tooltip; - private double m_ReqSkill; - private int m_BodyMod; private int m_HueModMin; private int m_HueModMax; - private bool m_StealthBonus; - private bool m_SpeedBoost; - private bool m_StealingBonus; - public Type Type => m_Type; - public TextDefinition Name => m_Name; - public int ItemID => m_ItemID; - public int Hue => m_Hue; - public int Tooltip => m_Tooltip; - public double ReqSkill => m_ReqSkill; - public int BodyMod => m_BodyMod; + public Type Type { get; } + + public TextDefinition Name { get; } + + public int ItemID { get; } + + public int Hue { get; } + + public int Tooltip { get; } + + public double ReqSkill { get; } + + public int BodyMod { get; } + public int HueMod => Utility.RandomMinMax( m_HueModMin, m_HueModMax ); - public bool StealthBonus => m_StealthBonus; - public bool SpeedBoost => m_SpeedBoost; - public bool StealingBonus => m_StealingBonus; + public bool StealthBonus { get; } + + public bool SpeedBoost { get; } + + public bool StealingBonus { get; } /* private AnimalFormCallback m_TransformCallback; private AnimalFormCallback m_UntransformCallback; @@ -352,41 +351,40 @@ namespace Server.Spells.Ninjitsu public AnimalFormEntry(Type type, TextDefinition name, int itemID, int hue, int tooltip, double reqSkill, int bodyMod, int hueModMin, int hueModMax, bool stealthBonus, bool speedBoost, bool stealingBonus) { - m_Type = type; - m_Name = name; - m_ItemID = itemID; - m_Hue = hue; - m_Tooltip = tooltip; - m_ReqSkill = reqSkill; - m_BodyMod = bodyMod; + Type = type; + Name = name; + ItemID = itemID; + Hue = hue; + Tooltip = tooltip; + ReqSkill = reqSkill; + BodyMod = bodyMod; m_HueModMin = hueModMin; m_HueModMax = hueModMax; - m_StealthBonus = stealthBonus; - m_SpeedBoost = speedBoost; - m_StealingBonus = stealingBonus; + StealthBonus = stealthBonus; + SpeedBoost = speedBoost; + StealingBonus = stealingBonus; } } - private static AnimalFormEntry[] m_Entries = { - new AnimalFormEntry( typeof( Kirin ), 1029632, 9632, 0, 1070811, 100.0, 0x84, 0, 0, false, true, false ), - new AnimalFormEntry( typeof( Unicorn ), 1018214, 9678, 0, 1070812, 100.0, 0x7A, 0, 0, false, true, false ), - new AnimalFormEntry( typeof( BakeKitsune ), 1030083, 10083, 0, 1070810, 82.5, 0xF6, 0, 0, false, true, false ), - new AnimalFormEntry( typeof( GreyWolf ), 1028482, 9681, 2309, 1070810, 82.5, 0x19, 0x8FD, 0x90E, false, true, false ), - new AnimalFormEntry( typeof( Llama ), 1028438, 8438, 0, 1070809, 70.0, 0xDC, 0, 0, false, true, false ), - new AnimalFormEntry( typeof( ForestOstard ), 1018273, 8503, 2212, 1070809, 70.0, 0xDB, 0x899, 0x8B0, false, true, false ), - new AnimalFormEntry( typeof( BullFrog ), 1028496, 8496, 2003, 1070807, 50.0, 0x51, 0x7D1, 0x7D6, false, false, false ), - new AnimalFormEntry( typeof( GiantSerpent ), 1018114, 9663, 2009, 1070808, 50.0, 0x15, 0x7D1, 0x7E2, false, false, false ), - new AnimalFormEntry( typeof( Dog ), 1018280, 8476, 2309, 1070806, 40.0, 0xD9, 0x8FD, 0x90E, false, false, false ), - new AnimalFormEntry( typeof( Cat ), 1018264, 8475, 2309, 1070806, 40.0, 0xC9, 0x8FD, 0x90E, false, false, false ), - new AnimalFormEntry( typeof( Rat ), 1018294, 8483, 2309, 1070805, 20.0, 0xEE, 0x8FD, 0x90E, true, false, false ), - new AnimalFormEntry( typeof( Rabbit ), 1028485, 8485, 2309, 1070805, 20.0, 0xCD, 0x8FD, 0x90E, true, false, false ), - new AnimalFormEntry( typeof( Squirrel ), 1031671, 11671, 0, 0, 20.0, 0x116, 0, 0, false, false, false ), - new AnimalFormEntry( typeof( Ferret ), 1031672, 11672, 0, 1075220, 40.0, 0x117, 0, 0, false, false, true ), - new AnimalFormEntry( typeof( CuSidhe ), 1031670, 11670, 0, 1075221, 60.0, 0x115, 0, 0, false, false, false ), - new AnimalFormEntry( typeof( Reptalon ), 1075202, 11669, 0, 1075222, 90.0, 0x114, 0, 0, false, false, false ), - }; - - public static AnimalFormEntry[] Entries => m_Entries; + public static AnimalFormEntry[] Entries { get; } = + { + new AnimalFormEntry( typeof( Kirin ), 1029632, 9632, 0, 1070811, 100.0, 0x84, 0, 0, false, true, false ), + new AnimalFormEntry( typeof( Unicorn ), 1018214, 9678, 0, 1070812, 100.0, 0x7A, 0, 0, false, true, false ), + new AnimalFormEntry( typeof( BakeKitsune ), 1030083, 10083, 0, 1070810, 82.5, 0xF6, 0, 0, false, true, false ), + new AnimalFormEntry( typeof( GreyWolf ), 1028482, 9681, 2309, 1070810, 82.5, 0x19, 0x8FD, 0x90E, false, true, false ), + new AnimalFormEntry( typeof( Llama ), 1028438, 8438, 0, 1070809, 70.0, 0xDC, 0, 0, false, true, false ), + new AnimalFormEntry( typeof( ForestOstard ), 1018273, 8503, 2212, 1070809, 70.0, 0xDB, 0x899, 0x8B0, false, true, false ), + new AnimalFormEntry( typeof( BullFrog ), 1028496, 8496, 2003, 1070807, 50.0, 0x51, 0x7D1, 0x7D6, false, false, false ), + new AnimalFormEntry( typeof( GiantSerpent ), 1018114, 9663, 2009, 1070808, 50.0, 0x15, 0x7D1, 0x7E2, false, false, false ), + new AnimalFormEntry( typeof( Dog ), 1018280, 8476, 2309, 1070806, 40.0, 0xD9, 0x8FD, 0x90E, false, false, false ), + new AnimalFormEntry( typeof( Cat ), 1018264, 8475, 2309, 1070806, 40.0, 0xC9, 0x8FD, 0x90E, false, false, false ), + new AnimalFormEntry( typeof( Rat ), 1018294, 8483, 2309, 1070805, 20.0, 0xEE, 0x8FD, 0x90E, true, false, false ), + new AnimalFormEntry( typeof( Rabbit ), 1028485, 8485, 2309, 1070805, 20.0, 0xCD, 0x8FD, 0x90E, true, false, false ), + new AnimalFormEntry( typeof( Squirrel ), 1031671, 11671, 0, 0, 20.0, 0x116, 0, 0, false, false, false ), + new AnimalFormEntry( typeof( Ferret ), 1031672, 11672, 0, 1075220, 40.0, 0x117, 0, 0, false, false, true ), + new AnimalFormEntry( typeof( CuSidhe ), 1031670, 11670, 0, 1075221, 60.0, 0x115, 0, 0, false, false, false ), + new AnimalFormEntry( typeof( Reptalon ), 1075202, 11669, 0, 1075222, 90.0, 0x114, 0, 0, false, false, false ), + }; public class AnimalFormGump : Gump { @@ -462,7 +460,7 @@ namespace Server.Spells.Ninjitsu { int entryID = info.ButtonID - 1; - if (entryID < 0 || entryID >= m_Entries.Length) + if (entryID < 0 || entryID >= AnimalForm.Entries.Length) return; int mana = m_Spell.ScaleMana(m_Spell.RequiredMana); @@ -501,25 +499,23 @@ namespace Server.Spells.Ninjitsu public class AnimalFormContext { - private Timer m_Timer; - private SkillMod m_Mod; - private bool m_SpeedBoost; - private Type m_Type; - private SkillMod m_StealingMod; + public Timer Timer { get; } - public Timer Timer => m_Timer; - public SkillMod Mod => m_Mod; - public bool SpeedBoost => m_SpeedBoost; - public Type Type => m_Type; - public SkillMod StealingMod => m_StealingMod; + public SkillMod Mod { get; } + + public bool SpeedBoost { get; } + + public Type Type { get; } + + public SkillMod StealingMod { get; } public AnimalFormContext(Timer timer, SkillMod mod, bool speedBoost, Type type, SkillMod stealingMod) { - m_Timer = timer; - m_Mod = mod; - m_SpeedBoost = speedBoost; - m_Type = type; - m_StealingMod = stealingMod; + Timer = timer; + Mod = mod; + SpeedBoost = speedBoost; + Type = type; + StealingMod = stealingMod; } } diff --git a/Scripts/Spells/Second/Protection.cs b/Scripts/Spells/Second/Protection.cs index 91afa74e0..e7050d0e6 100644 --- a/Scripts/Spells/Second/Protection.cs +++ b/Scripts/Spells/Second/Protection.cs @@ -5,8 +5,7 @@ namespace Server.Spells.Second { public class ProtectionSpell : MagerySpell { - private static Hashtable m_Registry = new Hashtable(); - public static Hashtable Registry => m_Registry; + public static Hashtable Registry { get; } = new Hashtable(); private static SpellInfo m_Info = new SpellInfo( "Protection", "Uus Sanct", @@ -28,7 +27,7 @@ namespace Server.Spells.Second if ( Core.AOS ) return true; - if ( m_Registry.ContainsKey( Caster ) ) + if ( Registry.ContainsKey( Caster ) ) { Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect. return false; @@ -122,7 +121,7 @@ namespace Server.Spells.Second } else { - if ( m_Registry.ContainsKey( Caster ) ) + if ( Registry.ContainsKey( Caster ) ) { Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect. } diff --git a/Scripts/Spells/Spellweaving/EssenceOfWind.cs b/Scripts/Spells/Spellweaving/EssenceOfWind.cs index c44b61521..06c356edf 100644 --- a/Scripts/Spells/Spellweaving/EssenceOfWind.cs +++ b/Scripts/Spells/Spellweaving/EssenceOfWind.cs @@ -65,24 +65,22 @@ namespace Server.Spells.Spellweaving private class EssenceOfWindInfo { - private Mobile m_Defender; - private int m_FCMalus; - private int m_SSIMalus; - private ExpireTimer m_Timer; + public Mobile Defender { get; } - public Mobile Defender => m_Defender; - public int FCMalus => m_FCMalus; - public int SSIMalus => m_SSIMalus; - public ExpireTimer Timer => m_Timer; + public int FCMalus { get; } + + public int SSIMalus { get; } + + public ExpireTimer Timer { get; } public EssenceOfWindInfo( Mobile defender, int fcMalus, int ssiMalus, TimeSpan duration ) { - m_Defender = defender; - m_FCMalus = fcMalus; - m_SSIMalus = ssiMalus; + Defender = defender; + FCMalus = fcMalus; + SSIMalus = ssiMalus; - m_Timer = new ExpireTimer( m_Defender, duration ); - m_Timer.Start(); + Timer = new ExpireTimer( Defender, duration ); + Timer.Start(); } } diff --git a/Scripts/Spells/Spellweaving/GiftOfLife.cs b/Scripts/Spells/Spellweaving/GiftOfLife.cs index 6f7a1c8f9..9348aab98 100644 --- a/Scripts/Spells/Spellweaving/GiftOfLife.cs +++ b/Scripts/Spells/Spellweaving/GiftOfLife.cs @@ -157,15 +157,13 @@ namespace Server.Spells.Spellweaving { private Mobile m_Mobile; - private GiftOfLifeSpell m_Spell; - - public GiftOfLifeSpell Spell => m_Spell; + public GiftOfLifeSpell Spell { get; } public ExpireTimer( Mobile m, TimeSpan delay, GiftOfLifeSpell spell ) : base( delay ) { m_Mobile = m; - m_Spell = spell; + Spell = spell; } protected override void OnTick() diff --git a/Scripts/Spells/Spellweaving/Items/ArcaneFocus.cs b/Scripts/Spells/Spellweaving/Items/ArcaneFocus.cs index d003394f6..6cfdd1a79 100644 --- a/Scripts/Spells/Spellweaving/Items/ArcaneFocus.cs +++ b/Scripts/Spells/Spellweaving/Items/ArcaneFocus.cs @@ -6,14 +6,8 @@ namespace Server.Items { public override int LabelNumber => 1032629; // Arcane Focus - private int m_StrengthBonus; - [CommandProperty( AccessLevel.GameMaster )] - public int StrengthBonus - { - get => m_StrengthBonus; - set => m_StrengthBonus = value; - } + public int StrengthBonus { get; set; } [Constructible] public ArcaneFocus() @@ -30,7 +24,7 @@ namespace Server.Items public ArcaneFocus( TimeSpan lifeSpan, int strengthBonus ) : base( 0x3155, lifeSpan ) { LootType = LootType.Blessed; - m_StrengthBonus = strengthBonus; + StrengthBonus = strengthBonus; } public ArcaneFocus( Serial serial ) : base( serial ) @@ -41,7 +35,7 @@ namespace Server.Items { base.GetProperties( list ); - list.Add( 1060485, m_StrengthBonus.ToString() ); // strength bonus ~1_val~ + list.Add( 1060485, StrengthBonus.ToString() ); // strength bonus ~1_val~ } public override TextDefinition InvalidTransferMessage => 1073480; // Your arcane focus disappears. @@ -52,7 +46,7 @@ namespace Server.Items base.Serialize( writer ); writer.Write( (int)0 ); - writer.Write( m_StrengthBonus ); + writer.Write( StrengthBonus ); } public override void Deserialize( GenericReader reader ) @@ -60,7 +54,7 @@ namespace Server.Items base.Deserialize( reader ); int version = reader.ReadInt(); - m_StrengthBonus = reader.ReadInt(); + StrengthBonus = reader.ReadInt(); } } } diff --git a/Scripts/Spells/Spellweaving/Items/TransientItem.cs b/Scripts/Spells/Spellweaving/Items/TransientItem.cs index 3f11ec9c0..b67098d4b 100644 --- a/Scripts/Spells/Spellweaving/Items/TransientItem.cs +++ b/Scripts/Spells/Spellweaving/Items/TransientItem.cs @@ -4,23 +4,11 @@ namespace Server.Items { public class TransientItem : Item { - private TimeSpan m_LifeSpan; + [CommandProperty( AccessLevel.GameMaster )] + public TimeSpan LifeSpan { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public TimeSpan LifeSpan - { - get => m_LifeSpan; - set => m_LifeSpan = value; - } - - private DateTime m_CreationTime; - - [CommandProperty( AccessLevel.GameMaster )] - public DateTime CreationTime - { - get => m_CreationTime; - set => m_CreationTime = value; - } + public DateTime CreationTime { get; set; } private Timer m_Timer; @@ -48,7 +36,7 @@ namespace Server.Items public virtual void SendTimeRemainingMessage( Mobile to ) { to.SendLocalizedMessage( 1072516, - $"{Name ?? $"#{LabelNumber}"}\t{(int) m_LifeSpan.TotalSeconds}"); // ~1_name~ will expire in ~2_val~ seconds! + $"{Name ?? $"#{LabelNumber}"}\t{(int) LifeSpan.TotalSeconds}"); // ~1_name~ will expire in ~2_val~ seconds! } public override void OnDelete() @@ -60,7 +48,7 @@ namespace Server.Items public virtual void CheckExpiry() { - if ( (m_CreationTime + m_LifeSpan) < DateTime.UtcNow ) + if ( (CreationTime + LifeSpan) < DateTime.UtcNow ) Expire( RootParent as Mobile ); else InvalidateProperties(); @@ -70,8 +58,8 @@ namespace Server.Items public TransientItem( int itemID, TimeSpan lifeSpan ) : base( itemID ) { - m_CreationTime = DateTime.UtcNow; - m_LifeSpan = lifeSpan; + CreationTime = DateTime.UtcNow; + LifeSpan = lifeSpan; m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 5 ), TimeSpan.FromSeconds( 5 ), CheckExpiry ); } @@ -85,7 +73,7 @@ namespace Server.Items { base.GetProperties( list ); - TimeSpan remaining = ((m_CreationTime + m_LifeSpan) - DateTime.UtcNow); + TimeSpan remaining = ((CreationTime + LifeSpan) - DateTime.UtcNow); list.Add( 1072517, ((int)remaining.TotalSeconds).ToString() ); // Lifespan: ~1_val~ seconds } @@ -95,8 +83,8 @@ namespace Server.Items base.Serialize( writer ); writer.Write( (int)0 ); - writer.Write( m_LifeSpan ); - writer.Write( m_CreationTime ); + writer.Write( LifeSpan ); + writer.Write( CreationTime ); } public override void Deserialize( GenericReader reader ) @@ -104,8 +92,8 @@ namespace Server.Items base.Deserialize( reader ); int version = reader.ReadInt(); - m_LifeSpan = reader.ReadTimeSpan(); - m_CreationTime = reader.ReadDateTime(); + LifeSpan = reader.ReadTimeSpan(); + CreationTime = reader.ReadDateTime(); m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 5 ), TimeSpan.FromSeconds( 5 ), CheckExpiry ); } diff --git a/Server/AggressorInfo.cs b/Server/AggressorInfo.cs index 35b79eaee..1716eb004 100644 --- a/Server/AggressorInfo.cs +++ b/Server/AggressorInfo.cs @@ -82,13 +82,7 @@ namespace Server Refresh(); } - private static TimeSpan m_ExpireDelay = TimeSpan.FromMinutes( 2.0 ); - - public static TimeSpan ExpireDelay - { - get => m_ExpireDelay; - set => m_ExpireDelay = value; - } + public static TimeSpan ExpireDelay { get; set; } = TimeSpan.FromMinutes( 2.0 ); public static void DumpAccess() { @@ -108,7 +102,7 @@ namespace Server if ( m_Queued ) DumpAccess(); - return ( m_Attacker.Deleted || m_Defender.Deleted || DateTime.UtcNow >= (m_LastCombatTime + m_ExpireDelay) ); + return ( m_Attacker.Deleted || m_Defender.Deleted || DateTime.UtcNow >= (m_LastCombatTime + ExpireDelay) ); } } diff --git a/Server/Attributes.cs b/Server/Attributes.cs index 3008be8d2..29fa965c9 100644 --- a/Server/Attributes.cs +++ b/Server/Attributes.cs @@ -59,17 +59,11 @@ namespace Server [AttributeUsage( AttributeTargets.Method )] public class CallPriorityAttribute : Attribute { - private int m_Priority; - - public int Priority - { - get => m_Priority; - set => m_Priority = value; - } + public int Priority { get; set; } public CallPriorityAttribute( int priority ) { - m_Priority = priority; + Priority = priority; } } @@ -115,13 +109,11 @@ namespace Server [AttributeUsage( AttributeTargets.Class )] public class TypeAliasAttribute : Attribute { - private string[] m_Aliases; - - public string[] Aliases => m_Aliases; + public string[] Aliases { get; } public TypeAliasAttribute( params string[] aliases ) { - m_Aliases = aliases; + Aliases = aliases; } } @@ -136,26 +128,18 @@ namespace Server [AttributeUsage( AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum )] public class CustomEnumAttribute : Attribute { - private string[] m_Names; - - public string[] Names => m_Names; + public string[] Names { get; } public CustomEnumAttribute( string[] names ) { - m_Names = names; + Names = names; } } [AttributeUsage( AttributeTargets.Constructor )] public class ConstructibleAttribute : Attribute { - private AccessLevel m_AccessLevel; - - public AccessLevel AccessLevel - { - get => m_AccessLevel; - set => m_AccessLevel = value; - } + public AccessLevel AccessLevel { get; set; } public ConstructibleAttribute() : this( AccessLevel.Player ) //Lowest accesslevel for current functionality (Level determined by access to [add) { @@ -163,26 +147,23 @@ namespace Server public ConstructibleAttribute( AccessLevel accessLevel ) { - m_AccessLevel = accessLevel; + AccessLevel = accessLevel; } } [AttributeUsage( AttributeTargets.Property )] public class CommandPropertyAttribute : Attribute { - private AccessLevel m_ReadLevel, m_WriteLevel; - private bool m_ReadOnly; + public AccessLevel ReadLevel { get; } - public AccessLevel ReadLevel => m_ReadLevel; + public AccessLevel WriteLevel { get; } - public AccessLevel WriteLevel => m_WriteLevel; - - public bool ReadOnly => m_ReadOnly; + public bool ReadOnly { get; } public CommandPropertyAttribute( AccessLevel level, bool readOnly ) { - m_ReadLevel = level; - m_ReadOnly = readOnly; + ReadLevel = level; + ReadOnly = readOnly; } public CommandPropertyAttribute( AccessLevel level ) : this( level, level ) @@ -191,8 +172,8 @@ namespace Server public CommandPropertyAttribute( AccessLevel readLevel, AccessLevel writeLevel ) { - m_ReadLevel = readLevel; - m_WriteLevel = writeLevel; + ReadLevel = readLevel; + WriteLevel = writeLevel; } } } diff --git a/Server/BaseVendor.cs b/Server/BaseVendor.cs index 59733af74..2c20a243c 100644 --- a/Server/BaseVendor.cs +++ b/Server/BaseVendor.cs @@ -36,89 +36,71 @@ namespace Server.Mobiles public class BuyItemResponse { - private Serial m_Serial; - private int m_Amount; - public BuyItemResponse( Serial serial, int amount ) { - m_Serial = serial; - m_Amount = amount; + Serial = serial; + Amount = amount; } - public Serial Serial => m_Serial; + public Serial Serial { get; } - public int Amount => m_Amount; + public int Amount { get; } } public class SellItemResponse { - private Item m_Item; - private int m_Amount; - public SellItemResponse( Item i, int amount ) { - m_Item = i; - m_Amount = amount; + Item = i; + Amount = amount; } - public Item Item => m_Item; + public Item Item { get; } - public int Amount => m_Amount; + public int Amount { get; } } public class SellItemState { - private Item m_Item; - private int m_Price; - private string m_Name; - public SellItemState( Item item, int price, string name ) { - m_Item = item; - m_Price = price; - m_Name = name; + Item = item; + Price = price; + Name = name; } - public Item Item => m_Item; + public Item Item { get; } - public int Price => m_Price; + public int Price { get; } - public string Name => m_Name; + public string Name { get; } } public class BuyItemState { - private Serial m_ContSer; - private Serial m_MySer; - private int m_ItemID; - private int m_Amount; - private int m_Hue; - private int m_Price; - private string m_Desc; - public BuyItemState( string name, Serial cont, Serial serial, int price, int amount, int itemID, int hue ) { - m_Desc = name; - m_ContSer = cont; - m_MySer = serial; - m_Price = price; - m_Amount = amount; - m_ItemID = itemID; - m_Hue = hue; + Description = name; + ContainerSerial = cont; + MySerial = serial; + Price = price; + Amount = amount; + ItemID = itemID; + Hue = hue; } - public int Price => m_Price; + public int Price { get; } - public Serial MySerial => m_MySer; + public Serial MySerial { get; } - public Serial ContainerSerial => m_ContSer; + public Serial ContainerSerial { get; } - public int ItemID => m_ItemID; + public int ItemID { get; } - public int Amount => m_Amount; + public int Amount { get; } - public int Hue => m_Hue; + public int Hue { get; } - public string Description => m_Desc; + public string Description { get; } } } diff --git a/Server/Body.cs b/Server/Body.cs index c2c757a5b..4dfb96bdd 100644 --- a/Server/Body.cs +++ b/Server/Body.cs @@ -35,8 +35,6 @@ namespace Server public struct Body { - private int m_BodyID; - private static BodyType[] m_Types; static Body() @@ -81,88 +79,88 @@ namespace Server public Body( int bodyID ) { - m_BodyID = bodyID; + BodyID = bodyID; } public BodyType Type { get { - if ( m_BodyID >= 0 && m_BodyID < m_Types.Length ) - return m_Types[m_BodyID]; + if ( BodyID >= 0 && BodyID < m_Types.Length ) + return m_Types[BodyID]; return BodyType.Empty; } } - public bool IsHuman => m_BodyID >= 0 - && m_BodyID < m_Types.Length - && m_Types[m_BodyID] == BodyType.Human - && m_BodyID != 402 - && m_BodyID != 403 - && m_BodyID != 607 - && m_BodyID != 608 - && m_BodyID != 694 - && m_BodyID != 695 - && m_BodyID != 970; + public bool IsHuman => BodyID >= 0 + && BodyID < m_Types.Length + && m_Types[BodyID] == BodyType.Human + && BodyID != 402 + && BodyID != 403 + && BodyID != 607 + && BodyID != 608 + && BodyID != 694 + && BodyID != 695 + && BodyID != 970; - public bool IsGargoyle => m_BodyID == 666 - || m_BodyID == 667 - || m_BodyID == 694 - || m_BodyID == 695; + public bool IsGargoyle => BodyID == 666 + || BodyID == 667 + || BodyID == 694 + || BodyID == 695; - public bool IsMale => m_BodyID == 183 - || m_BodyID == 185 - || m_BodyID == 400 - || m_BodyID == 402 - || m_BodyID == 605 - || m_BodyID == 607 - || m_BodyID == 666 - || m_BodyID == 694 - || m_BodyID == 750; + public bool IsMale => BodyID == 183 + || BodyID == 185 + || BodyID == 400 + || BodyID == 402 + || BodyID == 605 + || BodyID == 607 + || BodyID == 666 + || BodyID == 694 + || BodyID == 750; - public bool IsFemale => m_BodyID == 184 - || m_BodyID == 186 - || m_BodyID == 401 - || m_BodyID == 403 - || m_BodyID == 606 - || m_BodyID == 608 - || m_BodyID == 667 - || m_BodyID == 695 - || m_BodyID == 751; + public bool IsFemale => BodyID == 184 + || BodyID == 186 + || BodyID == 401 + || BodyID == 403 + || BodyID == 606 + || BodyID == 608 + || BodyID == 667 + || BodyID == 695 + || BodyID == 751; - public bool IsGhost => m_BodyID == 402 - || m_BodyID == 403 - || m_BodyID == 607 - || m_BodyID == 608 - || m_BodyID == 694 - || m_BodyID == 695 - || m_BodyID == 970; + public bool IsGhost => BodyID == 402 + || BodyID == 403 + || BodyID == 607 + || BodyID == 608 + || BodyID == 694 + || BodyID == 695 + || BodyID == 970; - public bool IsMonster => m_BodyID >= 0 - && m_BodyID < m_Types.Length - && m_Types[m_BodyID] == BodyType.Monster; + public bool IsMonster => BodyID >= 0 + && BodyID < m_Types.Length + && m_Types[BodyID] == BodyType.Monster; - public bool IsAnimal => m_BodyID >= 0 - && m_BodyID < m_Types.Length - && m_Types[m_BodyID] == BodyType.Animal; + public bool IsAnimal => BodyID >= 0 + && BodyID < m_Types.Length + && m_Types[BodyID] == BodyType.Animal; - public bool IsEmpty => m_BodyID >= 0 - && m_BodyID < m_Types.Length - && m_Types[m_BodyID] == BodyType.Empty; + public bool IsEmpty => BodyID >= 0 + && BodyID < m_Types.Length + && m_Types[BodyID] == BodyType.Empty; - public bool IsSea => m_BodyID >= 0 - && m_BodyID < m_Types.Length - && m_Types[m_BodyID] == BodyType.Sea; + public bool IsSea => BodyID >= 0 + && BodyID < m_Types.Length + && m_Types[BodyID] == BodyType.Sea; - public bool IsEquipment => m_BodyID >= 0 - && m_BodyID < m_Types.Length - && m_Types[m_BodyID] == BodyType.Equipment; + public bool IsEquipment => BodyID >= 0 + && BodyID < m_Types.Length + && m_Types[BodyID] == BodyType.Equipment; - public int BodyID => m_BodyID; + public int BodyID { get; } public static implicit operator int( Body a ) { - return a.m_BodyID; + return a.BodyID; } public static implicit operator Body( int a ) @@ -172,49 +170,49 @@ namespace Server public override string ToString() { - return $"0x{m_BodyID:X}"; + return $"0x{BodyID:X}"; } public override int GetHashCode() { - return m_BodyID; + return BodyID; } public override bool Equals( object o ) { if ( !(o is Body) ) return false; - return ((Body)o).m_BodyID == m_BodyID; + return ((Body)o).BodyID == BodyID; } public static bool operator == ( Body l, Body r ) { - return l.m_BodyID == r.m_BodyID; + return l.BodyID == r.BodyID; } public static bool operator != ( Body l, Body r ) { - return l.m_BodyID != r.m_BodyID; + return l.BodyID != r.BodyID; } public static bool operator > ( Body l, Body r ) { - return l.m_BodyID > r.m_BodyID; + return l.BodyID > r.BodyID; } public static bool operator >= ( Body l, Body r ) { - return l.m_BodyID >= r.m_BodyID; + return l.BodyID >= r.BodyID; } public static bool operator < ( Body l, Body r ) { - return l.m_BodyID < r.m_BodyID; + return l.BodyID < r.BodyID; } public static bool operator <= ( Body l, Body r ) { - return l.m_BodyID <= r.m_BodyID; + return l.BodyID <= r.BodyID; } } } diff --git a/Server/ClientVersion.cs b/Server/ClientVersion.cs index a0cf3eb58..241e89523 100644 --- a/Server/ClientVersion.cs +++ b/Server/ClientVersion.cs @@ -34,21 +34,17 @@ namespace Server public class ClientVersion : IComparable, IComparer { - private int m_Major, m_Minor, m_Revision, m_Patch; - private ClientType m_Type; - private string m_SourceString; + public int Major { get; } - public int Major => m_Major; + public int Minor { get; } - public int Minor => m_Minor; + public int Revision { get; } - public int Revision => m_Revision; + public int Patch { get; } - public int Patch => m_Patch; + public ClientType Type { get; } - public ClientType Type => m_Type; - - public string SourceString => m_SourceString; + public string SourceString { get; } public ClientVersion( int maj, int min, int rev, int pat ) : this( maj, min, rev, pat, ClientType.Regular ) { @@ -56,13 +52,13 @@ namespace Server public ClientVersion( int maj, int min, int rev, int pat, ClientType type ) { - m_Major = maj; - m_Minor = min; - m_Revision = rev; - m_Patch = pat; - m_Type = type; + Major = maj; + Minor = min; + Revision = rev; + Patch = pat; + Type = type; - m_SourceString = _ToStringImpl(); + SourceString = _ToStringImpl(); } public static bool operator == ( ClientVersion l, ClientVersion r ) @@ -97,7 +93,7 @@ namespace Server public override int GetHashCode() { - return m_Major ^ m_Minor ^ m_Revision ^ m_Patch ^ (int)m_Type; + return Major ^ Minor ^ Revision ^ Patch ^ (int)Type; } public override bool Equals( object obj ) @@ -110,38 +106,38 @@ namespace Server if ( v == null ) return false; - return m_Major == v.m_Major - && m_Minor == v.m_Minor - && m_Revision == v.m_Revision - && m_Patch == v.m_Patch - && m_Type == v.m_Type; + return Major == v.Major + && Minor == v.Minor + && Revision == v.Revision + && Patch == v.Patch + && Type == v.Type; } private string _ToStringImpl() { StringBuilder builder = new StringBuilder(16); - builder.Append(m_Major); + builder.Append(Major); builder.Append('.'); - builder.Append(m_Minor); + builder.Append(Minor); builder.Append('.'); - builder.Append(m_Revision); + builder.Append(Revision); - if (m_Major <= 5 && m_Minor <= 0 && m_Revision <= 6) //Anything before 5.0.7 + if (Major <= 5 && Minor <= 0 && Revision <= 6) //Anything before 5.0.7 { - if (m_Patch > 0) - builder.Append((char)('a' + (m_Patch - 1))); + if (Patch > 0) + builder.Append((char)('a' + (Patch - 1))); } else { builder.Append('.'); - builder.Append(m_Patch); + builder.Append(Patch); } - if (m_Type != ClientType.Regular) + if (Type != ClientType.Regular) { builder.Append(' '); - builder.Append(m_Type.ToString()); + builder.Append(Type.ToString()); } return builder.ToString(); @@ -154,7 +150,7 @@ namespace Server public ClientVersion( string fmt ) { - m_SourceString = fmt; + SourceString = fmt; try { @@ -167,37 +163,37 @@ namespace Server while ( br3 < fmt.Length && char.IsDigit( fmt, br3 ) ) br3++; - m_Major = Utility.ToInt32( fmt.Substring( 0, br1 ) ); - m_Minor = Utility.ToInt32( fmt.Substring( br1 + 1, br2 - br1 - 1 ) ); - m_Revision = Utility.ToInt32( fmt.Substring( br2 + 1, br3 - br2 - 1 ) ); + Major = Utility.ToInt32( fmt.Substring( 0, br1 ) ); + Minor = Utility.ToInt32( fmt.Substring( br1 + 1, br2 - br1 - 1 ) ); + Revision = Utility.ToInt32( fmt.Substring( br2 + 1, br3 - br2 - 1 ) ); if ( br3 < fmt.Length ) { - if ( m_Major <= 5 && m_Minor <= 0 && m_Revision <= 6 ) //Anything before 5.0.7 + if ( Major <= 5 && Minor <= 0 && Revision <= 6 ) //Anything before 5.0.7 { if ( !char.IsWhiteSpace( fmt, br3 ) ) - m_Patch = (fmt[br3] - 'a') + 1; + Patch = (fmt[br3] - 'a') + 1; } else { - m_Patch = Utility.ToInt32( fmt.Substring( br3+1, fmt.Length - br3 - 1 ) ); + Patch = Utility.ToInt32( fmt.Substring( br3+1, fmt.Length - br3 - 1 ) ); } } if ( fmt.IndexOf( "god" ) >= 0 || fmt.IndexOf( "gq" ) >= 0 ) - m_Type = ClientType.God; + Type = ClientType.God; else if ( fmt.IndexOf( "third dawn" ) >= 0 || fmt.IndexOf( "uo:td" ) >= 0 || fmt.IndexOf( "uotd" ) >= 0 || fmt.IndexOf( "uo3d" ) >= 0 || fmt.IndexOf( "uo:3d" ) >= 0 ) - m_Type = ClientType.UOTD; + Type = ClientType.UOTD; else - m_Type = ClientType.Regular; + Type = ClientType.Regular; } catch { - m_Major = 0; - m_Minor = 0; - m_Revision = 0; - m_Patch = 0; - m_Type = ClientType.Regular; + Major = 0; + Minor = 0; + Revision = 0; + Patch = 0; + Type = ClientType.Regular; } } @@ -211,21 +207,21 @@ namespace Server if ( o == null ) throw new ArgumentException(); - if ( m_Major > o.m_Major ) + if ( Major > o.Major ) return 1; - if ( m_Major < o.m_Major ) + if ( Major < o.Major ) return -1; - if ( m_Minor > o.m_Minor ) + if ( Minor > o.Minor ) return 1; - if ( m_Minor < o.m_Minor ) + if ( Minor < o.Minor ) return -1; - if ( m_Revision > o.m_Revision ) + if ( Revision > o.Revision ) return 1; - if ( m_Revision < o.m_Revision ) + if ( Revision < o.Revision ) return -1; - if ( m_Patch > o.m_Patch ) + if ( Patch > o.Patch ) return 1; - if ( m_Patch < o.m_Patch ) + if ( Patch < o.Patch ) return -1; return 0; } diff --git a/Server/Commands.cs b/Server/Commands.cs index 302747ff4..5f5e4a0e2 100644 --- a/Server/Commands.cs +++ b/Server/Commands.cs @@ -28,86 +28,78 @@ namespace Server.Commands public class CommandEventArgs : EventArgs { - private Mobile m_Mobile; - private string m_Command, m_ArgString; - private string[] m_Arguments; + public Mobile Mobile { get; } - public Mobile Mobile => m_Mobile; + public string Command { get; } - public string Command => m_Command; + public string ArgString { get; } - public string ArgString => m_ArgString; + public string[] Arguments { get; } - public string[] Arguments => m_Arguments; - - public int Length => m_Arguments.Length; + public int Length => Arguments.Length; public string GetString( int index ) { - if ( index < 0 || index >= m_Arguments.Length ) + if ( index < 0 || index >= Arguments.Length ) return ""; - return m_Arguments[index]; + return Arguments[index]; } public int GetInt32( int index ) { - if ( index < 0 || index >= m_Arguments.Length ) + if ( index < 0 || index >= Arguments.Length ) return 0; - return Utility.ToInt32( m_Arguments[index] ); + return Utility.ToInt32( Arguments[index] ); } public bool GetBoolean( int index ) { - if ( index < 0 || index >= m_Arguments.Length ) + if ( index < 0 || index >= Arguments.Length ) return false; - return Utility.ToBoolean( m_Arguments[index] ); + return Utility.ToBoolean( Arguments[index] ); } public double GetDouble( int index ) { - if ( index < 0 || index >= m_Arguments.Length ) + if ( index < 0 || index >= Arguments.Length ) return 0.0; - return Utility.ToDouble( m_Arguments[index] ); + return Utility.ToDouble( Arguments[index] ); } public TimeSpan GetTimeSpan( int index ) { - if ( index < 0 || index >= m_Arguments.Length ) + if ( index < 0 || index >= Arguments.Length ) return TimeSpan.Zero; - return Utility.ToTimeSpan( m_Arguments[index] ); + return Utility.ToTimeSpan( Arguments[index] ); } public CommandEventArgs( Mobile mobile, string command, string argString, string[] arguments ) { - m_Mobile = mobile; - m_Command = command; - m_ArgString = argString; - m_Arguments = arguments; + Mobile = mobile; + Command = command; + ArgString = argString; + Arguments = arguments; } } public class CommandEntry : IComparable { - private string m_Command; - private CommandEventHandler m_Handler; - private AccessLevel m_AccessLevel; + public string Command { get; } - public string Command => m_Command; + public CommandEventHandler Handler { get; } - public CommandEventHandler Handler => m_Handler; - - public AccessLevel AccessLevel => m_AccessLevel; + public AccessLevel AccessLevel { get; } public CommandEntry( string command, CommandEventHandler handler, AccessLevel accessLevel ) { - m_Command = command; - m_Handler = handler; - m_AccessLevel = accessLevel; + Command = command; + Handler = handler; + AccessLevel = accessLevel; } public int CompareTo( object obj ) @@ -120,19 +112,13 @@ namespace Server.Commands if ( !(obj is CommandEntry e) ) throw new ArgumentException(); - return m_Command.CompareTo( e.m_Command ); + return Command.CompareTo( e.Command ); } } public static class CommandSystem { - private static string m_Prefix = "["; - - public static string Prefix - { - get => m_Prefix; - set => m_Prefix = value; - } + public static string Prefix { get; set; } = "["; public static string[] Split( string value ) { @@ -187,25 +173,19 @@ namespace Server.Commands return list.ToArray(); } - private static Dictionary m_Entries; - - public static Dictionary Entries => m_Entries; + public static Dictionary Entries { get; } static CommandSystem() { - m_Entries = new Dictionary( StringComparer.OrdinalIgnoreCase ); + Entries = new Dictionary( StringComparer.OrdinalIgnoreCase ); } public static void Register( string command, AccessLevel access, CommandEventHandler handler ) { - m_Entries[command] = new CommandEntry( command, handler, access ); + Entries[command] = new CommandEntry( command, handler, access ); } - private static AccessLevel m_BadCommandIngoreLevel = AccessLevel.Player; - - public static AccessLevel BadCommandIgnoreLevel{ get => m_BadCommandIngoreLevel; - set => m_BadCommandIngoreLevel = value; - } + public static AccessLevel BadCommandIgnoreLevel { get; set; } = AccessLevel.Player; public static bool Handle( Mobile from, string text ) { @@ -214,10 +194,10 @@ namespace Server.Commands public static bool Handle( Mobile from, string text, MessageType type ) { - if ( text.StartsWith( m_Prefix ) || type == MessageType.Command ) + if ( text.StartsWith( Prefix ) || type == MessageType.Command ) { if ( type != MessageType.Command ) - text = text.Substring( m_Prefix.Length ); + text = text.Substring( Prefix.Length ); int indexOf = text.IndexOf( ' ' ); @@ -239,7 +219,7 @@ namespace Server.Commands args = new string[0]; } - m_Entries.TryGetValue( command, out CommandEntry entry ); + Entries.TryGetValue( command, out CommandEntry entry ); if ( entry != null ) { @@ -254,7 +234,7 @@ namespace Server.Commands } else { - if ( from.AccessLevel <= m_BadCommandIngoreLevel ) + if ( from.AccessLevel <= BadCommandIgnoreLevel ) return false; from.SendMessage( "You do not have access to that command." ); @@ -262,7 +242,7 @@ namespace Server.Commands } else { - if ( from.AccessLevel <= m_BadCommandIngoreLevel ) + if ( from.AccessLevel <= BadCommandIgnoreLevel ) return false; from.SendMessage( "That is not a valid command." ); diff --git a/Server/ContextMenus/ContextMenu.cs b/Server/ContextMenus/ContextMenu.cs index 90451b74c..e619a7c2b 100644 --- a/Server/ContextMenus/ContextMenu.cs +++ b/Server/ContextMenus/ContextMenu.cs @@ -28,24 +28,20 @@ namespace Server.ContextMenus ///
public class ContextMenu { - private Mobile m_From; - private object m_Target; - private ContextMenuEntry[] m_Entries; - /// /// Gets the who opened this ContextMenu. /// - public Mobile From => m_From; + public Mobile From { get; } /// /// Gets an object of the or for which this ContextMenu is on. /// - public object Target => m_Target; + public object Target { get; } /// /// Gets the list of entries contained in this ContextMenu. /// - public ContextMenuEntry[] Entries => m_Entries; + public ContextMenuEntry[] Entries { get; } /// /// Instantiates a new ContextMenu instance. @@ -60,8 +56,8 @@ namespace Server.ContextMenus /// public ContextMenu( Mobile from, object target ) { - m_From = from; - m_Target = target; + From = from; + Target = target; List list = new List(); @@ -76,11 +72,11 @@ namespace Server.ContextMenus //m_Entries = (ContextMenuEntry[])list.ToArray( typeof( ContextMenuEntry ) ); - m_Entries = list.ToArray(); + Entries = list.ToArray(); - for ( int i = 0; i < m_Entries.Length; ++i ) + for ( int i = 0; i < Entries.Length; ++i ) { - m_Entries[i].Owner = this; + Entries[i].Owner = this; } } @@ -91,9 +87,9 @@ namespace Server.ContextMenus { get { - for ( int i = 0; i < m_Entries.Length; ++i ) + for ( int i = 0; i < Entries.Length; ++i ) { - if ( m_Entries[i].Number < 3000000 || m_Entries[i].Number > 3032767 ) + if ( Entries[i].Number < 3000000 || Entries[i].Number > 3032767 ) return true; } diff --git a/Server/ContextMenus/ContextMenuEntry.cs b/Server/ContextMenus/ContextMenuEntry.cs index 8b0dd7ef0..c4726c39c 100644 --- a/Server/ContextMenus/ContextMenuEntry.cs +++ b/Server/ContextMenus/ContextMenuEntry.cs @@ -28,66 +28,35 @@ namespace Server.ContextMenus /// public class ContextMenuEntry { - private int m_Number; - private int m_Color; - private bool m_Enabled; - private int m_Range; - private CMEFlags m_Flags; - private ContextMenu m_Owner; - /// /// Gets or sets additional flags used in client communication. /// - public CMEFlags Flags - { - get => m_Flags; - set => m_Flags = value; - } + public CMEFlags Flags { get; set; } /// /// Gets or sets the that owns this entry. /// - public ContextMenu Owner - { - get => m_Owner; - set => m_Owner = value; - } + public ContextMenu Owner { get; set; } /// /// Gets or sets the localization number containing the name of this entry. /// - public int Number - { - get => m_Number; - set => m_Number = value; - } + public int Number { get; set; } /// /// Gets or sets the maximum range at which this entry may be used, in tiles. A value of -1 signifies no maximum range. /// - public int Range - { - get => m_Range; - set => m_Range = value; - } + public int Range { get; set; } /// /// Gets or sets the color for this entry. Format is A1-R5-G5-B5. /// - public int Color - { - get => m_Color; - set => m_Color = value; - } + public int Color { get; set; } /// /// Gets or sets whether this entry is enabled. When false, the entry will appear in a gray hue and will never be invoked. /// - public bool Enabled - { - get => m_Enabled; - set => m_Enabled = value; - } + public bool Enabled { get; set; } /// /// Gets a value indicating if non local use of this entry is permitted. @@ -119,13 +88,13 @@ namespace Server.ContextMenus public ContextMenuEntry( int number, int range ) { if ( number <= 0x7FFF ) // Legacy code support - m_Number = 3000000 + number; + Number = 3000000 + number; else - m_Number = number; + Number = number; - m_Range = range; - m_Enabled = true; - m_Color = 0xFFFF; + Range = range; + Enabled = true; + Color = 0xFFFF; } /// diff --git a/Server/Diagnostics/BaseProfile.cs b/Server/Diagnostics/BaseProfile.cs index e990cb054..c3c161bae 100644 --- a/Server/Diagnostics/BaseProfile.cs +++ b/Server/Diagnostics/BaseProfile.cs @@ -38,27 +38,20 @@ namespace Server.Diagnostics { } } - private string _name; - - private long _count; - - private TimeSpan _totalTime; - private TimeSpan _peakTime; - private Stopwatch _stopwatch; - public string Name => _name; + public string Name { get; } - public long Count => _count; + public long Count { get; private set; } - public TimeSpan AverageTime => TimeSpan.FromTicks( _totalTime.Ticks / Math.Max( 1, _count ) ); + public TimeSpan AverageTime => TimeSpan.FromTicks( TotalTime.Ticks / Math.Max( 1, Count ) ); - public TimeSpan PeakTime => _peakTime; + public TimeSpan PeakTime { get; private set; } - public TimeSpan TotalTime => _totalTime; + public TimeSpan TotalTime { get; private set; } protected BaseProfile( string name ) { - _name = name; + Name = name; _stopwatch = new Stopwatch(); } @@ -74,13 +67,13 @@ namespace Server.Diagnostics { public virtual void Finish() { TimeSpan elapsed = _stopwatch.Elapsed; - _totalTime += elapsed; + TotalTime += elapsed; - if ( elapsed > _peakTime ) { - _peakTime = elapsed; + if ( elapsed > PeakTime ) { + PeakTime = elapsed; } - _count++; + Count++; _stopwatch.Reset(); } diff --git a/Server/Diagnostics/PacketProfile.cs b/Server/Diagnostics/PacketProfile.cs index 3399acc2b..92f8d88f6 100644 --- a/Server/Diagnostics/PacketProfile.cs +++ b/Server/Diagnostics/PacketProfile.cs @@ -26,11 +26,9 @@ using System.IO; namespace Server.Diagnostics { public abstract class BasePacketProfile : BaseProfile { - private long _totalLength; + public long TotalLength { get; private set; } - public long TotalLength => _totalLength; - - public double AverageLength => ( double ) _totalLength / Math.Max( 1, Count ); + public double AverageLength => ( double ) TotalLength / Math.Max( 1, Count ); protected BasePacketProfile(string name) : base( name ) { @@ -39,7 +37,7 @@ namespace Server.Diagnostics { public void Finish( int length ) { Finish(); - _totalLength += length; + TotalLength += length; } public override void WriteTo( TextWriter op ) { diff --git a/Server/Diagnostics/TimerProfile.cs b/Server/Diagnostics/TimerProfile.cs index e90d6dee1..2411a4ed7 100644 --- a/Server/Diagnostics/TimerProfile.cs +++ b/Server/Diagnostics/TimerProfile.cs @@ -41,22 +41,11 @@ namespace Server.Diagnostics { return prof; } - private long _created, _started, _stopped; + public long Created { get; set; } - public long Created { - get => _created; - set => _created = value; - } + public long Started { get; set; } - public long Started { - get => _started; - set => _started = value; - } - - public long Stopped { - get => _stopped; - set => _stopped = value; - } + public long Stopped { get; set; } public TimerProfile( string name ) : base( name ) { @@ -65,7 +54,7 @@ namespace Server.Diagnostics { public override void WriteTo( TextWriter op ) { base.WriteTo( op ); - op.Write( "\t{0,12:N0} {1,12:N0} {2,-12:N0}", _created, _started, _stopped ); + op.Write( "\t{0,12:N0} {1,12:N0} {2,-12:N0}", Created, Started, Stopped ); } } } \ No newline at end of file diff --git a/Server/Effects.cs b/Server/Effects.cs index a96ac73e9..c709eee79 100644 --- a/Server/Effects.cs +++ b/Server/Effects.cs @@ -42,17 +42,11 @@ namespace Server public static class Effects { - private static ParticleSupportType m_ParticleSupportType = ParticleSupportType.Detect; - - public static ParticleSupportType ParticleSupportType - { - get => m_ParticleSupportType; - set => m_ParticleSupportType = value; - } + public static ParticleSupportType ParticleSupportType { get; set; } = ParticleSupportType.Detect; public static bool SendParticlesTo( NetState state ) { - return ( m_ParticleSupportType == ParticleSupportType.Full || (m_ParticleSupportType == ParticleSupportType.Detect && state.IsUOTDClient) ); + return ( ParticleSupportType == ParticleSupportType.Full || (ParticleSupportType == ParticleSupportType.Detect && state.IsUOTDClient) ); } public static void PlaySound( IPoint3D p, Map map, int soundID ) diff --git a/Server/EventSink.cs b/Server/EventSink.cs index 7f1d0cd67..efc93f644 100644 --- a/Server/EventSink.cs +++ b/Server/EventSink.cs @@ -74,126 +74,102 @@ namespace Server public class ClientVersionReceivedArgs : EventArgs { - private NetState m_State; - private ClientVersion m_Version; + public NetState State { get; } - public NetState State => m_State; - public ClientVersion Version => m_Version; + public ClientVersion Version { get; } public ClientVersionReceivedArgs( NetState state, ClientVersion cv ) { - m_State = state; - m_Version = cv; + State = state; + Version = cv; } } public class CreateGuildEventArgs : EventArgs { - private int m_Id; - public int Id { get => m_Id; - set => m_Id = value; - } + public int Id { get; set; } - private BaseGuild m_Guild; - public BaseGuild Guild { get => m_Guild; - set => m_Guild = value; - } + public BaseGuild Guild { get; set; } public CreateGuildEventArgs( int id ) { - m_Id = id; + Id = id; } } public class GuildGumpRequestArgs : EventArgs { - private Mobile m_Mobile; - - public Mobile Mobile => m_Mobile; + public Mobile Mobile { get; } public GuildGumpRequestArgs( Mobile mobile ) { - m_Mobile = mobile; + Mobile = mobile; } } public class QuestGumpRequestArgs : EventArgs { - private Mobile m_Mobile; - - public Mobile Mobile => m_Mobile; + public Mobile Mobile { get; } public QuestGumpRequestArgs( Mobile mobile ) { - m_Mobile = mobile; + Mobile = mobile; } } public class SetAbilityEventArgs : EventArgs { - private Mobile m_Mobile; - private int m_Index; + public Mobile Mobile { get; } - public Mobile Mobile => m_Mobile; - public int Index => m_Index; + public int Index { get; } public SetAbilityEventArgs( Mobile mobile, int index ) { - m_Mobile = mobile; - m_Index = index; + Mobile = mobile; + Index = index; } } public class DeleteRequestEventArgs : EventArgs { - private NetState m_State; - private int m_Index; + public NetState State { get; } - public NetState State => m_State; - public int Index => m_Index; + public int Index { get; } public DeleteRequestEventArgs( NetState state, int index ) { - m_State = state; - m_Index = index; + State = state; + Index = index; } } public class GameLoginEventArgs : EventArgs { - private NetState m_State; - private string m_Username; - private string m_Password; - private bool m_Accepted; - private CityInfo[] m_CityInfo; + public NetState State { get; } - public NetState State => m_State; - public string Username => m_Username; - public string Password => m_Password; - public bool Accepted{ get => m_Accepted; - set => m_Accepted = value; - } - public CityInfo[] CityInfo{ get => m_CityInfo; - set => m_CityInfo = value; - } + public string Username { get; } + + public string Password { get; } + + public bool Accepted { get; set; } + + public CityInfo[] CityInfo { get; set; } public GameLoginEventArgs( NetState state, string un, string pw ) { - m_State = state; - m_Username = un; - m_Password = pw; + State = state; + Username = un; + Password = pw; } } public class AggressiveActionEventArgs : EventArgs { - private Mobile m_Aggressed; - private Mobile m_Aggressor; - private bool m_Criminal; + public Mobile Aggressed { get; private set; } - public Mobile Aggressed => m_Aggressed; - public Mobile Aggressor => m_Aggressor; - public bool Criminal => m_Criminal; + public Mobile Aggressor { get; private set; } + + public bool Criminal { get; private set; } private static Queue m_Pool = new Queue(); @@ -205,9 +181,9 @@ namespace Server { args = m_Pool.Dequeue(); - args.m_Aggressed = aggressed; - args.m_Aggressor = aggressor; - args.m_Criminal = criminal; + args.Aggressed = aggressed; + args.Aggressor = aggressor; + args.Criminal = criminal; } else { @@ -219,9 +195,9 @@ namespace Server private AggressiveActionEventArgs( Mobile aggressed, Mobile aggressor, bool criminal ) { - m_Aggressed = aggressed; - m_Aggressor = aggressor; - m_Criminal = criminal; + Aggressed = aggressed; + Aggressor = aggressor; + Criminal = criminal; } public void Free() @@ -232,319 +208,272 @@ namespace Server public class ProfileRequestEventArgs : EventArgs { - private Mobile m_Beholder; - private Mobile m_Beheld; + public Mobile Beholder { get; } - public Mobile Beholder => m_Beholder; - public Mobile Beheld => m_Beheld; + public Mobile Beheld { get; } public ProfileRequestEventArgs( Mobile beholder, Mobile beheld ) { - m_Beholder = beholder; - m_Beheld = beheld; + Beholder = beholder; + Beheld = beheld; } } public class ChangeProfileRequestEventArgs : EventArgs { - private Mobile m_Beholder; - private Mobile m_Beheld; - private string m_Text; + public Mobile Beholder { get; } - public Mobile Beholder => m_Beholder; - public Mobile Beheld => m_Beheld; - public string Text => m_Text; + public Mobile Beheld { get; } + + public string Text { get; } public ChangeProfileRequestEventArgs( Mobile beholder, Mobile beheld, string text ) { - m_Beholder = beholder; - m_Beheld = beheld; - m_Text = text; + Beholder = beholder; + Beheld = beheld; + Text = text; } } public class PaperdollRequestEventArgs : EventArgs { - private Mobile m_Beholder; - private Mobile m_Beheld; + public Mobile Beholder { get; } - public Mobile Beholder => m_Beholder; - public Mobile Beheld => m_Beheld; + public Mobile Beheld { get; } public PaperdollRequestEventArgs( Mobile beholder, Mobile beheld ) { - m_Beholder = beholder; - m_Beheld = beheld; + Beholder = beholder; + Beheld = beheld; } } public class AccountLoginEventArgs : EventArgs { - private NetState m_State; - private string m_Username; - private string m_Password; + public NetState State { get; } - private bool m_Accepted; - private ALRReason m_RejectReason; + public string Username { get; } - public NetState State => m_State; - public string Username => m_Username; - public string Password => m_Password; - public bool Accepted{ get => m_Accepted; - set => m_Accepted = value; - } - public ALRReason RejectReason{ get => m_RejectReason; - set => m_RejectReason = value; - } + public string Password { get; } + + public bool Accepted { get; set; } + + public ALRReason RejectReason { get; set; } public AccountLoginEventArgs( NetState state, string username, string password ) { - m_State = state; - m_Username = username; - m_Password = password; + State = state; + Username = username; + Password = password; } } public class VirtueItemRequestEventArgs : EventArgs { - private Mobile m_Beholder; - private Mobile m_Beheld; - private int m_GumpID; + public Mobile Beholder { get; } - public Mobile Beholder => m_Beholder; - public Mobile Beheld => m_Beheld; - public int GumpID => m_GumpID; + public Mobile Beheld { get; } + + public int GumpID { get; } public VirtueItemRequestEventArgs( Mobile beholder, Mobile beheld, int gumpID ) { - m_Beholder = beholder; - m_Beheld = beheld; - m_GumpID = gumpID; + Beholder = beholder; + Beheld = beheld; + GumpID = gumpID; } } public class VirtueGumpRequestEventArgs : EventArgs { - private Mobile m_Beholder, m_Beheld; + public Mobile Beholder { get; } - public Mobile Beholder => m_Beholder; - public Mobile Beheld => m_Beheld; + public Mobile Beheld { get; } public VirtueGumpRequestEventArgs( Mobile beholder, Mobile beheld ) { - m_Beholder = beholder; - m_Beheld = beheld; + Beholder = beholder; + Beheld = beheld; } } public class VirtueMacroRequestEventArgs : EventArgs { - private Mobile m_Mobile; - private int m_VirtueID; + public Mobile Mobile { get; } - public Mobile Mobile => m_Mobile; - public int VirtueID => m_VirtueID; + public int VirtueID { get; } public VirtueMacroRequestEventArgs( Mobile mobile, int virtueID ) { - m_Mobile = mobile; - m_VirtueID = virtueID; + Mobile = mobile; + VirtueID = virtueID; } } public class ChatRequestEventArgs : EventArgs { - private Mobile m_Mobile; - - public Mobile Mobile => m_Mobile; + public Mobile Mobile { get; } public ChatRequestEventArgs( Mobile mobile ) { - m_Mobile = mobile; + Mobile = mobile; } } public class PlayerDeathEventArgs : EventArgs { - private Mobile m_Mobile; - - public Mobile Mobile => m_Mobile; + public Mobile Mobile { get; } public PlayerDeathEventArgs( Mobile mobile ) { - m_Mobile = mobile; + Mobile = mobile; } } public class RenameRequestEventArgs : EventArgs { - private Mobile m_From, m_Target; - private string m_Name; + public Mobile From { get; } - public Mobile From => m_From; - public Mobile Target => m_Target; - public string Name => m_Name; + public Mobile Target { get; } + + public string Name { get; } public RenameRequestEventArgs( Mobile from, Mobile target, string name ) { - m_From = from; - m_Target = target; - m_Name = name; + From = from; + Target = target; + Name = name; } } public class LogoutEventArgs : EventArgs { - private Mobile m_Mobile; - - public Mobile Mobile => m_Mobile; + public Mobile Mobile { get; } public LogoutEventArgs( Mobile m ) { - m_Mobile = m; + Mobile = m; } } public class SocketConnectEventArgs : EventArgs { - private Socket m_Socket; - private bool m_AllowConnection; + public Socket Socket { get; } - public Socket Socket => m_Socket; - public bool AllowConnection{ get => m_AllowConnection; - set => m_AllowConnection = value; - } + public bool AllowConnection { get; set; } public SocketConnectEventArgs( Socket s ) { - m_Socket = s; - m_AllowConnection = true; + Socket = s; + AllowConnection = true; } } public class ConnectedEventArgs : EventArgs { - private Mobile m_Mobile; - - public Mobile Mobile => m_Mobile; + public Mobile Mobile { get; } public ConnectedEventArgs( Mobile m ) { - m_Mobile = m; + Mobile = m; } } public class DisconnectedEventArgs : EventArgs { - private Mobile m_Mobile; - - public Mobile Mobile => m_Mobile; + public Mobile Mobile { get; } public DisconnectedEventArgs( Mobile m ) { - m_Mobile = m; + Mobile = m; } } public class AnimateRequestEventArgs : EventArgs { - private Mobile m_Mobile; - private string m_Action; + public Mobile Mobile { get; } - public Mobile Mobile => m_Mobile; - public string Action => m_Action; + public string Action { get; } public AnimateRequestEventArgs( Mobile m, string action ) { - m_Mobile = m; - m_Action = action; + Mobile = m; + Action = action; } } public class CastSpellRequestEventArgs : EventArgs { - private Mobile m_Mobile; - private Item m_Spellbook; - private int m_SpellID; + public Mobile Mobile { get; } - public Mobile Mobile => m_Mobile; - public Item Spellbook => m_Spellbook; - public int SpellID => m_SpellID; + public Item Spellbook { get; } + + public int SpellID { get; } public CastSpellRequestEventArgs( Mobile m, int spellID, Item book ) { - m_Mobile = m; - m_Spellbook = book; - m_SpellID = spellID; + Mobile = m; + Spellbook = book; + SpellID = spellID; } } public class BandageTargetRequestEventArgs : EventArgs { - private Mobile m_Mobile; - private Item m_Bandage; - private Mobile m_Target; + public Mobile Mobile { get; } - public Mobile Mobile => m_Mobile; - public Item Bandage => m_Bandage; - public Mobile Target => m_Target; + public Item Bandage { get; } + + public Mobile Target { get; } public BandageTargetRequestEventArgs(Mobile m, Item bandage, Mobile target) { - m_Mobile = m; - m_Bandage = bandage; - m_Target = target; + Mobile = m; + Bandage = bandage; + Target = target; } } public class OpenSpellbookRequestEventArgs : EventArgs { - private Mobile m_Mobile; - private int m_Type; + public Mobile Mobile { get; } - public Mobile Mobile => m_Mobile; - public int Type => m_Type; + public int Type { get; } public OpenSpellbookRequestEventArgs( Mobile m, int type ) { - m_Mobile = m; - m_Type = type; + Mobile = m; + Type = type; } } public class StunRequestEventArgs : EventArgs { - private Mobile m_Mobile; - - public Mobile Mobile => m_Mobile; + public Mobile Mobile { get; } public StunRequestEventArgs( Mobile m ) { - m_Mobile = m; + Mobile = m; } } public class DisarmRequestEventArgs : EventArgs { - private Mobile m_Mobile; - - public Mobile Mobile => m_Mobile; + public Mobile Mobile { get; } public DisarmRequestEventArgs( Mobile m ) { - m_Mobile = m; + Mobile = m; } } public class HelpRequestEventArgs : EventArgs { - private Mobile m_Mobile; - - public Mobile Mobile => m_Mobile; + public Mobile Mobile { get; } public HelpRequestEventArgs( Mobile m ) { - m_Mobile = m; + Mobile = m; } } @@ -557,46 +486,36 @@ namespace Server public class CrashedEventArgs : EventArgs { - private Exception m_Exception; - private bool m_Close; + public Exception Exception { get; } - public Exception Exception => m_Exception; - public bool Close{ get => m_Close; - set => m_Close = value; - } + public bool Close { get; set; } public CrashedEventArgs( Exception e ) { - m_Exception = e; + Exception = e; } } public class HungerChangedEventArgs : EventArgs { - private Mobile m_Mobile; - private int m_OldValue; + public Mobile Mobile { get; } - public Mobile Mobile => m_Mobile; - public int OldValue => m_OldValue; + public int OldValue { get; } public HungerChangedEventArgs( Mobile mobile, int oldValue ) { - m_Mobile = mobile; - m_OldValue = oldValue; + Mobile = mobile; + OldValue = oldValue; } } public class MovementEventArgs : EventArgs { - private Mobile m_Mobile; - private Direction m_Direction; - private bool m_Blocked; + public Mobile Mobile { get; private set; } - public Mobile Mobile => m_Mobile; - public Direction Direction => m_Direction; - public bool Blocked{ get => m_Blocked; - set => m_Blocked = value; - } + public Direction Direction { get; private set; } + + public bool Blocked { get; set; } private static Queue m_Pool = new Queue(); @@ -608,9 +527,9 @@ namespace Server { args = m_Pool.Dequeue(); - args.m_Mobile = mobile; - args.m_Direction = dir; - args.m_Blocked = false; + args.Mobile = mobile; + args.Direction = dir; + args.Blocked = false; } else { @@ -622,8 +541,8 @@ namespace Server public MovementEventArgs( Mobile mobile, Direction dir ) { - m_Mobile = mobile; - m_Direction = dir; + Mobile = mobile; + Direction = dir; } public void Free() @@ -634,17 +553,13 @@ namespace Server public class ServerListEventArgs : EventArgs { - private NetState m_State; - private IAccount m_Account; - private bool m_Rejected; - private List m_Servers; + public NetState State { get; } - public NetState State => m_State; - public IAccount Account => m_Account; - public bool Rejected{ get => m_Rejected; - set => m_Rejected = value; - } - public List Servers => m_Servers; + public IAccount Account { get; } + + public bool Rejected { get; set; } + + public List Servers { get; } public void AddServer( string name, IPEndPoint address ) { @@ -653,137 +568,123 @@ namespace Server public void AddServer( string name, int fullPercent, TimeZone tz, IPEndPoint address ) { - m_Servers.Add( new ServerInfo( name, fullPercent, tz, address ) ); + Servers.Add( new ServerInfo( name, fullPercent, tz, address ) ); } public ServerListEventArgs( NetState state, IAccount account ) { - m_State = state; - m_Account = account; - m_Servers = new List(); + State = state; + Account = account; + Servers = new List(); } } public struct SkillNameValue { - private SkillName m_Name; - private int m_Value; + public SkillName Name { get; } - public SkillName Name => m_Name; - public int Value => m_Value; + public int Value { get; } public SkillNameValue( SkillName name, int value ) { - m_Name = name; - m_Value = value; + Name = name; + Value = value; } } public class CharacterCreatedEventArgs : EventArgs { - private NetState m_State; - private IAccount m_Account; - private CityInfo m_City; - private SkillNameValue[] m_Skills; - private int m_ShirtHue, m_PantsHue; - private int m_HairID, m_HairHue; - private int m_BeardID, m_BeardHue; - private string m_Name; - private bool m_Female; - private int m_Hue; - private int m_Str, m_Dex, m_Int; - private int m_Profession; - private Mobile m_Mobile; + public NetState State { get; } - private Race m_Race; + public IAccount Account { get; } - public NetState State => m_State; - public IAccount Account => m_Account; - public Mobile Mobile{ get => m_Mobile; - set => m_Mobile = value; - } - public string Name => m_Name; - public bool Female => m_Female; - public int Hue => m_Hue; - public int Str => m_Str; - public int Dex => m_Dex; - public int Int => m_Int; - public CityInfo City => m_City; - public SkillNameValue[] Skills => m_Skills; - public int ShirtHue => m_ShirtHue; - public int PantsHue => m_PantsHue; - public int HairID => m_HairID; - public int HairHue => m_HairHue; - public int BeardID => m_BeardID; - public int BeardHue => m_BeardHue; - public int Profession{ get => m_Profession; - set => m_Profession = value; - } - public Race Race => m_Race; + public Mobile Mobile { get; set; } + + public string Name { get; } + + public bool Female { get; } + + public int Hue { get; } + + public int Str { get; } + + public int Dex { get; } + + public int Int { get; } + + public CityInfo City { get; } + + public SkillNameValue[] Skills { get; } + + public int ShirtHue { get; } + + public int PantsHue { get; } + + public int HairID { get; } + + public int HairHue { get; } + + public int BeardID { get; } + + public int BeardHue { get; } + + public int Profession { get; set; } + + public Race Race { get; } public CharacterCreatedEventArgs( NetState state, IAccount a, string name, bool female, int hue, int str, int dex, int intel, CityInfo city, SkillNameValue[] skills, int shirtHue, int pantsHue, int hairID, int hairHue, int beardID, int beardHue, int profession, Race race ) { - m_State = state; - m_Account = a; - m_Name = name; - m_Female = female; - m_Hue = hue; - m_Str = str; - m_Dex = dex; - m_Int = intel; - m_City = city; - m_Skills = skills; - m_ShirtHue = shirtHue; - m_PantsHue = pantsHue; - m_HairID = hairID; - m_HairHue = hairHue; - m_BeardID = beardID; - m_BeardHue = beardHue; - m_Profession = profession; - m_Race = race; + State = state; + Account = a; + Name = name; + Female = female; + Hue = hue; + Str = str; + Dex = dex; + Int = intel; + City = city; + Skills = skills; + ShirtHue = shirtHue; + PantsHue = pantsHue; + HairID = hairID; + HairHue = hairHue; + BeardID = beardID; + BeardHue = beardHue; + Profession = profession; + Race = race; } } public class OpenDoorMacroEventArgs : EventArgs { - private Mobile m_Mobile; - - public Mobile Mobile => m_Mobile; + public Mobile Mobile { get; } public OpenDoorMacroEventArgs( Mobile mobile ) { - m_Mobile = mobile; + Mobile = mobile; } } public class SpeechEventArgs : EventArgs { - private Mobile m_Mobile; - private string m_Speech; - private MessageType m_Type; - private int m_Hue; - private int[] m_Keywords; - private bool m_Handled; - private bool m_Blocked; + public Mobile Mobile { get; } - public Mobile Mobile => m_Mobile; - public string Speech{ get => m_Speech; - set => m_Speech = value; - } - public MessageType Type => m_Type; - public int Hue => m_Hue; - public int[] Keywords => m_Keywords; - public bool Handled{ get => m_Handled; - set => m_Handled = value; - } - public bool Blocked{ get => m_Blocked; - set => m_Blocked = value; - } + public string Speech { get; set; } + + public MessageType Type { get; } + + public int Hue { get; } + + public int[] Keywords { get; } + + public bool Handled { get; set; } + + public bool Blocked { get; set; } public bool HasKeyword( int keyword ) { - for ( int i = 0; i < m_Keywords.Length; ++i ) - if ( m_Keywords[i] == keyword ) + for ( int i = 0; i < Keywords.Length; ++i ) + if ( Keywords[i] == keyword ) return true; return false; @@ -791,53 +692,45 @@ namespace Server public SpeechEventArgs( Mobile mobile, string speech, MessageType type, int hue, int[] keywords ) { - m_Mobile = mobile; - m_Speech = speech; - m_Type = type; - m_Hue = hue; - m_Keywords = keywords; + Mobile = mobile; + Speech = speech; + Type = type; + Hue = hue; + Keywords = keywords; } } public class LoginEventArgs : EventArgs { - private Mobile m_Mobile; - - public Mobile Mobile => m_Mobile; + public Mobile Mobile { get; } public LoginEventArgs( Mobile mobile ) { - m_Mobile = mobile; + Mobile = mobile; } } public class WorldSaveEventArgs : EventArgs { - private bool m_Msg; - - public bool Message => m_Msg; + public bool Message { get; } public WorldSaveEventArgs( bool msg ) { - m_Msg = msg; + Message = msg; } } public class FastWalkEventArgs : EventArgs { - private NetState m_State; - private bool m_Blocked; - public FastWalkEventArgs( NetState state ) { - m_State = state; - m_Blocked = false; + NetState = state; + Blocked = false; } - public NetState NetState => m_State; - public bool Blocked{ get => m_Blocked; - set => m_Blocked = value; - } + public NetState NetState { get; } + + public bool Blocked { get; set; } } public static class EventSink diff --git a/Server/Geometry.cs b/Server/Geometry.cs index d49b311ef..2c515812e 100644 --- a/Server/Geometry.cs +++ b/Server/Geometry.cs @@ -481,62 +481,51 @@ namespace Server [PropertyObject] public struct Rectangle3D { - private Point3D m_Start; - private Point3D m_End; - public Rectangle3D( Point3D start, Point3D end ) { - m_Start = start; - m_End = end; + Start = start; + End = end; } public Rectangle3D( int x, int y, int z, int width, int height, int depth ) { - m_Start = new Point3D( x, y, z ); - m_End = new Point3D( x + width, y + height, z + depth ); + Start = new Point3D( x, y, z ); + End = new Point3D( x + width, y + height, z + depth ); } [CommandProperty( AccessLevel.Counselor )] - public Point3D Start - { - get => m_Start; - set => m_Start = value; - } + public Point3D Start { get; set; } [CommandProperty( AccessLevel.Counselor )] - public Point3D End - { - get => m_End; - set => m_End = value; - } + public Point3D End { get; set; } [CommandProperty( AccessLevel.Counselor )] - public int Width => m_End.X - m_Start.X; + public int Width => End.X - Start.X; [CommandProperty( AccessLevel.Counselor )] - public int Height => m_End.Y - m_Start.Y; + public int Height => End.Y - Start.Y; [CommandProperty( AccessLevel.Counselor )] - public int Depth => m_End.Z - m_Start.Z; + public int Depth => End.Z - Start.Z; public bool Contains( Point3D p ) { - return ( p.m_X >= m_Start.m_X ) - && ( p.m_X < m_End.m_X ) - && ( p.m_Y >= m_Start.m_Y ) - && ( p.m_Y < m_End.m_Y ) - && ( p.m_Z >= m_Start.m_Z ) - && ( p.m_Z < m_End.m_Z ); + return ( p.m_X >= Start.m_X ) + && ( p.m_X < End.m_X ) + && ( p.m_Y >= Start.m_Y ) + && ( p.m_Y < End.m_Y ) + && ( p.m_Z >= Start.m_Z ) + && ( p.m_Z < End.m_Z ); } public bool Contains( IPoint3D p ) { - return ( p.X >= m_Start.m_X ) - && ( p.X < m_End.m_X ) - && ( p.Y >= m_Start.m_Y ) - && ( p.Y < m_End.m_Y ) - && ( p.Z >= m_Start.m_Z ) - && ( p.Z < m_End.m_Z ); + return ( p.X >= Start.m_X ) + && ( p.X < End.m_X ) + && ( p.Y >= Start.m_Y ) + && ( p.Y < End.m_Y ) + && ( p.Z >= Start.m_Z ) + && ( p.Z < End.m_Z ); } } } diff --git a/Server/Guild.cs b/Server/Guild.cs index 31b106ff9..2c6fafef6 100644 --- a/Server/Guild.cs +++ b/Server/Guild.cs @@ -32,28 +32,26 @@ namespace Server.Guilds public abstract class BaseGuild : ISerializable { - private int m_Id; - protected BaseGuild( int Id )//serialization ctor { - m_Id = Id; - m_GuildList.Add( m_Id, this ); - if ( m_Id+1 > m_NextID ) - m_NextID = m_Id + 1; + this.Id = Id; + List.Add( this.Id, this ); + if ( this.Id+1 > m_NextID ) + m_NextID = this.Id + 1; } protected BaseGuild() { - m_Id = m_NextID++; - m_GuildList.Add( m_Id, this ); + Id = m_NextID++; + List.Add( Id, this ); } [CommandProperty( AccessLevel.Counselor )] - public int Id => m_Id; + public int Id { get; } int ISerializable.TypeReference => 0; - int ISerializable.SerialIdentity => m_Id; + int ISerializable.SerialIdentity => Id; public abstract void Deserialize( GenericReader reader ); public abstract void Serialize( GenericWriter writer ); @@ -64,23 +62,22 @@ namespace Server.Guilds public abstract bool Disbanded{ get; } public abstract void OnDelete( Mobile mob ); - private static Dictionary m_GuildList = new Dictionary(); private static int m_NextID = 1; - public static Dictionary List => m_GuildList; + public static Dictionary List { get; } = new Dictionary(); public static BaseGuild Find( int id ) { BaseGuild g; - m_GuildList.TryGetValue( id, out g ); + List.TryGetValue( id, out g ); return g; } public static BaseGuild FindByName( string name ) { - foreach ( BaseGuild g in m_GuildList.Values ) + foreach ( BaseGuild g in List.Values ) { if ( g.Name == name ) return g; @@ -91,7 +88,7 @@ namespace Server.Guilds public static BaseGuild FindByAbbrev( string abbr ) { - foreach ( BaseGuild g in m_GuildList.Values ) + foreach ( BaseGuild g in List.Values ) { if ( g.Abbreviation == abbr ) return g; @@ -105,7 +102,7 @@ namespace Server.Guilds string[] words = find.ToLower().Split( ' ' ); List results = new List(); - foreach ( BaseGuild g in m_GuildList.Values ) + foreach ( BaseGuild g in List.Values ) { bool match = true; string name = g.Name.ToLower(); @@ -127,7 +124,7 @@ namespace Server.Guilds public override string ToString() { - return $"0x{m_Id:X} \"{Name} [{Abbreviation}]\""; + return $"0x{Id:X} \"{Name} [{Abbreviation}]\""; } } } diff --git a/Server/Gumps/Gump.cs b/Server/Gumps/Gump.cs index c53d182ac..c98811247 100644 --- a/Server/Gumps/Gump.cs +++ b/Server/Gumps/Gump.cs @@ -27,7 +27,6 @@ namespace Server.Gumps { public class Gump { - private List m_Entries; private List m_Strings; internal int m_TextEntries, m_Switches; @@ -35,7 +34,6 @@ namespace Server.Gumps private static int m_NextSerial = 1; private int m_Serial; - private int m_TypeID; private int m_X, m_Y; private bool m_Dragable = true; @@ -58,9 +56,9 @@ namespace Server.Gumps m_X = x; m_Y = y; - m_TypeID = GetTypeID( GetType() ); + TypeID = GetTypeID( GetType() ); - m_Entries = new List(); + Entries = new List(); m_Strings = new List(); } @@ -70,9 +68,9 @@ namespace Server.Gumps // m_Strings.Clear(); } - public int TypeID => m_TypeID; + public int TypeID { get; } - public List Entries => m_Entries; + public List Entries { get; } public int Serial { @@ -289,20 +287,20 @@ namespace Server.Gumps { g.Parent = this; } - else if ( !m_Entries.Contains( g ) ) + else if ( !Entries.Contains( g ) ) { Invalidate(); - m_Entries.Add( g ); + Entries.Add( g ); } } public void Remove( GumpEntry g ) { - if (g == null || !m_Entries.Contains(g)) + if (g == null || !Entries.Contains(g)) return; Invalidate(); - m_Entries.Remove( g ); + Entries.Remove( g ); g.Parent = null; } @@ -365,12 +363,12 @@ namespace Server.Gumps if ( !m_Resizable ) disp.AppendLayout( m_NoResize ); - int count = m_Entries.Count; + int count = Entries.Count; GumpEntry e; for ( int i = 0; i < count; ++i ) { - e = m_Entries[i]; + e = Entries[i]; disp.AppendLayout( m_BeginLayout ); e.AppendTo( ns, disp ); diff --git a/Server/Gumps/GumpImageTileButton.cs b/Server/Gumps/GumpImageTileButton.cs index 13250e219..f8e7e6c17 100644 --- a/Server/Gumps/GumpImageTileButton.cs +++ b/Server/Gumps/GumpImageTileButton.cs @@ -37,8 +37,6 @@ namespace Server.Gumps private int m_Width; private int m_Height; - private int m_LocalizedTooltip; - public GumpImageTileButton( int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param, int itemID, int hue, int width, int height ) : this(x, y, normalID, pressedID, buttonID, type, param, itemID, hue, width, height, -1 ) { } @@ -57,7 +55,7 @@ namespace Server.Gumps m_Width = width; m_Height = height; - m_LocalizedTooltip = localizedTooltip; + LocalizedTooltip = localizedTooltip; } public int X @@ -136,17 +134,13 @@ namespace Server.Gumps set => Delta( ref m_Height, value ); } - public int LocalizedTooltip - { - get => m_LocalizedTooltip; - set => m_LocalizedTooltip = value; - } + public int LocalizedTooltip { get; set; } public override string Compile( NetState ns ) { - if ( m_LocalizedTooltip > 0 ) + if ( LocalizedTooltip > 0 ) return - $"{{ buttontileart {m_X} {m_Y} {m_ID1} {m_ID2} {(int) m_Type} {m_Param} {m_ButtonID} {m_ItemID} {m_Hue} {m_Width} {m_Height} }}{{ tooltip {m_LocalizedTooltip} }}"; + $"{{ buttontileart {m_X} {m_Y} {m_ID1} {m_ID2} {(int) m_Type} {m_Param} {m_ButtonID} {m_ItemID} {m_Hue} {m_Width} {m_Height} }}{{ tooltip {LocalizedTooltip} }}"; return $"{{ buttontileart {m_X} {m_Y} {m_ID1} {m_ID2} {(int) m_Type} {m_Param} {m_ButtonID} {m_ItemID} {m_Hue} {m_Width} {m_Height} }}"; } @@ -170,10 +164,10 @@ namespace Server.Gumps disp.AppendLayout( m_Width ); disp.AppendLayout( m_Height ); - if ( m_LocalizedTooltip > 0 ) + if ( LocalizedTooltip > 0 ) { disp.AppendLayout( m_LayoutTooltip ); - disp.AppendLayout( m_LocalizedTooltip ); + disp.AppendLayout( LocalizedTooltip ); } } } diff --git a/Server/Gumps/RelayInfo.cs b/Server/Gumps/RelayInfo.cs index b568e5085..21d3bd39b 100644 --- a/Server/Gumps/RelayInfo.cs +++ b/Server/Gumps/RelayInfo.cs @@ -22,44 +22,37 @@ namespace Server.Gumps { public class TextRelay { - private int m_EntryID; - private string m_Text; - public TextRelay( int entryID, string text ) { - m_EntryID = entryID; - m_Text = text; + EntryID = entryID; + Text = text; } - public int EntryID => m_EntryID; + public int EntryID { get; } - public string Text => m_Text; + public string Text { get; } } public class RelayInfo { - private int m_ButtonID; - private int[] m_Switches; - private TextRelay[] m_TextEntries; - public RelayInfo( int buttonID, int[] switches, TextRelay[] textEntries ) { - m_ButtonID = buttonID; - m_Switches = switches; - m_TextEntries = textEntries; + ButtonID = buttonID; + Switches = switches; + TextEntries = textEntries; } - public int ButtonID => m_ButtonID; + public int ButtonID { get; } - public int[] Switches => m_Switches; + public int[] Switches { get; } - public TextRelay[] TextEntries => m_TextEntries; + public TextRelay[] TextEntries { get; } public bool IsSwitched( int switchID ) { - for ( int i = 0; i < m_Switches.Length; ++i ) + for ( int i = 0; i < Switches.Length; ++i ) { - if ( m_Switches[i] == switchID ) + if ( Switches[i] == switchID ) { return true; } @@ -70,11 +63,11 @@ namespace Server.Gumps public TextRelay GetTextEntry( int entryID ) { - for ( int i = 0; i < m_TextEntries.Length; ++i ) + for ( int i = 0; i < TextEntries.Length; ++i ) { - if ( m_TextEntries[i].EntryID == entryID ) + if ( TextEntries[i].EntryID == entryID ) { - return m_TextEntries[i]; + return TextEntries[i]; } } diff --git a/Server/HuePicker.cs b/Server/HuePicker.cs index 2b7a24c28..c0e68d318 100644 --- a/Server/HuePicker.cs +++ b/Server/HuePicker.cs @@ -26,21 +26,18 @@ namespace Server.HuePickers { private static int m_NextSerial = 1; - private int m_Serial; - private int m_ItemID; + public int Serial { get; } - public int Serial => m_Serial; - - public int ItemID => m_ItemID; + public int ItemID { get; } public HuePicker( int itemID ) { do { - m_Serial = m_NextSerial++; - } while ( m_Serial == 0 ); + Serial = m_NextSerial++; + } while ( Serial == 0 ); - m_ItemID = itemID; + ItemID = itemID; } public virtual void OnResponse( int hue ) diff --git a/Server/IEntity.cs b/Server/IEntity.cs index 27a00199e..919ad96a9 100644 --- a/Server/IEntity.cs +++ b/Server/IEntity.cs @@ -41,7 +41,7 @@ namespace Server if ( other == null ) return -1; - return m_Serial.CompareTo( other.Serial ); + return Serial.CompareTo( other.Serial ); } public int CompareTo( Entity other ) @@ -57,38 +57,33 @@ namespace Server throw new ArgumentException(); } - private Serial m_Serial; - private Point3D m_Location; - private Map m_Map; - private bool m_Deleted; - public Entity( Serial serial, Point3D loc, Map map ) { - m_Serial = serial; - m_Location = loc; - m_Map = map; - m_Deleted = false; + Serial = serial; + Location = loc; + Map = map; + Deleted = false; } - public Serial Serial => m_Serial; + public Serial Serial { get; } - public Point3D Location => m_Location; + public Point3D Location { get; private set; } - public int X => m_Location.X; + public int X => Location.X; - public int Y => m_Location.Y; + public int Y => Location.Y; - public int Z => m_Location.Z; + public int Z => Location.Z; - public Map Map => m_Map; + public Map Map { get; private set; } public virtual void MoveToWorld(Point3D newLocation, Map map) { - m_Location = newLocation; - m_Map = map; + Location = newLocation; + Map = map; } - public bool Deleted => m_Deleted; + public bool Deleted { get; } public void Delete() { diff --git a/Server/Insensitive.cs b/Server/Insensitive.cs index 828b59df2..49b9e197e 100644 --- a/Server/Insensitive.cs +++ b/Server/Insensitive.cs @@ -24,13 +24,11 @@ namespace Server { public static class Insensitive { - private static IComparer m_Comparer = CaseInsensitiveComparer.Default; - - public static IComparer Comparer => m_Comparer; + public static IComparer Comparer { get; } = CaseInsensitiveComparer.Default; public static int Compare( string a, string b ) { - return m_Comparer.Compare( a, b ); + return Comparer.Compare( a, b ); } public static bool Equals( string a, string b ) @@ -40,7 +38,7 @@ namespace Server if ( a == null || b == null || a.Length != b.Length ) return false; - return ( m_Comparer.Compare( a, b ) == 0 ); + return ( Comparer.Compare( a, b ) == 0 ); } public static bool StartsWith( string a, string b ) @@ -48,7 +46,7 @@ namespace Server if ( a == null || b == null || a.Length < b.Length ) return false; - return ( m_Comparer.Compare( a.Substring( 0, b.Length ), b ) == 0 ); + return ( Comparer.Compare( a.Substring( 0, b.Length ), b ) == 0 ); } public static bool EndsWith( string a, string b ) @@ -56,7 +54,7 @@ namespace Server if ( a == null || b == null || a.Length < b.Length ) return false; - return ( m_Comparer.Compare( a.Substring( a.Length - b.Length ), b ) == 0 ); + return ( Comparer.Compare( a.Substring( a.Length - b.Length ), b ) == 0 ); } public static bool Contains( string a, string b ) diff --git a/Server/Item.cs b/Server/Item.cs index 2174ef3e7..df45816ff 100644 --- a/Server/Item.cs +++ b/Server/Item.cs @@ -567,7 +567,7 @@ namespace Server if ( other == null ) return -1; - return m_Serial.CompareTo( other.Serial ); + return Serial.CompareTo( other.Serial ); } public int CompareTo( Item other ) @@ -584,7 +584,7 @@ namespace Server } #region Standard fields - private Serial m_Serial; + private Point3D m_Location; private int m_ItemID; private int m_Hue; @@ -593,7 +593,6 @@ namespace Server private IEntity m_Parent; // Mobile, Item, or null=World private Map m_Map; private LootType m_LootType; - private DateTime m_LastMovedTime; private Direction m_Direction; #endregion @@ -1259,17 +1258,17 @@ namespace Server public void LabelTo( Mobile to, int number ) { - to.Send( new MessageLocalized( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, number, "", "" ) ); + to.Send( new MessageLocalized( Serial, m_ItemID, MessageType.Label, 0x3B2, 3, number, "", "" ) ); } public void LabelTo( Mobile to, int number, string args ) { - to.Send( new MessageLocalized( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, number, "", args ) ); + to.Send( new MessageLocalized( Serial, m_ItemID, MessageType.Label, 0x3B2, 3, number, "", args ) ); } public void LabelTo( Mobile to, string text ) { - to.Send( new UnicodeMessage( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, "ENU", "", text ) ); + to.Send( new UnicodeMessage( Serial, m_ItemID, MessageType.Label, 0x3B2, 3, "ENU", "", text ) ); } public void LabelTo( Mobile to, string format, params object[] args ) @@ -1279,12 +1278,12 @@ namespace Server public void LabelToAffix( Mobile to, int number, AffixType type, string affix ) { - to.Send( new MessageLocalizedAffix( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, number, "", type, affix, "" ) ); + to.Send( new MessageLocalizedAffix( Serial, m_ItemID, MessageType.Label, 0x3B2, 3, number, "", type, affix, "" ) ); } public void LabelToAffix( Mobile to, int number, AffixType type, string affix, string args ) { - to.Send( new MessageLocalizedAffix( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, number, "", type, affix, args ) ); + to.Send( new MessageLocalizedAffix( Serial, m_ItemID, MessageType.Label, 0x3B2, 3, number, "", type, affix, args ) ); } public virtual void LabelLootTypeTo( Mobile to ) @@ -1453,14 +1452,10 @@ namespace Server } } - private static TimeSpan m_DDT = TimeSpan.FromHours( 1.0 ); - - public static TimeSpan DefaultDecayTime{ get => m_DDT; - set => m_DDT = value; - } + public static TimeSpan DefaultDecayTime { get; set; } = TimeSpan.FromHours( 1.0 ); [CommandProperty( AccessLevel.GameMaster )] - public virtual TimeSpan DecayTime => m_DDT; + public virtual TimeSpan DecayTime => DefaultDecayTime; [CommandProperty( AccessLevel.GameMaster )] public virtual bool Decays => (Movable && Visible/* && Spawner == null*/); @@ -1472,14 +1467,10 @@ namespace Server public void SetLastMoved() { - m_LastMovedTime = DateTime.UtcNow; + LastMoved = DateTime.UtcNow; } - public DateTime LastMoved - { - get => m_LastMovedTime; - set => m_LastMovedTime = value; - } + public DateTime LastMoved { get; set; } public virtual bool CanStackWith( Item dropped ) { @@ -1962,7 +1953,7 @@ namespace Server int ISerializable.TypeReference => m_TypeRef; - int ISerializable.SerialIdentity => m_Serial; + int ISerializable.SerialIdentity => Serial; public virtual void Serialize( GenericWriter writer ) { @@ -2058,7 +2049,7 @@ namespace Server writer.Write( (int) flags ); /* begin last moved time optimization */ - long ticks = m_LastMovedTime.Ticks; + long ticks = LastMoved.Ticks; long now = DateTime.UtcNow.Ticks; TimeSpan d; @@ -2210,31 +2201,20 @@ namespace Server return map.GetClientsInRange( GetWorldLocation(), range ); } - private static int m_LockedDownFlag; - private static int m_SecureFlag; + public static int LockedDownFlag { get; set; } - public static int LockedDownFlag - { - get => m_LockedDownFlag; - set => m_LockedDownFlag = value; - } - - public static int SecureFlag - { - get => m_SecureFlag; - set => m_SecureFlag = value; - } + public static int SecureFlag { get; set; } public bool IsLockedDown { - get => GetTempFlag( m_LockedDownFlag ); - set{ SetTempFlag( m_LockedDownFlag, value ); InvalidateProperties(); } + get => GetTempFlag( LockedDownFlag ); + set{ SetTempFlag( LockedDownFlag, value ); InvalidateProperties(); } } public bool IsSecure { - get => GetTempFlag( m_SecureFlag ); - set{ SetTempFlag( m_SecureFlag, value ); InvalidateProperties(); } + get => GetTempFlag( SecureFlag ); + set{ SetTempFlag( SecureFlag, value ); InvalidateProperties(); } } public bool GetTempFlag( int flag ) @@ -3005,13 +2985,7 @@ namespace Server } } - private bool m_NoMoveHS; - - public bool NoMoveHS - { - get => m_NoMoveHS; - set => m_NoMoveHS = value; - } + public bool NoMoveHS { get; set; } public void ProcessDelta() { @@ -3331,9 +3305,9 @@ namespace Server if ( p == null ) { if ( ascii ) - p = new AsciiMessage( m_Serial, m_ItemID, type, hue, 3, Name, text ); + p = new AsciiMessage( Serial, m_ItemID, type, hue, 3, Name, text ); else - p = new UnicodeMessage( m_Serial, m_ItemID, type, hue, 3, "ENU", Name, text ); + p = new UnicodeMessage( Serial, m_ItemID, type, hue, 3, "ENU", Name, text ); p.Acquire(); } @@ -3369,7 +3343,7 @@ namespace Server if ( m.CanSee( this ) && m.InRange( worldLoc, GetUpdateRange( m ) ) ) { if ( p == null ) - p = Packet.Acquire( new MessageLocalized( m_Serial, m_ItemID, type, hue, 3, number, Name, args ) ); + p = Packet.Acquire( new MessageLocalized( Serial, m_ItemID, type, hue, 3, number, Name, args ) ); state.Send( p ); } @@ -3457,7 +3431,7 @@ namespace Server public virtual int EnergyResistance => 0; [CommandProperty( AccessLevel.Counselor )] - public Serial Serial => m_Serial; + public Serial Serial { get; } #region Location Location Location! @@ -3507,7 +3481,7 @@ namespace Server foreach (NetState state in eable) { Mobile m = state.Mobile; - if ( m.CanSee( this ) && m.InRange( m_Location, GetUpdateRange( m ) ) && ( !state.HighSeas || !m_NoMoveHS || ( m_DeltaFlags & ItemDelta.Update ) != 0 || !m.InRange( oldLoc, GetUpdateRange( m ) ) ) ) + if ( m.CanSee( this ) && m.InRange( m_Location, GetUpdateRange( m ) ) && ( !state.HighSeas || !NoMoveHS || ( m_DeltaFlags & ItemDelta.Update ) != 0 || !m.InRange( oldLoc, GetUpdateRange( m ) ) ) ) SendInfoTo( state ); } @@ -3699,7 +3673,7 @@ namespace Server InvalidateProperties(); if ( !Stackable && m_Amount > 1 ) - Console.WriteLine( "Warning: 0x{0:X}: Amount changed for non-stackable item '{2}'. ({1})", m_Serial.Value, m_Amount, GetType().Name ); + Console.WriteLine( "Warning: 0x{0:X}: Amount changed for non-stackable item '{2}'. ({1})", Serial.Value, m_Amount, GetType().Name ); } } } @@ -4348,7 +4322,7 @@ namespace Server ObjectPropertyList opl = PropertyList; if ( opl.Header > 0 ) - from.Send( new MessageLocalized( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, opl.Header, Name, opl.HeaderArgs ) ); + from.Send( new MessageLocalized( Serial, m_ItemID, MessageType.Label, 0x3B2, 3, opl.Header, Name, opl.HeaderArgs ) ); } public virtual void OnSingleClick( Mobile from ) @@ -4366,25 +4340,19 @@ namespace Server if ( Name == null ) { if ( m_Amount <= 1 ) - ns.Send( new MessageLocalized( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, LabelNumber, "", "" ) ); + ns.Send( new MessageLocalized( Serial, m_ItemID, MessageType.Label, 0x3B2, 3, LabelNumber, "", "" ) ); else - ns.Send( new MessageLocalizedAffix( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, LabelNumber, "", AffixType.Append, + ns.Send( new MessageLocalizedAffix( Serial, m_ItemID, MessageType.Label, 0x3B2, 3, LabelNumber, "", AffixType.Append, $" : {m_Amount}", "" ) ); } else { - ns.Send( new UnicodeMessage( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, "ENU", "", Name + ( m_Amount > 1 ? " : " + m_Amount : "" ) ) ); + ns.Send( new UnicodeMessage( Serial, m_ItemID, MessageType.Label, 0x3B2, 3, "ENU", "", Name + ( m_Amount > 1 ? " : " + m_Amount : "" ) ) ); } } } - private static bool m_ScissorCopyLootType; - - public static bool ScissorCopyLootType - { - get => m_ScissorCopyLootType; - set => m_ScissorCopyLootType = value; - } + public static bool ScissorCopyLootType { get; set; } public virtual void ScissorHelper( Mobile from, Item newItem, int amountPerOldItem ) { @@ -4414,7 +4382,7 @@ namespace Server if ( carryHue ) newItem.Hue = ourHue; - if ( m_ScissorCopyLootType ) + if ( ScissorCopyLootType ) newItem.LootType = type; if ( !(thisParent is Container) || !((Container)thisParent).TryDropItem( from, newItem, false ) ) @@ -4529,14 +4497,14 @@ namespace Server public override string ToString() { - return $"0x{m_Serial.Value:X} \"{GetType().Name}\""; + return $"0x{Serial.Value:X} \"{GetType().Name}\""; } internal int m_TypeRef; public Item() { - m_Serial = Serial.NewItem; + Serial = Serial.NewItem; //m_Items = new ArrayList( 1 ); Visible = true; @@ -4566,7 +4534,7 @@ namespace Server public Item( Serial serial ) { - m_Serial = serial; + Serial = serial; Type ourType = GetType(); m_TypeRef = World.m_ItemTypes.IndexOf( ourType ); diff --git a/Server/ItemBounds.cs b/Server/ItemBounds.cs index 692e8e681..46ff1f8ed 100644 --- a/Server/ItemBounds.cs +++ b/Server/ItemBounds.cs @@ -25,13 +25,11 @@ namespace Server { public static class ItemBounds { - private static Rectangle2D[] m_Bounds; - - public static Rectangle2D[] Table => m_Bounds; + public static Rectangle2D[] Table { get; } static ItemBounds() { - m_Bounds = new Rectangle2D[TileData.ItemTable.Length]; + Table = new Rectangle2D[TileData.ItemTable.Length]; if ( File.Exists( "Data/Binary/Bounds.bin" ) ) { @@ -39,7 +37,7 @@ namespace Server { BinaryReader bin = new BinaryReader( fs ); - int count = Math.Min( m_Bounds.Length, (int)( fs.Length / 8 ) ); + int count = Math.Min( Table.Length, (int)( fs.Length / 8 ) ); for ( int i = 0; i < count; ++i ) { @@ -48,7 +46,7 @@ namespace Server int xMax = bin.ReadInt16(); int yMax = bin.ReadInt16(); - m_Bounds[i].Set( xMin, yMin, (xMax - xMin) + 1, (yMax - yMin) + 1 ); + Table[i].Set( xMin, yMin, (xMax - xMin) + 1, (yMax - yMin) + 1 ); } bin.Close(); diff --git a/Server/Items/Container.cs b/Server/Items/Container.cs index b5f7ed652..076f3796f 100644 --- a/Server/Items/Container.cs +++ b/Server/Items/Container.cs @@ -33,13 +33,7 @@ namespace Server.Items public class Container : Item { - private static ContainerSnoopHandler m_SnoopHandler; - - public static ContainerSnoopHandler SnoopHandler - { - get => m_SnoopHandler; - set => m_SnoopHandler = value; - } + public static ContainerSnoopHandler SnoopHandler { get; set; } private ContainerData m_ContainerData; @@ -51,8 +45,6 @@ namespace Server.Items private int m_TotalWeight; private int m_TotalGold; - private bool m_LiftOverride; - internal List m_Items; public ContainerData ContainerData @@ -118,11 +110,7 @@ namespace Server.Items } [CommandProperty( AccessLevel.GameMaster )] - public bool LiftOverride - { - get => m_LiftOverride; - set => m_LiftOverride = value; - } + public bool LiftOverride { get; set; } public virtual void UpdateContainerData() { @@ -137,10 +125,10 @@ namespace Server.Items [CommandProperty( AccessLevel.GameMaster )] public virtual int DefaultDropSound => ContainerData.DropSound; - public virtual int DefaultMaxItems => m_GlobalMaxItems; - public virtual int DefaultMaxWeight => m_GlobalMaxWeight; + public virtual int DefaultMaxItems => GlobalMaxItems; + public virtual int DefaultMaxWeight => GlobalMaxWeight; - public virtual bool IsDecoContainer => !Movable && !IsLockedDown && !IsSecure && Parent == null && !m_LiftOverride; + public virtual bool IsDecoContainer => !Movable && !IsLockedDown && !IsSecure && Parent == null && !LiftOverride; public virtual int GetDroppedSound( Item item ) { @@ -151,7 +139,7 @@ namespace Server.Items public override void OnSnoop( Mobile from ) { - m_SnoopHandler?.Invoke( this, from ); + SnoopHandler?.Invoke( this, from ); } public override bool CheckLift( Mobile from, Item item, ref LRReason reject ) @@ -1284,7 +1272,7 @@ namespace Server.Items SetSaveFlag( ref flags, SaveFlag.MaxItems, m_MaxItems != -1 ); SetSaveFlag( ref flags, SaveFlag.GumpID, m_GumpID != -1 ); SetSaveFlag( ref flags, SaveFlag.DropSound, m_DropSound != -1 ); - SetSaveFlag( ref flags, SaveFlag.LiftOverride, m_LiftOverride ); + SetSaveFlag( ref flags, SaveFlag.LiftOverride, LiftOverride ); writer.Write( (byte) flags ); @@ -1325,7 +1313,7 @@ namespace Server.Items else m_DropSound = -1; - m_LiftOverride = GetSaveFlag( flags, SaveFlag.LiftOverride ); + LiftOverride = GetSaveFlag( flags, SaveFlag.LiftOverride ); break; } @@ -1337,7 +1325,7 @@ namespace Server.Items case 0: { if ( version < 1 ) - m_MaxItems = m_GlobalMaxItems; + m_MaxItems = GlobalMaxItems; m_GumpID = reader.ReadInt(); m_DropSound = reader.ReadInt(); @@ -1362,15 +1350,9 @@ namespace Server.Items UpdateContainerData(); } - private static int m_GlobalMaxItems = 125; - private static int m_GlobalMaxWeight = 400; + public static int GlobalMaxItems { get; set; } = 125; - public static int GlobalMaxItems{ get => m_GlobalMaxItems; - set => m_GlobalMaxItems = value; - } - public static int GlobalMaxWeight{ get => m_GlobalMaxWeight; - set => m_GlobalMaxWeight = value; - } + public static int GlobalMaxWeight { get; set; } = 400; public Container( int itemID ) : base( itemID ) { @@ -1658,13 +1640,7 @@ namespace Server.Items //LabelTo( from, 1050044, String.Format( "{0}\t{1}", TotalItems.ToString(), TotalWeight.ToString() ) ); } - private List m_Openers; - - public List Openers - { - get => m_Openers; - set => m_Openers = value; - } + public List Openers { get; set; } public virtual bool IsPublicContainer => false; @@ -1672,7 +1648,7 @@ namespace Server.Items { base.OnDelete(); - m_Openers = null; + Openers = null; } public virtual void DisplayTo( Mobile to ) @@ -1706,14 +1682,14 @@ namespace Server.Items { bool contains = false; - if ( m_Openers != null ) + if ( Openers != null ) { Point3D worldLoc = GetWorldLocation(); Map map = Map; - for ( int i = 0; i < m_Openers.Count; ++i ) + for ( int i = 0; i < Openers.Count; ++i ) { - Mobile mob = m_Openers[i]; + Mobile mob = Openers[i]; if ( mob == opener ) contains = true; @@ -1722,20 +1698,20 @@ namespace Server.Items int range = GetUpdateRange( mob ); if ( mob.Map != map || !mob.InRange( worldLoc, range ) ) - m_Openers.RemoveAt( i-- ); + Openers.RemoveAt( i-- ); } } } if ( !contains ) { - if ( m_Openers == null ) - m_Openers = new List(); + if ( Openers == null ) + Openers = new List(); - m_Openers.Add( opener ); + Openers.Add( opener ); } - else if ( m_Openers != null && m_Openers.Count == 0 ) - m_Openers = null; + else if ( Openers != null && Openers.Count == 0 ) + Openers = null; } } @@ -1786,7 +1762,7 @@ namespace Server.Items if ( !File.Exists( path ) ) { - m_Default = new ContainerData( 0x3C, new Rectangle2D( 44, 65, 142, 94 ), 0x48 ); + Default = new ContainerData( 0x3C, new Rectangle2D( 44, 65, 142, 94 ), 0x48 ); return; } @@ -1824,8 +1800,8 @@ namespace Server.Items ContainerData data = new ContainerData( gumpID, bounds, dropSound ); - if ( m_Default == null ) - m_Default = data; + if ( Default == null ) + Default = data; if ( split.Length >= 4 ) { @@ -1853,18 +1829,13 @@ namespace Server.Items } } - if ( m_Default == null ) - m_Default = new ContainerData( 0x3C, new Rectangle2D( 44, 65, 142, 94 ), 0x48 ); + if ( Default == null ) + Default = new ContainerData( 0x3C, new Rectangle2D( 44, 65, 142, 94 ), 0x48 ); } - private static ContainerData m_Default; private static Dictionary m_Table; - public static ContainerData Default - { - get => m_Default; - set => m_Default = value; - } + public static ContainerData Default { get; set; } public static ContainerData GetData( int itemID ) { @@ -1873,22 +1844,20 @@ namespace Server.Items if ( data != null ) return data; - return m_Default; + return Default; } - private int m_GumpID; - private Rectangle2D m_Bounds; - private int m_DropSound; + public int GumpID { get; } - public int GumpID => m_GumpID; - public Rectangle2D Bounds => m_Bounds; - public int DropSound => m_DropSound; + public Rectangle2D Bounds { get; } + + public int DropSound { get; } public ContainerData( int gumpID, Rectangle2D bounds, int dropSound ) { - m_GumpID = gumpID; - m_Bounds = bounds; - m_DropSound = dropSound; + GumpID = gumpID; + Bounds = bounds; + DropSound = dropSound; } } } diff --git a/Server/Items/Containers.cs b/Server/Items/Containers.cs index 361af98e3..af3f4e61a 100644 --- a/Server/Items/Containers.cs +++ b/Server/Items/Containers.cs @@ -27,9 +27,6 @@ namespace Server.Items { public class BankBox : Container { - private Mobile m_Owner; - private bool m_Open; - public override int DefaultMaxWeight => 0; public override bool IsVirtualItem => true; @@ -38,20 +35,20 @@ namespace Server.Items { } - public Mobile Owner => m_Owner; + public Mobile Owner { get; private set; } - public bool Opened => m_Open; + public bool Opened { get; private set; } public void Open() { - m_Open = true; + Opened = true; - if ( m_Owner != null ) + if ( Owner != null ) { - m_Owner.PrivateOverheadMessage( MessageType.Regular, 0x3B2, true, - $"Bank container has {TotalItems} items, {TotalWeight} stones", m_Owner.NetState ); - m_Owner.Send( new EquipUpdate( this ) ); - DisplayTo( m_Owner ); + Owner.PrivateOverheadMessage( MessageType.Regular, 0x3B2, true, + $"Bank container has {TotalItems} items, {TotalWeight} stones", Owner.NetState ); + Owner.Send( new EquipUpdate( this ) ); + DisplayTo( Owner ); } } @@ -61,8 +58,8 @@ namespace Server.Items writer.Write( (int) 0 ); // version - writer.Write( (Mobile) m_Owner ); - writer.Write( (bool) m_Open ); + writer.Write( (Mobile) Owner ); + writer.Write( (bool) Opened ); } public override void Deserialize( GenericReader reader ) @@ -75,10 +72,10 @@ namespace Server.Items { case 0: { - m_Owner = reader.ReadMobile(); - m_Open = reader.ReadBool(); + Owner = reader.ReadMobile(); + Opened = reader.ReadBool(); - if ( m_Owner == null ) + if ( Owner == null ) Delete(); break; @@ -89,18 +86,14 @@ namespace Server.Items ItemID = 0xE7C; } - private static bool m_SendRemovePacket; - - public static bool SendDeleteOnClose{ get => m_SendRemovePacket; - set => m_SendRemovePacket = value; - } + public static bool SendDeleteOnClose { get; set; } public void Close() { - m_Open = false; + Opened = false; - if ( m_Owner != null && m_SendRemovePacket ) - m_Owner.Send( RemovePacket ); + if ( Owner != null && SendDeleteOnClose ) + Owner.Send( RemovePacket ); } public override void OnSingleClick( Mobile from ) @@ -120,26 +113,26 @@ namespace Server.Items { Layer = Layer.Bank; Movable = false; - m_Owner = owner; + Owner = owner; } public override bool IsAccessibleTo(Mobile check) { - if ( ( check == m_Owner && m_Open ) || check.AccessLevel >= AccessLevel.GameMaster ) + if ( ( check == Owner && Opened ) || check.AccessLevel >= AccessLevel.GameMaster ) return base.IsAccessibleTo (check); return false; } public override bool OnDragDrop( Mobile from, Item dropped ) { - if ( ( from == m_Owner && m_Open ) || from.AccessLevel >= AccessLevel.GameMaster ) + if ( ( from == Owner && Opened ) || from.AccessLevel >= AccessLevel.GameMaster ) return base.OnDragDrop( from, dropped ); return false; } public override bool OnDragDropInto(Mobile from, Item item, Point3D p) { - if ( ( from == m_Owner && m_Open ) || from.AccessLevel >= AccessLevel.GameMaster ) + if ( ( from == Owner && Opened ) || from.AccessLevel >= AccessLevel.GameMaster ) return base.OnDragDropInto (from, item, p); return false; } diff --git a/Server/Items/SecureTradeContainer.cs b/Server/Items/SecureTradeContainer.cs index de47cf914..8fc00c67c 100644 --- a/Server/Items/SecureTradeContainer.cs +++ b/Server/Items/SecureTradeContainer.cs @@ -25,13 +25,11 @@ namespace Server.Items { public class SecureTradeContainer : Container { - private SecureTrade m_Trade; - - public SecureTrade Trade => m_Trade; + public SecureTrade Trade { get; } public SecureTradeContainer( SecureTrade trade ) : base( 0x1E5E ) { - m_Trade = trade; + Trade = trade; Movable = false; } @@ -65,7 +63,7 @@ namespace Server.Items public override bool IsAccessibleTo( Mobile check ) { - if ( !IsChildOf( check ) || m_Trade == null || !m_Trade.Valid ) + if ( !IsChildOf( check ) || Trade == null || !Trade.Valid ) return false; return base.IsAccessibleTo( check ); @@ -105,19 +103,19 @@ namespace Server.Items public void ClearChecks( ) { - if ( m_Trade != null ) + if ( Trade != null ) { - if ( m_Trade.From != null && !m_Trade.From.IsDisposed ) + if ( Trade.From != null && !Trade.From.IsDisposed ) { - m_Trade.From.Accepted = false; + Trade.From.Accepted = false; } - if ( m_Trade.To != null && !m_Trade.To.IsDisposed ) + if ( Trade.To != null && !Trade.To.IsDisposed ) { - m_Trade.To.Accepted = false; + Trade.To.Accepted = false; } - m_Trade.Update(); + Trade.Update(); } } diff --git a/Server/Items/VirtualHair.cs b/Server/Items/VirtualHair.cs index 89f509ca2..cd03fe889 100644 --- a/Server/Items/VirtualHair.cs +++ b/Server/Items/VirtualHair.cs @@ -24,18 +24,11 @@ namespace Server { public abstract class BaseHairInfo { - private int m_ItemID; - private int m_Hue; + [CommandProperty( AccessLevel.GameMaster )] + public int ItemID { get; set; } [CommandProperty( AccessLevel.GameMaster )] - public int ItemID { get => m_ItemID; - set => m_ItemID = value; - } - - [CommandProperty( AccessLevel.GameMaster )] - public int Hue { get => m_Hue; - set => m_Hue = value; - } + public int Hue { get; set; } protected BaseHairInfo( int itemid ) : this( itemid, 0 ) @@ -44,8 +37,8 @@ namespace Server protected BaseHairInfo( int itemid, int hue ) { - m_ItemID = itemid; - m_Hue = hue; + ItemID = itemid; + Hue = hue; } protected BaseHairInfo( GenericReader reader ) @@ -56,8 +49,8 @@ namespace Server { case 0: { - m_ItemID = reader.ReadInt(); - m_Hue = reader.ReadInt(); + ItemID = reader.ReadInt(); + Hue = reader.ReadInt(); break; } } @@ -66,8 +59,8 @@ namespace Server public virtual void Serialize( GenericWriter writer ) { writer.Write( (int)0 ); //version - writer.Write( (int)m_ItemID ); - writer.Write( (int)m_Hue ); + writer.Write( (int)ItemID ); + writer.Write( (int)Hue ); } } diff --git a/Server/KeywordList.cs b/Server/KeywordList.cs index 3363538c4..1746ec63b 100644 --- a/Server/KeywordList.cs +++ b/Server/KeywordList.cs @@ -23,21 +23,20 @@ namespace Server public class KeywordList { private int[] m_Keywords; - private int m_Count; public KeywordList() { m_Keywords = new int[8]; - m_Count = 0; + Count = 0; } - public int Count => m_Count; + public int Count { get; private set; } public bool Contains( int keyword ) { bool contains = false; - for ( int i = 0; !contains && i < m_Count; ++i ) + for ( int i = 0; !contains && i < Count; ++i ) contains = ( keyword == m_Keywords[i] ); return contains; @@ -45,7 +44,7 @@ namespace Server public void Add( int keyword ) { - if ( (m_Count + 1) > m_Keywords.Length ) + if ( (Count + 1) > m_Keywords.Length ) { int[] old = m_Keywords; m_Keywords = new int[old.Length * 2]; @@ -54,22 +53,22 @@ namespace Server m_Keywords[i] = old[i]; } - m_Keywords[m_Count++] = keyword; + m_Keywords[Count++] = keyword; } private static int[] m_EmptyInts = new int[0]; public int[] ToArray() { - if ( m_Count == 0 ) + if ( Count == 0 ) return m_EmptyInts; - int[] keywords = new int[m_Count]; + int[] keywords = new int[Count]; - for ( int i = 0; i < m_Count; ++i ) + for ( int i = 0; i < Count; ++i ) keywords[i] = m_Keywords[i]; - m_Count = 0; + Count = 0; return keywords; } diff --git a/Server/Main.cs b/Server/Main.cs index 77c1e53b1..039ed1d85 100644 --- a/Server/Main.cs +++ b/Server/Main.cs @@ -42,29 +42,13 @@ namespace Server private static string m_BaseDirectory; private static string m_ExePath; - private static readonly List m_DataDirectories = new List(); - - private static Assembly m_Assembly; - private static Process m_Process; - private static Thread m_Thread; - private static bool m_Service; - private static bool m_Debug; private static bool m_Cache = true; - private static bool m_HaltOnWarning; - private static bool m_VBdotNET; - private static MultiTextWriter m_MultiConOut; private static bool m_Profiling; private static DateTime m_ProfileStart; private static TimeSpan m_ProfileTime; - private static MessagePump m_MessagePump; - - public static MessagePump MessagePump - { - get => m_MessagePump; - set => m_MessagePump = value; - } + public static MessagePump MessagePump { get; set; } public static Slice Slice; @@ -96,18 +80,24 @@ namespace Server } } - public static bool Service => m_Service; - public static bool Debug => m_Debug; - internal static bool HaltOnWarning => m_HaltOnWarning; - internal static bool VBdotNet => m_VBdotNET; - public static List DataDirectories => m_DataDirectories; - public static Assembly Assembly { get => m_Assembly; - set => m_Assembly = value; - } - public static Version Version => m_Assembly.GetName().Version; - public static Process Process => m_Process; - public static Thread Thread => m_Thread; - public static MultiTextWriter MultiConsoleOut => m_MultiConOut; + public static bool Service { get; private set; } + + public static bool Debug { get; private set; } + + internal static bool HaltOnWarning { get; private set; } + + internal static bool VBdotNet { get; private set; } + + public static List DataDirectories { get; } = new List(); + + public static Assembly Assembly { get; set; } + + public static Version Version => Assembly.GetName().Version; + public static Process Process { get; private set; } + + public static Thread Thread { get; private set; } + + public static MultiTextWriter MultiConsoleOut { get; private set; } /* * DateTime.Now and DateTime.UtcNow are based on actual system clock time. @@ -146,24 +136,20 @@ namespace Server public static readonly bool Is64Bit = Environment.Is64BitProcess; - private static bool m_MultiProcessor; - private static int m_ProcessorCount; + public static bool MultiProcessor { get; private set; } - public static bool MultiProcessor => m_MultiProcessor; - public static int ProcessorCount => m_ProcessorCount; + public static int ProcessorCount { get; private set; } - private static bool m_Unix; - - public static bool Unix => m_Unix; + public static bool Unix { get; private set; } public static string FindDataFile( string path ) { - if ( m_DataDirectories.Count == 0 ) + if ( DataDirectories.Count == 0 ) throw new InvalidOperationException( "Attempted to FindDataFile before DataDirectories list has been filled." ); string fullPath = null; - foreach (string p in m_DataDirectories) + foreach (string p in DataDirectories) { fullPath = Path.Combine( p, path ); @@ -183,32 +169,27 @@ namespace Server #region Expansions - private static Expansion m_Expansion; - public static Expansion Expansion - { - get => m_Expansion; - set => m_Expansion = value; - } + public static Expansion Expansion { get; set; } - public static bool T2A => m_Expansion >= Expansion.T2A; + public static bool T2A => Expansion >= Expansion.T2A; - public static bool UOR => m_Expansion >= Expansion.UOR; + public static bool UOR => Expansion >= Expansion.UOR; - public static bool UOTD => m_Expansion >= Expansion.UOTD; + public static bool UOTD => Expansion >= Expansion.UOTD; - public static bool LBR => m_Expansion >= Expansion.LBR; + public static bool LBR => Expansion >= Expansion.LBR; - public static bool AOS => m_Expansion >= Expansion.AOS; + public static bool AOS => Expansion >= Expansion.AOS; - public static bool SE => m_Expansion >= Expansion.SE; + public static bool SE => Expansion >= Expansion.SE; - public static bool ML => m_Expansion >= Expansion.ML; + public static bool ML => Expansion >= Expansion.ML; - public static bool SA => m_Expansion >= Expansion.SA; + public static bool SA => Expansion >= Expansion.SA; - public static bool HS => m_Expansion >= Expansion.HS; + public static bool HS => Expansion >= Expansion.HS; - public static bool TOL => m_Expansion >= Expansion.TOL; + public static bool TOL => Expansion >= Expansion.TOL; #endregion @@ -260,11 +241,11 @@ namespace Server { } - if ( !close && !m_Service ) + if ( !close && !Service ) { try { - foreach (Listener l in m_MessagePump.Listeners) + foreach (Listener l in MessagePump.Listeners) { l.Dispose(); } @@ -300,7 +281,7 @@ namespace Server private static bool OnConsoleEvent( ConsoleEventType type ) { - if ( World.Saving || ( m_Service && type == ConsoleEventType.CTRL_LOGOFF_EVENT ) ) + if ( World.Saving || ( Service && type == ConsoleEventType.CTRL_LOGOFF_EVENT ) ) return true; Kill(); //Kill -> HandleClosed will handle waiting for the completion of flushing to disk @@ -313,8 +294,7 @@ namespace Server HandleClosed(); } - private static bool m_Closing; - public static bool Closing => m_Closing; + public static bool Closing { get; private set; } private static int m_CycleIndex = 1; private static readonly float[] m_CyclesPerSecond = new float[100]; @@ -335,15 +315,15 @@ namespace Server if ( restart ) Process.Start( ExePath, Arguments ); - m_Process.Kill(); + Process.Kill(); } private static void HandleClosed() { - if ( m_Closing ) + if ( Closing ) return; - m_Closing = true; + Closing = true; Console.Write( "Exiting..." ); @@ -369,45 +349,45 @@ namespace Server foreach (string a in args) { if ( Insensitive.Equals( a, "-debug" ) ) - m_Debug = true; + Debug = true; else if ( Insensitive.Equals( a, "-service" ) ) - m_Service = true; + Service = true; else if ( Insensitive.Equals( a, "-profile" ) ) Profiling = true; else if ( Insensitive.Equals( a, "-nocache" ) ) m_Cache = false; else if ( Insensitive.Equals( a, "-haltonwarning" ) ) - m_HaltOnWarning = true; + HaltOnWarning = true; else if ( Insensitive.Equals( a, "-vb" ) ) - m_VBdotNET = true; + VBdotNet = true; else if ( Insensitive.Equals( a, "-usehrt" ) ) _UseHRT = true; } try { - if ( m_Service ) + if ( Service ) { if ( !Directory.Exists( "Logs" ) ) Directory.CreateDirectory( "Logs" ); - Console.SetOut( m_MultiConOut = new MultiTextWriter( new FileLogger( "Logs/Console.log" ) ) ); + Console.SetOut( MultiConsoleOut = new MultiTextWriter( new FileLogger( "Logs/Console.log" ) ) ); } else { - Console.SetOut( m_MultiConOut = new MultiTextWriter( Console.Out ) ); + Console.SetOut( MultiConsoleOut = new MultiTextWriter( Console.Out ) ); } } catch { } - m_Thread = Thread.CurrentThread; - m_Process = Process.GetCurrentProcess(); - m_Assembly = Assembly.GetEntryAssembly(); + Thread = Thread.CurrentThread; + Process = Process.GetCurrentProcess(); + Assembly = Assembly.GetEntryAssembly(); - if ( m_Thread != null ) - m_Thread.Name = "Core Thread"; + if ( Thread != null ) + Thread.Name = "Core Thread"; if ( BaseDirectory.Length > 0 ) Directory.SetCurrentDirectory( BaseDirectory ); @@ -418,7 +398,7 @@ namespace Server Name = "Timer Thread" }; - Version ver = m_Assembly.GetName().Version; + Version ver = Assembly.GetName().Version; // Added to help future code support on forums, as a 'check' people can ask for to it see if they recompiled core or not Console.WriteLine("RunUO - [https://github.com/runuo/] Version {0}.{1}.{2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision); @@ -429,17 +409,17 @@ namespace Server if ( s.Length > 0 ) Console.WriteLine( "Core: Running with arguments: {0}", s ); - m_ProcessorCount = Environment.ProcessorCount; + ProcessorCount = Environment.ProcessorCount; - if ( m_ProcessorCount > 1 ) - m_MultiProcessor = true; + if ( ProcessorCount > 1 ) + MultiProcessor = true; - if ( m_MultiProcessor || Is64Bit ) - Console.WriteLine( "Core: Optimizing for {0} {2}processor{1}", m_ProcessorCount, m_ProcessorCount == 1 ? "" : "s", Is64Bit ? "64-bit " : "" ); + if ( MultiProcessor || Is64Bit ) + Console.WriteLine( "Core: Optimizing for {0} {2}processor{1}", ProcessorCount, ProcessorCount == 1 ? "" : "s", Is64Bit ? "64-bit " : "" ); int platform = (int)Environment.OSVersion.Platform; if ( platform == 4 || platform == 128 ) { // MS 4, MONO 128 - m_Unix = true; + Unix = true; Console.WriteLine( "Core: Unix environment detected" ); } else { @@ -455,11 +435,11 @@ namespace Server Console.WriteLine("RandomImpl: {0} ({1})", RandomImpl.Type.Name, RandomImpl.IsHardwareRNG ? "Hardware" : "Software"); - while( !ScriptCompiler.Compile( m_Debug, m_Cache ) ) + while( !ScriptCompiler.Compile( Debug, m_Cache ) ) { Console.WriteLine( "Scripts: One or more scripts failed to compile or no script files were found." ); - if ( m_Service ) + if ( Service ) return; Console.WriteLine( " - Press return to exit, or R to try again." ); @@ -475,7 +455,7 @@ namespace Server ScriptCompiler.Invoke( "Initialize" ); - MessagePump messagePump = m_MessagePump = new MessagePump(); + MessagePump messagePump = MessagePump = new MessagePump(); timerThread.Start(); @@ -495,7 +475,7 @@ namespace Server long sample = 0; - while( !m_Closing ) + while( !Closing ) { m_Signal.WaitOne(); @@ -534,10 +514,10 @@ namespace Server { StringBuilder sb = new StringBuilder(); - if ( m_Debug ) + if ( Debug ) Utility.Separate( sb, "-debug", " " ); - if ( m_Service ) + if ( Service ) Utility.Separate( sb, "-service", " " ); if ( m_Profiling ) @@ -546,10 +526,10 @@ namespace Server if ( !m_Cache ) Utility.Separate( sb, "-nocache", " " ); - if ( m_HaltOnWarning ) + if ( HaltOnWarning ) Utility.Separate( sb, "-haltonwarning", " " ); - if ( m_VBdotNET ) + if ( VBdotNet ) Utility.Separate( sb, "-vb", " " ); if ( _UseHRT ) @@ -559,21 +539,9 @@ namespace Server } } - private static int m_GlobalUpdateRange = 18; + public static int GlobalUpdateRange { get; set; } = 18; - public static int GlobalUpdateRange - { - get => m_GlobalUpdateRange; - set => m_GlobalUpdateRange = value; - } - - private static int m_GlobalMaxUpdateRange = 24; - - public static int GlobalMaxUpdateRange - { - get => m_GlobalMaxUpdateRange; - set => m_GlobalMaxUpdateRange = value; - } + public static int GlobalMaxUpdateRange { get; set; } = 24; private static int m_ItemCount, m_MobileCount; diff --git a/Server/Map.cs b/Server/Map.cs index 19372c494..f9b53c3fe 100644 --- a/Server/Map.cs +++ b/Server/Map.cs @@ -291,49 +291,38 @@ namespace Server public const int SectorShift = 4; public static int SectorActiveRange = 2; - private static Map[] m_Maps = new Map[0x100]; + public static Map[] Maps { get; } = new Map[0x100]; - public static Map[] Maps => m_Maps; + public static Map Felucca => Maps[0]; + public static Map Trammel => Maps[1]; + public static Map Ilshenar => Maps[2]; + public static Map Malas => Maps[3]; + public static Map Tokuno => Maps[4]; + public static Map TerMur => Maps[5]; + public static Map Internal => Maps[0x7F]; - public static Map Felucca => m_Maps[0]; - public static Map Trammel => m_Maps[1]; - public static Map Ilshenar => m_Maps[2]; - public static Map Malas => m_Maps[3]; - public static Map Tokuno => m_Maps[4]; - public static Map TerMur => m_Maps[5]; - public static Map Internal => m_Maps[0x7F]; + public static List AllMaps { get; } = new List(); - private static List m_AllMaps = new List(); + private int m_FileIndex; - public static List AllMaps => m_AllMaps; - - private int m_MapID, m_MapIndex, m_FileIndex; - - private int m_Width, m_Height; private int m_SectorsWidth, m_SectorsHeight; - private int m_Season; - private Dictionary m_Regions; private Region m_DefaultRegion; - public int Season { get => m_Season; - set => m_Season = value; - } + public int Season { get; set; } private string m_Name; - private MapRules m_Rules; private Sector[][] m_Sectors; - private Sector m_InvalidSector; private TileMatrix m_Tiles; public static string[] GetMapNames() { - return m_Maps.Where(m => m != null).Select(m => m.Name).ToArray(); + return Maps.Where(m => m != null).Select(m => m.Name).ToArray(); } public static Map[] GetMapValues() { - return m_Maps.Where(m => m != null).ToArray(); + return Maps.Where(m => m != null).ToArray(); } public static Map Parse(string value) @@ -350,7 +339,7 @@ namespace Server if (!int.TryParse(value, out int index)) { - return m_Maps.FirstOrDefault(m => m != null && Insensitive.Equals(m.Name, value)); + return Maps.FirstOrDefault(m => m != null && Insensitive.Equals(m.Name, value)); } if (index == 127) @@ -358,7 +347,7 @@ namespace Server return Internal; } - return m_Maps.FirstOrDefault(m => m != null && m.MapIndex == index); + return Maps.FirstOrDefault(m => m != null && m.MapIndex == index); } public override string ToString() @@ -523,7 +512,7 @@ namespace Server if ( this == Internal ) return false; - if ( x < 0 || y < 0 || x >= m_Width || y >= m_Height ) + if ( x < 0 || y < 0 || x >= Width || y >= Height ) return false; bool hasSurface = false; @@ -853,15 +842,15 @@ namespace Server { if ( x < 0 ) newX = 0; - else if ( x >= m_Width ) - newX = m_Width - 1; + else if ( x >= Width ) + newX = Width - 1; else newX = x; if ( y < 0 ) newY = 0; - else if ( y >= m_Height ) - newY = m_Height - 1; + else if ( y >= Height ) + newY = Height - 1; else newY = y; } @@ -872,29 +861,29 @@ namespace Server if ( x < 0 ) x = 0; - else if ( x >= m_Width ) - x = m_Width - 1; + else if ( x >= Width ) + x = Width - 1; if ( y < 0 ) y = 0; - else if ( y >= m_Height ) - y = m_Height - 1; + else if ( y >= Height ) + y = Height - 1; return new Point2D( x, y ); } public Map( int mapID, int mapIndex, int fileIndex, int width, int height, int season, string name, MapRules rules ) { - m_MapID = mapID; - m_MapIndex = mapIndex; + MapID = mapID; + MapIndex = mapIndex; m_FileIndex = fileIndex; - m_Width = width; - m_Height = height; - m_Season = season; + Width = width; + Height = height; + Season = season; m_Name = name; - m_Rules = rules; - m_Regions = new Dictionary( StringComparer.OrdinalIgnoreCase ); - m_InvalidSector = new Sector( 0, 0, this ); + Rules = rules; + Regions = new Dictionary( StringComparer.OrdinalIgnoreCase ); + InvalidSector = new Sector( 0, 0, this ); m_SectorsWidth = width >> SectorShift; m_SectorsHeight = height >> SectorShift; m_Sectors = new Sector[m_SectorsWidth][]; @@ -943,7 +932,7 @@ namespace Server return sec; } - return m_InvalidSector; + return InvalidSector; } #endregion @@ -954,7 +943,7 @@ namespace Server for ( int y = cy - SectorActiveRange; y <= cy + SectorActiveRange; ++y ) { Sector sect = GetRealSector( x, y ); - if ( sect != m_InvalidSector ) + if ( sect != InvalidSector ) sect.Activate(); } } @@ -967,7 +956,7 @@ namespace Server for ( int y = cy - SectorActiveRange; y <= cy + SectorActiveRange; ++y ) { Sector sect = GetRealSector( x, y ); - if ( sect != m_InvalidSector && !PlayersInRange( sect, SectorActiveRange ) ) + if ( sect != InvalidSector && !PlayersInRange( sect, SectorActiveRange ) ) sect.Deactivate(); } } @@ -980,7 +969,7 @@ namespace Server for ( int y = sect.Y - range; y <= sect.Y + range; ++y ) { Sector check = GetRealSector( x, y ); - if ( check != m_InvalidSector && check.Players.Count > 0 ) + if ( check != InvalidSector && check.Players.Count > 0 ) return true; } } @@ -1127,21 +1116,21 @@ namespace Server { if (m_Tiles == null) lock (tileLock) - m_Tiles = new TileMatrix(this, m_FileIndex, m_MapID, m_Width, m_Height); + m_Tiles = new TileMatrix(this, m_FileIndex, MapID, Width, Height); return m_Tiles; } } - public int MapID => m_MapID; + public int MapID { get; } - public int MapIndex => m_MapIndex; + public int MapIndex { get; } - public int Width => m_Width; + public int Width { get; } - public int Height => m_Height; + public int Height { get; } - public Dictionary Regions => m_Regions; + public Dictionary Regions { get; } public void RegisterRegion( Region reg ) { @@ -1149,10 +1138,10 @@ namespace Server if ( regName != null ) { - if ( m_Regions.ContainsKey( regName ) ) + if ( Regions.ContainsKey( regName ) ) Console.WriteLine( "Warning: Duplicate region name '{0}' for map '{1}'", regName, Name ); else - m_Regions[regName] = reg; + Regions[regName] = reg; } } @@ -1161,7 +1150,7 @@ namespace Server string regName = reg.Name; if ( regName != null ) - m_Regions.Remove( regName ); + Regions.Remove( regName ); } public Region DefaultRegion @@ -1176,13 +1165,9 @@ namespace Server set => m_DefaultRegion = value; } - public MapRules Rules - { - get => m_Rules; - set => m_Rules = value; - } + public MapRules Rules { get; set; } - public Sector InvalidSector => m_InvalidSector; + public Sector InvalidSector { get; } public string Name { @@ -1349,20 +1334,15 @@ namespace Server } #region Line Of Sight - private static int m_MaxLOSDistance = 25; - public static int MaxLOSDistance - { - get => m_MaxLOSDistance; - set => m_MaxLOSDistance = value; - } + public static int MaxLOSDistance { get; set; } = 25; public bool LineOfSight( Point3D org, Point3D dest ) { if ( this == Internal ) return false; - if ( !Utility.InRange( org, dest, m_MaxLOSDistance ) ) + if ( !Utility.InRange( org, dest, MaxLOSDistance ) ) return false; Point3D end = dest; @@ -1465,8 +1445,8 @@ namespace Server bool contains = false; int ltID = landTile.ID; - for ( int j = 0; !contains && j < m_InvalidLandTiles.Length; ++j ) - contains =ltID == m_InvalidLandTiles[j]; + for ( int j = 0; !contains && j < InvalidLandTiles.Length; ++j ) + contains =ltID == InvalidLandTiles[j]; if ( contains && statics.Length == 0 ) { @@ -1610,20 +1590,14 @@ namespace Server } #endregion - private static int[] m_InvalidLandTiles = { 0x244 }; - - public static int[] InvalidLandTiles - { - get => m_InvalidLandTiles; - set => m_InvalidLandTiles = value; - } + public static int[] InvalidLandTiles { get; set; } = { 0x244 }; public int CompareTo( Map other ) { if ( other == null ) return -1; - return m_MapID.CompareTo( other.m_MapID ); + return MapID.CompareTo( other.MapID ); } public int CompareTo( object other ) diff --git a/Server/Menus/ItemListMenu.cs b/Server/Menus/ItemListMenu.cs index 9a0bdf8b9..3d0cfceb2 100644 --- a/Server/Menus/ItemListMenu.cs +++ b/Server/Menus/ItemListMenu.cs @@ -24,15 +24,11 @@ namespace Server.Menus.ItemLists { public class ItemListEntry { - private string m_Name; - private int m_ItemID; - private int m_Hue; + public string Name { get; } - public string Name => m_Name; + public int ItemID { get; } - public int ItemID => m_ItemID; - - public int Hue => m_Hue; + public int Hue { get; } public ItemListEntry( string name, int itemID ) : this( name, itemID, 0 ) { @@ -40,36 +36,29 @@ namespace Server.Menus.ItemLists public ItemListEntry( string name, int itemID, int hue ) { - m_Name = name; - m_ItemID = itemID; - m_Hue = hue; + Name = name; + ItemID = itemID; + Hue = hue; } } public class ItemListMenu : IMenu { - private string m_Question; - private ItemListEntry[] m_Entries; - private int m_Serial; private static int m_NextSerial; int IMenu.Serial => m_Serial; - int IMenu.EntryLength => m_Entries.Length; + int IMenu.EntryLength => Entries.Length; - public string Question => m_Question; + public string Question { get; } - public ItemListEntry[] Entries - { - get => m_Entries; - set => m_Entries = value; - } + public ItemListEntry[] Entries { get; set; } public ItemListMenu( string question, ItemListEntry[] entries ) { - m_Question = question; - m_Entries = entries; + Question = question; + Entries = entries; do { diff --git a/Server/Menus/QuestionMenu.cs b/Server/Menus/QuestionMenu.cs index ab9b2cb2e..94212e8c8 100644 --- a/Server/Menus/QuestionMenu.cs +++ b/Server/Menus/QuestionMenu.cs @@ -24,28 +24,21 @@ namespace Server.Menus.Questions { public class QuestionMenu : IMenu { - private string m_Question; - private string[] m_Answers; - private int m_Serial; private static int m_NextSerial; int IMenu.Serial => m_Serial; - int IMenu.EntryLength => m_Answers.Length; + int IMenu.EntryLength => Answers.Length; - public string Question - { - get => m_Question; - set => m_Question = value; - } + public string Question { get; set; } - public string[] Answers => m_Answers; + public string[] Answers { get; } public QuestionMenu( string question, string[] answers ) { - m_Question = question; - m_Answers = answers; + Question = question; + Answers = answers; do { diff --git a/Server/Movement.cs b/Server/Movement.cs index effe68ecf..8f61dbb51 100644 --- a/Server/Movement.cs +++ b/Server/Movement.cs @@ -22,18 +22,12 @@ namespace Server.Movement { public static class Movement { - private static IMovementImpl m_Impl; - - public static IMovementImpl Impl - { - get => m_Impl; - set => m_Impl = value; - } + public static IMovementImpl Impl { get; set; } public static bool CheckMovement( Mobile m, Direction d, out int newZ ) { - if ( m_Impl != null ) - return m_Impl.CheckMovement( m, d, out newZ ); + if ( Impl != null ) + return Impl.CheckMovement( m, d, out newZ ); newZ = m.Z; return false; @@ -41,8 +35,8 @@ namespace Server.Movement public static bool CheckMovement( Mobile m, Map map, Point3D loc, Direction d, out int newZ ) { - if ( m_Impl != null ) - return m_Impl.CheckMovement( m, map, loc, d, out newZ ); + if ( Impl != null ) + return Impl.CheckMovement( m, map, loc, d, out newZ ); newZ = m.Z; return false; diff --git a/Server/MultiData.cs b/Server/MultiData.cs index 575062e8a..e91a75e62 100644 --- a/Server/MultiData.cs +++ b/Server/MultiData.cs @@ -145,39 +145,33 @@ namespace Server public sealed class MultiComponentList { - public static bool PostHSFormat { - get => _PostHSFormat; - set => _PostHSFormat = value; - } + public static bool PostHSFormat { get; set; } - private static bool _PostHSFormat; - - private Point2D m_Min, m_Max, m_Center; - private int m_Width, m_Height; - private StaticTile[][][] m_Tiles; - private MultiTileEntry[] m_List; + private Point2D m_Min, m_Max; public static readonly MultiComponentList Empty = new MultiComponentList(); public Point2D Min => m_Min; public Point2D Max => m_Max; - public Point2D Center => m_Center; + public Point2D Center { get; } - public int Width => m_Width; - public int Height => m_Height; + public int Width { get; private set; } - public StaticTile[][][] Tiles => m_Tiles; - public MultiTileEntry[] List => m_List; + public int Height { get; private set; } + + public StaticTile[][][] Tiles { get; private set; } + + public MultiTileEntry[] List { get; private set; } public void Add( int itemID, int x, int y, int z ) { - int vx = x + m_Center.m_X; - int vy = y + m_Center.m_Y; + int vx = x + Center.m_X; + int vy = y + Center.m_Y; - if ( vx >= 0 && vx < m_Width && vy >= 0 && vy < m_Height ) + if ( vx >= 0 && vx < Width && vy >= 0 && vy < Height ) { - StaticTile[] oldTiles = m_Tiles[vx][vy]; + StaticTile[] oldTiles = Tiles[vx][vy]; for ( int i = oldTiles.Length - 1; i >= 0; --i ) { @@ -193,7 +187,7 @@ namespace Server } } - oldTiles = m_Tiles[vx][vy]; + oldTiles = Tiles[vx][vy]; StaticTile[] newTiles = new StaticTile[oldTiles.Length + 1]; @@ -202,9 +196,9 @@ namespace Server newTiles[oldTiles.Length] = new StaticTile( (ushort)itemID, (sbyte)z ); - m_Tiles[vx][vy] = newTiles; + Tiles[vx][vy] = newTiles; - MultiTileEntry[] oldList = m_List; + MultiTileEntry[] oldList = List; MultiTileEntry[] newList = new MultiTileEntry[oldList.Length + 1]; for ( int i = 0; i < oldList.Length; ++i ) @@ -212,7 +206,7 @@ namespace Server newList[oldList.Length] = new MultiTileEntry( (ushort)itemID, (short)x, (short)y, (short)z, 1 ); - m_List = newList; + List = newList; if ( x < m_Min.m_X ) m_Min.m_X = x; @@ -230,12 +224,12 @@ namespace Server public void RemoveXYZH( int x, int y, int z, int minHeight ) { - int vx = x + m_Center.m_X; - int vy = y + m_Center.m_Y; + int vx = x + Center.m_X; + int vy = y + Center.m_Y; - if ( vx >= 0 && vx < m_Width && vy >= 0 && vy < m_Height ) + if ( vx >= 0 && vx < Width && vy >= 0 && vy < Height ) { - StaticTile[] oldTiles = m_Tiles[vx][vy]; + StaticTile[] oldTiles = Tiles[vx][vy]; for ( int i = 0; i < oldTiles.Length; ++i ) { @@ -251,13 +245,13 @@ namespace Server for ( int j = i + 1; j < oldTiles.Length; ++j ) newTiles[j - 1] = oldTiles[j]; - m_Tiles[vx][vy] = newTiles; + Tiles[vx][vy] = newTiles; break; } } - MultiTileEntry[] oldList = m_List; + MultiTileEntry[] oldList = List; for ( int i = 0; i < oldList.Length; ++i ) { @@ -273,7 +267,7 @@ namespace Server for ( int j = i + 1; j < oldList.Length; ++j ) newList[j - 1] = oldList[j]; - m_List = newList; + List = newList; break; } @@ -283,12 +277,12 @@ namespace Server public void Remove( int itemID, int x, int y, int z ) { - int vx = x + m_Center.m_X; - int vy = y + m_Center.m_Y; + int vx = x + Center.m_X; + int vy = y + Center.m_Y; - if ( vx >= 0 && vx < m_Width && vy >= 0 && vy < m_Height ) + if ( vx >= 0 && vx < Width && vy >= 0 && vy < Height ) { - StaticTile[] oldTiles = m_Tiles[vx][vy]; + StaticTile[] oldTiles = Tiles[vx][vy]; for ( int i = 0; i < oldTiles.Length; ++i ) { @@ -304,13 +298,13 @@ namespace Server for ( int j = i + 1; j < oldTiles.Length; ++j ) newTiles[j - 1] = oldTiles[j]; - m_Tiles[vx][vy] = newTiles; + Tiles[vx][vy] = newTiles; break; } } - MultiTileEntry[] oldList = m_List; + MultiTileEntry[] oldList = List; for ( int i = 0; i < oldList.Length; ++i ) { @@ -326,7 +320,7 @@ namespace Server for ( int j = i + 1; j < oldList.Length; ++j ) newList[j - 1] = oldList[j]; - m_List = newList; + List = newList; break; } @@ -336,8 +330,8 @@ namespace Server public void Resize( int newWidth, int newHeight ) { - int oldWidth = m_Width, oldHeight = m_Height; - StaticTile[][][] oldTiles = m_Tiles; + int oldWidth = Width, oldHeight = Height; + StaticTile[][][] oldTiles = Tiles; int totalLength = 0; @@ -358,10 +352,10 @@ namespace Server } } - m_Tiles = newTiles; - m_List = new MultiTileEntry[totalLength]; - m_Width = newWidth; - m_Height = newHeight; + Tiles = newTiles; + List = new MultiTileEntry[totalLength]; + Width = newWidth; + Height = newHeight; m_Min = Point2D.Zero; m_Max = Point2D.Zero; @@ -378,8 +372,8 @@ namespace Server { StaticTile tile = tiles[i]; - int vx = x - m_Center.X; - int vy = y - m_Center.Y; + int vx = x - Center.X; + int vy = y - Center.Y; if ( vx < m_Min.m_X ) m_Min.m_X = vx; @@ -393,7 +387,7 @@ namespace Server if ( vy > m_Max.m_Y ) m_Max.m_Y = vy; - m_List[index++] = new MultiTileEntry( (ushort)tile.ID, (short)vx, (short)vy, (short)tile.Z, 1 ); + List[index++] = new MultiTileEntry( (ushort)tile.ID, (short)vx, (short)vy, (short)tile.Z, 1 ); } } } @@ -404,30 +398,30 @@ namespace Server m_Min = toCopy.m_Min; m_Max = toCopy.m_Max; - m_Center = toCopy.m_Center; + Center = toCopy.Center; - m_Width = toCopy.m_Width; - m_Height = toCopy.m_Height; + Width = toCopy.Width; + Height = toCopy.Height; - m_Tiles = new StaticTile[m_Width][][]; + Tiles = new StaticTile[Width][][]; - for ( int x = 0; x < m_Width; ++x ) + for ( int x = 0; x < Width; ++x ) { - m_Tiles[x] = new StaticTile[m_Height][]; + Tiles[x] = new StaticTile[Height][]; - for ( int y = 0; y < m_Height; ++y ) + for ( int y = 0; y < Height; ++y ) { - m_Tiles[x][y] = new StaticTile[toCopy.m_Tiles[x][y].Length]; + Tiles[x][y] = new StaticTile[toCopy.Tiles[x][y].Length]; - for ( int i = 0; i < m_Tiles[x][y].Length; ++i ) - m_Tiles[x][y][i] = toCopy.m_Tiles[x][y][i]; + for ( int i = 0; i < Tiles[x][y].Length; ++i ) + Tiles[x][y][i] = toCopy.Tiles[x][y][i]; } } - m_List = new MultiTileEntry[toCopy.m_List.Length]; + List = new MultiTileEntry[toCopy.List.Length]; - for ( int i = 0; i < m_List.Length; ++i ) - m_List[i] = toCopy.m_List[i]; + for ( int i = 0; i < List.Length; ++i ) + List[i] = toCopy.List[i]; } public void Serialize( GenericWriter writer ) @@ -436,16 +430,16 @@ namespace Server writer.Write( m_Min ); writer.Write( m_Max ); - writer.Write( m_Center ); + writer.Write( Center ); - writer.Write( (int) m_Width ); - writer.Write( (int) m_Height ); + writer.Write( (int) Width ); + writer.Write( (int) Height ); - writer.Write( (int) m_List.Length ); + writer.Write( (int) List.Length ); - for ( int i = 0; i < m_List.Length; ++i ) + for ( int i = 0; i < List.Length; ++i ) { - MultiTileEntry ent = m_List[i]; + MultiTileEntry ent = List[i]; writer.Write( (ushort) ent.m_ItemID ); writer.Write( (short) ent.m_OffsetX ); @@ -461,13 +455,13 @@ namespace Server m_Min = reader.ReadPoint2D(); m_Max = reader.ReadPoint2D(); - m_Center = reader.ReadPoint2D(); - m_Width = reader.ReadInt(); - m_Height = reader.ReadInt(); + Center = reader.ReadPoint2D(); + Width = reader.ReadInt(); + Height = reader.ReadInt(); int length = reader.ReadInt(); - MultiTileEntry[] allTiles = m_List = new MultiTileEntry[length]; + MultiTileEntry[] allTiles = List = new MultiTileEntry[length]; if ( version == 0 ) { for ( int i = 0; i < length; ++i ) @@ -493,15 +487,15 @@ namespace Server } } - TileList[][] tiles = new TileList[m_Width][]; - m_Tiles = new StaticTile[m_Width][][]; + TileList[][] tiles = new TileList[Width][]; + Tiles = new StaticTile[Width][][]; - for ( int x = 0; x < m_Width; ++x ) + for ( int x = 0; x < Width; ++x ) { - tiles[x] = new TileList[m_Height]; - m_Tiles[x] = new StaticTile[m_Height][]; + tiles[x] = new TileList[Height]; + Tiles[x] = new StaticTile[Height][]; - for ( int y = 0; y < m_Height; ++y ) + for ( int y = 0; y < Height; ++y ) tiles[x][y] = new TileList(); } @@ -509,21 +503,21 @@ namespace Server { if ( i == 0 || allTiles[i].m_Flags != 0 ) { - int xOffset = allTiles[i].m_OffsetX + m_Center.m_X; - int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y; + int xOffset = allTiles[i].m_OffsetX + Center.m_X; + int yOffset = allTiles[i].m_OffsetY + Center.m_Y; tiles[xOffset][yOffset].Add( (ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ ); } } - for ( int x = 0; x < m_Width; ++x ) - for ( int y = 0; y < m_Height; ++y ) - m_Tiles[x][y] = tiles[x][y].ToArray(); + for ( int x = 0; x < Width; ++x ) + for ( int y = 0; y < Height; ++y ) + Tiles[x][y] = tiles[x][y].ToArray(); } public MultiComponentList( BinaryReader reader, int count ) { - MultiTileEntry[] allTiles = m_List = new MultiTileEntry[count]; + MultiTileEntry[] allTiles = List = new MultiTileEntry[count]; for ( int i = 0; i < count; ++i ) { @@ -533,7 +527,7 @@ namespace Server allTiles[i].m_OffsetZ = reader.ReadInt16(); allTiles[i].m_Flags = reader.ReadInt32(); - if ( _PostHSFormat ) + if ( PostHSFormat ) reader.ReadInt32(); // ?? MultiTileEntry e = allTiles[i]; @@ -554,19 +548,19 @@ namespace Server } } - m_Center = new Point2D( -m_Min.m_X, -m_Min.m_Y ); - m_Width = (m_Max.m_X - m_Min.m_X) + 1; - m_Height = (m_Max.m_Y - m_Min.m_Y) + 1; + Center = new Point2D( -m_Min.m_X, -m_Min.m_Y ); + Width = (m_Max.m_X - m_Min.m_X) + 1; + Height = (m_Max.m_Y - m_Min.m_Y) + 1; - TileList[][] tiles = new TileList[m_Width][]; - m_Tiles = new StaticTile[m_Width][][]; + TileList[][] tiles = new TileList[Width][]; + Tiles = new StaticTile[Width][][]; - for ( int x = 0; x < m_Width; ++x ) + for ( int x = 0; x < Width; ++x ) { - tiles[x] = new TileList[m_Height]; - m_Tiles[x] = new StaticTile[m_Height][]; + tiles[x] = new TileList[Height]; + Tiles[x] = new StaticTile[Height][]; - for ( int y = 0; y < m_Height; ++y ) + for ( int y = 0; y < Height; ++y ) tiles[x][y] = new TileList(); } @@ -574,22 +568,22 @@ namespace Server { if ( i == 0 || allTiles[i].m_Flags != 0 ) { - int xOffset = allTiles[i].m_OffsetX + m_Center.m_X; - int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y; + int xOffset = allTiles[i].m_OffsetX + Center.m_X; + int yOffset = allTiles[i].m_OffsetY + Center.m_Y; tiles[xOffset][yOffset].Add( (ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ ); } } - for ( int x = 0; x < m_Width; ++x ) - for ( int y = 0; y < m_Height; ++y ) - m_Tiles[x][y] = tiles[x][y].ToArray(); + for ( int x = 0; x < Width; ++x ) + for ( int y = 0; y < Height; ++y ) + Tiles[x][y] = tiles[x][y].ToArray(); } private MultiComponentList() { - m_Tiles = new StaticTile[0][][]; - m_List = new MultiTileEntry[0]; + Tiles = new StaticTile[0][][]; + List = new MultiTileEntry[0]; } } } \ No newline at end of file diff --git a/Server/Network/BufferPool.cs b/Server/Network/BufferPool.cs index 7c9a91c07..3bdc6deda 100644 --- a/Server/Network/BufferPool.cs +++ b/Server/Network/BufferPool.cs @@ -24,11 +24,7 @@ namespace Server.Network { public class BufferPool { - private static List m_Pools = new List(); - - public static List Pools{ get => m_Pools; - set => m_Pools = value; - } + public static List Pools { get; set; } = new List(); private string m_Name; @@ -64,8 +60,8 @@ namespace Server.Network for ( int i = 0; i < initialCapacity; ++i ) m_FreeBuffers.Enqueue( new byte[bufferSize] ); - lock ( m_Pools ) - m_Pools.Add( this ); + lock ( Pools ) + Pools.Add( this ); } public byte[] AcquireBuffer() @@ -95,8 +91,8 @@ namespace Server.Network public void Free() { - lock ( m_Pools ) - m_Pools.Remove( this ); + lock ( Pools ) + Pools.Remove( this ); } } } \ No newline at end of file diff --git a/Server/Network/ByteQueue.cs b/Server/Network/ByteQueue.cs index fb65f2b84..019afb907 100644 --- a/Server/Network/ByteQueue.cs +++ b/Server/Network/ByteQueue.cs @@ -26,11 +26,10 @@ namespace Server.Network { private int m_Head; private int m_Tail; - private int m_Size; private byte[] m_Buffer; - public int Length => m_Size; + public int Length { get; private set; } public ByteQueue() { @@ -41,18 +40,18 @@ namespace Server.Network { m_Head = 0; m_Tail = 0; - m_Size = 0; + Length = 0; } private void SetCapacity( int capacity ) { byte[] newBuffer = new byte[capacity]; - if ( m_Size > 0 ) + if ( Length > 0 ) { if ( m_Head < m_Tail ) { - Buffer.BlockCopy( m_Buffer, m_Head, newBuffer, 0, m_Size ); + Buffer.BlockCopy( m_Buffer, m_Head, newBuffer, 0, Length ); } else { @@ -62,13 +61,13 @@ namespace Server.Network } m_Head = 0; - m_Tail = m_Size; + m_Tail = Length; m_Buffer = newBuffer; } public byte GetPacketID() { - if ( m_Size >= 1 ) + if ( Length >= 1 ) return m_Buffer[m_Head]; return 0xFF; @@ -76,7 +75,7 @@ namespace Server.Network public int GetPacketLength() { - if ( m_Size >= 3 ) + if ( Length >= 3 ) return (m_Buffer[(m_Head + 1) % m_Buffer.Length] << 8) | m_Buffer[(m_Head + 2) % m_Buffer.Length]; return 0; @@ -84,8 +83,8 @@ namespace Server.Network public int Dequeue( byte[] buffer, int offset, int size ) { - if ( size > m_Size ) - size = m_Size; + if ( size > Length ) + size = Length; if ( size == 0 ) return 0; @@ -110,9 +109,9 @@ namespace Server.Network } m_Head = ( m_Head + size ) % m_Buffer.Length; - m_Size -= size; + Length -= size; - if ( m_Size == 0 ) + if ( Length == 0 ) { m_Head = 0; m_Tail = 0; @@ -123,8 +122,8 @@ namespace Server.Network public void Enqueue( byte[] buffer, int offset, int size ) { - if ( (m_Size + size) > m_Buffer.Length ) - SetCapacity( (m_Size + size + 2047) & ~2047 ); + if ( (Length + size) > m_Buffer.Length ) + SetCapacity( (Length + size + 2047) & ~2047 ); if ( m_Head < m_Tail ) { @@ -146,7 +145,7 @@ namespace Server.Network } m_Tail = ( m_Tail + size ) % m_Buffer.Length; - m_Size += size; + Length += size; } } } \ No newline at end of file diff --git a/Server/Network/EncodedPacketHandler.cs b/Server/Network/EncodedPacketHandler.cs index ea7d08c34..de79ab0bc 100644 --- a/Server/Network/EncodedPacketHandler.cs +++ b/Server/Network/EncodedPacketHandler.cs @@ -24,21 +24,17 @@ namespace Server.Network public class EncodedPacketHandler { - private int m_PacketID; - private bool m_Ingame; - private OnEncodedPacketReceive m_OnReceive; - public EncodedPacketHandler( int packetID, bool ingame, OnEncodedPacketReceive onReceive ) { - m_PacketID = packetID; - m_Ingame = ingame; - m_OnReceive = onReceive; + PacketID = packetID; + Ingame = ingame; + OnReceive = onReceive; } - public int PacketID => m_PacketID; + public int PacketID { get; } - public OnEncodedPacketReceive OnReceive => m_OnReceive; + public OnEncodedPacketReceive OnReceive { get; } - public bool Ingame => m_Ingame; + public bool Ingame { get; } } } \ No newline at end of file diff --git a/Server/Network/Listener.cs b/Server/Network/Listener.cs index e73a03aab..3b1efe94c 100644 --- a/Server/Network/Listener.cs +++ b/Server/Network/Listener.cs @@ -43,12 +43,7 @@ namespace Server.Network private static Socket[] m_EmptySockets = new Socket[0]; - private static IPEndPoint[] m_EndPoints; - - public static IPEndPoint[] EndPoints { - get => m_EndPoints; - set => m_EndPoints = value; - } + public static IPEndPoint[] EndPoints { get; set; } public Listener( IPEndPoint ipep ) { diff --git a/Server/Network/MessagePump.cs b/Server/Network/MessagePump.cs index 2dc2707b0..4ffcb997a 100644 --- a/Server/Network/MessagePump.cs +++ b/Server/Network/MessagePump.cs @@ -29,7 +29,6 @@ namespace Server.Network { public class MessagePump { - private Listener[] m_Listeners; private Queue m_Queue; private Queue m_WorkingQueue; private Queue m_Throttled; @@ -38,7 +37,7 @@ namespace Server.Network { IPEndPoint[] ipep = Listener.EndPoints; - m_Listeners = new Listener[ipep.Length]; + Listeners = new Listener[ipep.Length]; bool success = false; @@ -47,7 +46,7 @@ namespace Server.Network Listener l = new Listener( ipep[i] ); if ( !success && l != null ) success = true; - m_Listeners[i] = l; + Listeners[i] = l; } if ( !success ) { @@ -61,29 +60,25 @@ namespace Server.Network m_Throttled = new Queue(); } - public Listener[] Listeners - { - get => m_Listeners; - set => m_Listeners = value; - } + public Listener[] Listeners { get; set; } public void AddListener( Listener l ) { - Listener[] old = m_Listeners; + Listener[] old = Listeners; - m_Listeners = new Listener[old.Length + 1]; + Listeners = new Listener[old.Length + 1]; for ( int i = 0; i < old.Length; ++i ) - m_Listeners[i] = old[i]; + Listeners[i] = old[i]; - m_Listeners[old.Length] = l; + Listeners[old.Length] = l; } private void CheckListener() { - for ( int j = 0; j < m_Listeners.Length; ++j ) + for ( int j = 0; j < Listeners.Length; ++j ) { - Socket[] accepted = m_Listeners[j].Slice(); + Socket[] accepted = Listeners[j].Slice(); for ( int i = 0; i < accepted.Length; ++i ) { diff --git a/Server/Network/NetState.cs b/Server/Network/NetState.cs index 861eee98a..94381205d 100644 --- a/Server/Network/NetState.cs +++ b/Server/Network/NetState.cs @@ -41,13 +41,8 @@ namespace Server.Network { public delegate void NetStateCreatedCallback( NetState ns ); public class NetState : IComparable { - private Socket m_Socket; - private IPAddress m_Address; - private ByteQueue m_Buffer; private byte[] m_RecvBuffer; private SendQueue m_SendQueue; - private bool m_Seeded; - private bool m_Running; #if NewAsyncSockets private SocketAsyncEventArgs m_ReceiveEventArgs, m_SendEventArgs; @@ -56,33 +51,17 @@ namespace Server.Network { #endif private MessagePump m_MessagePump; - private ServerInfo[] m_ServerInfo; - private IAccount m_Account; - private Mobile m_Mobile; - private CityInfo[] m_CityInfo; - private List m_Gumps; - private List m_HuePickers; - private List m_Menus; - private List m_Trades; - private int m_Sequence; - private bool m_CompressionEnabled; private string m_ToString; private ClientVersion m_Version; - private bool m_SentFirstPacket; - private bool m_BlockAllPackets; - private DateTime m_ConnectedOn; + public DateTime ConnectedOn { get; } - public DateTime ConnectedOn => m_ConnectedOn; - - public TimeSpan ConnectedFor => ( DateTime.UtcNow - m_ConnectedOn ); + public TimeSpan ConnectedFor => ( DateTime.UtcNow - ConnectedOn ); internal int m_Seed; internal int m_AuthID; - public IPAddress Address => m_Address; - - private ClientFlags m_Flags; + public IPAddress Address { get; } private static bool m_Paused; @@ -95,34 +74,15 @@ namespace Server.Network { private AsyncState m_AsyncState; private object m_AsyncLock = new object(); - private IPacketEncoder m_Encoder; + public IPacketEncoder PacketEncoder { get; set; } - public IPacketEncoder PacketEncoder { - get => m_Encoder; - set => m_Encoder = value; - } + public static NetStateCreatedCallback CreatedCallback { get; set; } - private static NetStateCreatedCallback m_CreatedCallback; + public bool SentFirstPacket { get; set; } - public static NetStateCreatedCallback CreatedCallback { - get => m_CreatedCallback; - set => m_CreatedCallback = value; - } + public bool BlockAllPackets { get; set; } - public bool SentFirstPacket { - get => m_SentFirstPacket; - set => m_SentFirstPacket = value; - } - - public bool BlockAllPackets { - get => m_BlockAllPackets; - set => m_BlockAllPackets = value; - } - - public ClientFlags Flags { - get => m_Flags; - set => m_Flags = value; - } + public ClientFlags Flags { get; set; } public ClientVersion Version { get => m_Version; @@ -225,19 +185,19 @@ namespace Server.Network { public bool NewMobileIncoming => ((_ProtocolChanges & ProtocolChanges.NewMobileIncoming) != 0); public bool NewSecureTrading => ((_ProtocolChanges & ProtocolChanges.NewSecureTrading) != 0); - public bool IsUOTDClient => ( (m_Flags & ClientFlags.UOTD) != 0 || ( m_Version != null && m_Version.Type == ClientType.UOTD ) ); + public bool IsUOTDClient => ( (Flags & ClientFlags.UOTD) != 0 || ( m_Version != null && m_Version.Type == ClientType.UOTD ) ); public bool IsSAClient => ( m_Version != null && m_Version.Type == ClientType.SA ); - public List Trades => m_Trades; + public List Trades { get; } public void ValidateAllTrades() { - for ( int i = m_Trades.Count - 1; i >= 0; --i ) { - if ( i >= m_Trades.Count ) { + for ( int i = Trades.Count - 1; i >= 0; --i ) { + if ( i >= Trades.Count ) { continue; } - SecureTrade trade = m_Trades[i]; + SecureTrade trade = Trades[i]; if ( trade.From.Mobile.Deleted || trade.To.Mobile.Deleted || !trade.From.Mobile.Alive || !trade.To.Mobile.Alive || !trade.From.Mobile.InRange( trade.To.Mobile, 2 ) || trade.From.Mobile.Map != trade.To.Mobile.Map ) { trade.Cancel(); @@ -246,20 +206,20 @@ namespace Server.Network { } public void CancelAllTrades() { - for ( int i = m_Trades.Count - 1; i >= 0; --i ) { - if ( i < m_Trades.Count ) { - m_Trades[i].Cancel(); + for ( int i = Trades.Count - 1; i >= 0; --i ) { + if ( i < Trades.Count ) { + Trades[i].Cancel(); } } } public void RemoveTrade( SecureTrade trade ) { - m_Trades.Remove( trade ); + Trades.Remove( trade ); } public SecureTrade FindTrade( Mobile m ) { - for ( int i = 0; i < m_Trades.Count; ++i ) { - SecureTrade trade = m_Trades[i]; + for ( int i = 0; i < Trades.Count; ++i ) { + SecureTrade trade = Trades[i]; if ( trade.From.Mobile == m || trade.To.Mobile == m ) { return trade; @@ -270,17 +230,17 @@ namespace Server.Network { } public SecureTradeContainer FindTradeContainer( Mobile m ) { - for ( int i = 0; i < m_Trades.Count; ++i ) { - SecureTrade trade = m_Trades[i]; + for ( int i = 0; i < Trades.Count; ++i ) { + SecureTrade trade = Trades[i]; SecureTradeInfo from = trade.From; SecureTradeInfo to = trade.To; - if ( from.Mobile == m_Mobile && to.Mobile == m ) { + if ( from.Mobile == Mobile && to.Mobile == m ) { return from.Container; } - if ( from.Mobile == m && to.Mobile == m_Mobile ) { + if ( from.Mobile == m && to.Mobile == Mobile ) { return to.Container; } } @@ -289,46 +249,29 @@ namespace Server.Network { } public SecureTradeContainer AddTrade( NetState state ) { - SecureTrade newTrade = new SecureTrade( m_Mobile, state.m_Mobile ); + SecureTrade newTrade = new SecureTrade( Mobile, state.Mobile ); - m_Trades.Add( newTrade ); - state.m_Trades.Add( newTrade ); + Trades.Add( newTrade ); + state.Trades.Add( newTrade ); return newTrade.From.Container; } - public bool CompressionEnabled { - get => m_CompressionEnabled; - set => m_CompressionEnabled = value; - } + public bool CompressionEnabled { get; set; } - public int Sequence { - get => m_Sequence; - set => m_Sequence = value; - } + public int Sequence { get; set; } - public List Gumps => m_Gumps; + public List Gumps { get; private set; } - public List HuePickers => m_HuePickers; + public List HuePickers { get; private set; } - public List Menus => m_Menus; + public List Menus { get; private set; } - private static int m_GumpCap = 512, m_HuePickerCap = 512, m_MenuCap = 512; + public static int GumpCap { get; set; } = 512; - public static int GumpCap { - get => m_GumpCap; - set => m_GumpCap = value; - } + public static int HuePickerCap { get; set; } = 512; - public static int HuePickerCap { - get => m_HuePickerCap; - set => m_HuePickerCap = value; - } - - public static int MenuCap { - get => m_MenuCap; - set => m_MenuCap = value; - } + public static int MenuCap { get; set; } = 512; public void WriteConsole( string text ) { Console.WriteLine( "Client: {0}: {1}", this, text ); @@ -339,12 +282,12 @@ namespace Server.Network { } public void AddMenu( IMenu menu ) { - if ( m_Menus == null ) { - m_Menus = new List(); + if ( Menus == null ) { + Menus = new List(); } - if ( m_Menus.Count < m_MenuCap ) { - m_Menus.Add( menu ); + if ( Menus.Count < MenuCap ) { + Menus.Add( menu ); } else { WriteConsole( "Exceeded menu cap, disconnecting..." ); Dispose(); @@ -353,26 +296,26 @@ namespace Server.Network { public void RemoveMenu( IMenu menu ) { - m_Menus?.Remove( menu ); + Menus?.Remove( menu ); } public void RemoveMenu( int index ) { - m_Menus?.RemoveAt( index ); + Menus?.RemoveAt( index ); } public void ClearMenus() { - m_Menus?.Clear(); + Menus?.Clear(); } public void AddHuePicker( HuePicker huePicker ) { - if ( m_HuePickers == null ) { - m_HuePickers = new List(); + if ( HuePickers == null ) { + HuePickers = new List(); } - if ( m_HuePickers.Count < m_HuePickerCap ) { - m_HuePickers.Add( huePicker ); + if ( HuePickers.Count < HuePickerCap ) { + HuePickers.Add( huePicker ); } else { WriteConsole( "Exceeded hue picker cap, disconnecting..." ); Dispose(); @@ -381,26 +324,26 @@ namespace Server.Network { public void RemoveHuePicker( HuePicker huePicker ) { - m_HuePickers?.Remove( huePicker ); + HuePickers?.Remove( huePicker ); } public void RemoveHuePicker( int index ) { - m_HuePickers?.RemoveAt( index ); + HuePickers?.RemoveAt( index ); } public void ClearHuePickers() { - m_HuePickers?.Clear(); + HuePickers?.Clear(); } public void AddGump( Gump gump ) { - if ( m_Gumps == null ) { - m_Gumps = new List(); + if ( Gumps == null ) { + Gumps = new List(); } - if ( m_Gumps.Count < m_GumpCap ) { - m_Gumps.Add( gump ); + if ( Gumps.Count < GumpCap ) { + Gumps.Add( gump ); } else { WriteConsole( "Exceeded gump cap, disconnecting..." ); Dispose(); @@ -409,17 +352,17 @@ namespace Server.Network { public void RemoveGump( Gump gump ) { - m_Gumps?.Remove( gump ); + Gumps?.Remove( gump ); } public void RemoveGump( int index ) { - m_Gumps?.RemoveAt( index ); + Gumps?.RemoveAt( index ); } public void ClearGumps() { - m_Gumps?.Clear(); + Gumps?.Clear(); } public void LaunchBrowser( string url ) { @@ -427,80 +370,66 @@ namespace Server.Network { Send( new LaunchBrowser( url ) ); } - public CityInfo[] CityInfo { - get => m_CityInfo; - set => m_CityInfo = value; - } + public CityInfo[] CityInfo { get; set; } - public Mobile Mobile { - get => m_Mobile; - set => m_Mobile = value; - } + public Mobile Mobile { get; set; } - public ServerInfo[] ServerInfo { - get => m_ServerInfo; - set => m_ServerInfo = value; - } + public ServerInfo[] ServerInfo { get; set; } - public IAccount Account { - get => m_Account; - set => m_Account = value; - } + public IAccount Account { get; set; } public override string ToString() { return m_ToString; } - private static List m_Instances = new List(); - - public static List Instances => m_Instances; + public static List Instances { get; } = new List(); private static BufferPool m_ReceiveBufferPool = new BufferPool( "Receive", 2048, 2048 ); public NetState( Socket socket, MessagePump messagePump ) { - m_Socket = socket; - m_Buffer = new ByteQueue(); - m_Seeded = false; - m_Running = false; + Socket = socket; + Buffer = new ByteQueue(); + Seeded = false; + Running = false; m_RecvBuffer = m_ReceiveBufferPool.AcquireBuffer(); m_MessagePump = messagePump; - m_Gumps = new List(); - m_HuePickers = new List(); - m_Menus = new List(); - m_Trades = new List(); + Gumps = new List(); + HuePickers = new List(); + Menus = new List(); + Trades = new List(); m_SendQueue = new SendQueue(); m_NextCheckActivity = Core.TickCount + 30000; - m_Instances.Add( this ); + Instances.Add( this ); try { - m_Address = Utility.Intern( ( ( IPEndPoint ) m_Socket.RemoteEndPoint ).Address ); - m_ToString = m_Address.ToString(); + Address = Utility.Intern( ( ( IPEndPoint ) Socket.RemoteEndPoint ).Address ); + m_ToString = Address.ToString(); } catch ( Exception ex ) { TraceException( ex ); - m_Address = IPAddress.None; + Address = IPAddress.None; m_ToString = "(error)"; } - m_ConnectedOn = DateTime.UtcNow; + ConnectedOn = DateTime.UtcNow; - m_CreatedCallback?.Invoke( this ); + CreatedCallback?.Invoke( this ); } private bool _sending; private object _sendL = new object(); public virtual void Send( Packet p ) { - if ( m_Socket == null || m_BlockAllPackets ) { + if ( Socket == null || BlockAllPackets ) { p.OnSend(); return; } int length; - byte[] buffer = p.Compile( m_CompressionEnabled, out length ); + byte[] buffer = p.Compile( CompressionEnabled, out length ); if ( buffer != null ) { if ( buffer.Length <= 0 || length <= 0 ) { @@ -514,7 +443,7 @@ namespace Server.Network { prof?.Start(); - m_Encoder?.EncodeOutgoingPacket( this, ref buffer, ref length ); + PacketEncoder?.EncodeOutgoingPacket( this, ref buffer, ref length ); try { SendQueue.Gram gram; @@ -567,9 +496,9 @@ namespace Server.Network { m_SendEventArgs = new SocketAsyncEventArgs(); m_SendEventArgs.Completed += Send_Completion; - m_Running = true; + Running = true; - if ( m_Socket == null || m_Paused ) { + if ( Socket == null || m_Paused ) { return; } @@ -585,7 +514,7 @@ namespace Server.Network { lock ( m_AsyncLock ) { if ( ( m_AsyncState & ( AsyncState.Pending | AsyncState.Paused ) ) == 0 ) { m_AsyncState |= AsyncState.Pending; - result = !m_Socket.ReceiveAsync( m_ReceiveEventArgs ); + result = !Socket.ReceiveAsync( m_ReceiveEventArgs ); if ( result ) Receive_Process( m_ReceiveEventArgs ); @@ -602,7 +531,7 @@ namespace Server.Network { { Receive_Process( e ); - if ( !m_Disposing ) + if ( !IsDisposing ) Receive_Start(); } @@ -615,7 +544,7 @@ namespace Server.Network { return; } - if ( m_Disposing ) { + if ( IsDisposing ) { return; } @@ -623,10 +552,10 @@ namespace Server.Network { byte[] buffer = m_RecvBuffer; - m_Encoder?.DecodeIncomingPacket( this, ref buffer, ref byteCount ); + PacketEncoder?.DecodeIncomingPacket( this, ref buffer, ref byteCount ); - lock ( m_Buffer ) - m_Buffer.Enqueue( buffer, 0, byteCount ); + lock ( Buffer ) + Buffer.Enqueue( buffer, 0, byteCount ); m_MessagePump.OnReceive( this ); @@ -641,7 +570,7 @@ namespace Server.Network { bool result = false; do { - result = !m_Socket.SendAsync( m_SendEventArgs ); + result = !Socket.SendAsync( m_SendEventArgs ); if ( result ) Send_Process( m_SendEventArgs ); @@ -656,11 +585,11 @@ namespace Server.Network { { Send_Process( e ); - if ( m_Disposing ) + if ( IsDisposing ) return; - if ( m_CoalesceSleep >= 0 ) { - Thread.Sleep( m_CoalesceSleep ); + if ( CoalesceSleep >= 0 ) { + Thread.Sleep( CoalesceSleep ); } SendQueue.Gram gram; @@ -696,8 +625,8 @@ namespace Server.Network { public static void Pause() { m_Paused = true; - for ( int i = 0; i < m_Instances.Count; ++i ) { - NetState ns = m_Instances[i]; + for ( int i = 0; i < Instances.Count; ++i ) { + NetState ns = Instances[i]; lock ( ns.m_AsyncLock ) { ns.m_AsyncState |= AsyncState.Paused; @@ -708,10 +637,10 @@ namespace Server.Network { public static void Resume() { m_Paused = false; - for ( int i = 0; i < m_Instances.Count; ++i ) { - NetState ns = m_Instances[i]; + for ( int i = 0; i < Instances.Count; ++i ) { + NetState ns = Instances[i]; - if ( ns.m_Socket == null ) { + if ( ns.Socket == null ) { continue; } @@ -725,7 +654,7 @@ namespace Server.Network { } public bool Flush() { - if ( m_Socket == null ) + if ( Socket == null ) return false; lock (_sendL) { @@ -939,25 +868,20 @@ namespace Server.Network { } public static void FlushAll() { - if (m_Instances.Count >= 1024) - Parallel.ForEach(m_Instances, ns => ns.Flush()); + if (Instances.Count >= 1024) + Parallel.ForEach(Instances, ns => ns.Flush()); else - for ( int i = 0; i < m_Instances.Count; ++i ) { - m_Instances[i].Flush(); + for ( int i = 0; i < Instances.Count; ++i ) { + Instances[i].Flush(); } } - private static int m_CoalesceSleep = -1; - - public static int CoalesceSleep { - get => m_CoalesceSleep; - set => m_CoalesceSleep = value; - } + public static int CoalesceSleep { get; set; } = -1; private long m_NextCheckActivity; public void CheckAlive(long curTicks) { - if ( m_Socket == null ) + if ( Socket == null ) return; if (m_NextCheckActivity - curTicks >= 0) { @@ -992,32 +916,30 @@ namespace Server.Network { } } - private bool m_Disposing; - - public bool IsDisposing => m_Disposing; + public bool IsDisposing { get; private set; } public void Dispose() { Dispose( true ); } public virtual void Dispose( bool flush ) { - if ( m_Socket == null || m_Disposing ) { + if ( Socket == null || IsDisposing ) { return; } - m_Disposing = true; + IsDisposing = true; if ( flush ) flush = Flush(); try { - m_Socket.Shutdown( SocketShutdown.Both ); + Socket.Shutdown( SocketShutdown.Both ); } catch ( SocketException ex ) { TraceException( ex ); } try { - m_Socket.Close(); + Socket.Close(); } catch ( SocketException ex ) { TraceException( ex ); } @@ -1027,9 +949,9 @@ namespace Server.Network { m_ReceiveBufferPool.ReleaseBuffer( m_RecvBuffer ); } - m_Socket = null; + Socket = null; - m_Buffer = null; + Buffer = null; m_RecvBuffer = null; #if NewAsyncSockets @@ -1040,7 +962,7 @@ namespace Server.Network { m_OnSend = null; #endif - m_Running = false; + Running = false; lock (m_Disposed) m_Disposed.Enqueue( this ); @@ -1059,11 +981,11 @@ namespace Server.Network { try { long curTicks = Core.TickCount; - if (m_Instances.Count >= 1024) - Parallel.ForEach(m_Instances, ns => ns.CheckAlive(curTicks)); + if (Instances.Count >= 1024) + Parallel.ForEach(Instances, ns => ns.CheckAlive(curTicks)); else - for ( int i = 0; i < m_Instances.Count; ++i ) { - m_Instances[i].CheckAlive(curTicks); + for ( int i = 0; i < Instances.Count; ++i ) { + Instances[i].CheckAlive(curTicks); } } catch ( Exception ex ) { TraceException( ex ); @@ -1080,42 +1002,39 @@ namespace Server.Network { ++breakout; NetState ns = m_Disposed.Dequeue(); - Mobile m = ns.m_Mobile; - IAccount a = ns.m_Account; + Mobile m = ns.Mobile; + IAccount a = ns.Account; if ( m != null ) { m.NetState = null; - ns.m_Mobile = null; + ns.Mobile = null; } - ns.m_Gumps.Clear(); - ns.m_Menus.Clear(); - ns.m_HuePickers.Clear(); - ns.m_Account = null; - ns.m_ServerInfo = null; - ns.m_CityInfo = null; + ns.Gumps.Clear(); + ns.Menus.Clear(); + ns.HuePickers.Clear(); + ns.Account = null; + ns.ServerInfo = null; + ns.CityInfo = null; - m_Instances.Remove( ns ); + Instances.Remove( ns ); if ( a != null ) { - ns.WriteConsole( "Disconnected. [{0} Online] [{1}]", m_Instances.Count, a ); + ns.WriteConsole( "Disconnected. [{0} Online] [{1}]", Instances.Count, a ); } else { - ns.WriteConsole( "Disconnected. [{0} Online]", m_Instances.Count ); + ns.WriteConsole( "Disconnected. [{0} Online]", Instances.Count ); } } } } - public bool Running => m_Running; + public bool Running { get; private set; } - public bool Seeded { - get => m_Seeded; - set => m_Seeded = value; - } + public bool Seeded { get; set; } - public Socket Socket => m_Socket; + public Socket Socket { get; private set; } - public ByteQueue Buffer => m_Buffer; + public ByteQueue Buffer { get; private set; } public ExpansionInfo ExpansionInfo { get { diff --git a/Server/Network/PacketHandler.cs b/Server/Network/PacketHandler.cs index 0bb1001b5..844cedacb 100644 --- a/Server/Network/PacketHandler.cs +++ b/Server/Network/PacketHandler.cs @@ -25,32 +25,22 @@ namespace Server.Network public class PacketHandler { - private int m_PacketID; - private int m_Length; - private bool m_Ingame; - private OnPacketReceive m_OnReceive; - private ThrottlePacketCallback m_ThrottleCallback; - public PacketHandler( int packetID, int length, bool ingame, OnPacketReceive onReceive ) { - m_PacketID = packetID; - m_Length = length; - m_Ingame = ingame; - m_OnReceive = onReceive; + PacketID = packetID; + Length = length; + Ingame = ingame; + OnReceive = onReceive; } - public int PacketID => m_PacketID; + public int PacketID { get; } - public int Length => m_Length; + public int Length { get; } - public OnPacketReceive OnReceive => m_OnReceive; + public OnPacketReceive OnReceive { get; } - public ThrottlePacketCallback ThrottleCallback - { - get => m_ThrottleCallback; - set => m_ThrottleCallback = value; - } + public ThrottlePacketCallback ThrottleCallback { get; set; } - public bool Ingame => m_Ingame; + public bool Ingame { get; } } } \ No newline at end of file diff --git a/Server/Network/PacketHandlers.cs b/Server/Network/PacketHandlers.cs index d987b2a21..46394fc66 100644 --- a/Server/Network/PacketHandlers.cs +++ b/Server/Network/PacketHandlers.cs @@ -55,7 +55,6 @@ namespace Server.Network public static class PacketHandlers { - private static PacketHandler[] m_Handlers; private static PacketHandler[] m_6017Handlers; private static PacketHandler[] m_ExtendedHandlersLow; @@ -64,11 +63,11 @@ namespace Server.Network private static EncodedPacketHandler[] m_EncodedHandlersLow; private static Dictionary m_EncodedHandlersHigh; - public static PacketHandler[] Handlers => m_Handlers; + public static PacketHandler[] Handlers { get; } static PacketHandlers() { - m_Handlers = new PacketHandler[0x100]; + Handlers = new PacketHandler[0x100]; m_6017Handlers = new PacketHandler[0x100]; m_ExtendedHandlersLow = new PacketHandler[0x100]; @@ -173,7 +172,7 @@ namespace Server.Network public static void Register( int packetID, int length, bool ingame, OnPacketReceive onReceive ) { - m_Handlers[packetID] = new PacketHandler( packetID, length, ingame, onReceive ); + Handlers[packetID] = new PacketHandler( packetID, length, ingame, onReceive ); if ( m_6017Handlers[packetID] == null ) m_6017Handlers[packetID] = new PacketHandler( packetID, length, ingame, onReceive ); @@ -181,7 +180,7 @@ namespace Server.Network public static PacketHandler GetHandler( int packetID ) { - return m_Handlers[packetID]; + return Handlers[packetID]; } public static void Register6017( int packetID, int length, bool ingame, OnPacketReceive onReceive ) @@ -1467,13 +1466,7 @@ namespace Server.Network } } - private static bool m_SingleClickProps; - - public static bool SingleClickProps - { - get => m_SingleClickProps; - set => m_SingleClickProps = value; - } + public static bool SingleClickProps { get; set; } public static void LookReq( NetState state, PacketReader pvSrc ) { @@ -1487,7 +1480,7 @@ namespace Server.Network if ( m != null && from.CanSee( m ) && Utility.InUpdateRange( from, m ) ) { - if ( m_SingleClickProps ) + if ( SingleClickProps ) { m.OnAosSingleClick( from ); } @@ -1504,7 +1497,7 @@ namespace Server.Network if ( item != null && !item.Deleted && from.CanSee( item ) && Utility.InUpdateRange( from.Location, item.GetWorldLocation() ) ) { - if ( m_SingleClickProps ) + if ( SingleClickProps ) { item.OnAosSingleClick( from ); } @@ -2457,13 +2450,7 @@ namespace Server.Network } } - private static bool m_ClientVerification = true; - - public static bool ClientVerification - { - get => m_ClientVerification; - set => m_ClientVerification = value; - } + public static bool ClientVerification { get; set; } = true; internal struct AuthIDPersistence { public DateTime Age; @@ -2525,7 +2512,7 @@ namespace Server.Network m_AuthIDWindow.Remove( authID ); state.Version = ap.Version; - } else if ( m_ClientVerification ) { + } else if ( ClientVerification ) { Console.WriteLine( "Login: {0}: Invalid client detected, disconnecting", state ); state.Dispose(); return; diff --git a/Server/Network/PacketReader.cs b/Server/Network/PacketReader.cs index 3c4e1be48..6fd2b50e1 100644 --- a/Server/Network/PacketReader.cs +++ b/Server/Network/PacketReader.cs @@ -26,20 +26,18 @@ namespace Server.Network { public class PacketReader { - private byte[] m_Data; - private int m_Size; private int m_Index; public PacketReader( byte[] data, int size, bool fixedSize ) { - m_Data = data; - m_Size = size; + Buffer = data; + Size = size; m_Index = fixedSize ? 1 : 3; } - public byte[] Buffer => m_Data; + public byte[] Buffer { get; } - public int Size => m_Size; + public int Size { get; } public void Trace( NetState state ) { @@ -47,7 +45,7 @@ namespace Server.Network { using ( StreamWriter sw = new StreamWriter( "Packets.log", true ) ) { - byte[] buffer = m_Data; + byte[] buffer = Buffer; if ( buffer.Length > 0 ) sw.WriteLine( "Client: {0}: Unhandled packet 0x{1:X2}", state, buffer[0] ); @@ -70,7 +68,7 @@ namespace Server.Network { case SeekOrigin.Begin: m_Index = offset; break; case SeekOrigin.Current: m_Index += offset; break; - case SeekOrigin.End: m_Index = m_Size - offset; break; + case SeekOrigin.End: m_Index = Size - offset; break; } return m_Index; @@ -78,61 +76,61 @@ namespace Server.Network public int ReadInt32() { - if ( (m_Index + 4) > m_Size ) + if ( (m_Index + 4) > Size ) return 0; - return (m_Data[m_Index++] << 24) - | (m_Data[m_Index++] << 16) - | (m_Data[m_Index++] << 8) - | m_Data[m_Index++]; + return (Buffer[m_Index++] << 24) + | (Buffer[m_Index++] << 16) + | (Buffer[m_Index++] << 8) + | Buffer[m_Index++]; } public short ReadInt16() { - if ( (m_Index + 2) > m_Size ) + if ( (m_Index + 2) > Size ) return 0; - return (short)((m_Data[m_Index++] << 8) | m_Data[m_Index++]); + return (short)((Buffer[m_Index++] << 8) | Buffer[m_Index++]); } public byte ReadByte() { - if ( (m_Index + 1) > m_Size ) + if ( (m_Index + 1) > Size ) return 0; - return m_Data[m_Index++]; + return Buffer[m_Index++]; } public uint ReadUInt32() { - if ( (m_Index + 4) > m_Size ) + if ( (m_Index + 4) > Size ) return 0; - return (uint)((m_Data[m_Index++] << 24) | (m_Data[m_Index++] << 16) | (m_Data[m_Index++] << 8) | m_Data[m_Index++]); + return (uint)((Buffer[m_Index++] << 24) | (Buffer[m_Index++] << 16) | (Buffer[m_Index++] << 8) | Buffer[m_Index++]); } public ushort ReadUInt16() { - if ( (m_Index + 2) > m_Size ) + if ( (m_Index + 2) > Size ) return 0; - return (ushort)((m_Data[m_Index++] << 8) | m_Data[m_Index++]); + return (ushort)((Buffer[m_Index++] << 8) | Buffer[m_Index++]); } public sbyte ReadSByte() { - if ( (m_Index + 1) > m_Size ) + if ( (m_Index + 1) > Size ) return 0; - return (sbyte)m_Data[m_Index++]; + return (sbyte)Buffer[m_Index++]; } public bool ReadBoolean() { - if ( (m_Index + 1) > m_Size ) + if ( (m_Index + 1) > Size ) return false; - return ( m_Data[m_Index++] != 0 ); + return ( Buffer[m_Index++] != 0 ); } public string ReadUnicodeStringLE() @@ -141,7 +139,7 @@ namespace Server.Network int c; - while ( (m_Index + 1) < m_Size && (c = (m_Data[m_Index++] | (m_Data[m_Index++] << 8))) != 0 ) + while ( (m_Index + 1) < Size && (c = (Buffer[m_Index++] | (Buffer[m_Index++] << 8))) != 0 ) sb.Append( (char)c ); return sb.ToString(); @@ -152,14 +150,14 @@ namespace Server.Network int bound = m_Index + (fixedLength << 1); int end = bound; - if ( bound > m_Size ) - bound = m_Size; + if ( bound > Size ) + bound = Size; StringBuilder sb = new StringBuilder(); int c; - while ( (m_Index + 1) < bound && (c = (m_Data[m_Index++] | (m_Data[m_Index++] << 8))) != 0 ) + while ( (m_Index + 1) < bound && (c = (Buffer[m_Index++] | (Buffer[m_Index++] << 8))) != 0 ) { if ( IsSafeChar( c ) ) sb.Append( (char)c ); @@ -176,7 +174,7 @@ namespace Server.Network int c; - while ( (m_Index + 1) < m_Size && (c = (m_Data[m_Index++] | (m_Data[m_Index++] << 8))) != 0 ) + while ( (m_Index + 1) < Size && (c = (Buffer[m_Index++] | (Buffer[m_Index++] << 8))) != 0 ) { if ( IsSafeChar( c ) ) sb.Append( (char)c ); @@ -191,7 +189,7 @@ namespace Server.Network int c; - while ( (m_Index + 1) < m_Size && (c = ((m_Data[m_Index++] << 8) | m_Data[m_Index++])) != 0 ) + while ( (m_Index + 1) < Size && (c = ((Buffer[m_Index++] << 8) | Buffer[m_Index++])) != 0 ) { if ( IsSafeChar( c ) ) sb.Append( (char)c ); @@ -206,7 +204,7 @@ namespace Server.Network int c; - while ( (m_Index + 1) < m_Size && (c = ((m_Data[m_Index++] << 8) | m_Data[m_Index++])) != 0 ) + while ( (m_Index + 1) < Size && (c = ((Buffer[m_Index++] << 8) | Buffer[m_Index++])) != 0 ) sb.Append( (char)c ); return sb.ToString(); @@ -219,7 +217,7 @@ namespace Server.Network public string ReadUTF8StringSafe( int fixedLength ) { - if ( m_Index >= m_Size ) + if ( m_Index >= Size ) { m_Index += fixedLength; return string.Empty; @@ -228,14 +226,14 @@ namespace Server.Network int bound = m_Index + fixedLength; //int end = bound; - if ( bound > m_Size ) - bound = m_Size; + if ( bound > Size ) + bound = Size; int count = 0; int index = m_Index; int start = m_Index; - while ( index < bound && m_Data[index++] != 0 ) + while ( index < bound && Buffer[index++] != 0 ) ++count; index = 0; @@ -243,7 +241,7 @@ namespace Server.Network byte[] buffer = new byte[count]; int value = 0; - while ( m_Index < bound && (value = m_Data[m_Index++]) != 0 ) + while ( m_Index < bound && (value = Buffer[m_Index++]) != 0 ) buffer[index++] = (byte)value; string s = Utility.UTF8.GetString( buffer ); @@ -269,13 +267,13 @@ namespace Server.Network public string ReadUTF8StringSafe() { - if ( m_Index >= m_Size ) + if ( m_Index >= Size ) return string.Empty; int count = 0; int index = m_Index; - while ( index < m_Size && m_Data[index++] != 0 ) + while ( index < Size && Buffer[index++] != 0 ) ++count; index = 0; @@ -283,7 +281,7 @@ namespace Server.Network byte[] buffer = new byte[count]; int value = 0; - while ( m_Index < m_Size && (value = m_Data[m_Index++]) != 0 ) + while ( m_Index < Size && (value = Buffer[m_Index++]) != 0 ) buffer[index++] = (byte)value; string s = Utility.UTF8.GetString( buffer ); @@ -309,13 +307,13 @@ namespace Server.Network public string ReadUTF8String() { - if ( m_Index >= m_Size ) + if ( m_Index >= Size ) return string.Empty; int count = 0; int index = m_Index; - while ( index < m_Size && m_Data[index++] != 0 ) + while ( index < Size && Buffer[index++] != 0 ) ++count; index = 0; @@ -323,7 +321,7 @@ namespace Server.Network byte[] buffer = new byte[count]; int value = 0; - while ( m_Index < m_Size && (value = m_Data[m_Index++]) != 0 ) + while ( m_Index < Size && (value = Buffer[m_Index++]) != 0 ) buffer[index++] = (byte)value; return Utility.UTF8.GetString( buffer ); @@ -335,7 +333,7 @@ namespace Server.Network int c; - while ( m_Index < m_Size && (c = m_Data[m_Index++]) != 0 ) + while ( m_Index < Size && (c = Buffer[m_Index++]) != 0 ) sb.Append( (char)c ); return sb.ToString(); @@ -347,7 +345,7 @@ namespace Server.Network int c; - while ( m_Index < m_Size && (c = m_Data[m_Index++]) != 0 ) + while ( m_Index < Size && (c = Buffer[m_Index++]) != 0 ) { if ( IsSafeChar( c ) ) sb.Append( (char)c ); @@ -361,14 +359,14 @@ namespace Server.Network int bound = m_Index + (fixedLength << 1); int end = bound; - if ( bound > m_Size ) - bound = m_Size; + if ( bound > Size ) + bound = Size; StringBuilder sb = new StringBuilder(); int c; - while ( (m_Index + 1) < bound && (c = ((m_Data[m_Index++] << 8) | m_Data[m_Index++])) != 0 ) + while ( (m_Index + 1) < bound && (c = ((Buffer[m_Index++] << 8) | Buffer[m_Index++])) != 0 ) { if ( IsSafeChar( c ) ) sb.Append( (char)c ); @@ -384,14 +382,14 @@ namespace Server.Network int bound = m_Index + (fixedLength << 1); int end = bound; - if ( bound > m_Size ) - bound = m_Size; + if ( bound > Size ) + bound = Size; StringBuilder sb = new StringBuilder(); int c; - while ( (m_Index + 1) < bound && (c = ((m_Data[m_Index++] << 8) | m_Data[m_Index++])) != 0 ) + while ( (m_Index + 1) < bound && (c = ((Buffer[m_Index++] << 8) | Buffer[m_Index++])) != 0 ) sb.Append( (char)c ); m_Index = end; @@ -404,14 +402,14 @@ namespace Server.Network int bound = m_Index + fixedLength; int end = bound; - if ( bound > m_Size ) - bound = m_Size; + if ( bound > Size ) + bound = Size; StringBuilder sb = new StringBuilder(); int c; - while ( m_Index < bound && (c = m_Data[m_Index++]) != 0 ) + while ( m_Index < bound && (c = Buffer[m_Index++]) != 0 ) { if ( IsSafeChar( c ) ) sb.Append( (char)c ); @@ -427,14 +425,14 @@ namespace Server.Network int bound = m_Index + fixedLength; int end = bound; - if ( bound > m_Size ) - bound = m_Size; + if ( bound > Size ) + bound = Size; StringBuilder sb = new StringBuilder(); int c; - while ( m_Index < bound && (c = m_Data[m_Index++]) != 0 ) + while ( m_Index < bound && (c = Buffer[m_Index++]) != 0 ) sb.Append( (char)c ); m_Index = end; diff --git a/Server/Network/Packets.cs b/Server/Network/Packets.cs index 275a3f124..d9bab22da 100644 --- a/Server/Network/Packets.cs +++ b/Server/Network/Packets.cs @@ -477,12 +477,9 @@ namespace Server.Network public class EquipInfoAttribute { - private int m_Number; - private int m_Charges; + public int Number { get; } - public int Number => m_Number; - - public int Charges => m_Charges; + public int Charges { get; } public EquipInfoAttribute( int number ) : this( number, -1 ) { @@ -490,32 +487,27 @@ namespace Server.Network public EquipInfoAttribute( int number, int charges ) { - m_Number = number; - m_Charges = charges; + Number = number; + Charges = charges; } } public class EquipmentInfo { - private int m_Number; - private Mobile m_Crafter; - private bool m_Unidentified; - private EquipInfoAttribute[] m_Attributes; + public int Number { get; } - public int Number => m_Number; + public Mobile Crafter { get; } - public Mobile Crafter => m_Crafter; + public bool Unidentified { get; } - public bool Unidentified => m_Unidentified; - - public EquipInfoAttribute[] Attributes => m_Attributes; + public EquipInfoAttribute[] Attributes { get; } public EquipmentInfo( int number, Mobile crafter, bool unidentified, EquipInfoAttribute[] attributes ) { - m_Number = number; - m_Crafter = crafter; - m_Unidentified = unidentified; - m_Attributes = attributes; + Number = number; + Crafter = crafter; + Unidentified = unidentified; + Attributes = attributes; } } @@ -2353,14 +2345,9 @@ namespace Server.Network public sealed class DisplayGumpPacked : Packet, IGumpWriter { - private int m_TextEntries, m_Switches; + public int TextEntries { get; set; } - public int TextEntries { get => m_TextEntries; - set => m_TextEntries = value; - } - public int Switches { get => m_Switches; - set => m_Switches = value; - } + public int Switches { get; set; } private Gump m_Gump; @@ -2507,16 +2494,11 @@ namespace Server.Network public sealed class DisplayGumpFast : Packet, IGumpWriter { - private int m_TextEntries, m_Switches; - private int m_LayoutLength; - public int TextEntries{ get => m_TextEntries; - set => m_TextEntries = value; - } - public int Switches{ get => m_Switches; - set => m_Switches = value; - } + public int TextEntries { get; set; } + + public int Switches { get; set; } public DisplayGumpFast( Gump g ) : base( 0xB0 ) { @@ -2799,11 +2781,7 @@ namespace Server.Network public sealed class SupportedFeatures : Packet { - private static FeatureFlags m_AdditionalFlags; - - public static FeatureFlags Value{ get => m_AdditionalFlags; - set => m_AdditionalFlags = value; - } + public static FeatureFlags Value { get; set; } public static SupportedFeatures Instantiate( NetState ns ) { @@ -2814,7 +2792,7 @@ namespace Server.Network { FeatureFlags flags = ExpansionInfo.CoreExpansion.SupportedFeatures; - flags |= m_AdditionalFlags; + flags |= Value; if ( ns.Account is IAccount acct && acct.Limit >= 6 ) { @@ -2837,27 +2815,16 @@ namespace Server.Network public static class AttributeNormalizer { - private static int m_Maximum = 25; - private static bool m_Enabled = true; + public static int Maximum { get; set; } = 25; - public static int Maximum - { - get => m_Maximum; - set => m_Maximum = value; - } - - public static bool Enabled - { - get => m_Enabled; - set => m_Enabled = value; - } + public static bool Enabled { get; set; } = true; public static void Write( PacketWriter stream, int cur, int max ) { - if ( m_Enabled && max != 0 ) + if ( Enabled && max != 0 ) { - stream.Write( (short) m_Maximum ); - stream.Write( (short) ((cur * m_Maximum) / max) ); + stream.Write( (short) Maximum ); + stream.Write( (short) ((cur * Maximum) / max) ); } else { @@ -2868,10 +2835,10 @@ namespace Server.Network public static void WriteReverse( PacketWriter stream, int cur, int max ) { - if ( m_Enabled && max != 0 ) + if ( Enabled && max != 0 ) { - stream.Write( (short) ((cur * m_Maximum) / max) ); - stream.Write( (short) m_Maximum ); + stream.Write( (short) ((cur * Maximum) / max) ); + stream.Write( (short) Maximum ); } else { @@ -3857,19 +3824,15 @@ namespace Server.Network public sealed class CityInfo { - private string m_City; - private string m_Building; - private int m_Description; private Point3D m_Location; - private Map m_Map; public CityInfo( string city, string building, int description, int x, int y, int z, Map m ) { - m_City = city; - m_Building = building; - m_Description = description; + City = city; + Building = building; + Description = description; m_Location = new Point3D( x, y, z ); - m_Map = m; + Map = m; } public CityInfo( string city, string building, int x, int y, int z, Map m ) : this( city, building, 0, x, y, z, m ) @@ -3884,23 +3847,11 @@ namespace Server.Network { } - public string City - { - get => m_City; - set => m_City = value; - } + public string City { get; set; } - public string Building - { - get => m_Building; - set => m_Building = value; - } + public string Building { get; set; } - public int Description - { - get => m_Description; - set => m_Description = value; - } + public int Description { get; set; } public int X { @@ -3926,11 +3877,7 @@ namespace Server.Network set => m_Location = value; } - public Map Map - { - get => m_Map; - set => m_Map = value; - } + public Map Map { get; set; } } public sealed class CharacterListUpdate : Packet @@ -4011,9 +3958,7 @@ namespace Server.Network public static class FeatureProtection { - private static ThirdPartyFeature m_Disabled = 0; - - public static ThirdPartyFeature DisabledFeatures => m_Disabled; + public static ThirdPartyFeature DisabledFeatures { get; private set; } = 0; public static void Disable( ThirdPartyFeature feature ) { @@ -4028,9 +3973,9 @@ namespace Server.Network public static void SetDisabled( ThirdPartyFeature feature, bool value ) { if ( value ) - m_Disabled |= feature; + DisabledFeatures |= feature; else - m_Disabled &= ~feature; + DisabledFeatures &= ~feature; } } @@ -4091,7 +4036,7 @@ namespace Server.Network else if ( a.Limit == 1 ) flags |= (CharacterListFlags.SlotLimit & CharacterListFlags.OneCharacterSlot); // Limit Characters & One Character - m_Stream.Write( (int)(flags | m_AdditionalFlags) ); // Additional Flags + m_Stream.Write( (int)(flags | AdditionalFlags) ); // Additional Flags m_Stream.Write( (short) -1 ); @@ -4126,13 +4071,7 @@ namespace Server.Network private static System.Security.Cryptography.MD5CryptoServiceProvider m_MD5Provider; - private static CharacterListFlags m_AdditionalFlags; - - public static CharacterListFlags AdditionalFlags - { - get => m_AdditionalFlags; - set => m_AdditionalFlags = value; - } + public static CharacterListFlags AdditionalFlags { get; set; } } public sealed class CharacterListOld : Packet @@ -4285,41 +4224,20 @@ namespace Server.Network public sealed class ServerInfo { - private string m_Name; - private int m_FullPercent; - private int m_TimeZone; - private IPEndPoint m_Address; + public string Name { get; set; } - public string Name - { - get => m_Name; - set => m_Name = value; - } + public int FullPercent { get; set; } - public int FullPercent - { - get => m_FullPercent; - set => m_FullPercent = value; - } + public int TimeZone { get; set; } - public int TimeZone - { - get => m_TimeZone; - set => m_TimeZone = value; - } - - public IPEndPoint Address - { - get => m_Address; - set => m_Address = value; - } + public IPEndPoint Address { get; set; } public ServerInfo( string name, int fullPercent, TimeZone tz, IPEndPoint address ) { - m_Name = name; - m_FullPercent = fullPercent; - m_TimeZone = tz.GetUtcOffset( DateTime.Now ).Hours; - m_Address = address; + Name = name; + FullPercent = fullPercent; + TimeZone = tz.GetUtcOffset( DateTime.Now ).Hours; + Address = address; } } @@ -4413,15 +4331,14 @@ namespace Server.Network } protected PacketWriter m_Stream; - private int m_PacketID; private int m_Length; private State m_State; - public int PacketID => m_PacketID; + public int PacketID { get; } protected Packet( int packetID ) { - m_PacketID = packetID; + PacketID = packetID; if (Core.Profiling) { PacketSendProfile prof = PacketSendProfile.Acquire( GetType() ); @@ -4432,13 +4349,13 @@ namespace Server.Network public void EnsureCapacity( int length ) { m_Stream = PacketWriter.CreateInstance( length );// new PacketWriter( length ); - m_Stream.Write( (byte) m_PacketID ); + m_Stream.Write( (byte) PacketID ); m_Stream.Write( (short) 0 ); } protected Packet( int packetID, int length ) { - m_PacketID = packetID; + PacketID = packetID; m_Length = length; m_Stream = PacketWriter.CreateInstance( length );// new PacketWriter( length ); @@ -4609,7 +4526,7 @@ namespace Server.Network { int diff = (int)m_Stream.Length - m_Length; - Console.WriteLine( "Packet: 0x{0:X2}: Bad packet length! ({1}{2} bytes)", m_PacketID, diff >= 0 ? "+" : "", diff ); + Console.WriteLine( "Packet: 0x{0:X2}: Bad packet length! ({1}{2} bytes)", PacketID, diff >= 0 ? "+" : "", diff ); } MemoryStream ms = m_Stream.UnderlyingStream; @@ -4625,10 +4542,10 @@ namespace Server.Network Compression.Compress(m_CompiledBuffer, 0, length, buffer, ref length); if (length <= 0) { - Console.WriteLine("Warning: Compression buffer overflowed on packet 0x{0:X2} ('{1}') (length={2})", m_PacketID, GetType().Name, length); + Console.WriteLine("Warning: Compression buffer overflowed on packet 0x{0:X2} ('{1}') (length={2})", PacketID, GetType().Name, length); using (StreamWriter op = new StreamWriter("compression_overflow.log", true)) { - op.WriteLine("{0} Warning: Compression buffer overflowed on packet 0x{1:X2} ('{2}') (length={3})", DateTime.UtcNow, m_PacketID, GetType().Name, length); + op.WriteLine("{0} Warning: Compression buffer overflowed on packet 0x{1:X2} ('{2}') (length={3})", DateTime.UtcNow, PacketID, GetType().Name, length); op.WriteLine(new System.Diagnostics.StackTrace()); } } else { diff --git a/Server/Network/SendQueue.cs b/Server/Network/SendQueue.cs index 127d160ab..d5a24f166 100644 --- a/Server/Network/SendQueue.cs +++ b/Server/Network/SendQueue.cs @@ -36,23 +36,20 @@ namespace Server.Network { gram = new Gram(); } - gram._buffer = AcquireBuffer(); - gram._length = 0; + gram.Buffer = AcquireBuffer(); + gram.Length = 0; return gram; } } - private byte[] _buffer; - private int _length; + public byte[] Buffer { get; private set; } - public byte[] Buffer => _buffer; + public int Length { get; private set; } - public int Length => _length; + public int Available => ( Buffer.Length - Length ); - public int Available => ( _buffer.Length - _length ); - - public bool IsFull => ( _length == _buffer.Length ); + public bool IsFull => ( Length == Buffer.Length ); private Gram() { } @@ -60,9 +57,9 @@ namespace Server.Network { public int Write( byte[] buffer, int offset, int length ) { int write = Math.Min( length, Available ); - System.Buffer.BlockCopy( buffer, offset, _buffer, _length, write ); + System.Buffer.BlockCopy( buffer, offset, Buffer, Length, write ); - _length += write; + Length += write; return write; } @@ -70,7 +67,7 @@ namespace Server.Network { public void Release() { lock ( _pool ) { _pool.Push( this ); - ReleaseBuffer( _buffer ); + ReleaseBuffer( Buffer ); } } } diff --git a/Server/Notoriety.cs b/Server/Notoriety.cs index 0ef104ff6..f310b3884 100644 --- a/Server/Notoriety.cs +++ b/Server/Notoriety.cs @@ -32,42 +32,31 @@ namespace Server public const int Murderer = 6; public const int Invulnerable = 7; - private static NotorietyHandler m_Handler; + public static NotorietyHandler Handler { get; set; } - public static NotorietyHandler Handler + public static int[] Hues { get; set; } = { - get => m_Handler; - set => m_Handler = value; - } - - private static int[] m_Hues = { - 0x000, - 0x059, - 0x03F, - 0x3B2, - 0x3B2, - 0x090, - 0x022, - 0x035 - }; - - public static int[] Hues - { - get => m_Hues; - set => m_Hues = value; - } + 0x000, + 0x059, + 0x03F, + 0x3B2, + 0x3B2, + 0x090, + 0x022, + 0x035 + }; public static int GetHue( int noto ) { - if ( noto < 0 || noto >= m_Hues.Length ) + if ( noto < 0 || noto >= Hues.Length ) return 0; - return m_Hues[noto]; + return Hues[noto]; } public static int Compute( Mobile source, Mobile target ) { - return m_Handler?.Invoke( source, target ) ?? CanBeAttacked; + return Handler?.Invoke( source, target ) ?? CanBeAttacked; } } } \ No newline at end of file diff --git a/Server/ObjectPropertyList.cs b/Server/ObjectPropertyList.cs index 52c4bd096..552102b08 100644 --- a/Server/ObjectPropertyList.cs +++ b/Server/ObjectPropertyList.cs @@ -26,33 +26,24 @@ namespace Server { public sealed class ObjectPropertyList : Packet { - private IEntity m_Entity; private int m_Hash; - private int m_Header; private int m_Strings; - private string m_HeaderArgs; - public IEntity Entity => m_Entity; + public IEntity Entity { get; } + public int Hash => 0x40000000 + m_Hash; - public int Header{ get => m_Header; - set => m_Header = value; - } - public string HeaderArgs{ get => m_HeaderArgs; - set => m_HeaderArgs = value; - } + public int Header { get; set; } - private static bool m_Enabled; + public string HeaderArgs { get; set; } - public static bool Enabled{ get => m_Enabled; - set => m_Enabled = value; - } + public static bool Enabled { get; set; } public ObjectPropertyList( IEntity e ) : base( 0xD6 ) { EnsureCapacity( 128 ); - m_Entity = e; + Entity = e; m_Stream.Write( (short) 1 ); m_Stream.Write( (int) e.Serial ); @@ -68,10 +59,10 @@ namespace Server AddHash( number ); - if ( m_Header == 0 ) + if ( Header == 0 ) { - m_Header = number; - m_HeaderArgs = ""; + Header = number; + HeaderArgs = ""; } m_Stream.Write( number ); @@ -103,10 +94,10 @@ namespace Server if ( arguments == null ) arguments = ""; - if ( m_Header == 0 ) + if ( Header == 0 ) { - m_Header = number; - m_HeaderArgs = arguments; + Header = number; + HeaderArgs = arguments; } AddHash( number ); diff --git a/Server/Party.cs b/Server/Party.cs index 6605324fd..0bac2a1bb 100644 --- a/Server/Party.cs +++ b/Server/Party.cs @@ -22,11 +22,7 @@ namespace Server { public abstract class PartyCommands { - private static PartyCommands m_Handler; - - public static PartyCommands Handler{ get => m_Handler; - set => m_Handler = value; - } + public static PartyCommands Handler { get; set; } public abstract void OnAdd( Mobile from ); public abstract void OnRemove( Mobile from, Mobile target ); diff --git a/Server/Persistence/FileOperations.cs b/Server/Persistence/FileOperations.cs index a24d1f5e2..7f7c08b94 100644 --- a/Server/Persistence/FileOperations.cs +++ b/Server/Persistence/FileOperations.cs @@ -40,44 +40,30 @@ namespace Server { } #endif - private static int bufferSize = 1 * MB; - private static int concurrency = 1; + public static int BufferSize { get; set; } = 1 * MB; - private static bool unbuffered = true; + public static int Concurrency { get; set; } = 1; - public static int BufferSize { - get => bufferSize; - set => bufferSize = value; - } + public static bool Unbuffered { get; set; } = true; - public static int Concurrency { - get => concurrency; - set => concurrency = value; - } + public static bool AreSynchronous => ( Concurrency < 1 ); - public static bool Unbuffered { - get => unbuffered; - set => unbuffered = value; - } - - public static bool AreSynchronous => ( concurrency < 1 ); - - public static bool AreAsynchronous => ( concurrency > 0 ); + public static bool AreAsynchronous => ( Concurrency > 0 ); public static FileStream OpenSequentialStream( string path, FileMode mode, FileAccess access, FileShare share ) { FileOptions options = FileOptions.SequentialScan; - if ( concurrency > 0 ) { + if ( Concurrency > 0 ) { options |= FileOptions.Asynchronous; } #if MONO return new FileStream( path, mode, access, share, bufferSize, options ); #else - if ( unbuffered ) { + if ( Unbuffered ) { options |= NoBuffering; } else { - return new FileStream( path, mode, access, share, bufferSize, options ); + return new FileStream( path, mode, access, share, BufferSize, options ); } SafeFileHandle fileHandle = UnsafeNativeMethods.CreateFile(path, (int)access, share, IntPtr.Zero, mode, (int)options, IntPtr.Zero); @@ -86,7 +72,7 @@ namespace Server { throw new IOException(); } - return new UnbufferedFileStream( fileHandle, access, bufferSize, ( concurrency > 0 ) ); + return new UnbufferedFileStream( fileHandle, access, BufferSize, ( Concurrency > 0 ) ); #endif } @@ -100,11 +86,11 @@ namespace Server { } public override void Write( byte[] array, int offset, int count ) { - base.Write( array, offset, bufferSize ); + base.Write( array, offset, BufferSize ); } public override IAsyncResult BeginWrite( byte[] array, int offset, int numBytes, AsyncCallback userCallback, object stateObject ) { - return base.BeginWrite( array, offset, bufferSize, userCallback, stateObject ); + return base.BeginWrite( array, offset, BufferSize, userCallback, stateObject ); } protected override void Dispose( bool disposing ) { diff --git a/Server/Persistence/FileQueue.cs b/Server/Persistence/FileQueue.cs index 0c6862226..f9787bfa3 100644 --- a/Server/Persistence/FileQueue.cs +++ b/Server/Persistence/FileQueue.cs @@ -31,23 +31,21 @@ namespace Server { private FileQueue owner; private int slot; - private byte[] buffer; private int offset; - private int size; - public byte[] Buffer => buffer; + public byte[] Buffer { get; } public int Offset => 0; - public int Size => size; + public int Size { get; } public Chunk( FileQueue owner, int slot, byte[] buffer, int offset, int size ) { this.owner = owner; this.slot = slot; - this.buffer = buffer; + this.Buffer = buffer; this.offset = offset; - this.size = size; + this.Size = size; } public void Commit() { @@ -80,9 +78,7 @@ namespace Server { private ManualResetEvent idle; - private long position; - - public long Position => position; + public long Position { get; private set; } public FileQueue( int concurrentWrites, FileCommitCallback callback ) { if ( concurrentWrites < 1 ) { @@ -209,7 +205,7 @@ namespace Server { throw new ArgumentException(); } - position += size; + Position += size; while ( size > 0 ) { if ( buffered.buffer == null ) { // nothing yet buffered diff --git a/Server/Persistence/StandardSaveStrategy.cs b/Server/Persistence/StandardSaveStrategy.cs index 35405af49..2356427f5 100644 --- a/Server/Persistence/StandardSaveStrategy.cs +++ b/Server/Persistence/StandardSaveStrategy.cs @@ -35,21 +35,18 @@ namespace Server { public override string Name => "Standard"; private Queue _decayQueue; - private bool _permitBackgroundWrite; public StandardSaveStrategy() { _decayQueue = new Queue(); } - protected bool PermitBackgroundWrite { get => _permitBackgroundWrite; - set => _permitBackgroundWrite = value; - } + protected bool PermitBackgroundWrite { get; set; } - protected bool UseSequentialWriters => (SaveType == SaveOption.Normal || !_permitBackgroundWrite); + protected bool UseSequentialWriters => (SaveType == SaveOption.Normal || !PermitBackgroundWrite); public override void Save(SaveMetrics metrics, bool permitBackgroundWrite) { - _permitBackgroundWrite = permitBackgroundWrite; + PermitBackgroundWrite = permitBackgroundWrite; SaveMobiles(metrics); SaveItems(metrics); diff --git a/Server/Point3DList.cs b/Server/Point3DList.cs index a9f4e8028..2309c04de 100644 --- a/Server/Point3DList.cs +++ b/Server/Point3DList.cs @@ -23,28 +23,27 @@ namespace Server public class Point3DList { private Point3D[] m_List; - private int m_Count; public Point3DList() { m_List = new Point3D[8]; - m_Count = 0; + Count = 0; } - public int Count => m_Count; + public int Count { get; private set; } public void Clear() { - m_Count = 0; + Count = 0; } - public Point3D Last => m_List[m_Count - 1]; + public Point3D Last => m_List[Count - 1]; public Point3D this[int index] => m_List[index]; public void Add( int x, int y, int z ) { - if ( (m_Count + 1) > m_List.Length ) + if ( (Count + 1) > m_List.Length ) { Point3D[] old = m_List; m_List = new Point3D[old.Length * 2]; @@ -53,15 +52,15 @@ namespace Server m_List[i] = old[i]; } - m_List[m_Count].m_X = x; - m_List[m_Count].m_Y = y; - m_List[m_Count].m_Z = z; - ++m_Count; + m_List[Count].m_X = x; + m_List[Count].m_Y = y; + m_List[Count].m_Z = z; + ++Count; } public void Add( Point3D p ) { - if ( (m_Count + 1) > m_List.Length ) + if ( (Count + 1) > m_List.Length ) { Point3D[] old = m_List; m_List = new Point3D[old.Length * 2]; @@ -70,25 +69,25 @@ namespace Server m_List[i] = old[i]; } - m_List[m_Count].m_X = p.m_X; - m_List[m_Count].m_Y = p.m_Y; - m_List[m_Count].m_Z = p.m_Z; - ++m_Count; + m_List[Count].m_X = p.m_X; + m_List[Count].m_Y = p.m_Y; + m_List[Count].m_Z = p.m_Z; + ++Count; } private static Point3D[] m_EmptyList = new Point3D[0]; public Point3D[] ToArray() { - if ( m_Count == 0 ) + if ( Count == 0 ) return m_EmptyList; - Point3D[] list = new Point3D[m_Count]; + Point3D[] list = new Point3D[Count]; - for ( int i = 0; i < m_Count; ++i ) + for ( int i = 0; i < Count; ++i ) list[i] = m_List[i]; - m_Count = 0; + Count = 0; return list; } diff --git a/Server/Poison.cs b/Server/Poison.cs index 98f6ad696..4b9879a07 100644 --- a/Server/Poison.cs +++ b/Server/Poison.cs @@ -39,21 +39,19 @@ namespace Server } - private static List m_Poisons = new List(); - - public static void Register( Poison reg ) + public static void Register( Poison reg ) { string regName = reg.Name.ToLower(); - for ( int i = 0; i < m_Poisons.Count; i++ ) + for ( int i = 0; i < Poisons.Count; i++ ) { - if ( reg.Level == m_Poisons[i].Level ) + if ( reg.Level == Poisons[i].Level ) throw new Exception( "A poison with that level already exists." ); - if ( regName == m_Poisons[i].Name.ToLower() ) + if ( regName == Poisons[i].Name.ToLower() ) throw new Exception( "A poison with that name already exists." ); } - m_Poisons.Add( reg ); + Poisons.Add( reg ); } public static Poison Lesser => GetPoison( "Lesser" ); @@ -62,7 +60,7 @@ namespace Server public static Poison Deadly => GetPoison( "Deadly" ); public static Poison Lethal => GetPoison( "Lethal" ); - public static List Poisons => m_Poisons; + public static List Poisons { get; } = new List(); public static Poison Parse( string value ) { @@ -81,9 +79,9 @@ namespace Server public static Poison GetPoison( int level ) { - for ( int i = 0; i < m_Poisons.Count; ++i ) + for ( int i = 0; i < Poisons.Count; ++i ) { - Poison p = m_Poisons[i]; + Poison p = Poisons[i]; if ( p.Level == level ) return p; @@ -94,9 +92,9 @@ namespace Server public static Poison GetPoison( string name ) { - for ( int i = 0; i < m_Poisons.Count; ++i ) + for ( int i = 0; i < Poisons.Count; ++i ) { - Poison p = m_Poisons[i]; + Poison p = Poisons[i]; if ( Utility.InsensitiveCompare( p.Name, name ) == 0 ) return p; diff --git a/Server/Prompt.cs b/Server/Prompt.cs index 51cf17d89..eb975c9e9 100644 --- a/Server/Prompt.cs +++ b/Server/Prompt.cs @@ -22,17 +22,16 @@ namespace Server.Prompts { public abstract class Prompt { - private int m_Serial; private static int m_Serials; - public int Serial => m_Serial; + public int Serial { get; } protected Prompt() { do { - m_Serial = ++m_Serials; - } while ( m_Serial == 0 ); + Serial = ++m_Serials; + } while ( Serial == 0 ); } public virtual void OnCancel( Mobile from ) diff --git a/Server/QuestArrow.cs b/Server/QuestArrow.cs index c8f47e069..e83d1e4d4 100644 --- a/Server/QuestArrow.cs +++ b/Server/QuestArrow.cs @@ -24,59 +24,55 @@ namespace Server { public class QuestArrow { - private Mobile m_Mobile; - private Mobile m_Target; - private bool m_Running; + public Mobile Mobile { get; } - public Mobile Mobile => m_Mobile; + public Mobile Target { get; } - public Mobile Target => m_Target; - - public bool Running => m_Running; + public bool Running { get; private set; } public void Update() { - Update( m_Target.X, m_Target.Y ); + Update( Target.X, Target.Y ); } public void Update( int x, int y ) { - if ( !m_Running ) + if ( !Running ) return; - NetState ns = m_Mobile.NetState; + NetState ns = Mobile.NetState; if ( ns == null ) return; if ( ns.HighSeas ) - ns.Send( new SetArrowHS( x, y, m_Target.Serial ) ); + ns.Send( new SetArrowHS( x, y, Target.Serial ) ); else ns.Send( new SetArrow( x, y ) ); } public void Stop() { - Stop( m_Target.X, m_Target.Y ); + Stop( Target.X, Target.Y ); } public void Stop( int x, int y ) { - if ( !m_Running ) + if ( !Running ) return; - m_Mobile.ClearQuestArrow(); + Mobile.ClearQuestArrow(); - NetState ns = m_Mobile.NetState; + NetState ns = Mobile.NetState; if ( ns != null ) { if ( ns.HighSeas ) - ns.Send( new CancelArrowHS( x, y, m_Target.Serial ) ); + ns.Send( new CancelArrowHS( x, y, Target.Serial ) ); else ns.Send( new CancelArrow() ); } - m_Running = false; + Running = false; OnStop(); } @@ -90,9 +86,9 @@ namespace Server public QuestArrow( Mobile m, Mobile t ) { - m_Running = true; - m_Mobile = m; - m_Target = t; + Running = true; + Mobile = m; + Target = t; } public QuestArrow( Mobile m, Mobile t, int x, int y ) : this( m, t ) diff --git a/Server/Race.cs b/Server/Race.cs index 8a35e4fde..c5ece6643 100644 --- a/Server/Race.cs +++ b/Server/Race.cs @@ -26,23 +26,15 @@ namespace Server [Parsable] public abstract class Race { - public static Race DefaultRace => m_Races[0]; + public static Race DefaultRace => Races[0]; - private static Race[] m_Races = new Race[0x100]; + public static Race[] Races { get; } = new Race[0x100]; - public static Race[] Races => m_Races; + public static Race Human => Races[0]; + public static Race Elf => Races[1]; + public static Race Gargoyle => Races[2]; - public static Race Human => m_Races[0]; - public static Race Elf => m_Races[1]; - public static Race Gargoyle => m_Races[2]; - - private static List m_AllRaces = new List(); - - public static List AllRaces => m_AllRaces; - - private int m_RaceID, m_RaceIndex; - - private string m_Name, m_PluralName; + public static List AllRaces { get; } = new List(); private static string[] m_RaceNames; private static Race[] m_RaceValues; @@ -72,8 +64,8 @@ namespace Server int index; if ( int.TryParse( value, out index ) ) { - if ( index >= 0 && index < m_Races.Length && m_Races[index] != null ) - return m_Races[index]; + if ( index >= 0 && index < Races.Length && Races[index] != null ) + return Races[index]; } throw new ArgumentException( "Invalid race name" ); @@ -81,15 +73,15 @@ namespace Server private static void CheckNamesAndValues() { - if ( m_RaceNames != null && m_RaceNames.Length == m_AllRaces.Count ) + if ( m_RaceNames != null && m_RaceNames.Length == AllRaces.Count ) return; - m_RaceNames = new string[m_AllRaces.Count]; - m_RaceValues = new Race[m_AllRaces.Count]; + m_RaceNames = new string[AllRaces.Count]; + m_RaceValues = new Race[AllRaces.Count]; - for( int i = 0; i < m_AllRaces.Count; ++i ) + for( int i = 0; i < AllRaces.Count; ++i ) { - Race race = m_AllRaces[i]; + Race race = AllRaces[i]; m_RaceNames[i] = race.Name; m_RaceValues[i] = race; @@ -98,35 +90,33 @@ namespace Server public override string ToString() { - return m_Name; + return Name; } - private int m_MaleBody, m_FemaleBody, m_MaleGhostBody, m_FemaleGhostBody; + public Expansion RequiredExpansion { get; } - private Expansion m_RequiredExpansion; + public int MaleBody { get; } - public Expansion RequiredExpansion => m_RequiredExpansion; + public int MaleGhostBody { get; } - public int MaleBody => m_MaleBody; - public int MaleGhostBody => m_MaleGhostBody; + public int FemaleBody { get; } - public int FemaleBody => m_FemaleBody; - public int FemaleGhostBody => m_FemaleGhostBody; + public int FemaleGhostBody { get; } protected Race( int raceID, int raceIndex, string name, string pluralName, int maleBody, int femaleBody, int maleGhostBody, int femaleGhostBody, Expansion requiredExpansion ) { - m_RaceID = raceID; - m_RaceIndex = raceIndex; + RaceID = raceID; + RaceIndex = raceIndex; - m_Name = name; + Name = name; - m_MaleBody = maleBody; - m_FemaleBody = femaleBody; - m_MaleGhostBody = maleGhostBody; - m_FemaleGhostBody = femaleGhostBody; + MaleBody = maleBody; + FemaleBody = femaleBody; + MaleGhostBody = maleGhostBody; + FemaleGhostBody = femaleGhostBody; - m_RequiredExpansion = requiredExpansion; - m_PluralName = pluralName; + RequiredExpansion = requiredExpansion; + PluralName = pluralName; } public virtual bool ValidateHair( Mobile m, int itemID ) { return ValidateHair( m.Female, itemID ); } @@ -158,29 +148,21 @@ namespace Server public virtual int AliveBody( Mobile m ) { return AliveBody( m.Female ); } public virtual int AliveBody( bool female ) { - return (female ? m_FemaleBody : m_MaleBody); + return (female ? FemaleBody : MaleBody); } public virtual int GhostBody( Mobile m ) { return GhostBody( m.Female ); } public virtual int GhostBody( bool female ) { - return (female ? m_FemaleGhostBody : m_MaleGhostBody); + return (female ? FemaleGhostBody : MaleGhostBody); } - public int RaceID => m_RaceID; + public int RaceID { get; } - public int RaceIndex => m_RaceIndex; + public int RaceIndex { get; } - public string Name - { - get => m_Name; - set => m_Name = value; - } + public string Name { get; set; } - public string PluralName - { - get => m_PluralName; - set => m_PluralName = value; - } + public string PluralName { get; set; } } } diff --git a/Server/Region.cs b/Server/Region.cs index 1301535a4..b54b67862 100644 --- a/Server/Region.cs +++ b/Server/Region.cs @@ -100,9 +100,7 @@ namespace Server public class Region : IComparable { - private static List m_Regions = new List(); - - public static List Regions => m_Regions; + public static List Regions { get; } = new List(); public static Region Find( Point3D p, Map map ) { @@ -123,20 +121,11 @@ namespace Server return map.DefaultRegion; } - private static Type m_DefaultRegionType = typeof( Region ); - public static Type DefaultRegionType{ get => m_DefaultRegionType; - set => m_DefaultRegionType = value; - } + public static Type DefaultRegionType { get; set; } = typeof( Region ); - private static TimeSpan m_StaffLogoutDelay = TimeSpan.Zero; - private static TimeSpan m_DefaultLogoutDelay = TimeSpan.FromMinutes( 5.0 ); + public static TimeSpan StaffLogoutDelay { get; set; } = TimeSpan.Zero; - public static TimeSpan StaffLogoutDelay{ get => m_StaffLogoutDelay; - set => m_StaffLogoutDelay = value; - } - public static TimeSpan DefaultLogoutDelay{ get => m_DefaultLogoutDelay; - set => m_DefaultLogoutDelay = value; - } + public static TimeSpan DefaultLogoutDelay { get; set; } = TimeSpan.FromMinutes( 5.0 ); public static readonly int DefaultPriority = 50; @@ -162,39 +151,35 @@ namespace Server private string m_Name; - private Map m_Map; - private Region m_Parent; - private List m_Children = new List(); - private Rectangle3D[] m_Area; - private Sector[] m_Sectors; - private bool m_Dynamic; private int m_Priority; - private int m_ChildLevel; - private bool m_Registered; private Point3D m_GoLocation; - private MusicName m_Music; public string Name => m_Name; - public Map Map => m_Map; - public Region Parent => m_Parent; - public List Children => m_Children; - public Rectangle3D[] Area => m_Area; - public Sector[] Sectors => m_Sectors; - public bool Dynamic => m_Dynamic; + public Map Map { get; } + + public Region Parent { get; } + + public List Children { get; } = new List(); + + public Rectangle3D[] Area { get; } + + public Sector[] Sectors { get; private set; } + + public bool Dynamic { get; } + public int Priority => m_Priority; - public int ChildLevel => m_ChildLevel; - public bool Registered => m_Registered; + public int ChildLevel { get; } + + public bool Registered { get; private set; } public Point3D GoLocation{ get => m_GoLocation; set => m_GoLocation = value; } - public MusicName Music{ get => m_Music; - set => m_Music = value; - } + public MusicName Music { get; set; } - public bool IsDefault => m_Map.DefaultRegion == this; - public virtual MusicName DefaultMusic => m_Parent?.Music ?? MusicName.Invalid; + public bool IsDefault => Map.DefaultRegion == this; + public virtual MusicName DefaultMusic => Parent?.Music ?? MusicName.Invalid; public Region( string name, Map map, int priority, params Rectangle2D[] area ) : this( name, map, priority, ConvertTo3D( area ) ) { @@ -212,60 +197,60 @@ namespace Server public Region( string name, Map map, Region parent, params Rectangle3D[] area ) { m_Name = name; - m_Map = map; - m_Parent = parent; - m_Area = area; - m_Dynamic = true; - m_Music = DefaultMusic; + Map = map; + Parent = parent; + Area = area; + Dynamic = true; + Music = DefaultMusic; - if ( m_Parent == null ) + if ( Parent == null ) { - m_ChildLevel = 0; + ChildLevel = 0; m_Priority = DefaultPriority; } else { - m_ChildLevel = m_Parent.ChildLevel + 1; - m_Priority = m_Parent.Priority; + ChildLevel = Parent.ChildLevel + 1; + m_Priority = Parent.Priority; } } public void Register() { - if ( m_Registered ) + if ( Registered ) return; OnRegister(); - m_Registered = true; + Registered = true; - if ( m_Parent != null ) + if ( Parent != null ) { - m_Parent.m_Children.Add( this ); - m_Parent.OnChildAdded( this ); + Parent.Children.Add( this ); + Parent.OnChildAdded( this ); } - m_Regions.Add( this ); + Regions.Add( this ); - m_Map.RegisterRegion( this ); + Map.RegisterRegion( this ); List sectors = new List(); - for ( int i = 0; i < m_Area.Length; i++ ) + for ( int i = 0; i < Area.Length; i++ ) { - Rectangle3D rect = m_Area[i]; + Rectangle3D rect = Area[i]; - Point2D start = m_Map.Bound( new Point2D( rect.Start ) ); - Point2D end = m_Map.Bound( new Point2D( rect.End ) ); + Point2D start = Map.Bound( new Point2D( rect.Start ) ); + Point2D end = Map.Bound( new Point2D( rect.End ) ); - Sector startSector = m_Map.GetSector( start ); - Sector endSector = m_Map.GetSector( end ); + Sector startSector = Map.GetSector( start ); + Sector endSector = Map.GetSector( end ); for ( int x = startSector.X; x <= endSector.X; x++ ) { for ( int y = startSector.Y; y <= endSector.Y; y++ ) { - Sector sector = m_Map.GetRealSector( x, y ); + Sector sector = Map.GetRealSector( x, y ); sector.OnEnter( this, rect ); @@ -275,45 +260,45 @@ namespace Server } } - m_Sectors = sectors.ToArray(); + Sectors = sectors.ToArray(); } public void Unregister() { - if ( !m_Registered ) + if ( !Registered ) return; OnUnregister(); - m_Registered = false; + Registered = false; - if ( m_Children.Count > 0 ) + if ( Children.Count > 0 ) Console.WriteLine( "Warning: Unregistering region '{0}' with children", this ); - if ( m_Parent != null ) + if ( Parent != null ) { - m_Parent.m_Children.Remove( this ); - m_Parent.OnChildRemoved( this ); + Parent.Children.Remove( this ); + Parent.OnChildRemoved( this ); } - m_Regions.Remove( this ); + Regions.Remove( this ); - m_Map.UnregisterRegion( this ); + Map.UnregisterRegion( this ); - if ( m_Sectors != null ) + if ( Sectors != null ) { - for ( int i = 0; i < m_Sectors.Length; i++ ) - m_Sectors[i].OnLeave( this ); + for ( int i = 0; i < Sectors.Length; i++ ) + Sectors[i].OnLeave( this ); } - m_Sectors = null; + Sectors = null; } public bool Contains( Point3D p ) { - for ( int i = 0; i < m_Area.Length; i++ ) + for ( int i = 0; i < Area.Length; i++ ) { - Rectangle3D rect = m_Area[i]; + Rectangle3D rect = Area[i]; if ( rect.Contains( p ) ) return true; @@ -327,14 +312,14 @@ namespace Server if ( region == null ) return false; - Region p = m_Parent; + Region p = Parent; while ( p != null ) { if ( p == region ) return true; - p = p.m_Parent; + p = p.Parent; } return false; @@ -352,7 +337,7 @@ namespace Server if ( regionType.IsAssignableFrom( r.GetType() ) ) return r; - r = r.m_Parent; + r = r.Parent; } while ( r != null ); @@ -371,7 +356,7 @@ namespace Server if ( r.m_Name == regionName ) return r; - r = r.m_Parent; + r = r.Parent; } while ( r != null ); @@ -404,8 +389,8 @@ namespace Server if ( region == this ) return true; - if ( m_Parent != null ) - return m_Parent.AcceptsSpawnsFrom( region ); + if ( Parent != null ) + return Parent.AcceptsSpawnsFrom( region ); return false; } @@ -414,11 +399,11 @@ namespace Server { List list = new List(); - if ( m_Sectors != null ) + if ( Sectors != null ) { - for ( int i = 0; i < m_Sectors.Length; i++ ) + for ( int i = 0; i < Sectors.Length; i++ ) { - Sector sector = m_Sectors[i]; + Sector sector = Sectors[i]; foreach ( Mobile player in sector.Players ) { @@ -435,11 +420,11 @@ namespace Server { int count = 0; - if ( m_Sectors != null ) + if ( Sectors != null ) { - for ( int i = 0; i < m_Sectors.Length; i++ ) + for ( int i = 0; i < Sectors.Length; i++ ) { - Sector sector = m_Sectors[i]; + Sector sector = Sectors[i]; foreach ( Mobile player in sector.Players ) { @@ -456,11 +441,11 @@ namespace Server { List list = new List(); - if ( m_Sectors != null ) + if ( Sectors != null ) { - for ( int i = 0; i < m_Sectors.Length; i++ ) + for ( int i = 0; i < Sectors.Length; i++ ) { - Sector sector = m_Sectors[i]; + Sector sector = Sectors[i]; foreach ( Mobile mobile in sector.Mobiles ) { @@ -477,11 +462,11 @@ namespace Server { int count = 0; - if ( m_Sectors != null ) + if ( Sectors != null ) { - for ( int i = 0; i < m_Sectors.Length; i++ ) + for ( int i = 0; i < Sectors.Length; i++ ) { - Sector sector = m_Sectors[i]; + Sector sector = Sectors[i]; foreach ( Mobile mobile in sector.Mobiles ) { @@ -561,97 +546,97 @@ namespace Server public virtual void MakeGuard( Mobile focus ) { - m_Parent?.MakeGuard( focus ); + Parent?.MakeGuard( focus ); } public virtual Type GetResource( Type type ) { - if ( m_Parent != null ) - return m_Parent.GetResource( type ); + if ( Parent != null ) + return Parent.GetResource( type ); return type; } public virtual bool CanUseStuckMenu( Mobile m ) { - if ( m_Parent != null ) - return m_Parent.CanUseStuckMenu( m ); + if ( Parent != null ) + return Parent.CanUseStuckMenu( m ); return true; } public virtual void OnAggressed( Mobile aggressor, Mobile aggressed, bool criminal ) { - m_Parent?.OnAggressed( aggressor, aggressed, criminal ); + Parent?.OnAggressed( aggressor, aggressed, criminal ); } public virtual void OnDidHarmful( Mobile harmer, Mobile harmed ) { - m_Parent?.OnDidHarmful( harmer, harmed ); + Parent?.OnDidHarmful( harmer, harmed ); } public virtual void OnGotHarmful( Mobile harmer, Mobile harmed ) { - m_Parent?.OnGotHarmful( harmer, harmed ); + Parent?.OnGotHarmful( harmer, harmed ); } public virtual void OnLocationChanged( Mobile m, Point3D oldLocation ) { - m_Parent?.OnLocationChanged( m, oldLocation ); + Parent?.OnLocationChanged( m, oldLocation ); } public virtual bool OnTarget( Mobile m, Target t, object o ) { - if ( m_Parent != null ) - return m_Parent.OnTarget( m, t, o ); + if ( Parent != null ) + return Parent.OnTarget( m, t, o ); return true; } public virtual bool OnCombatantChange( Mobile m, Mobile Old, Mobile New ) { - if ( m_Parent != null ) - return m_Parent.OnCombatantChange( m, Old, New ); + if ( Parent != null ) + return Parent.OnCombatantChange( m, Old, New ); return true; } public virtual bool AllowHousing( Mobile from, Point3D p ) { - if ( m_Parent != null ) - return m_Parent.AllowHousing( from, p ); + if ( Parent != null ) + return Parent.AllowHousing( from, p ); return true; } public virtual bool SendInaccessibleMessage( Item item, Mobile from ) { - if ( m_Parent != null ) - return m_Parent.SendInaccessibleMessage( item, from ); + if ( Parent != null ) + return Parent.SendInaccessibleMessage( item, from ); return false; } public virtual bool CheckAccessibility( Item item, Mobile from ) { - if ( m_Parent != null ) - return m_Parent.CheckAccessibility( item, from ); + if ( Parent != null ) + return Parent.CheckAccessibility( item, from ); return true; } public virtual bool OnDecay( Item item ) { - if ( m_Parent != null ) - return m_Parent.OnDecay( item ); + if ( Parent != null ) + return Parent.OnDecay( item ); return true; } public virtual bool AllowHarmful( Mobile from, Mobile target ) { - if ( m_Parent != null ) - return m_Parent.AllowHarmful( from, target ); + if ( Parent != null ) + return Parent.AllowHarmful( from, target ); if ( Mobile.AllowHarmfulHandler != null ) return Mobile.AllowHarmfulHandler( from, target ); @@ -661,16 +646,16 @@ namespace Server public virtual void OnCriminalAction( Mobile m, bool message ) { - if ( m_Parent != null ) - m_Parent.OnCriminalAction( m, message ); + if ( Parent != null ) + Parent.OnCriminalAction( m, message ); else if ( message ) m.SendLocalizedMessage( 1005040 ); // You've committed a criminal act!! } public virtual bool AllowBeneficial( Mobile from, Mobile target ) { - if ( m_Parent != null ) - return m_Parent.AllowBeneficial( from, target ); + if ( Parent != null ) + return Parent.AllowBeneficial( from, target ); if ( Mobile.AllowBeneficialHandler != null ) return Mobile.AllowBeneficialHandler( from, target ); @@ -680,118 +665,118 @@ namespace Server public virtual void OnBeneficialAction( Mobile helper, Mobile target ) { - m_Parent?.OnBeneficialAction( helper, target ); + Parent?.OnBeneficialAction( helper, target ); } public virtual void OnGotBeneficialAction( Mobile helper, Mobile target ) { - m_Parent?.OnGotBeneficialAction( helper, target ); + Parent?.OnGotBeneficialAction( helper, target ); } public virtual void SpellDamageScalar( Mobile caster, Mobile target, ref double damage ) { - m_Parent?.SpellDamageScalar( caster, target, ref damage ); + Parent?.SpellDamageScalar( caster, target, ref damage ); } public virtual void OnSpeech( SpeechEventArgs args ) { - m_Parent?.OnSpeech( args ); + Parent?.OnSpeech( args ); } public virtual bool OnSkillUse( Mobile m, int Skill ) { - if ( m_Parent != null ) - return m_Parent.OnSkillUse( m, Skill ); + if ( Parent != null ) + return Parent.OnSkillUse( m, Skill ); return true; } public virtual bool OnBeginSpellCast( Mobile m, ISpell s ) { - if ( m_Parent != null ) - return m_Parent.OnBeginSpellCast( m, s ); + if ( Parent != null ) + return Parent.OnBeginSpellCast( m, s ); return true; } public virtual void OnSpellCast( Mobile m, ISpell s ) { - m_Parent?.OnSpellCast( m, s ); + Parent?.OnSpellCast( m, s ); } public virtual bool OnResurrect( Mobile m ) { - if ( m_Parent != null ) - return m_Parent.OnResurrect( m ); + if ( Parent != null ) + return Parent.OnResurrect( m ); return true; } public virtual bool OnBeforeDeath( Mobile m ) { - if ( m_Parent != null ) - return m_Parent.OnBeforeDeath( m ); + if ( Parent != null ) + return Parent.OnBeforeDeath( m ); return true; } public virtual void OnDeath( Mobile m ) { - m_Parent?.OnDeath( m ); + Parent?.OnDeath( m ); } public virtual bool OnDamage( Mobile m, ref int Damage ) { - if ( m_Parent != null ) - return m_Parent.OnDamage( m, ref Damage ); + if ( Parent != null ) + return Parent.OnDamage( m, ref Damage ); return true; } public virtual bool OnHeal( Mobile m, ref int Heal ) { - if ( m_Parent != null ) - return m_Parent.OnHeal( m, ref Heal ); + if ( Parent != null ) + return Parent.OnHeal( m, ref Heal ); return true; } public virtual bool OnDoubleClick( Mobile m, object o ) { - if ( m_Parent != null ) - return m_Parent.OnDoubleClick( m, o ); + if ( Parent != null ) + return Parent.OnDoubleClick( m, o ); return true; } public virtual bool OnSingleClick( Mobile m, object o ) { - if ( m_Parent != null ) - return m_Parent.OnSingleClick( m, o ); + if ( Parent != null ) + return Parent.OnSingleClick( m, o ); return true; } public virtual bool AllowSpawn() { - if ( m_Parent != null ) - return m_Parent.AllowSpawn(); + if ( Parent != null ) + return Parent.AllowSpawn(); return true; } public virtual void AlterLightLevel( Mobile m, ref int global, ref int personal ) { - m_Parent?.AlterLightLevel( m, ref global, ref personal ); + Parent?.AlterLightLevel( m, ref global, ref personal ); } public virtual TimeSpan GetLogoutDelay( Mobile m ) { - if ( m_Parent != null ) - return m_Parent.GetLogoutDelay( m ); + if ( Parent != null ) + return Parent.GetLogoutDelay( m ); if ( m.AccessLevel > AccessLevel.Player ) - return m_StaffLogoutDelay; - return m_DefaultLogoutDelay; + return StaffLogoutDelay; + return DefaultLogoutDelay; } @@ -805,10 +790,10 @@ namespace Server if ( !newRegion.OnMoveInto( m, d, newLocation, oldLocation ) ) return false; - if ( newRegion.m_Parent == null ) + if ( newRegion.Parent == null ) return true; - newRegion = newRegion.m_Parent; + newRegion = newRegion.Parent; } return true; @@ -919,19 +904,19 @@ namespace Server public Region( XmlElement xml, Map map, Region parent ) { - m_Map = map; - m_Parent = parent; - m_Dynamic = false; + Map = map; + Parent = parent; + Dynamic = false; - if ( m_Parent == null ) + if ( Parent == null ) { - m_ChildLevel = 0; + ChildLevel = 0; m_Priority = DefaultPriority; } else { - m_ChildLevel = m_Parent.ChildLevel + 1; - m_Priority = m_Parent.Priority; + ChildLevel = Parent.ChildLevel + 1; + m_Priority = Parent.Priority; } ReadString( xml, "name", ref m_Name, false ); @@ -956,21 +941,21 @@ namespace Server area.Add( rect ); } - m_Area = area.ToArray(); + Area = area.ToArray(); - if ( m_Area.Length == 0 ) + if ( Area.Length == 0 ) Console.WriteLine( "Empty area for region '{0}'", this ); - if ( !ReadPoint3D( xml["go"], map, ref m_GoLocation, false ) && m_Area.Length > 0 ) + if ( !ReadPoint3D( xml["go"], map, ref m_GoLocation, false ) && Area.Length > 0 ) { - Point3D start = m_Area[0].Start; - Point3D end = m_Area[0].End; + Point3D start = Area[0].Start; + Point3D end = Area[0].End; int x = start.X + (end.X - start.X) / 2; int y = start.Y + (end.Y - start.Y) / 2; - m_GoLocation = new Point3D( x, y, m_Map.GetAverageZ( x, y ) ); + m_GoLocation = new Point3D( x, y, Map.GetAverageZ( x, y ) ); } @@ -978,7 +963,7 @@ namespace Server ReadEnum( xml["music"], "name", ref music, false ); - m_Music = music; + Music = music; } protected static string GetAttribute( XmlElement xml, string attribute, bool mandatory ) diff --git a/Server/ScriptCompiler.cs b/Server/ScriptCompiler.cs index 3ece619e0..fbbdcdaf2 100644 --- a/Server/ScriptCompiler.cs +++ b/Server/ScriptCompiler.cs @@ -31,13 +31,7 @@ namespace Server { public static class ScriptCompiler { - private static Assembly[] m_Assemblies; - - public static Assembly[] Assemblies - { - get => m_Assemblies; - set => m_Assemblies = value; - } + public static Assembly[] Assemblies { get; set; } private static List m_AdditionalReferences = new List(); @@ -595,7 +589,7 @@ namespace Server return false; } - m_Assemblies = assemblies.ToArray(); + Assemblies = assemblies.ToArray(); Console.Write( "Scripts: Verifying..." ); @@ -614,9 +608,9 @@ namespace Server { List invoke = new List(); - for( int a = 0; a < m_Assemblies.Length; ++a ) + for( int a = 0; a < Assemblies.Length; ++a ) { - Type[] types = m_Assemblies[a].GetTypes(); + Type[] types = Assemblies[a].GetTypes(); for( int i = 0; i < types.Length; ++i ) { @@ -664,8 +658,8 @@ namespace Server { Type type = null; - for( int i = 0; type == null && i < m_Assemblies.Length; ++i ) - type = GetTypeCache( m_Assemblies[i] ).GetTypeByFullName( fullName, ignoreCase ); + for( int i = 0; type == null && i < Assemblies.Length; ++i ) + type = GetTypeCache( Assemblies[i] ).GetTypeByFullName( fullName, ignoreCase ); if ( type == null ) type = GetTypeCache( Core.Assembly ).GetTypeByFullName( fullName, ignoreCase ); @@ -682,8 +676,8 @@ namespace Server { Type type = null; - for( int i = 0; type == null && i < m_Assemblies.Length; ++i ) - type = GetTypeCache( m_Assemblies[i] ).GetTypeByName( name, ignoreCase ); + for( int i = 0; type == null && i < Assemblies.Length; ++i ) + type = GetTypeCache( Assemblies[i] ).GetTypeByName( name, ignoreCase ); if ( type == null ) type = GetTypeCache( Core.Assembly ).GetTypeByName( name, ignoreCase ); @@ -719,41 +713,40 @@ namespace Server public class TypeCache { - private Type[] m_Types; - private TypeTable m_Names, m_FullNames; + public Type[] Types { get; } - public Type[] Types => m_Types; - public TypeTable Names => m_Names; - public TypeTable FullNames => m_FullNames; + public TypeTable Names { get; } + + public TypeTable FullNames { get; } public Type GetTypeByName( string name, bool ignoreCase ) { - return m_Names.Get( name, ignoreCase ); + return Names.Get( name, ignoreCase ); } public Type GetTypeByFullName( string fullName, bool ignoreCase ) { - return m_FullNames.Get( fullName, ignoreCase ); + return FullNames.Get( fullName, ignoreCase ); } public TypeCache( Assembly asm ) { if ( asm == null ) - m_Types = Type.EmptyTypes; + Types = Type.EmptyTypes; else - m_Types = asm.GetTypes(); + Types = asm.GetTypes(); - m_Names = new TypeTable( m_Types.Length ); - m_FullNames = new TypeTable( m_Types.Length ); + Names = new TypeTable( Types.Length ); + FullNames = new TypeTable( Types.Length ); Type typeofTypeAliasAttribute = typeof( TypeAliasAttribute ); - for( int i = 0; i < m_Types.Length; ++i ) + for( int i = 0; i < Types.Length; ++i ) { - Type type = m_Types[i]; + Type type = Types[i]; - m_Names.Add( type.Name, type ); - m_FullNames.Add( type.FullName, type ); + Names.Add( type.Name, type ); + FullNames.Add( type.FullName, type ); if ( type.IsDefined( typeofTypeAliasAttribute, false ) ) { @@ -764,7 +757,7 @@ namespace Server if ( attrs[0] is TypeAliasAttribute attr ) { for( int j = 0; j < attr.Aliases.Length; ++j ) - m_FullNames.Add( attr.Aliases[j], type ); + FullNames.Add( attr.Aliases[j], type ); } } } diff --git a/Server/Sector.cs b/Server/Sector.cs index 3bb0358a4..d88c6c581 100644 --- a/Server/Sector.cs +++ b/Server/Sector.cs @@ -25,14 +25,14 @@ using Server.Network; namespace Server { public class RegionRect : IComparable { - private Region m_Region; private Rectangle3D m_Rect; - public Region Region => m_Region; + public Region Region { get; } + public Rectangle3D Rect => m_Rect; public RegionRect( Region region, Rectangle3D rect ) { - m_Region = region; + Region = region; m_Rect = rect; } @@ -47,14 +47,12 @@ namespace Server { if ( !(obj is RegionRect regRect) ) throw new ArgumentException( "obj is not a RegionRect", nameof(obj) ); - return ( ( IComparable ) m_Region ).CompareTo( regRect.m_Region ); + return ( ( IComparable ) Region ).CompareTo( regRect.Region ); } } public class Sector { - private int m_X, m_Y; - private Map m_Owner; private List m_Mobiles; private List m_Players; private List m_Items; @@ -71,9 +69,9 @@ namespace Server { private static List m_DefaultRectList = new List(); public Sector( int x, int y, Map owner ) { - m_X = x; - m_Y = y; - m_Owner = owner; + X = x; + Y = y; + Owner = owner; m_Active = false; } @@ -132,7 +130,7 @@ namespace Server { if ( mob.Player ) { if ( m_Players == null ) { - m_Owner.ActivateSectors( m_X, m_Y ); + Owner.ActivateSectors( X, Y ); } Add( ref m_Players, mob ); @@ -150,7 +148,7 @@ namespace Server { Remove( ref m_Players, mob ); if ( m_Players == null ) { - m_Owner.DeactivateSectors( m_X, m_Y ); + Owner.DeactivateSectors( X, Y ); } } } @@ -200,7 +198,7 @@ namespace Server { } public void Activate() { - if ( !Active && m_Owner != Map.Internal ) { + if ( !Active && Owner != Map.Internal ) { if ( m_Items != null ) { foreach ( Item item in m_Items ) { item.OnSectorActivate(); @@ -289,12 +287,12 @@ namespace Server { } } - public bool Active => ( m_Active && m_Owner != Map.Internal ); + public bool Active => ( m_Active && Owner != Map.Internal ); - public Map Owner => m_Owner; + public Map Owner { get; } - public int X => m_X; + public int X { get; } - public int Y => m_Y; + public int Y { get; } } } diff --git a/Server/SecureTrade.cs b/Server/SecureTrade.cs index df79a5459..37a8c7245 100644 --- a/Server/SecureTrade.cs +++ b/Server/SecureTrade.cs @@ -30,17 +30,12 @@ namespace Server { public class SecureTrade { - private readonly SecureTradeInfo m_From; - private readonly SecureTradeInfo m_To; - - private bool m_Valid; - public SecureTrade(Mobile from, Mobile to) { - m_Valid = true; + Valid = true; - m_From = new SecureTradeInfo(this, from, new SecureTradeContainer(this)); - m_To = new SecureTradeInfo(this, to, new SecureTradeContainer(this)); + From = new SecureTradeInfo(this, from, new SecureTradeContainer(this)); + To = new SecureTradeInfo(this, to, new SecureTradeContainer(this)); var from6017 = (from.NetState != null && from.NetState.ContainerGridLines); var to6017 = (to.NetState != null && to.NetState.ContainerGridLines); @@ -49,82 +44,83 @@ namespace Server var to704565 = (to.NetState != null && to.NetState.NewSecureTrading); from.Send(new MobileStatus(from, to)); - from.Send(new UpdateSecureTrade(m_From.Container, false, false)); + from.Send(new UpdateSecureTrade(From.Container, false, false)); if (from6017) { - from.Send(new SecureTradeEquip6017(m_To.Container, to)); + from.Send(new SecureTradeEquip6017(To.Container, to)); } else { - from.Send(new SecureTradeEquip(m_To.Container, to)); + from.Send(new SecureTradeEquip(To.Container, to)); } - from.Send(new UpdateSecureTrade(m_From.Container, false, false)); + from.Send(new UpdateSecureTrade(From.Container, false, false)); if (from6017) { - from.Send(new SecureTradeEquip6017(m_From.Container, from)); + from.Send(new SecureTradeEquip6017(From.Container, from)); } else { - from.Send(new SecureTradeEquip(m_From.Container, from)); + from.Send(new SecureTradeEquip(From.Container, from)); } - from.Send(new DisplaySecureTrade(to, m_From.Container, m_To.Container, to.Name)); - from.Send(new UpdateSecureTrade(m_From.Container, false, false)); + from.Send(new DisplaySecureTrade(to, From.Container, To.Container, to.Name)); + from.Send(new UpdateSecureTrade(From.Container, false, false)); if (from.Account != null && from704565) { from.Send( - new UpdateSecureTrade(m_From.Container, TradeFlag.UpdateLedger, from.Account.TotalGold, from.Account.TotalPlat)); + new UpdateSecureTrade(From.Container, TradeFlag.UpdateLedger, from.Account.TotalGold, from.Account.TotalPlat)); } to.Send(new MobileStatus(to, from)); - to.Send(new UpdateSecureTrade(m_To.Container, false, false)); + to.Send(new UpdateSecureTrade(To.Container, false, false)); if (to6017) { - to.Send(new SecureTradeEquip6017(m_From.Container, from)); + to.Send(new SecureTradeEquip6017(From.Container, from)); } else { - to.Send(new SecureTradeEquip(m_From.Container, from)); + to.Send(new SecureTradeEquip(From.Container, from)); } - to.Send(new UpdateSecureTrade(m_To.Container, false, false)); + to.Send(new UpdateSecureTrade(To.Container, false, false)); if (to6017) { - to.Send(new SecureTradeEquip6017(m_To.Container, to)); + to.Send(new SecureTradeEquip6017(To.Container, to)); } else { - to.Send(new SecureTradeEquip(m_To.Container, to)); + to.Send(new SecureTradeEquip(To.Container, to)); } - to.Send(new DisplaySecureTrade(from, m_To.Container, m_From.Container, from.Name)); - to.Send(new UpdateSecureTrade(m_To.Container, false, false)); + to.Send(new DisplaySecureTrade(from, To.Container, From.Container, from.Name)); + to.Send(new UpdateSecureTrade(To.Container, false, false)); if (to.Account != null && to704565) { - to.Send(new UpdateSecureTrade(m_To.Container, TradeFlag.UpdateLedger, to.Account.TotalGold, to.Account.TotalPlat)); + to.Send(new UpdateSecureTrade(To.Container, TradeFlag.UpdateLedger, to.Account.TotalGold, to.Account.TotalPlat)); } } - public SecureTradeInfo From => m_From; - public SecureTradeInfo To => m_To; + public SecureTradeInfo From { get; } - public bool Valid => m_Valid; + public SecureTradeInfo To { get; } + + public bool Valid { get; private set; } public void Cancel() { - if (!m_Valid) + if (!Valid) { return; } - var list = m_From.Container.Items; + var list = From.Container.Items; for (var i = list.Count - 1; i >= 0; --i) { @@ -132,21 +128,21 @@ namespace Server { var item = list[i]; - if (item == m_From.VirtualCheck) + if (item == From.VirtualCheck) { continue; } - item.OnSecureTrade(m_From.Mobile, m_To.Mobile, m_From.Mobile, false); + item.OnSecureTrade(From.Mobile, To.Mobile, From.Mobile, false); if (!item.Deleted) { - m_From.Mobile.AddToBackpack(item); + From.Mobile.AddToBackpack(item); } } } - list = m_To.Container.Items; + list = To.Container.Items; for (var i = list.Count - 1; i >= 0; --i) { @@ -154,16 +150,16 @@ namespace Server { var item = list[i]; - if (item == m_To.VirtualCheck) + if (item == To.VirtualCheck) { continue; } - item.OnSecureTrade(m_To.Mobile, m_From.Mobile, m_To.Mobile, false); + item.OnSecureTrade(To.Mobile, From.Mobile, To.Mobile, false); if (!item.Deleted) { - m_To.Mobile.AddToBackpack(item); + To.Mobile.AddToBackpack(item); } } } @@ -173,36 +169,36 @@ namespace Server public void Close() { - if (!m_Valid) + if (!Valid) { return; } - m_From.Mobile.Send(new CloseSecureTrade(m_From.Container)); - m_To.Mobile.Send(new CloseSecureTrade(m_To.Container)); + From.Mobile.Send(new CloseSecureTrade(From.Container)); + To.Mobile.Send(new CloseSecureTrade(To.Container)); - m_Valid = false; + Valid = false; - var ns = m_From.Mobile.NetState; + var ns = From.Mobile.NetState; ns?.RemoveTrade(this); - ns = m_To.Mobile.NetState; + ns = To.Mobile.NetState; ns?.RemoveTrade(this); - Timer.DelayCall(m_From.Dispose); - Timer.DelayCall(m_To.Dispose); + Timer.DelayCall(From.Dispose); + Timer.DelayCall(To.Dispose); } public void UpdateFromCurrency() { - UpdateCurrency(m_From, m_To); + UpdateCurrency(From, To); } public void UpdateToCurrency() { - UpdateCurrency(m_To, m_From); + UpdateCurrency(To, From); } private static void UpdateCurrency(SecureTradeInfo left, SecureTradeInfo right) @@ -223,14 +219,14 @@ namespace Server public void Update() { - if (!m_Valid) + if (!Valid) { return; } - if (!m_From.IsDisposed && m_From.Accepted && !m_To.IsDisposed && m_To.Accepted) + if (!From.IsDisposed && From.Accepted && !To.IsDisposed && To.Accepted) { - var list = m_From.Container.Items; + var list = From.Container.Items; var allowed = true; @@ -240,19 +236,19 @@ namespace Server { var item = list[i]; - if (item == m_From.VirtualCheck) + if (item == From.VirtualCheck) { continue; } - if (!item.AllowSecureTrade(m_From.Mobile, m_To.Mobile, m_To.Mobile, true)) + if (!item.AllowSecureTrade(From.Mobile, To.Mobile, To.Mobile, true)) { allowed = false; } } } - list = m_To.Container.Items; + list = To.Container.Items; for (var i = list.Count - 1; allowed && i >= 0; --i) { @@ -260,12 +256,12 @@ namespace Server { var item = list[i]; - if (item == m_To.VirtualCheck) + if (item == To.VirtualCheck) { continue; } - if (!item.AllowSecureTrade(m_To.Mobile, m_From.Mobile, m_From.Mobile, true)) + if (!item.AllowSecureTrade(To.Mobile, From.Mobile, From.Mobile, true)) { allowed = false; } @@ -274,48 +270,48 @@ namespace Server if (AccountGold.Enabled) { - if (m_From.Mobile.Account != null) + if (From.Mobile.Account != null) { - int totalPlat = m_From.Mobile.Account.TotalPlat; - int totalGold = m_From.Mobile.Account.TotalGold; + int totalPlat = From.Mobile.Account.TotalPlat; + int totalGold = From.Mobile.Account.TotalGold; - if (totalPlat < m_From.Plat || totalGold < m_From.Gold) + if (totalPlat < From.Plat || totalGold < From.Gold) { allowed = false; - m_From.Mobile.SendMessage("You do not have enough currency to complete this trade."); + From.Mobile.SendMessage("You do not have enough currency to complete this trade."); } } - if (m_To.Mobile.Account != null) + if (To.Mobile.Account != null) { - int totalPlat = m_To.Mobile.Account.TotalPlat; - int totalGold = m_To.Mobile.Account.TotalGold; + int totalPlat = To.Mobile.Account.TotalPlat; + int totalGold = To.Mobile.Account.TotalGold; - if (totalPlat < m_To.Plat || totalGold < m_To.Gold) + if (totalPlat < To.Plat || totalGold < To.Gold) { allowed = false; - m_To.Mobile.SendMessage("You do not have enough currency to complete this trade."); + To.Mobile.SendMessage("You do not have enough currency to complete this trade."); } } } if (!allowed) { - m_From.Accepted = false; - m_To.Accepted = false; + From.Accepted = false; + To.Accepted = false; - m_From.Mobile.Send(new UpdateSecureTrade(m_From.Container, m_From.Accepted, m_To.Accepted)); - m_To.Mobile.Send(new UpdateSecureTrade(m_To.Container, m_To.Accepted, m_From.Accepted)); + From.Mobile.Send(new UpdateSecureTrade(From.Container, From.Accepted, To.Accepted)); + To.Mobile.Send(new UpdateSecureTrade(To.Container, To.Accepted, From.Accepted)); return; } - if (AccountGold.Enabled && m_From.Mobile.Account != null && m_To.Mobile.Account != null) + if (AccountGold.Enabled && From.Mobile.Account != null && To.Mobile.Account != null) { HandleAccountGoldTrade(); } - list = m_From.Container.Items; + list = From.Container.Items; for (var i = list.Count - 1; i >= 0; --i) { @@ -323,21 +319,21 @@ namespace Server { var item = list[i]; - if (item == m_From.VirtualCheck) + if (item == From.VirtualCheck) { continue; } - item.OnSecureTrade(m_From.Mobile, m_To.Mobile, m_To.Mobile, true); + item.OnSecureTrade(From.Mobile, To.Mobile, To.Mobile, true); if (!item.Deleted) { - m_To.Mobile.AddToBackpack(item); + To.Mobile.AddToBackpack(item); } } } - list = m_To.Container.Items; + list = To.Container.Items; for (var i = list.Count - 1; i >= 0; --i) { @@ -345,26 +341,26 @@ namespace Server { var item = list[i]; - if (item == m_To.VirtualCheck) + if (item == To.VirtualCheck) { continue; } - item.OnSecureTrade(m_To.Mobile, m_From.Mobile, m_From.Mobile, true); + item.OnSecureTrade(To.Mobile, From.Mobile, From.Mobile, true); if (!item.Deleted) { - m_From.Mobile.AddToBackpack(item); + From.Mobile.AddToBackpack(item); } } } Close(); } - else if (!m_From.IsDisposed && !m_To.IsDisposed) + else if (!From.IsDisposed && !To.IsDisposed) { - m_From.Mobile.Send(new UpdateSecureTrade(m_From.Container, m_From.Accepted, m_To.Accepted)); - m_To.Mobile.Send(new UpdateSecureTrade(m_To.Container, m_To.Accepted, m_From.Accepted)); + From.Mobile.Send(new UpdateSecureTrade(From.Container, From.Accepted, To.Accepted)); + To.Mobile.Send(new UpdateSecureTrade(To.Container, To.Accepted, From.Accepted)); } } @@ -373,48 +369,48 @@ namespace Server int fromPlatSend = 0, fromGoldSend = 0, fromPlatRecv = 0, fromGoldRecv = 0; int toPlatSend = 0, toGoldSend = 0, toPlatRecv = 0, toGoldRecv = 0; - if (m_From.Plat > 0 & m_From.Mobile.Account.WithdrawPlat(m_From.Plat)) + if (From.Plat > 0 & From.Mobile.Account.WithdrawPlat(From.Plat)) { - fromPlatSend = m_From.Plat; + fromPlatSend = From.Plat; - if (m_To.Mobile.Account.DepositPlat(m_From.Plat)) + if (To.Mobile.Account.DepositPlat(From.Plat)) { toPlatRecv = fromPlatSend; } } - if (m_From.Gold > 0 & m_From.Mobile.Account.WithdrawGold(m_From.Gold)) + if (From.Gold > 0 & From.Mobile.Account.WithdrawGold(From.Gold)) { - fromGoldSend = m_From.Gold; + fromGoldSend = From.Gold; - if (m_To.Mobile.Account.DepositGold(m_From.Gold)) + if (To.Mobile.Account.DepositGold(From.Gold)) { toGoldRecv = fromGoldSend; } } - if (m_To.Plat > 0 & m_To.Mobile.Account.WithdrawPlat(m_To.Plat)) + if (To.Plat > 0 & To.Mobile.Account.WithdrawPlat(To.Plat)) { - toPlatSend = m_To.Plat; + toPlatSend = To.Plat; - if (m_From.Mobile.Account.DepositPlat(m_To.Plat)) + if (From.Mobile.Account.DepositPlat(To.Plat)) { fromPlatRecv = toPlatSend; } } - if (m_To.Gold > 0 & m_To.Mobile.Account.WithdrawGold(m_To.Gold)) + if (To.Gold > 0 & To.Mobile.Account.WithdrawGold(To.Gold)) { - toGoldSend = m_To.Gold; + toGoldSend = To.Gold; - if (m_From.Mobile.Account.DepositGold(m_To.Gold)) + if (From.Mobile.Account.DepositGold(To.Gold)) { fromGoldRecv = toGoldSend; } } - HandleAccountGoldTrade(m_From.Mobile, m_To.Mobile, fromPlatSend, fromGoldSend, fromPlatRecv, fromGoldRecv); - HandleAccountGoldTrade(m_To.Mobile, m_From.Mobile, toPlatSend, toGoldSend, toPlatRecv, toGoldRecv); + HandleAccountGoldTrade(From.Mobile, To.Mobile, fromPlatSend, fromGoldSend, fromPlatRecv, fromGoldRecv); + HandleAccountGoldTrade(To.Mobile, From.Mobile, toPlatSend, toGoldSend, toPlatRecv, toGoldRecv); } private static void HandleAccountGoldTrade( diff --git a/Server/Serial.cs b/Server/Serial.cs index 9db9b5175..87fc3a204 100644 --- a/Server/Serial.cs +++ b/Server/Serial.cs @@ -24,13 +24,9 @@ namespace Server { public struct Serial : IComparable, IComparable { - private int m_Serial; + public static Serial LastMobile { get; private set; } = Zero; - private static Serial m_LastMobile = Zero; - private static Serial m_LastItem = 0x40000000; - - public static Serial LastMobile => m_LastMobile; - public static Serial LastItem => m_LastItem; + public static Serial LastItem { get; private set; } = 0x40000000; public static readonly Serial MinusOne = new Serial( -1 ); public static readonly Serial Zero = new Serial( 0 ); @@ -39,9 +35,9 @@ namespace Server { get { - while ( World.FindMobile( m_LastMobile = (m_LastMobile + 1) ) != null ); + while ( World.FindMobile( LastMobile = (LastMobile + 1) ) != null ); - return m_LastMobile; + return LastMobile; } } @@ -49,33 +45,33 @@ namespace Server { get { - while ( World.FindItem( m_LastItem = (m_LastItem + 1) ) != null ); + while ( World.FindItem( LastItem = (LastItem + 1) ) != null ); - return m_LastItem; + return LastItem; } } private Serial( int serial ) { - m_Serial = serial; + Value = serial; } - public int Value => m_Serial; + public int Value { get; } - public bool IsMobile => ( m_Serial > 0 && m_Serial < 0x40000000 ); + public bool IsMobile => ( Value > 0 && Value < 0x40000000 ); - public bool IsItem => ( m_Serial >= 0x40000000 && m_Serial <= 0x7FFFFFFF ); + public bool IsItem => ( Value >= 0x40000000 && Value <= 0x7FFFFFFF ); - public bool IsValid => ( m_Serial > 0 ); + public bool IsValid => ( Value > 0 ); public override int GetHashCode() { - return m_Serial; + return Value; } public int CompareTo( Serial other ) { - return m_Serial.CompareTo( other.m_Serial ); + return Value.CompareTo( other.Value ); } public int CompareTo( object other ) @@ -94,37 +90,37 @@ namespace Server if ( !(o is Serial serial) ) return false; - return serial.m_Serial == m_Serial; + return serial.Value == Value; } public static bool operator == ( Serial l, Serial r ) { - return l.m_Serial == r.m_Serial; + return l.Value == r.Value; } public static bool operator != ( Serial l, Serial r ) { - return l.m_Serial != r.m_Serial; + return l.Value != r.Value; } public static bool operator > ( Serial l, Serial r ) { - return l.m_Serial > r.m_Serial; + return l.Value > r.Value; } public static bool operator < ( Serial l, Serial r ) { - return l.m_Serial < r.m_Serial; + return l.Value < r.Value; } public static bool operator >= ( Serial l, Serial r ) { - return l.m_Serial >= r.m_Serial; + return l.Value >= r.Value; } public static bool operator <= ( Serial l, Serial r ) { - return l.m_Serial <= r.m_Serial; + return l.Value <= r.Value; } /*public static Serial operator ++ ( Serial l ) @@ -134,12 +130,12 @@ namespace Server public override string ToString() { - return $"0x{m_Serial:X8}"; + return $"0x{Value:X8}"; } public static implicit operator int( Serial a ) { - return a.m_Serial; + return a.Value; } public static implicit operator Serial( int a ) diff --git a/Server/Serialization.cs b/Server/Serialization.cs index 3bea7e079..57c2c5acb 100644 --- a/Server/Serialization.cs +++ b/Server/Serialization.cs @@ -1385,8 +1385,7 @@ namespace Server public sealed class AsyncWriter : GenericWriter { - private static int m_ThreadCount; - public static int ThreadCount => m_ThreadCount; + public static int ThreadCount { get; private set; } private int BufferSize; @@ -1442,7 +1441,7 @@ namespace Server public void Worker() { - m_ThreadCount++; + ThreadCount++; int lastCount = 0; @@ -1461,9 +1460,9 @@ namespace Server if ( m_Owner.m_Closed ) m_Owner.m_File.Close(); - m_ThreadCount--; + ThreadCount--; - if (m_ThreadCount <= 0) + if (ThreadCount <= 0) World.NotifyDiskWriteComplete(); } } diff --git a/Server/Skills.cs b/Server/Skills.cs index 5a7c54bbe..18db94d74 100644 --- a/Server/Skills.cs +++ b/Server/Skills.cs @@ -101,11 +101,8 @@ namespace Server [PropertyObject] public class Skill { - private Skills m_Owner; - private SkillInfo m_Info; private ushort m_Base; private ushort m_Cap; - private SkillLock m_Lock; public override string ToString() { @@ -114,8 +111,8 @@ namespace Server public Skill( Skills owner, SkillInfo info, GenericReader reader ) { - m_Owner = owner; - m_Info = info; + Owner = owner; + Info = info; int version = reader.ReadByte(); @@ -125,7 +122,7 @@ namespace Server { m_Base = reader.ReadUShort(); m_Cap = reader.ReadUShort(); - m_Lock = (SkillLock)reader.ReadByte(); + Lock = (SkillLock)reader.ReadByte(); break; } @@ -133,7 +130,7 @@ namespace Server { m_Base = 0; m_Cap = 1000; - m_Lock = SkillLock.Up; + Lock = SkillLock.Up; break; } @@ -150,27 +147,27 @@ namespace Server m_Cap = 1000; if ( (version & 0x4) != 0 ) - m_Lock = (SkillLock)reader.ReadByte(); + Lock = (SkillLock)reader.ReadByte(); } break; } } - if ( m_Lock < SkillLock.Up || m_Lock > SkillLock.Locked ) + if ( Lock < SkillLock.Up || Lock > SkillLock.Locked ) { - Console.WriteLine( "Bad skill lock -> {0}.{1}", owner.Owner, m_Lock ); - m_Lock = SkillLock.Up; + Console.WriteLine( "Bad skill lock -> {0}.{1}", owner.Owner, Lock ); + Lock = SkillLock.Up; } } public Skill( Skills owner, SkillInfo info, int baseValue, int cap, SkillLock skillLock ) { - m_Owner = owner; - m_Info = info; + Owner = owner; + Info = info; m_Base = (ushort)baseValue; m_Cap = (ushort)cap; - m_Lock = skillLock; + Lock = skillLock; } public void SetLockNoRelay( SkillLock skillLock ) @@ -178,12 +175,12 @@ namespace Server if ( skillLock < SkillLock.Up || skillLock > SkillLock.Locked ) return; - m_Lock = skillLock; + Lock = skillLock; } public void Serialize( GenericWriter writer ) { - if ( m_Base == 0 && m_Cap == 1000 && m_Lock == SkillLock.Up ) + if ( m_Base == 0 && m_Cap == 1000 && Lock == SkillLock.Up ) { writer.Write( (byte) 0xFF ); // default } @@ -197,7 +194,7 @@ namespace Server if ( m_Cap != 1000 ) flags |= 0x2; - if ( m_Lock != SkillLock.Up ) + if ( Lock != SkillLock.Up ) flags |= 0x4; writer.Write( (byte) flags ); // version @@ -208,24 +205,24 @@ namespace Server if ( m_Cap != 1000 ) writer.Write( (short) m_Cap ); - if ( m_Lock != SkillLock.Up ) - writer.Write( (byte) m_Lock ); + if ( Lock != SkillLock.Up ) + writer.Write( (byte) Lock ); } } - public Skills Owner => m_Owner; + public Skills Owner { get; } - public SkillName SkillName => (SkillName)m_Info.SkillID; + public SkillName SkillName => (SkillName)Info.SkillID; - public int SkillID => m_Info.SkillID; + public int SkillID => Info.SkillID; [CommandProperty( AccessLevel.Counselor )] - public string Name => m_Info.Name; + public string Name => Info.Name; - public SkillInfo Info => m_Info; + public SkillInfo Info { get; } [CommandProperty( AccessLevel.Counselor )] - public SkillLock Lock => m_Lock; + public SkillLock Lock { get; private set; } public int BaseFixedPoint { @@ -243,13 +240,13 @@ namespace Server if ( m_Base != sv ) { - m_Owner.Total = (m_Owner.Total - m_Base) + sv; + Owner.Total = (Owner.Total - m_Base) + sv; m_Base = sv; - m_Owner.OnSkillChange( this ); + Owner.OnSkillChange( this ); - Mobile m = m_Owner.Owner; + Mobile m = Owner.Owner; m?.OnSkillChange( SkillName, (double)oldBase / 10 ); } @@ -279,7 +276,7 @@ namespace Server { m_Cap = sv; - m_Owner.OnSkillChange( this ); + Owner.OnSkillChange( this ); } } } @@ -291,11 +288,7 @@ namespace Server set => CapFixedPoint = (int)(value * 10.0); } - private static bool m_UseStatMods; - - public static bool UseStatMods{ get => m_UseStatMods; - set => m_UseStatMods = value; - } + public static bool UseStatMods { get; set; } public int Fixed => (int)(Value * 10); @@ -307,7 +300,7 @@ namespace Server //There has to be this distinction between the racial values and not to account for gaining skills and these skills aren't displayed nor Totaled up. double value = NonRacialValue; - double raceBonus = m_Owner.Owner.RacialSkillBonus; + double raceBonus = Owner.Owner.RacialSkillBonus; if ( raceBonus > value ) value = raceBonus; @@ -328,8 +321,8 @@ namespace Server inv /= 100.0; - double statsOffset = ((m_UseStatMods ? m_Owner.Owner.Str : m_Owner.Owner.RawStr) * m_Info.StrScale) + ((m_UseStatMods ? m_Owner.Owner.Dex : m_Owner.Owner.RawDex) * m_Info.DexScale) + ((m_UseStatMods ? m_Owner.Owner.Int : m_Owner.Owner.RawInt) * m_Info.IntScale); - double statTotal = m_Info.StatTotal * inv; + double statsOffset = ((UseStatMods ? Owner.Owner.Str : Owner.Owner.RawStr) * Info.StrScale) + ((UseStatMods ? Owner.Owner.Dex : Owner.Owner.RawDex) * Info.DexScale) + ((UseStatMods ? Owner.Owner.Int : Owner.Owner.RawInt) * Info.IntScale); + double statTotal = Info.StatTotal * inv; statsOffset *= inv; @@ -338,9 +331,9 @@ namespace Server double value = baseValue + statsOffset; - m_Owner.Owner.ValidateSkillMods(); + Owner.Owner.ValidateSkillMods(); - List mods = m_Owner.Owner.SkillMods; + List mods = Owner.Owner.SkillMods; double bonusObey = 0.0, bonusNotObey = 0.0; @@ -348,7 +341,7 @@ namespace Server { SkillMod mod = mods[i]; - if ( mod.Skill == (SkillName)m_Info.SkillID ) + if ( mod.Skill == (SkillName)Info.SkillID ) { if ( mod.Relative ) { @@ -382,185 +375,120 @@ namespace Server public void Update() { - m_Owner.OnSkillChange( this ); + Owner.OnSkillChange( this ); } } public class SkillInfo { - private int m_SkillID; - private string m_Name; - private string m_Title; - private double m_StrScale; - private double m_DexScale; - private double m_IntScale; - private double m_StatTotal; - private SkillUseCallback m_Callback; - private double m_StrGain; - private double m_DexGain; - private double m_IntGain; - private double m_GainFactor; - public SkillInfo( int skillID, string name, double strScale, double dexScale, double intScale, string title, SkillUseCallback callback, double strGain, double dexGain, double intGain, double gainFactor ) { - m_Name = name; - m_Title = title; - m_SkillID = skillID; - m_StrScale = strScale / 100.0; - m_DexScale = dexScale / 100.0; - m_IntScale = intScale / 100.0; - m_Callback = callback; - m_StrGain = strGain; - m_DexGain = dexGain; - m_IntGain = intGain; - m_GainFactor = gainFactor; + Name = name; + Title = title; + SkillID = skillID; + StrScale = strScale / 100.0; + DexScale = dexScale / 100.0; + IntScale = intScale / 100.0; + Callback = callback; + StrGain = strGain; + DexGain = dexGain; + IntGain = intGain; + GainFactor = gainFactor; - m_StatTotal = strScale + dexScale + intScale; + StatTotal = strScale + dexScale + intScale; } - public SkillUseCallback Callback + public SkillUseCallback Callback { get; set; } + + public int SkillID { get; } + + public string Name { get; set; } + + public string Title { get; set; } + + public double StrScale { get; set; } + + public double DexScale { get; set; } + + public double IntScale { get; set; } + + public double StatTotal { get; set; } + + public double StrGain { get; set; } + + public double DexGain { get; set; } + + public double IntGain { get; set; } + + public double GainFactor { get; set; } + + public static SkillInfo[] Table { get; set; } = new SkillInfo[58] { - get => m_Callback; - set => m_Callback = value; - } - - public int SkillID => m_SkillID; - - public string Name - { - get => m_Name; - set => m_Name = value; - } - - public string Title - { - get => m_Title; - set => m_Title = value; - } - - public double StrScale - { - get => m_StrScale; - set => m_StrScale = value; - } - - public double DexScale - { - get => m_DexScale; - set => m_DexScale = value; - } - - public double IntScale - { - get => m_IntScale; - set => m_IntScale = value; - } - - public double StatTotal - { - get => m_StatTotal; - set => m_StatTotal = value; - } - - public double StrGain - { - get => m_StrGain; - set => m_StrGain = value; - } - - public double DexGain - { - get => m_DexGain; - set => m_DexGain = value; - } - - public double IntGain - { - get => m_IntGain; - set => m_IntGain = value; - } - - public double GainFactor - { - get => m_GainFactor; - set => m_GainFactor = value; - } - - private static SkillInfo[] m_Table = new SkillInfo[58] - { - new SkillInfo( 0, "Alchemy", 0.0, 5.0, 5.0, "Alchemist", null, 0.0, 0.5, 0.5, 1.0 ), - new SkillInfo( 1, "Anatomy", 0.0, 0.0, 0.0, "Biologist", null, 0.15, 0.15, 0.7, 1.0 ), - new SkillInfo( 2, "Animal Lore", 0.0, 0.0, 0.0, "Naturalist", null, 0.0, 0.0, 1.0, 1.0 ), - new SkillInfo( 3, "Item Identification", 0.0, 0.0, 0.0, "Merchant", null, 0.0, 0.0, 1.0, 1.0 ), - new SkillInfo( 4, "Arms Lore", 0.0, 0.0, 0.0, "Weapon Master", null, 0.75, 0.15, 0.1, 1.0 ), - new SkillInfo( 5, "Parrying", 7.5, 2.5, 0.0, "Duelist", null, 0.75, 0.25, 0.0, 1.0 ), - new SkillInfo( 6, "Begging", 0.0, 0.0, 0.0, "Beggar", null, 0.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 7, "Blacksmithy", 10.0, 0.0, 0.0, "Blacksmith", null, 1.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 8, "Bowcraft/Fletching", 6.0, 16.0, 0.0, "Bowyer", null, 0.6, 1.6, 0.0, 1.0 ), - new SkillInfo( 9, "Peacemaking", 0.0, 0.0, 0.0, "Pacifier", null, 0.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 10, "Camping", 20.0, 15.0, 15.0, "Explorer", null, 2.0, 1.5, 1.5, 1.0 ), - new SkillInfo( 11, "Carpentry", 20.0, 5.0, 0.0, "Carpenter", null, 2.0, 0.5, 0.0, 1.0 ), - new SkillInfo( 12, "Cartography", 0.0, 7.5, 7.5, "Cartographer", null, 0.0, 0.75, 0.75, 1.0 ), - new SkillInfo( 13, "Cooking", 0.0, 20.0, 30.0, "Chef", null, 0.0, 2.0, 3.0, 1.0 ), - new SkillInfo( 14, "Detecting Hidden", 0.0, 0.0, 0.0, "Scout", null, 0.0, 0.4, 0.6, 1.0 ), - new SkillInfo( 15, "Discordance", 0.0, 2.5, 2.5, "Demoralizer", null, 0.0, 0.25, 0.25, 1.0 ), - new SkillInfo( 16, "Evaluating Intelligence", 0.0, 0.0, 0.0, "Scholar", null, 0.0, 0.0, 1.0, 1.0 ), - new SkillInfo( 17, "Healing", 6.0, 6.0, 8.0, "Healer", null, 0.6, 0.6, 0.8, 1.0 ), - new SkillInfo( 18, "Fishing", 0.0, 0.0, 0.0, "Fisherman", null, 0.5, 0.5, 0.0, 1.0 ), - new SkillInfo( 19, "Forensic Evaluation", 0.0, 0.0, 0.0, "Detective", null, 0.0, 0.2, 0.8, 1.0 ), - new SkillInfo( 20, "Herding", 16.25, 6.25, 2.5, "Shepherd", null, 1.625, 0.625, 0.25, 1.0 ), - new SkillInfo( 21, "Hiding", 0.0, 0.0, 0.0, "Shade", null, 0.0, 0.8, 0.2, 1.0 ), - new SkillInfo( 22, "Provocation", 0.0, 4.5, 0.5, "Rouser", null, 0.0, 0.45, 0.05, 1.0 ), - new SkillInfo( 23, "Inscription", 0.0, 2.0, 8.0, "Scribe", null, 0.0, 0.2, 0.8, 1.0 ), - new SkillInfo( 24, "Lockpicking", 0.0, 25.0, 0.0, "Infiltrator", null, 0.0, 2.0, 0.0, 1.0 ), - new SkillInfo( 25, "Magery", 0.0, 0.0, 15.0, "Mage", null, 0.0, 0.0, 1.5, 1.0 ), - new SkillInfo( 26, "Resisting Spells", 0.0, 0.0, 0.0, "Warder", null, 0.25, 0.25, 0.5, 1.0 ), - new SkillInfo( 27, "Tactics", 0.0, 0.0, 0.0, "Tactician", null, 0.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 28, "Snooping", 0.0, 25.0, 0.0, "Spy", null, 0.0, 2.5, 0.0, 1.0 ), - new SkillInfo( 29, "Musicianship", 0.0, 0.0, 0.0, "Bard", null, 0.0, 0.8, 0.2, 1.0 ), - new SkillInfo( 30, "Poisoning", 0.0, 4.0, 16.0, "Assassin", null, 0.0, 0.4, 1.6, 1.0 ), - new SkillInfo( 31, "Archery", 2.5, 7.5, 0.0, "Archer", null, 0.25, 0.75, 0.0, 1.0 ), - new SkillInfo( 32, "Spirit Speak", 0.0, 0.0, 0.0, "Medium", null, 0.0, 0.0, 1.0, 1.0 ), - new SkillInfo( 33, "Stealing", 0.0, 10.0, 0.0, "Pickpocket", null, 0.0, 1.0, 0.0, 1.0 ), - new SkillInfo( 34, "Tailoring", 3.75, 16.25, 5.0, "Tailor", null, 0.38, 1.63, 0.5, 1.0 ), - new SkillInfo( 35, "Animal Taming", 14.0, 2.0, 4.0, "Tamer", null, 1.4, 0.2, 0.4, 1.0 ), - new SkillInfo( 36, "Taste Identification", 0.0, 0.0, 0.0, "Praegustator", null, 0.2, 0.0, 0.8, 1.0 ), - new SkillInfo( 37, "Tinkering", 5.0, 2.0, 3.0, "Tinker", null, 0.5, 0.2, 0.3, 1.0 ), - new SkillInfo( 38, "Tracking", 0.0, 12.5, 12.5, "Ranger", null, 0.0, 1.25, 1.25, 1.0 ), - new SkillInfo( 39, "Veterinary", 8.0, 4.0, 8.0, "Veterinarian", null, 0.8, 0.4, 0.8, 1.0 ), - new SkillInfo( 40, "Swordsmanship", 7.5, 2.5, 0.0, "Swordsman", null, 0.75, 0.25, 0.0, 1.0 ), - new SkillInfo( 41, "Mace Fighting", 9.0, 1.0, 0.0, "Armsman", null, 0.9, 0.1, 0.0, 1.0 ), - new SkillInfo( 42, "Fencing", 4.5, 5.5, 0.0, "Fencer", null, 0.45, 0.55, 0.0, 1.0 ), - new SkillInfo( 43, "Wrestling", 9.0, 1.0, 0.0, "Wrestler", null, 0.9, 0.1, 0.0, 1.0 ), - new SkillInfo( 44, "Lumberjacking", 20.0, 0.0, 0.0, "Lumberjack", null, 2.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 45, "Mining", 20.0, 0.0, 0.0, "Miner", null, 2.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 46, "Meditation", 0.0, 0.0, 0.0, "Stoic", null, 0.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 47, "Stealth", 0.0, 0.0, 0.0, "Rogue", null, 0.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 48, "Remove Trap", 0.0, 0.0, 0.0, "Trap Specialist", null, 0.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 49, "Necromancy", 0.0, 0.0, 0.0, "Necromancer", null, 0.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 50, "Focus", 0.0, 0.0, 0.0, "Driven", null, 0.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 51, "Chivalry", 0.0, 0.0, 0.0, "Paladin", null, 0.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 52, "Bushido", 0.0, 0.0, 0.0, "Samurai", null, 0.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 53, "Ninjitsu", 0.0, 0.0, 0.0, "Ninja", null, 0.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 54, "Spellweaving", 0.0, 0.0, 0.0, "Arcanist", null, 0.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 55, "Mysticism", 0.0, 0.0, 0.0, "Mystic", null, 0.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 56, "Imbuing", 0.0, 0.0, 0.0, "Artificer", null, 0.0, 0.0, 0.0, 1.0 ), - new SkillInfo( 57, "Throwing", 0.0, 0.0, 0.0, "Bladeweaver", null, 0.0, 0.0, 0.0, 1.0 ), - }; - - public static SkillInfo[] Table - { - get => m_Table; - set => m_Table = value; - } + new SkillInfo( 0, "Alchemy", 0.0, 5.0, 5.0, "Alchemist", null, 0.0, 0.5, 0.5, 1.0 ), + new SkillInfo( 1, "Anatomy", 0.0, 0.0, 0.0, "Biologist", null, 0.15, 0.15, 0.7, 1.0 ), + new SkillInfo( 2, "Animal Lore", 0.0, 0.0, 0.0, "Naturalist", null, 0.0, 0.0, 1.0, 1.0 ), + new SkillInfo( 3, "Item Identification", 0.0, 0.0, 0.0, "Merchant", null, 0.0, 0.0, 1.0, 1.0 ), + new SkillInfo( 4, "Arms Lore", 0.0, 0.0, 0.0, "Weapon Master", null, 0.75, 0.15, 0.1, 1.0 ), + new SkillInfo( 5, "Parrying", 7.5, 2.5, 0.0, "Duelist", null, 0.75, 0.25, 0.0, 1.0 ), + new SkillInfo( 6, "Begging", 0.0, 0.0, 0.0, "Beggar", null, 0.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 7, "Blacksmithy", 10.0, 0.0, 0.0, "Blacksmith", null, 1.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 8, "Bowcraft/Fletching", 6.0, 16.0, 0.0, "Bowyer", null, 0.6, 1.6, 0.0, 1.0 ), + new SkillInfo( 9, "Peacemaking", 0.0, 0.0, 0.0, "Pacifier", null, 0.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 10, "Camping", 20.0, 15.0, 15.0, "Explorer", null, 2.0, 1.5, 1.5, 1.0 ), + new SkillInfo( 11, "Carpentry", 20.0, 5.0, 0.0, "Carpenter", null, 2.0, 0.5, 0.0, 1.0 ), + new SkillInfo( 12, "Cartography", 0.0, 7.5, 7.5, "Cartographer", null, 0.0, 0.75, 0.75, 1.0 ), + new SkillInfo( 13, "Cooking", 0.0, 20.0, 30.0, "Chef", null, 0.0, 2.0, 3.0, 1.0 ), + new SkillInfo( 14, "Detecting Hidden", 0.0, 0.0, 0.0, "Scout", null, 0.0, 0.4, 0.6, 1.0 ), + new SkillInfo( 15, "Discordance", 0.0, 2.5, 2.5, "Demoralizer", null, 0.0, 0.25, 0.25, 1.0 ), + new SkillInfo( 16, "Evaluating Intelligence", 0.0, 0.0, 0.0, "Scholar", null, 0.0, 0.0, 1.0, 1.0 ), + new SkillInfo( 17, "Healing", 6.0, 6.0, 8.0, "Healer", null, 0.6, 0.6, 0.8, 1.0 ), + new SkillInfo( 18, "Fishing", 0.0, 0.0, 0.0, "Fisherman", null, 0.5, 0.5, 0.0, 1.0 ), + new SkillInfo( 19, "Forensic Evaluation", 0.0, 0.0, 0.0, "Detective", null, 0.0, 0.2, 0.8, 1.0 ), + new SkillInfo( 20, "Herding", 16.25, 6.25, 2.5, "Shepherd", null, 1.625, 0.625, 0.25, 1.0 ), + new SkillInfo( 21, "Hiding", 0.0, 0.0, 0.0, "Shade", null, 0.0, 0.8, 0.2, 1.0 ), + new SkillInfo( 22, "Provocation", 0.0, 4.5, 0.5, "Rouser", null, 0.0, 0.45, 0.05, 1.0 ), + new SkillInfo( 23, "Inscription", 0.0, 2.0, 8.0, "Scribe", null, 0.0, 0.2, 0.8, 1.0 ), + new SkillInfo( 24, "Lockpicking", 0.0, 25.0, 0.0, "Infiltrator", null, 0.0, 2.0, 0.0, 1.0 ), + new SkillInfo( 25, "Magery", 0.0, 0.0, 15.0, "Mage", null, 0.0, 0.0, 1.5, 1.0 ), + new SkillInfo( 26, "Resisting Spells", 0.0, 0.0, 0.0, "Warder", null, 0.25, 0.25, 0.5, 1.0 ), + new SkillInfo( 27, "Tactics", 0.0, 0.0, 0.0, "Tactician", null, 0.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 28, "Snooping", 0.0, 25.0, 0.0, "Spy", null, 0.0, 2.5, 0.0, 1.0 ), + new SkillInfo( 29, "Musicianship", 0.0, 0.0, 0.0, "Bard", null, 0.0, 0.8, 0.2, 1.0 ), + new SkillInfo( 30, "Poisoning", 0.0, 4.0, 16.0, "Assassin", null, 0.0, 0.4, 1.6, 1.0 ), + new SkillInfo( 31, "Archery", 2.5, 7.5, 0.0, "Archer", null, 0.25, 0.75, 0.0, 1.0 ), + new SkillInfo( 32, "Spirit Speak", 0.0, 0.0, 0.0, "Medium", null, 0.0, 0.0, 1.0, 1.0 ), + new SkillInfo( 33, "Stealing", 0.0, 10.0, 0.0, "Pickpocket", null, 0.0, 1.0, 0.0, 1.0 ), + new SkillInfo( 34, "Tailoring", 3.75, 16.25, 5.0, "Tailor", null, 0.38, 1.63, 0.5, 1.0 ), + new SkillInfo( 35, "Animal Taming", 14.0, 2.0, 4.0, "Tamer", null, 1.4, 0.2, 0.4, 1.0 ), + new SkillInfo( 36, "Taste Identification", 0.0, 0.0, 0.0, "Praegustator", null, 0.2, 0.0, 0.8, 1.0 ), + new SkillInfo( 37, "Tinkering", 5.0, 2.0, 3.0, "Tinker", null, 0.5, 0.2, 0.3, 1.0 ), + new SkillInfo( 38, "Tracking", 0.0, 12.5, 12.5, "Ranger", null, 0.0, 1.25, 1.25, 1.0 ), + new SkillInfo( 39, "Veterinary", 8.0, 4.0, 8.0, "Veterinarian", null, 0.8, 0.4, 0.8, 1.0 ), + new SkillInfo( 40, "Swordsmanship", 7.5, 2.5, 0.0, "Swordsman", null, 0.75, 0.25, 0.0, 1.0 ), + new SkillInfo( 41, "Mace Fighting", 9.0, 1.0, 0.0, "Armsman", null, 0.9, 0.1, 0.0, 1.0 ), + new SkillInfo( 42, "Fencing", 4.5, 5.5, 0.0, "Fencer", null, 0.45, 0.55, 0.0, 1.0 ), + new SkillInfo( 43, "Wrestling", 9.0, 1.0, 0.0, "Wrestler", null, 0.9, 0.1, 0.0, 1.0 ), + new SkillInfo( 44, "Lumberjacking", 20.0, 0.0, 0.0, "Lumberjack", null, 2.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 45, "Mining", 20.0, 0.0, 0.0, "Miner", null, 2.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 46, "Meditation", 0.0, 0.0, 0.0, "Stoic", null, 0.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 47, "Stealth", 0.0, 0.0, 0.0, "Rogue", null, 0.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 48, "Remove Trap", 0.0, 0.0, 0.0, "Trap Specialist", null, 0.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 49, "Necromancy", 0.0, 0.0, 0.0, "Necromancer", null, 0.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 50, "Focus", 0.0, 0.0, 0.0, "Driven", null, 0.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 51, "Chivalry", 0.0, 0.0, 0.0, "Paladin", null, 0.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 52, "Bushido", 0.0, 0.0, 0.0, "Samurai", null, 0.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 53, "Ninjitsu", 0.0, 0.0, 0.0, "Ninja", null, 0.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 54, "Spellweaving", 0.0, 0.0, 0.0, "Arcanist", null, 0.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 55, "Mysticism", 0.0, 0.0, 0.0, "Mystic", null, 0.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 56, "Imbuing", 0.0, 0.0, 0.0, "Artificer", null, 0.0, 0.0, 0.0, 1.0 ), + new SkillInfo( 57, "Throwing", 0.0, 0.0, 0.0, "Bladeweaver", null, 0.0, 0.0, 0.0, 1.0 ), + }; } [PropertyObject] public class Skills : IEnumerable { - private Mobile m_Owner; private Skill[] m_Skills; - private int m_Total, m_Cap; private Skill m_Highest; #region Skill Getters & Setters @@ -799,19 +727,11 @@ namespace Server #endregion [CommandProperty( AccessLevel.Counselor, AccessLevel.GameMaster )] - public int Cap - { - get => m_Cap; - set => m_Cap = value; - } + public int Cap { get; set; } - public int Total - { - get => m_Total; - set => m_Total = value; - } + public int Total { get; set; } - public Mobile Owner => m_Owner; + public Mobile Owner { get; } public int Length => m_Skills.Length; @@ -910,11 +830,11 @@ namespace Server public void Serialize( GenericWriter writer ) { - m_Total = 0; + Total = 0; writer.Write( (int) 3 ); // version - writer.Write( (int) m_Cap ); + writer.Write( (int) Cap ); writer.Write( (int) m_Skills.Length ); for ( int i = 0; i < m_Skills.Length; ++i ) @@ -928,15 +848,15 @@ namespace Server else { sk.Serialize( writer ); - m_Total += sk.BaseFixedPoint; + Total += sk.BaseFixedPoint; } } } public Skills( Mobile owner ) { - m_Owner = owner; - m_Cap = 7000; + Owner = owner; + Cap = 7000; SkillInfo[] info = SkillInfo.Table; @@ -948,7 +868,7 @@ namespace Server public Skills( Mobile owner, GenericReader reader ) { - m_Owner = owner; + Owner = owner; int version = reader.ReadInt(); @@ -957,14 +877,14 @@ namespace Server case 3: case 2: { - m_Cap = reader.ReadInt(); + Cap = reader.ReadInt(); goto case 1; } case 1: { if ( version < 2 ) - m_Cap = 7000; + Cap = 7000; if ( version < 3 ) /*m_Total =*/ reader.ReadInt(); @@ -984,7 +904,7 @@ namespace Server if ( sk.BaseFixedPoint != 0 || sk.CapFixedPoint != 1000 || sk.Lock != SkillLock.Up ) { m_Skills[i] = sk; - m_Total += sk.BaseFixedPoint; + Total += sk.BaseFixedPoint; } } else @@ -1014,9 +934,9 @@ namespace Server else if ( m_Highest != null && skill.BaseFixedPoint > m_Highest.BaseFixedPoint ) m_Highest = skill; - m_Owner.OnSkillInvalidated( skill ); + Owner.OnSkillInvalidated( skill ); - NetState ns = m_Owner.NetState; + NetState ns = Owner.NetState; ns?.Send( new SkillChange( skill ) ); } diff --git a/Server/Targeting/LandTarget.cs b/Server/Targeting/LandTarget.cs index 463795283..1ff2fe0cb 100644 --- a/Server/Targeting/LandTarget.cs +++ b/Server/Targeting/LandTarget.cs @@ -23,7 +23,6 @@ namespace Server.Targeting public class LandTarget : IPoint3D { private Point3D m_Location; - private int m_TileID; public LandTarget( Point3D location, Map map ) { @@ -32,18 +31,18 @@ namespace Server.Targeting if ( map != null ) { m_Location.Z = map.GetAverageZ( m_Location.X, m_Location.Y ); - m_TileID = map.Tiles.GetLandTile( m_Location.X, m_Location.Y ).ID & TileData.MaxLandValue; + TileID = map.Tiles.GetLandTile( m_Location.X, m_Location.Y ).ID & TileData.MaxLandValue; } } [CommandProperty( AccessLevel.Counselor )] - public string Name => TileData.LandTable[m_TileID].Name; + public string Name => TileData.LandTable[TileID].Name; [CommandProperty( AccessLevel.Counselor )] - public TileFlag Flags => TileData.LandTable[m_TileID].Flags; + public TileFlag Flags => TileData.LandTable[TileID].Flags; [CommandProperty( AccessLevel.Counselor )] - public int TileID => m_TileID; + public int TileID { get; } [CommandProperty( AccessLevel.Counselor )] public Point3D Location => m_Location; diff --git a/Server/Targeting/MultiTarget.cs b/Server/Targeting/MultiTarget.cs index 19b1e012a..71ef0b54a 100644 --- a/Server/Targeting/MultiTarget.cs +++ b/Server/Targeting/MultiTarget.cs @@ -24,20 +24,9 @@ namespace Server.Targeting { public abstract class MultiTarget : Target { - private int m_MultiID; - private Point3D m_Offset; + public int MultiID { get; set; } - public int MultiID - { - get => m_MultiID; - set => m_MultiID = value; - } - - public Point3D Offset - { - get => m_Offset; - set => m_Offset = value; - } + public Point3D Offset { get; set; } protected MultiTarget( int multiID, Point3D offset ) : this( multiID, offset, 10, true, TargetFlags.None ) @@ -47,8 +36,8 @@ namespace Server.Targeting protected MultiTarget( int multiID, Point3D offset, int range, bool allowGround, TargetFlags flags ) : base( range, allowGround, flags ) { - m_MultiID = multiID; - m_Offset = offset; + MultiID = multiID; + Offset = offset; } public override Packet GetPacketFor( NetState ns ) diff --git a/Server/Targeting/StaticTarget.cs b/Server/Targeting/StaticTarget.cs index 3e414873f..7ef2de9ca 100644 --- a/Server/Targeting/StaticTarget.cs +++ b/Server/Targeting/StaticTarget.cs @@ -23,23 +23,22 @@ namespace Server.Targeting public class StaticTarget : IPoint3D { private Point3D m_Location; - private int m_ItemID; public StaticTarget( Point3D location, int itemID ) { m_Location = location; - m_ItemID = itemID & TileData.MaxItemValue; - m_Location.Z += TileData.ItemTable[m_ItemID].CalcHeight; + ItemID = itemID & TileData.MaxItemValue; + m_Location.Z += TileData.ItemTable[ItemID].CalcHeight; } [CommandProperty( AccessLevel.Counselor )] public Point3D Location => m_Location; [CommandProperty( AccessLevel.Counselor )] - public string Name => TileData.ItemTable[m_ItemID].Name; + public string Name => TileData.ItemTable[ItemID].Name; [CommandProperty( AccessLevel.Counselor )] - public TileFlag Flags => TileData.ItemTable[m_ItemID].Flags; + public TileFlag Flags => TileData.ItemTable[ItemID].Flags; [CommandProperty( AccessLevel.Counselor )] public int X => m_Location.X; @@ -51,6 +50,6 @@ namespace Server.Targeting public int Z => m_Location.Z; [CommandProperty( AccessLevel.Counselor )] - public int ItemID => m_ItemID; + public int ItemID { get; } } } \ No newline at end of file diff --git a/Server/Targeting/Target.cs b/Server/Targeting/Target.cs index 748290710..b9c73c951 100644 --- a/Server/Targeting/Target.cs +++ b/Server/Targeting/Target.cs @@ -27,33 +27,18 @@ namespace Server.Targeting { private static int m_NextTargetID; - private static bool m_TargetIDValidation = true; + public static bool TargetIDValidation { get; set; } = true; - public static bool TargetIDValidation - { - get => m_TargetIDValidation; - set => m_TargetIDValidation = value; - } - - private int m_TargetID; - private int m_Range; - private bool m_AllowGround; - private bool m_CheckLOS; - private bool m_AllowNonlocal; - private bool m_DisallowMultis; - private TargetFlags m_Flags; - private DateTime m_TimeoutTime; - - public DateTime TimeoutTime => m_TimeoutTime; + public DateTime TimeoutTime { get; private set; } protected Target( int range, bool allowGround, TargetFlags flags ) { - m_TargetID = ++m_NextTargetID; - m_Range = range; - m_AllowGround = allowGround; - m_Flags = flags; + TargetID = ++m_NextTargetID; + Range = range; + AllowGround = allowGround; + Flags = flags; - m_CheckLOS = true; + CheckLOS = true; } public static void Cancel( Mobile m ) @@ -71,7 +56,7 @@ namespace Server.Targeting public void BeginTimeout( Mobile from, TimeSpan delay ) { - m_TimeoutTime = DateTime.UtcNow + delay; + TimeoutTime = DateTime.UtcNow + delay; m_TimeoutTimer?.Stop(); @@ -128,25 +113,13 @@ namespace Server.Targeting } } - public bool CheckLOS - { - get => m_CheckLOS; - set => m_CheckLOS = value; - } + public bool CheckLOS { get; set; } - public bool DisallowMultis - { - get => m_DisallowMultis; - set => m_DisallowMultis = value; - } + public bool DisallowMultis { get; set; } - public bool AllowNonlocal - { - get => m_AllowNonlocal; - set => m_AllowNonlocal = value; - } + public bool AllowNonlocal { get; set; } - public int TargetID => m_TargetID; + public int TargetID { get; } public virtual Packet GetPacketFor( NetState ns ) { @@ -227,7 +200,7 @@ namespace Server.Targeting object root = item.RootParent; - if ( !m_AllowNonlocal && root is Mobile && root != from && from.AccessLevel == AccessLevel.Player ) + if ( !AllowNonlocal && root is Mobile && root != from && from.AccessLevel == AccessLevel.Player ) { OnNonlocalTarget( from, item ); OnTargetFinish( from ); @@ -244,7 +217,7 @@ namespace Server.Targeting return; } - if ( map == null || map != from.Map || ( m_Range != -1 && !from.InRange( loc, m_Range ) ) ) + if ( map == null || map != from.Map || ( Range != -1 && !from.InRange( loc, Range ) ) ) { OnTargetOutOfRange( from, targeted ); } @@ -252,7 +225,7 @@ namespace Server.Targeting { if ( !from.CanSee( targeted ) ) OnCantSeeTarget( from, targeted ); - else if ( m_CheckLOS && !from.InLOS( targeted ) ) + else if ( CheckLOS && !from.InLOS( targeted ) ) OnTargetOutOfLOS( from, targeted ); else if ( item?.InSecureTrade == true ) OnTargetInSecureTrade( from, targeted ); @@ -320,22 +293,10 @@ namespace Server.Targeting { } - public int Range - { - get => m_Range; - set => m_Range = value; - } + public int Range { get; set; } - public bool AllowGround - { - get => m_AllowGround; - set => m_AllowGround = value; - } + public bool AllowGround { get; set; } - public TargetFlags Flags - { - get => m_Flags; - set => m_Flags = value; - } + public TargetFlags Flags { get; set; } } } diff --git a/Server/TileData.cs b/Server/TileData.cs index caf6aa1ed..797b9e17f 100644 --- a/Server/TileData.cs +++ b/Server/TileData.cs @@ -26,32 +26,19 @@ namespace Server { public struct LandData { - private string m_Name; - private TileFlag m_Flags; - public LandData( string name, TileFlag flags ) { - m_Name = name; - m_Flags = flags; + Name = name; + Flags = flags; } - public string Name - { - get => m_Name; - set => m_Name = value; - } + public string Name { get; set; } - public TileFlag Flags - { - get => m_Flags; - set => m_Flags = value; - } + public TileFlag Flags { get; set; } } public struct ItemData { - private string m_Name; - private TileFlag m_Flags; private byte m_Weight; private byte m_Quality; private byte m_Quantity; @@ -60,8 +47,8 @@ namespace Server public ItemData( string name, TileFlag flags, int weight, int quality, int quantity, int value, int height ) { - m_Name = name; - m_Flags = flags; + Name = name; + Flags = flags; m_Weight = (byte)weight; m_Quality = (byte)quality; m_Quantity = (byte)quantity; @@ -69,51 +56,43 @@ namespace Server m_Height = (byte)height; } - public string Name - { - get => m_Name; - set => m_Name = value; - } + public string Name { get; set; } - public TileFlag Flags - { - get => m_Flags; - set => m_Flags = value; - } + public TileFlag Flags { get; set; } public bool Bridge { - get => (m_Flags & TileFlag.Bridge) != 0; + get => (Flags & TileFlag.Bridge) != 0; set { if ( value ) - m_Flags |= TileFlag.Bridge; + Flags |= TileFlag.Bridge; else - m_Flags &= ~TileFlag.Bridge; + Flags &= ~TileFlag.Bridge; } } public bool Impassable { - get => (m_Flags & TileFlag.Impassable) != 0; + get => (Flags & TileFlag.Impassable) != 0; set { if ( value ) - m_Flags |= TileFlag.Impassable; + Flags |= TileFlag.Impassable; else - m_Flags &= ~TileFlag.Impassable; + Flags &= ~TileFlag.Impassable; } } public bool Surface { - get => (m_Flags & TileFlag.Surface) != 0; + get => (Flags & TileFlag.Surface) != 0; set { if ( value ) - m_Flags |= TileFlag.Surface; + Flags |= TileFlag.Surface; else - m_Flags &= ~TileFlag.Surface; + Flags &= ~TileFlag.Surface; } } @@ -151,7 +130,7 @@ namespace Server { get { - if ( (m_Flags & TileFlag.Bridge) != 0 ) + if ( (Flags & TileFlag.Bridge) != 0 ) return m_Height / 2; return m_Height; } @@ -198,19 +177,13 @@ namespace Server public static class TileData { - private static LandData[] m_LandData; - private static ItemData[] m_ItemData; + public static LandData[] LandTable { get; } - public static LandData[] LandTable => m_LandData; + public static ItemData[] ItemTable { get; } - public static ItemData[] ItemTable => m_ItemData; + public static int MaxLandValue { get; } - private static int m_MaxLandValue; - private static int m_MaxItemValue; - - public static int MaxLandValue => m_MaxLandValue; - - public static int MaxItemValue => m_MaxItemValue; + public static int MaxItemValue { get; } private static byte[] m_StringBuffer = new byte[20]; @@ -236,7 +209,7 @@ namespace Server BinaryReader bin = new BinaryReader( fs ); if ( fs.Length == 3188736 ) { // 7.0.9.0 - m_LandData = new LandData[0x4000]; + LandTable = new LandData[0x4000]; for ( int i = 0; i < 0x4000; ++i ) { @@ -248,10 +221,10 @@ namespace Server TileFlag flags = (TileFlag)bin.ReadInt64(); bin.ReadInt16(); // skip 2 bytes -- textureID - m_LandData[i] = new LandData( ReadNameString( bin ), flags ); + LandTable[i] = new LandData( ReadNameString( bin ), flags ); } - m_ItemData = new ItemData[0x10000]; + ItemTable = new ItemData[0x10000]; for ( int i = 0; i < 0x10000; ++i ) { @@ -271,10 +244,10 @@ namespace Server int value = bin.ReadByte(); int height = bin.ReadByte(); - m_ItemData[i] = new ItemData( ReadNameString( bin ), flags, weight, quality, quantity, value, height ); + ItemTable[i] = new ItemData( ReadNameString( bin ), flags, weight, quality, quantity, value, height ); } } else { - m_LandData = new LandData[0x4000]; + LandTable = new LandData[0x4000]; for ( int i = 0; i < 0x4000; ++i ) { @@ -286,11 +259,11 @@ namespace Server TileFlag flags = (TileFlag)bin.ReadInt32(); bin.ReadInt16(); // skip 2 bytes -- textureID - m_LandData[i] = new LandData( ReadNameString( bin ), flags ); + LandTable[i] = new LandData( ReadNameString( bin ), flags ); } if ( fs.Length == 1644544 ) { // 7.0.0.0 - m_ItemData = new ItemData[0x8000]; + ItemTable = new ItemData[0x8000]; for ( int i = 0; i < 0x8000; ++i ) { @@ -310,10 +283,10 @@ namespace Server int value = bin.ReadByte(); int height = bin.ReadByte(); - m_ItemData[i] = new ItemData( ReadNameString( bin ), flags, weight, quality, quantity, value, height ); + ItemTable[i] = new ItemData( ReadNameString( bin ), flags, weight, quality, quantity, value, height ); } } else { - m_ItemData = new ItemData[0x4000]; + ItemTable = new ItemData[0x4000]; for ( int i = 0; i < 0x4000; ++i ) { @@ -333,14 +306,14 @@ namespace Server int value = bin.ReadByte(); int height = bin.ReadByte(); - m_ItemData[i] = new ItemData( ReadNameString( bin ), flags, weight, quality, quantity, value, height ); + ItemTable[i] = new ItemData( ReadNameString( bin ), flags, weight, quality, quantity, value, height ); } } } } - m_MaxLandValue = m_LandData.Length - 1; - m_MaxItemValue = m_ItemData.Length - 1; + MaxLandValue = LandTable.Length - 1; + MaxItemValue = ItemTable.Length - 1; } else { diff --git a/Server/TileList.cs b/Server/TileList.cs index 200e96fb5..ff0f5a5c3 100644 --- a/Server/TileList.cs +++ b/Server/TileList.cs @@ -23,34 +23,33 @@ namespace Server public class TileList { private StaticTile[] m_Tiles; - private int m_Count; public TileList() { m_Tiles = new StaticTile[8]; - m_Count = 0; + Count = 0; } - public int Count => m_Count; + public int Count { get; private set; } public void AddRange( StaticTile[] tiles ) { - if ( (m_Count + tiles.Length) > m_Tiles.Length ) + if ( (Count + tiles.Length) > m_Tiles.Length ) { StaticTile[] old = m_Tiles; - m_Tiles = new StaticTile[(m_Count + tiles.Length) * 2]; + m_Tiles = new StaticTile[(Count + tiles.Length) * 2]; for ( int i = 0; i < old.Length; ++i ) m_Tiles[i] = old[i]; } for ( int i = 0; i < tiles.Length; ++i ) - m_Tiles[m_Count++] = tiles[i]; + m_Tiles[Count++] = tiles[i]; } public void Add( ushort id, sbyte z ) { - if ( (m_Count + 1) > m_Tiles.Length ) + if ( (Count + 1) > m_Tiles.Length ) { StaticTile[] old = m_Tiles; m_Tiles = new StaticTile[old.Length * 2]; @@ -59,24 +58,24 @@ namespace Server m_Tiles[i] = old[i]; } - m_Tiles[m_Count].m_ID = id; - m_Tiles[m_Count].m_Z = z; - ++m_Count; + m_Tiles[Count].m_ID = id; + m_Tiles[Count].m_Z = z; + ++Count; } private static StaticTile[] m_EmptyTiles = new StaticTile[0]; public StaticTile[] ToArray() { - if ( m_Count == 0 ) + if ( Count == 0 ) return m_EmptyTiles; - StaticTile[] tiles = new StaticTile[m_Count]; + StaticTile[] tiles = new StaticTile[Count]; - for ( int i = 0; i < m_Count; ++i ) + for ( int i = 0; i < Count; ++i ) tiles[i] = m_Tiles[i]; - m_Count = 0; + Count = 0; return tiles; } diff --git a/Server/TileMatrix.cs b/Server/TileMatrix.cs index 221602686..50f1b948c 100644 --- a/Server/TileMatrix.cs +++ b/Server/TileMatrix.cs @@ -32,23 +32,14 @@ namespace Server private LandTile[][][] m_LandTiles; private LandTile[] m_InvalidLandBlock; - private StaticTile[][][] m_EmptyStaticBlock; - private FileStream m_Map; private UOPIndex m_MapIndex; - private FileStream m_Index; - private BinaryReader m_IndexReader; - - private FileStream m_Statics; - private int m_FileIndex; - private int m_BlockWidth, m_BlockHeight; private int m_Width, m_Height; private Map m_Owner; - private TileMatrixPatch m_Patch; private int[][] m_StaticPatches; private int[][] m_LandPatches; @@ -60,11 +51,11 @@ namespace Server } }*/ - public TileMatrixPatch Patch => m_Patch; + public TileMatrixPatch Patch { get; } - public int BlockWidth => m_BlockWidth; + public int BlockWidth { get; } - public int BlockHeight => m_BlockHeight; + public int BlockHeight { get; } /*public int Width { @@ -82,36 +73,20 @@ namespace Server } }*/ - public FileStream MapStream - { - get => m_Map; - set => m_Map = value; - } + public FileStream MapStream { get; set; } /*public bool MapUOPPacked { get{ return ( m_MapIndex != null ); } }*/ - public FileStream IndexStream - { - get => m_Index; - set => m_Index = value; - } + public FileStream IndexStream { get; set; } - public FileStream DataStream - { - get => m_Statics; - set => m_Statics = value; - } + public FileStream DataStream { get; set; } - public BinaryReader IndexReader - { - get => m_IndexReader; - set => m_IndexReader = value; - } + public BinaryReader IndexReader { get; set; } - public bool Exists => ( m_Map != null && m_Index != null && m_Statics != null ); + public bool Exists => ( MapStream != null && IndexStream != null && DataStream != null ); private static List m_Instances = new List(); private List m_FileShare = new List(); @@ -140,8 +115,8 @@ namespace Server m_FileIndex = fileIndex; m_Width = width; m_Height = height; - m_BlockWidth = width >> 3; - m_BlockHeight = height >> 3; + BlockWidth = width >> 3; + BlockHeight = height >> 3; m_Owner = owner; @@ -151,7 +126,7 @@ namespace Server if ( File.Exists( mapPath ) ) { - m_Map = new FileStream( mapPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ); + MapStream = new FileStream( mapPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ); } else { @@ -159,8 +134,8 @@ namespace Server if ( File.Exists( mapPath ) ) { - m_Map = new FileStream( mapPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ); - m_MapIndex = new UOPIndex( m_Map ); + MapStream = new FileStream( mapPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ); + m_MapIndex = new UOPIndex( MapStream ); } } @@ -168,51 +143,51 @@ namespace Server if ( File.Exists( indexPath ) ) { - m_Index = new FileStream( indexPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ); - m_IndexReader = new BinaryReader( m_Index ); + IndexStream = new FileStream( indexPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ); + IndexReader = new BinaryReader( IndexStream ); } string staticsPath = Core.FindDataFile( "statics{0}.mul", fileIndex ); if ( File.Exists( staticsPath ) ) - m_Statics = new FileStream( staticsPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ); + DataStream = new FileStream( staticsPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ); } - m_EmptyStaticBlock = new StaticTile[8][][]; + EmptyStaticBlock = new StaticTile[8][][]; for ( int i = 0; i < 8; ++i ) { - m_EmptyStaticBlock[i] = new StaticTile[8][]; + EmptyStaticBlock[i] = new StaticTile[8][]; for ( int j = 0; j < 8; ++j ) - m_EmptyStaticBlock[i][j] = new StaticTile[0]; + EmptyStaticBlock[i][j] = new StaticTile[0]; } m_InvalidLandBlock = new LandTile[196]; - m_LandTiles = new LandTile[m_BlockWidth][][]; - m_StaticTiles = new StaticTile[m_BlockWidth][][][][]; - m_StaticPatches = new int[m_BlockWidth][]; - m_LandPatches = new int[m_BlockWidth][]; + m_LandTiles = new LandTile[BlockWidth][][]; + m_StaticTiles = new StaticTile[BlockWidth][][][][]; + m_StaticPatches = new int[BlockWidth][]; + m_LandPatches = new int[BlockWidth][]; - m_Patch = new TileMatrixPatch( this, mapID ); + Patch = new TileMatrixPatch( this, mapID ); } - public StaticTile[][][] EmptyStaticBlock => m_EmptyStaticBlock; + public StaticTile[][][] EmptyStaticBlock { get; } [MethodImpl(MethodImplOptions.Synchronized)] public void SetStaticBlock( int x, int y, StaticTile[][][] value ) { - if ( x < 0 || y < 0 || x >= m_BlockWidth || y >= m_BlockHeight ) + if ( x < 0 || y < 0 || x >= BlockWidth || y >= BlockHeight ) return; if ( m_StaticTiles[x] == null ) - m_StaticTiles[x] = new StaticTile[m_BlockHeight][][][]; + m_StaticTiles[x] = new StaticTile[BlockHeight][][][]; m_StaticTiles[x][y] = value; if ( m_StaticPatches[x] == null ) - m_StaticPatches[x] = new int[(m_BlockHeight + 31) >> 5]; + m_StaticPatches[x] = new int[(BlockHeight + 31) >> 5]; m_StaticPatches[x][y >> 5] |= 1 << (y & 0x1F); } @@ -220,11 +195,11 @@ namespace Server [MethodImpl(MethodImplOptions.Synchronized)] public StaticTile[][][] GetStaticBlock( int x, int y ) { - if ( x < 0 || y < 0 || x >= m_BlockWidth || y >= m_BlockHeight || m_Statics == null || m_Index == null ) - return m_EmptyStaticBlock; + if ( x < 0 || y < 0 || x >= BlockWidth || y >= BlockHeight || DataStream == null || IndexStream == null ) + return EmptyStaticBlock; if ( m_StaticTiles[x] == null ) - m_StaticTiles[x] = new StaticTile[m_BlockHeight][][][]; + m_StaticTiles[x] = new StaticTile[BlockHeight][][][]; StaticTile[][][] tiles = m_StaticTiles[x][y]; @@ -236,7 +211,7 @@ namespace Server TileMatrix shared = m_FileShare[i]; lock (shared) { - if ( x >= 0 && x < shared.m_BlockWidth && y >= 0 && y < shared.m_BlockHeight ) + if ( x >= 0 && x < shared.BlockWidth && y >= 0 && y < shared.BlockHeight ) { StaticTile[][][][] theirTiles = shared.m_StaticTiles[x]; @@ -311,16 +286,16 @@ namespace Server [MethodImpl(MethodImplOptions.Synchronized)] public void SetLandBlock( int x, int y, LandTile[] value ) { - if ( x < 0 || y < 0 || x >= m_BlockWidth || y >= m_BlockHeight ) + if ( x < 0 || y < 0 || x >= BlockWidth || y >= BlockHeight ) return; if ( m_LandTiles[x] == null ) - m_LandTiles[x] = new LandTile[m_BlockHeight][]; + m_LandTiles[x] = new LandTile[BlockHeight][]; m_LandTiles[x][y] = value; if ( m_LandPatches[x] == null ) - m_LandPatches[x] = new int[(m_BlockHeight + 31) >> 5]; + m_LandPatches[x] = new int[(BlockHeight + 31) >> 5]; m_LandPatches[x][y >> 5] |= 1 << (y & 0x1F); } @@ -328,11 +303,11 @@ namespace Server [MethodImpl(MethodImplOptions.Synchronized)] public LandTile[] GetLandBlock( int x, int y ) { - if ( x < 0 || y < 0 || x >= m_BlockWidth || y >= m_BlockHeight || m_Map == null ) + if ( x < 0 || y < 0 || x >= BlockWidth || y >= BlockHeight || MapStream == null ) return m_InvalidLandBlock; if ( m_LandTiles[x] == null ) - m_LandTiles[x] = new LandTile[m_BlockHeight][]; + m_LandTiles[x] = new LandTile[BlockHeight][]; LandTile[] tiles = m_LandTiles[x][y]; @@ -344,7 +319,7 @@ namespace Server TileMatrix shared = m_FileShare[i]; lock (shared) { - if ( x >= 0 && x < shared.m_BlockWidth && y >= 0 && y < shared.m_BlockHeight ) + if ( x >= 0 && x < shared.BlockWidth && y >= 0 && y < shared.BlockHeight ) { LandTile[][] theirTiles = shared.m_LandTiles[x]; @@ -388,19 +363,19 @@ namespace Server { try { - m_IndexReader.BaseStream.Seek( ((x * m_BlockHeight) + y) * 12, SeekOrigin.Begin ); + IndexReader.BaseStream.Seek( ((x * BlockHeight) + y) * 12, SeekOrigin.Begin ); - int lookup = m_IndexReader.ReadInt32(); - int length = m_IndexReader.ReadInt32(); + int lookup = IndexReader.ReadInt32(); + int length = IndexReader.ReadInt32(); if ( lookup < 0 || length <= 0 ) { - return m_EmptyStaticBlock; + return EmptyStaticBlock; } int count = length / 7; - m_Statics.Seek( lookup, SeekOrigin.Begin ); + DataStream.Seek( lookup, SeekOrigin.Begin ); if ( m_TileBuffer.Length < count ) m_TileBuffer = new StaticTile[count]; @@ -410,7 +385,7 @@ namespace Server fixed ( StaticTile *pTiles = staTiles ) { #if !MONO - NativeReader.Read( m_Statics.SafeFileHandle.DangerousGetHandle(), pTiles, length ); + NativeReader.Read( DataStream.SafeFileHandle.DangerousGetHandle(), pTiles, length ); #else NativeReader.Read( m_Statics.Handle, pTiles, length ); #endif @@ -458,7 +433,7 @@ namespace Server m_NextStaticWarning = DateTime.UtcNow + TimeSpan.FromMinutes( 1.0 ); } - return m_EmptyStaticBlock; + return EmptyStaticBlock; } } @@ -476,19 +451,19 @@ namespace Server { try { - int offset = ((x * m_BlockHeight) + y) * 196 + 4; + int offset = ((x * BlockHeight) + y) * 196 + 4; if ( m_MapIndex != null ) offset = m_MapIndex.Lookup( offset ); - m_Map.Seek( offset, SeekOrigin.Begin ); + MapStream.Seek( offset, SeekOrigin.Begin ); LandTile[] tiles = new LandTile[64]; fixed ( LandTile *pTiles = tiles ) { #if !MONO - NativeReader.Read( m_Map.SafeFileHandle.DangerousGetHandle(), pTiles, 192 ); + NativeReader.Read( MapStream.SafeFileHandle.DangerousGetHandle(), pTiles, 192 ); #else NativeReader.Read( m_Map.Handle, pTiles, 192 ); #endif @@ -514,12 +489,12 @@ namespace Server m_MapIndex.Close(); else { - m_Map?.Close(); + MapStream?.Close(); } - m_Statics?.Close(); + DataStream?.Close(); - m_IndexReader?.Close(); + IndexReader?.Close(); } } @@ -663,10 +638,9 @@ namespace Server private BinaryReader m_Reader; private int m_Length; - private int m_Version; private UOPEntry[] m_Entries; - public int Version => m_Version; + public int Version { get; } public UOPIndex( FileStream stream ) { @@ -676,7 +650,7 @@ namespace Server if ( m_Reader.ReadInt32() != 0x50594D ) throw new ArgumentException( "Invalid UOP file." ); - m_Version = m_Reader.ReadInt32(); + Version = m_Reader.ReadInt32(); m_Reader.ReadInt32(); int nextTable = m_Reader.ReadInt32(); diff --git a/Server/TileMatrixPatch.cs b/Server/TileMatrixPatch.cs index af048f92d..0ec2644a5 100644 --- a/Server/TileMatrixPatch.cs +++ b/Server/TileMatrixPatch.cs @@ -27,13 +27,7 @@ namespace Server { private int m_LandBlocks, m_StaticBlocks; - private static bool m_Enabled = true; - - public static bool Enabled - { - get => m_Enabled; - set => m_Enabled = value; - } + public static bool Enabled { get; set; } = true; public int LandBlocks { @@ -55,7 +49,7 @@ namespace Server public TileMatrixPatch( TileMatrix matrix, int index ) { - if ( !m_Enabled ) + if ( !Enabled ) return; string mapDataPath = Core.FindDataFile( "mapdif{0}.mul", index ); diff --git a/Server/Timer.cs b/Server/Timer.cs index 7927c3ff2..2d45d5ae3 100644 --- a/Server/Timer.cs +++ b/Server/Timer.cs @@ -355,11 +355,8 @@ namespace Server } private static Queue m_Queue = new Queue(); - private static int m_BreakCount = 20000; - public static int BreakCount{ get => m_BreakCount; - set => m_BreakCount = value; - } + public static int BreakCount { get; set; } = 20000; private static int m_QueueCountAtSlice; @@ -373,7 +370,7 @@ namespace Server int index = 0; - while ( index < m_BreakCount && m_Queue.Count != 0 ) + while ( index < BreakCount && m_Queue.Count != 0 ) { Timer t = m_Queue.Dequeue(); TimerProfile prof = t.GetProfile(); @@ -550,41 +547,38 @@ namespace Server #region DelayCall Timers private class DelayCallTimer : Timer { - private TimerCallback m_Callback; - - public TimerCallback Callback => m_Callback; + public TimerCallback Callback { get; } public override bool DefRegCreation => false; public DelayCallTimer( TimeSpan delay, TimeSpan interval, int count, TimerCallback callback ) : base( delay, interval, count ) { - m_Callback = callback; + Callback = callback; RegCreation(); } protected override void OnTick() { - m_Callback?.Invoke(); + Callback?.Invoke(); } public override string ToString() { - return $"DelayCallTimer[{FormatDelegate(m_Callback)}]"; + return $"DelayCallTimer[{FormatDelegate(Callback)}]"; } } private class DelayStateCallTimer : Timer { - private TimerStateCallback m_Callback; private object m_State; - public TimerStateCallback Callback => m_Callback; + public TimerStateCallback Callback { get; } public override bool DefRegCreation => false; public DelayStateCallTimer( TimeSpan delay, TimeSpan interval, int count, TimerStateCallback callback, object state ) : base( delay, interval, count ) { - m_Callback = callback; + Callback = callback; m_State = state; RegCreation(); @@ -592,28 +586,27 @@ namespace Server protected override void OnTick() { - m_Callback?.Invoke( m_State ); + Callback?.Invoke( m_State ); } public override string ToString() { - return $"DelayStateCall[{FormatDelegate(m_Callback)}]"; + return $"DelayStateCall[{FormatDelegate(Callback)}]"; } } private class DelayStateCallTimer : Timer { - private TimerStateCallback m_Callback; private T m_State; - public TimerStateCallback Callback => m_Callback; + public TimerStateCallback Callback { get; } public override bool DefRegCreation => false; public DelayStateCallTimer( TimeSpan delay, TimeSpan interval, int count, TimerStateCallback callback, T state ) : base( delay, interval, count ) { - m_Callback = callback; + Callback = callback; m_State = state; RegCreation(); @@ -621,12 +614,12 @@ namespace Server protected override void OnTick() { - m_Callback?.Invoke( m_State ); + Callback?.Invoke( m_State ); } public override string ToString() { - return $"DelayStateCall[{FormatDelegate(m_Callback)}]"; + return $"DelayStateCall[{FormatDelegate(Callback)}]"; } } #endregion diff --git a/Server/VirtueInfo.cs b/Server/VirtueInfo.cs index bd05dacb8..6b28b8fe3 100644 --- a/Server/VirtueInfo.cs +++ b/Server/VirtueInfo.cs @@ -23,23 +23,21 @@ namespace Server [PropertyObject] public class VirtueInfo { - private int[] m_Values; - - public int[] Values => m_Values; + public int[] Values { get; private set; } public int GetValue( int index ) { - if ( m_Values == null ) + if ( Values == null ) return 0; - return m_Values[index]; + return Values[index]; } public void SetValue( int index, int value ) { - if ( m_Values == null ) - m_Values = new int[8]; + if ( Values == null ) + Values = new int[8]; - m_Values[index] = value; + Values[index] = value; } public override string ToString() @@ -104,11 +102,11 @@ namespace Server if ( mask != 0 ) { - m_Values = new int[8]; + Values = new int[8]; for ( int i = 0; i < 8; ++i ) if ( (mask & (1 << i)) != 0 ) - m_Values[i] = reader.ReadInt(); + Values[i] = reader.ReadInt(); } break; @@ -131,7 +129,7 @@ namespace Server { writer.Write( (byte) 1 ); // version - if ( info.m_Values == null ) + if ( info.Values == null ) { writer.Write( (byte) 0 ); } @@ -140,14 +138,14 @@ namespace Server int mask = 0; for ( int i = 0; i < 8; ++i ) - if ( info.m_Values[i] != 0 ) + if ( info.Values[i] != 0 ) mask |= 1 << i; writer.Write( (byte) mask ); for ( int i = 0; i < 8; ++i ) - if ( info.m_Values[i] != 0 ) - writer.Write( (int) info.m_Values[i] ); + if ( info.Values[i] != 0 ) + writer.Write( (int) info.Values[i] ); } } } diff --git a/Server/World.cs b/Server/World.cs index d7c6dd492..2011250fd 100644 --- a/Server/World.cs +++ b/Server/World.cs @@ -29,21 +29,15 @@ using Server.Guilds; namespace Server { public static class World { - - private static Dictionary m_Mobiles; - private static Dictionary m_Items; - - private static bool m_Loading; - private static bool m_Loaded; - - private static bool m_Saving; private static ManualResetEvent m_DiskWriteHandle = new ManualResetEvent(true); private static Queue _addQueue, _deleteQueue; - public static bool Saving => m_Saving; - public static bool Loaded => m_Loaded; - public static bool Loading => m_Loading; + public static bool Saving { get; private set; } + + public static bool Loaded { get; private set; } + + public static bool Loading { get; private set; } public readonly static string MobileIndexPath = Path.Combine( "Saves/Mobiles/", "Mobiles.idx" ); public readonly static string MobileTypesPath = Path.Combine( "Saves/Mobiles/", "Mobiles.tdb" ); @@ -69,13 +63,13 @@ namespace Server { m_DiskWriteHandle.WaitOne(); } - public static Dictionary Mobiles => m_Mobiles; + public static Dictionary Mobiles { get; private set; } - public static Dictionary Items => m_Items; + public static Dictionary Items { get; private set; } public static bool OnDelete( IEntity entity ) { - if ( m_Saving || m_Loading ) { - if ( m_Saving ) { + if ( Saving || Loading ) { + if ( Saving ) { AppendSafetyLog( "delete", entity ); } @@ -121,86 +115,68 @@ namespace Server { } private sealed class GuildEntry : IEntityEntry { - private BaseGuild m_Guild; - private long m_Position; - private int m_Length; + public BaseGuild Guild { get; } - public BaseGuild Guild => m_Guild; - - public Serial Serial => m_Guild?.Id ?? 0; + public Serial Serial => Guild?.Id ?? 0; public int TypeID => 0; - public long Position => m_Position; + public long Position { get; } - public int Length => m_Length; + public int Length { get; } public GuildEntry( BaseGuild g, long pos, int length ) { - m_Guild = g; - m_Position = pos; - m_Length = length; + Guild = g; + Position = pos; + Length = length; } } private sealed class ItemEntry : IEntityEntry { - private Item m_Item; - private int m_TypeID; - private string m_TypeName; - private long m_Position; - private int m_Length; + public Item Item { get; } - public Item Item => m_Item; + public Serial Serial => Item?.Serial ?? Serial.MinusOne; - public Serial Serial => m_Item?.Serial ?? Serial.MinusOne; + public int TypeID { get; } - public int TypeID => m_TypeID; + public string TypeName { get; } - public string TypeName => m_TypeName; + public long Position { get; } - public long Position => m_Position; - - public int Length => m_Length; + public int Length { get; } public ItemEntry( Item item, int typeID, string typeName, long pos, int length ) { - m_Item = item; - m_TypeID = typeID; - m_TypeName = typeName; - m_Position = pos; - m_Length = length; + Item = item; + TypeID = typeID; + TypeName = typeName; + Position = pos; + Length = length; } } private sealed class MobileEntry : IEntityEntry { - private Mobile m_Mobile; - private int m_TypeID; - private string m_TypeName; - private long m_Position; - private int m_Length; + public Mobile Mobile { get; } - public Mobile Mobile => m_Mobile; + public Serial Serial => Mobile?.Serial ?? Serial.MinusOne; - public Serial Serial => m_Mobile?.Serial ?? Serial.MinusOne; + public int TypeID { get; } - public int TypeID => m_TypeID; + public string TypeName { get; } - public string TypeName => m_TypeName; + public long Position { get; } - public long Position => m_Position; - - public int Length => m_Length; + public int Length { get; } public MobileEntry( Mobile mobile, int typeID, string typeName, long pos, int length ) { - m_Mobile = mobile; - m_TypeID = typeID; - m_TypeName = typeName; - m_Position = pos; - m_Length = length; + Mobile = mobile; + TypeID = typeID; + TypeName = typeName; + Position = pos; + Length = length; } } - private static string m_LoadingType; - - public static string LoadingType => m_LoadingType; + public static string LoadingType { get; private set; } private static readonly Type[] m_SerialTypeArray = new Type[1] { typeof(Serial) }; @@ -257,17 +233,17 @@ namespace Server { } public static void Load() { - if ( m_Loaded ) + if ( Loaded ) return; - m_Loaded = true; - m_LoadingType = null; + Loaded = true; + LoadingType = null; Console.Write( "World: Loading..." ); Stopwatch watch = Stopwatch.StartNew(); - m_Loading = true; + Loading = true; _addQueue = new Queue(); _deleteQueue = new Queue(); @@ -291,7 +267,7 @@ namespace Server { mobileCount = idxReader.ReadInt32(); - m_Mobiles = new Dictionary( mobileCount ); + Mobiles = new Dictionary( mobileCount ); for ( int i = 0; i < mobileCount; ++i ) { int typeID = idxReader.ReadInt32(); @@ -326,7 +302,7 @@ namespace Server { idxReader.Close(); } } else { - m_Mobiles = new Dictionary(); + Mobiles = new Dictionary(); } if ( File.Exists( ItemIndexPath ) && File.Exists( ItemTypesPath ) ) { @@ -340,7 +316,7 @@ namespace Server { itemCount = idxReader.ReadInt32(); - m_Items = new Dictionary( itemCount ); + Items = new Dictionary( itemCount ); for ( int i = 0; i < itemCount; ++i ) { int typeID = idxReader.ReadInt32(); @@ -375,7 +351,7 @@ namespace Server { idxReader.Close(); } } else { - m_Items = new Dictionary(); + Items = new Dictionary(); } if ( File.Exists( GuildIndexPath ) ) { @@ -420,7 +396,7 @@ namespace Server { reader.Seek( entry.Position, SeekOrigin.Begin ); try { - m_LoadingType = entry.TypeName; + LoadingType = entry.TypeName; m.Deserialize( reader ); if ( reader.Position != ( entry.Position + entry.Length ) ) @@ -455,7 +431,7 @@ namespace Server { reader.Seek( entry.Position, SeekOrigin.Begin ); try { - m_LoadingType = entry.TypeName; + LoadingType = entry.TypeName; item.Deserialize( reader ); if ( reader.Position != ( entry.Position + entry.Length ) ) @@ -478,7 +454,7 @@ namespace Server { } } - m_LoadingType = null; + LoadingType = null; if ( !failedMobiles && !failedItems && File.Exists( GuildDataPath ) ) { using ( FileStream bin = new FileStream( GuildDataPath, FileMode.Open, FileAccess.Read, FileShare.Read ) ) { @@ -563,18 +539,18 @@ namespace Server { EventSink.InvokeWorldLoad(); - m_Loading = false; + Loading = false; ProcessSafetyQueues(); - foreach ( Item item in m_Items.Values ) { + foreach ( Item item in Items.Values ) { if ( item.Parent == null ) item.UpdateTotals(); item.ClearProperties(); } - foreach ( Mobile m in m_Mobiles.Values ) { + foreach ( Mobile m in Mobiles.Values ) { m.UpdateRegion(); // Is this really needed? m.UpdateTotals(); @@ -583,7 +559,7 @@ namespace Server { watch.Stop(); - Console.WriteLine( "done ({1} items, {2} mobiles) ({0:F2} seconds)", watch.Elapsed.TotalSeconds, m_Items.Count, m_Mobiles.Count ); + Console.WriteLine( "done ({1} items, {2} mobiles) ({0:F2} seconds)", watch.Elapsed.TotalSeconds, Items.Count, Mobiles.Count ); } private static void ProcessSafetyQueues() { @@ -661,7 +637,7 @@ namespace Server { } public static void Save( bool message, bool permitBackgroundWrite ) { - if ( m_Saving ) + if ( Saving ) return; ++m_Saves; @@ -671,7 +647,7 @@ namespace Server { WaitForWriteCompletion();//Blocks Save until current disk flush is done. - m_Saving = true; + Saving = true; m_DiskWriteHandle.Reset(); @@ -705,7 +681,7 @@ namespace Server { watch.Stop(); - m_Saving = false; + Saving = false; if (!permitBackgroundWrite) NotifyDiskWriteComplete(); //Sets the DiskWriteHandle. If we allow background writes, we leave this upto the individual save strategies. @@ -737,43 +713,43 @@ namespace Server { public static Mobile FindMobile( Serial serial ) { Mobile mob; - m_Mobiles.TryGetValue( serial, out mob ); + Mobiles.TryGetValue( serial, out mob ); return mob; } public static void AddMobile( Mobile m ) { - if ( m_Saving ) { + if ( Saving ) { AppendSafetyLog( "add", m ); _addQueue.Enqueue( m ); } else { - m_Mobiles[m.Serial] = m; + Mobiles[m.Serial] = m; } } public static Item FindItem( Serial serial ) { Item item; - m_Items.TryGetValue( serial, out item ); + Items.TryGetValue( serial, out item ); return item; } public static void AddItem( Item item ) { - if ( m_Saving ) { + if ( Saving ) { AppendSafetyLog( "add", item ); _addQueue.Enqueue( item ); } else { - m_Items[item.Serial] = item; + Items[item.Serial] = item; } } public static void RemoveMobile( Mobile m ) { - m_Mobiles.Remove( m.Serial ); + Mobiles.Remove( m.Serial ); } public static void RemoveItem( Item item ) { - m_Items.Remove( item.Serial ); + Items.Remove( item.Serial ); } } }