refactor: fold hand-written serializable property setters into field hooks (#2587)
## Summary
Folds **113** hand-written `[SerializableProperty]` members into plain `[SerializableField]` declarations using the v4 setter hooks — value coercion/vetoes via `allowFieldChange`, post-change side effects via `fieldChanged` (whose `oldValue` parameter covers the old-house/old-sender unsubscribe patterns). Net **-450 lines** of setter boilerplate.
```cs
// before
[SerializableProperty(1)]
[CommandProperty(AccessLevel.GameMaster)]
public int Charges
{
get => _charges;
set
{
_charges = Math.Clamp(value, 0, MaxCharges);
InvalidateProperties();
this.MarkDirty();
}
}
// after
[SerializableField(1, allowFieldChange: nameof(AllowChargesChange))]
[SerializedCommandProperty(AccessLevel.GameMaster)]
[InvalidateProperties]
private int _charges;
private bool AllowChargesChange(ref int value)
{
value = Math.Clamp(value, 0, MaxCharges);
return true;
}
```
## How sites were selected
A classifier parsed all 204 `[SerializableProperty]` sites and converted only those matching strict shapes: getter is exactly `get => _field;`, the assignment comes first (after at most an equality guard), and relocated side effects contain no `return`, no `value` mutation, and no field re-assignment. Everything else was left alone deliberately:
- **~34 custom getters** (fallback defaults like `_x == -1 ? Default : _x`, self-healing refs) — no setter hook can express these.
- **~35 pre-assignment logic** (durability Unscale/Scale sandwiches, old-state captures like PotionKeg's pile weight).
- **virtual/override members, name-mismatched backing fields (`m_`), exotic semantics** (guards' `Focus` does work on *equal* assignment; `ChampionSpawn.Active` never assigns its field).
Five sites the classifier refused were converted by hand where the hooks fit cleanly: `ReceiverCrystal.Sender`, `PlayerVendor.House`, `PlayerBarkeeper.House` (old-value unsubscribe via `oldValue`), `BaseSuit.AccessLevel` (its existing virtual `OnAccessLevelChanged` already had the exact callback shape), and `DyeTub.DyedHue` (a true veto: `AllowDyedHueChange(ref int value) => _redyable`).
## Verification
- Build: **0 errors, 0 warnings**.
- **Schema regeneration produces zero Migrations changes** — the conversion is wire- and schema-neutral by construction (same orders, types, and property names), and CI's schema diff check enforces it.
- **835 + 708 tests green.**
## Behavioral notes (all strict improvements, called out for review)
- Generated setters skip everything when the incoming value equals the current one; a few converted setters previously re-ran side effects on equal assignment (redundant `Update()`-style refreshes).
- Generated setters always `MarkDirty()` on change; several converted setters never did (e.g. `DyeTub.DyedHue`, `MorphItem` ranges) — their changes only persisted if something else dirtied the entity. Those latent persistence bugs are fixed by construction.
This commit is contained in:
parent
73f9688083
commit
b042edcf0b
73 changed files with 893 additions and 1340 deletions
|
|
@ -33,17 +33,13 @@ public partial class ChampionSkullBrazier : AddonComponent
|
||||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
private ChampionSkullPlatform _platform;
|
private ChampionSkullPlatform _platform;
|
||||||
|
|
||||||
[SerializableProperty(2)]
|
[SerializableField(2, fieldChanged: nameof(OnSkullChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public Item Skull
|
private Item _skull;
|
||||||
|
|
||||||
|
private void OnSkullChanged(Item oldValue, Item newValue)
|
||||||
{
|
{
|
||||||
get => _skull;
|
_platform?.Validate();
|
||||||
set
|
|
||||||
{
|
|
||||||
_skull = value;
|
|
||||||
this.MarkDirty();
|
|
||||||
_platform?.Validate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int LabelNumber => 1049489 + (int)_type;
|
public override int LabelNumber => 1049489 + (int)_type;
|
||||||
|
|
|
||||||
|
|
@ -203,47 +203,38 @@ public partial class ChampionSpawn : Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(3)]
|
[SerializableField(3, allowFieldChange: nameof(AllowMaxLevelChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
[SerializedCommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||||
public int MaxLevel
|
private int _maxLevel;
|
||||||
|
|
||||||
|
private bool AllowMaxLevelChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _maxLevel;
|
value = Math.Clamp(value, 0, 18);
|
||||||
set => _maxLevel = Math.Clamp(value, 0, 18);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(9)]
|
[SerializableField(9, fieldChanged: nameof(OnSpawnAreaChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public Rectangle2D SpawnArea
|
[InvalidateProperties]
|
||||||
|
private Rectangle2D _spawnArea;
|
||||||
|
|
||||||
|
private void OnSpawnAreaChanged(Rectangle2D oldValue, Rectangle2D newValue)
|
||||||
{
|
{
|
||||||
get => _spawnArea;
|
UpdateRegion();
|
||||||
set
|
|
||||||
{
|
|
||||||
_spawnArea = value;
|
|
||||||
this.MarkDirty();
|
|
||||||
InvalidateProperties();
|
|
||||||
UpdateRegion();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(11)]
|
[SerializableField(11, fieldChanged: nameof(OnKillsChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Kills
|
[InvalidateProperties]
|
||||||
|
private int _kills;
|
||||||
|
|
||||||
|
private void OnKillsChanged(int oldValue, int newValue)
|
||||||
{
|
{
|
||||||
get => _kills;
|
var n = _kills / (double)MaxKills;
|
||||||
set
|
var p = (int)(n * 100);
|
||||||
|
if (p < 90)
|
||||||
{
|
{
|
||||||
_kills = value;
|
SetWhiteSkullCount(p / 20);
|
||||||
this.MarkDirty();
|
|
||||||
|
|
||||||
var n = _kills / (double)MaxKills;
|
|
||||||
var p = (int)(n * 100);
|
|
||||||
|
|
||||||
if (p < 90)
|
|
||||||
{
|
|
||||||
SetWhiteSkullCount(p / 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
InvalidateProperties();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,17 +64,13 @@ public partial class Trophy : Item
|
||||||
UpdateStyle();
|
UpdateStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(1)]
|
[SerializableField(1, fieldChanged: nameof(OnRankChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public TrophyRank Rank
|
private TrophyRank _rank;
|
||||||
|
|
||||||
|
private void OnRankChanged(TrophyRank oldValue, TrophyRank newValue)
|
||||||
{
|
{
|
||||||
get => _rank;
|
UpdateStyle();
|
||||||
set
|
|
||||||
{
|
|
||||||
_rank = value;
|
|
||||||
UpdateStyle();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Deserialize(IGenericReader reader, int version)
|
private void Deserialize(IGenericReader reader, int version)
|
||||||
|
|
|
||||||
|
|
@ -237,16 +237,12 @@ namespace Server.Items
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnSolutionChanged))]
|
||||||
public PuzzleChestSolution Solution
|
private PuzzleChestSolution _solution;
|
||||||
|
|
||||||
|
private void OnSolutionChanged(PuzzleChestSolution oldValue, PuzzleChestSolution newValue)
|
||||||
{
|
{
|
||||||
get => _solution;
|
InitHints();
|
||||||
set
|
|
||||||
{
|
|
||||||
_solution = value;
|
|
||||||
InitHints();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PuzzleChestCylinder FirstHint
|
public PuzzleChestCylinder FirstHint
|
||||||
|
|
|
||||||
|
|
@ -123,49 +123,35 @@ public partial class PlantItem : Item, ISecurable
|
||||||
|
|
||||||
private bool ShouldSerializePlantStatus() => _plantStatus != PlantStatus.BowlOfDirt;
|
private bool ShouldSerializePlantStatus() => _plantStatus != PlantStatus.BowlOfDirt;
|
||||||
|
|
||||||
[SerializableProperty(2)]
|
[SerializableField(2, fieldChanged: nameof(OnPlantTypeChanged))]
|
||||||
[SaveFlag(nameof(ShouldSerializePlantType))]
|
[SaveFlag(nameof(ShouldSerializePlantType))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public PlantType PlantType
|
private PlantType _plantType;
|
||||||
|
|
||||||
|
private void OnPlantTypeChanged(PlantType oldValue, PlantType newValue)
|
||||||
{
|
{
|
||||||
get => _plantType;
|
Update();
|
||||||
set
|
|
||||||
{
|
|
||||||
_plantType = value;
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializePlantType() => (int)_plantType != 0;
|
private bool ShouldSerializePlantType() => (int)_plantType != 0;
|
||||||
|
|
||||||
[SerializableProperty(3)]
|
[SerializableField(3, fieldChanged: nameof(OnPlantHueChanged))]
|
||||||
[SaveFlag(nameof(ShouldSerializePlantHue))]
|
[SaveFlag(nameof(ShouldSerializePlantHue))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public PlantHue PlantHue
|
private PlantHue _plantHue;
|
||||||
|
|
||||||
|
private void OnPlantHueChanged(PlantHue oldValue, PlantHue newValue)
|
||||||
{
|
{
|
||||||
get => _plantHue;
|
Update();
|
||||||
set
|
|
||||||
{
|
|
||||||
_plantHue = value;
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializePlantHue() => _plantHue != PlantHue.None;
|
private bool ShouldSerializePlantHue() => _plantHue != PlantHue.None;
|
||||||
|
|
||||||
[SerializableProperty(4)]
|
[SerializableField(4)]
|
||||||
[SaveFlag(nameof(ShouldSerializeShowType))]
|
[SaveFlag(nameof(ShouldSerializeShowType))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public bool ShowType
|
[InvalidateProperties]
|
||||||
{
|
private bool _showType;
|
||||||
get => _showType;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_showType = value;
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool ShouldSerializeShowType() => _showType;
|
private bool ShouldSerializeShowType() => _showType;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,43 +97,40 @@ namespace Server.Engines.Plants
|
||||||
|
|
||||||
public bool IsFullWater => _water >= 4;
|
public bool IsFullWater => _water >= 4;
|
||||||
|
|
||||||
[SerializableProperty(3)]
|
[SerializableField(3, fieldChanged: nameof(OnWaterChanged), allowFieldChange: nameof(AllowWaterChange))]
|
||||||
[SaveFlag(nameof(ShouldSerializeWater))]
|
[SaveFlag(nameof(ShouldSerializeWater))]
|
||||||
public int Water
|
private int _water;
|
||||||
|
|
||||||
|
private bool AllowWaterChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _water;
|
value = Math.Clamp(value, 0, 4);
|
||||||
set
|
return true;
|
||||||
{
|
}
|
||||||
_water = Math.Clamp(value, 0, 4);
|
|
||||||
Plant.InvalidateProperties();
|
private void OnWaterChanged(int oldValue, int newValue)
|
||||||
MarkDirty();
|
{
|
||||||
}
|
Plant.InvalidateProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeWater() => _water != 0;
|
private bool ShouldSerializeWater() => _water != 0;
|
||||||
|
|
||||||
[SerializableProperty(4)]
|
[SerializableField(4, fieldChanged: nameof(OnHitsChanged), allowFieldChange: nameof(AllowHitsChange))]
|
||||||
[SaveFlag(nameof(ShouldSerializeHits))]
|
[SaveFlag(nameof(ShouldSerializeHits))]
|
||||||
public int Hits
|
private int _hits;
|
||||||
|
|
||||||
|
private bool AllowHitsChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _hits;
|
value = Math.Clamp(value, 0, MaxHits);
|
||||||
set
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnHitsChanged(int oldValue, int newValue)
|
||||||
|
{
|
||||||
|
if (_hits == 0)
|
||||||
{
|
{
|
||||||
if (_hits == value)
|
Plant.Die();
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_hits = Math.Clamp(value, 0, MaxHits);
|
|
||||||
|
|
||||||
if (_hits == 0)
|
|
||||||
{
|
|
||||||
Plant.Die();
|
|
||||||
}
|
|
||||||
|
|
||||||
Plant.InvalidateProperties();
|
|
||||||
MarkDirty();
|
|
||||||
}
|
}
|
||||||
|
Plant.InvalidateProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeHits() => _hits != 0;
|
private bool ShouldSerializeHits() => _hits != 0;
|
||||||
|
|
@ -149,122 +146,106 @@ namespace Server.Engines.Plants
|
||||||
_ => PlantHealth.Vibrant
|
_ => PlantHealth.Vibrant
|
||||||
};
|
};
|
||||||
|
|
||||||
[SerializableProperty(5)]
|
[SerializableField(5, allowFieldChange: nameof(AllowInfestationChange))]
|
||||||
[SaveFlag(nameof(ShouldSerializeInfestation))]
|
[SaveFlag(nameof(ShouldSerializeInfestation))]
|
||||||
public int Infestation
|
private int _infestation;
|
||||||
|
|
||||||
|
private bool AllowInfestationChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _infestation;
|
value = Math.Clamp(value, 0, 2);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_infestation = Math.Clamp(value, 0, 2);
|
|
||||||
MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeInfestation() => _infestation != 0;
|
private bool ShouldSerializeInfestation() => _infestation != 0;
|
||||||
|
|
||||||
[SerializableProperty(6)]
|
[SerializableField(6, allowFieldChange: nameof(AllowFungusChange))]
|
||||||
[SaveFlag(nameof(ShouldSerializeFungus))]
|
[SaveFlag(nameof(ShouldSerializeFungus))]
|
||||||
public int Fungus
|
private int _fungus;
|
||||||
|
|
||||||
|
private bool AllowFungusChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _fungus;
|
value = Math.Clamp(value, 0, 2);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_fungus = Math.Clamp(value, 0, 2);
|
|
||||||
MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeFungus() => _fungus != 0;
|
private bool ShouldSerializeFungus() => _fungus != 0;
|
||||||
|
|
||||||
[SerializableProperty(7)]
|
[SerializableField(7, allowFieldChange: nameof(AllowPoisonChange))]
|
||||||
[SaveFlag(nameof(ShouldSerializePoison))]
|
[SaveFlag(nameof(ShouldSerializePoison))]
|
||||||
public int Poison
|
private int _poison;
|
||||||
|
|
||||||
|
private bool AllowPoisonChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _poison;
|
value = Math.Clamp(value, 0, 2);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_poison = Math.Clamp(value, 0, 2);
|
|
||||||
MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializePoison() => _poison != 0;
|
private bool ShouldSerializePoison() => _poison != 0;
|
||||||
|
|
||||||
[SerializableProperty(8)]
|
[SerializableField(8, allowFieldChange: nameof(AllowDiseaseChange))]
|
||||||
[SaveFlag(nameof(ShouldSerializeDisease))]
|
[SaveFlag(nameof(ShouldSerializeDisease))]
|
||||||
public int Disease
|
private int _disease;
|
||||||
|
|
||||||
|
private bool AllowDiseaseChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _disease;
|
value = Math.Clamp(value, 0, 2);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_disease = Math.Clamp(value, 0, 2);
|
|
||||||
MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeDisease() => _disease != 0;
|
private bool ShouldSerializeDisease() => _disease != 0;
|
||||||
|
|
||||||
public bool IsFullPoisonPotion => _poisonPotion >= 2;
|
public bool IsFullPoisonPotion => _poisonPotion >= 2;
|
||||||
|
|
||||||
[SerializableProperty(9)]
|
[SerializableField(9, allowFieldChange: nameof(AllowPoisonPotionChange))]
|
||||||
[SaveFlag(nameof(ShouldSerializePoisonPotion))]
|
[SaveFlag(nameof(ShouldSerializePoisonPotion))]
|
||||||
public int PoisonPotion
|
private int _poisonPotion;
|
||||||
|
|
||||||
|
private bool AllowPoisonPotionChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _poisonPotion;
|
value = Math.Clamp(value, 0, 2);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_poisonPotion = Math.Clamp(value, 0, 2);
|
|
||||||
MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializePoisonPotion() => _poisonPotion != 0;
|
private bool ShouldSerializePoisonPotion() => _poisonPotion != 0;
|
||||||
|
|
||||||
public bool IsFullCurePotion => _curePotion >= 2;
|
public bool IsFullCurePotion => _curePotion >= 2;
|
||||||
|
|
||||||
[SerializableProperty(10)]
|
[SerializableField(10, allowFieldChange: nameof(AllowCurePotionChange))]
|
||||||
[SaveFlag(nameof(ShouldSerializeCurePotion))]
|
[SaveFlag(nameof(ShouldSerializeCurePotion))]
|
||||||
public int CurePotion
|
private int _curePotion;
|
||||||
|
|
||||||
|
private bool AllowCurePotionChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _curePotion;
|
value = Math.Clamp(value, 0, 2);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_curePotion = Math.Clamp(value, 0, 2);
|
|
||||||
MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeCurePotion() => _curePotion != 0;
|
private bool ShouldSerializeCurePotion() => _curePotion != 0;
|
||||||
|
|
||||||
public bool IsFullHealPotion => _healPotion >= 2;
|
public bool IsFullHealPotion => _healPotion >= 2;
|
||||||
|
|
||||||
[SerializableProperty(11)]
|
[SerializableField(11, allowFieldChange: nameof(AllowHealPotionChange))]
|
||||||
[SaveFlag(nameof(ShouldSerializeHealPotion))]
|
[SaveFlag(nameof(ShouldSerializeHealPotion))]
|
||||||
public int HealPotion
|
private int _healPotion;
|
||||||
|
|
||||||
|
private bool AllowHealPotionChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _healPotion;
|
value = Math.Clamp(value, 0, 2);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_healPotion = Math.Clamp(value, 0, 2);
|
|
||||||
MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeHealPotion() => _healPotion != 0;
|
private bool ShouldSerializeHealPotion() => _healPotion != 0;
|
||||||
|
|
||||||
public bool IsFullStrengthPotion => _strengthPotion >= 2;
|
public bool IsFullStrengthPotion => _strengthPotion >= 2;
|
||||||
|
|
||||||
[SerializableProperty(12)]
|
[SerializableField(12, allowFieldChange: nameof(AllowStrengthPotionChange))]
|
||||||
[SaveFlag(nameof(ShouldSerializeStrengthPotion))]
|
[SaveFlag(nameof(ShouldSerializeStrengthPotion))]
|
||||||
public int StrengthPotion
|
private int _strengthPotion;
|
||||||
|
|
||||||
|
private bool AllowStrengthPotionChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _strengthPotion;
|
value = Math.Clamp(value, 0, 2);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_strengthPotion = Math.Clamp(value, 0, 2);
|
|
||||||
MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeStrengthPotion() => _strengthPotion != 0;
|
private bool ShouldSerializeStrengthPotion() => _strengthPotion != 0;
|
||||||
|
|
@ -301,44 +282,52 @@ namespace Server.Engines.Plants
|
||||||
|
|
||||||
private bool ShouldSerializeSeedHue() => _pollinated;
|
private bool ShouldSerializeSeedHue() => _pollinated;
|
||||||
|
|
||||||
[SerializableProperty(16)]
|
[SerializableField(16, allowFieldChange: nameof(AllowAvailableSeedsChange))]
|
||||||
[SaveFlag(nameof(ShouldSerializeAvailableSeeds))]
|
[SaveFlag(nameof(ShouldSerializeAvailableSeeds))]
|
||||||
public int AvailableSeeds
|
private int _availableSeeds;
|
||||||
|
|
||||||
|
private bool AllowAvailableSeedsChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _availableSeeds;
|
value = Math.Max(value, 0);
|
||||||
set => _availableSeeds = Math.Max(value, 0);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeAvailableSeeds() => _availableSeeds != 0;
|
private bool ShouldSerializeAvailableSeeds() => _availableSeeds != 0;
|
||||||
|
|
||||||
[SerializableProperty(17)]
|
[SerializableField(17, allowFieldChange: nameof(AllowLeftSeedsChange))]
|
||||||
[SaveFlag(nameof(ShouldSerializeLeftSeeds), nameof(LeftSeedsDefaultValue))]
|
[SaveFlag(nameof(ShouldSerializeLeftSeeds), nameof(LeftSeedsDefaultValue))]
|
||||||
public int LeftSeeds
|
private int _leftSeeds;
|
||||||
|
|
||||||
|
private bool AllowLeftSeedsChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _leftSeeds;
|
value = Math.Max(value, 0);
|
||||||
set => _leftSeeds = Math.Max(value, 0);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeLeftSeeds() => _leftSeeds != 8;
|
private bool ShouldSerializeLeftSeeds() => _leftSeeds != 8;
|
||||||
|
|
||||||
private int LeftSeedsDefaultValue() => 8;
|
private int LeftSeedsDefaultValue() => 8;
|
||||||
|
|
||||||
[SerializableProperty(18)]
|
[SerializableField(18, allowFieldChange: nameof(AllowAvailableResourcesChange))]
|
||||||
[SaveFlag(nameof(ShouldSerializeAvailableResources))]
|
[SaveFlag(nameof(ShouldSerializeAvailableResources))]
|
||||||
public int AvailableResources
|
private int _availableResources;
|
||||||
|
|
||||||
|
private bool AllowAvailableResourcesChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _availableResources;
|
value = Math.Max(value, 0);
|
||||||
set => _availableResources = Math.Max(value, 0);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeAvailableResources() => _availableResources != 0;
|
private bool ShouldSerializeAvailableResources() => _availableResources != 0;
|
||||||
|
|
||||||
[SerializableProperty(19)]
|
[SerializableField(19, allowFieldChange: nameof(AllowLeftResourcesChange))]
|
||||||
[SaveFlag(nameof(ShouldSerializeLeftResources), nameof(LeftResourcesDefaultValue))]
|
[SaveFlag(nameof(ShouldSerializeLeftResources), nameof(LeftResourcesDefaultValue))]
|
||||||
public int LeftResources
|
private int _leftResources;
|
||||||
|
|
||||||
|
private bool AllowLeftResourcesChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _leftResources;
|
value = Math.Max(value, 0);
|
||||||
set => _leftResources = Math.Max(value, 0);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeLeftResources() => _leftResources != 8;
|
private bool ShouldSerializeLeftResources() => _leftResources != 8;
|
||||||
|
|
|
||||||
|
|
@ -35,18 +35,14 @@ public partial class Seed : Item
|
||||||
|
|
||||||
public override double DefaultWeight => 1.0;
|
public override double DefaultWeight => 1.0;
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializableField(1, fieldChanged: nameof(OnPlantHueChanged))]
|
||||||
[SerializableProperty(1)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public PlantHue PlantHue
|
[InvalidateProperties]
|
||||||
|
private PlantHue _plantHue;
|
||||||
|
|
||||||
|
private void OnPlantHueChanged(PlantHue oldValue, PlantHue newValue)
|
||||||
{
|
{
|
||||||
get => _plantHue;
|
Hue = PlantHueInfo.GetInfo(newValue).Hue;
|
||||||
set
|
|
||||||
{
|
|
||||||
_plantHue = value;
|
|
||||||
Hue = PlantHueInfo.GetInfo(value).Hue;
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int LabelNumber => 1060810; // seed
|
public override int LabelNumber => 1060810; // seed
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,14 @@ public partial class MurderContext
|
||||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
private TimeSpan _longTermElapse;
|
private TimeSpan _longTermElapse;
|
||||||
|
|
||||||
[SerializableProperty(2)]
|
[SerializableField(2, allowFieldChange: nameof(AllowShortTermMurdersChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int ShortTermMurders
|
private int _shortTermMurders;
|
||||||
|
|
||||||
|
private bool AllowShortTermMurdersChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _shortTermMurders;
|
value = Math.Max(value, 0);
|
||||||
set => _shortTermMurders = Math.Max(value, 0);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableField(3)]
|
[SerializableField(3)]
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,12 @@ public partial class SummoningAltar : AbbatoirAddon
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnDaemonChanged))]
|
||||||
public BoneDemon Daemon
|
private BoneDemon _daemon;
|
||||||
|
|
||||||
|
private void OnDaemonChanged(BoneDemon oldValue, BoneDemon newValue)
|
||||||
{
|
{
|
||||||
get => _daemon;
|
CheckDaemon();
|
||||||
set
|
|
||||||
{
|
|
||||||
_daemon = value;
|
|
||||||
CheckDaemon();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CheckDaemon()
|
public void CheckDaemon()
|
||||||
|
|
|
||||||
|
|
@ -311,26 +311,20 @@ public abstract partial class BaseSpawner : Item, ISpawner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(8)]
|
[SerializableField(8, fieldChanged: nameof(OnCountChanged))]
|
||||||
[CommandProperty(AccessLevel.Developer)]
|
[SerializedCommandProperty(AccessLevel.Developer)]
|
||||||
public int Count
|
[InvalidateProperties]
|
||||||
|
private int _count;
|
||||||
|
|
||||||
|
private void OnCountChanged(int oldValue, int newValue)
|
||||||
{
|
{
|
||||||
get => _count;
|
if (IsFull)
|
||||||
set
|
|
||||||
{
|
{
|
||||||
_count = value;
|
_timer?.Stop();
|
||||||
|
}
|
||||||
if (IsFull)
|
else if (_timer?.Running != true)
|
||||||
{
|
{
|
||||||
_timer?.Stop();
|
DoTimer();
|
||||||
}
|
|
||||||
else if (_timer?.Running != true)
|
|
||||||
{
|
|
||||||
DoTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -332,27 +332,22 @@ public partial class PigmentsOfTokuno : BasePigmentsOfTokuno
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public PigmentsOfTokuno(PigmentType type, int uses) : base(uses) => Type = type;
|
public PigmentsOfTokuno(PigmentType type, int uses) : base(uses) => Type = type;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnTypeChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public PigmentType Type
|
private PigmentType _type;
|
||||||
|
|
||||||
|
private void OnTypeChanged(PigmentType oldValue, PigmentType newValue)
|
||||||
{
|
{
|
||||||
get => _type;
|
var v = (int)_type;
|
||||||
set
|
if (v >= 0 && v < _table.Length)
|
||||||
{
|
{
|
||||||
_type = value;
|
Hue = _table[v][0];
|
||||||
|
Label = _table[v][1];
|
||||||
var v = (int)_type;
|
}
|
||||||
|
else
|
||||||
if (v >= 0 && v < _table.Length)
|
{
|
||||||
{
|
Hue = 0;
|
||||||
Hue = _table[v][0];
|
Label = -1;
|
||||||
Label = _table[v][1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Hue = 0;
|
|
||||||
Label = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -617,27 +617,22 @@ public partial class LesserPigmentsOfTokuno : BasePigmentsOfTokuno
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public LesserPigmentsOfTokuno(LesserPigmentType type) : base(1) => Type = type;
|
public LesserPigmentsOfTokuno(LesserPigmentType type) : base(1) => Type = type;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnTypeChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public LesserPigmentType Type
|
private LesserPigmentType _type;
|
||||||
|
|
||||||
|
private void OnTypeChanged(LesserPigmentType oldValue, LesserPigmentType newValue)
|
||||||
{
|
{
|
||||||
get => _type;
|
var v = (int)_type;
|
||||||
set
|
if (v >= 0 && v < _table.Length)
|
||||||
{
|
{
|
||||||
_type = value;
|
Hue = _table[v][0];
|
||||||
|
Label = _table[v][1];
|
||||||
var v = (int)_type;
|
}
|
||||||
|
else
|
||||||
if (v >= 0 && v < _table.Length)
|
{
|
||||||
{
|
Hue = 0;
|
||||||
Hue = _table[v][0];
|
Label = -1;
|
||||||
Label = _table[v][1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Hue = 0;
|
|
||||||
Label = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,45 +79,33 @@ public partial class CharacterStatue : Mobile, IRewardItem
|
||||||
InvalidateHues();
|
InvalidateHues();
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnStatueTypeChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public StatueType StatueType
|
private StatueType _statueType;
|
||||||
|
|
||||||
|
private void OnStatueTypeChanged(StatueType oldValue, StatueType newValue)
|
||||||
{
|
{
|
||||||
get => _statueType;
|
InvalidateHues();
|
||||||
set
|
InvalidatePose();
|
||||||
{
|
|
||||||
_statueType = value;
|
|
||||||
InvalidateHues();
|
|
||||||
InvalidatePose();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(1)]
|
[SerializableField(1, fieldChanged: nameof(OnPoseChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public StatuePose Pose
|
private StatuePose _pose;
|
||||||
|
|
||||||
|
private void OnPoseChanged(StatuePose oldValue, StatuePose newValue)
|
||||||
{
|
{
|
||||||
get => _pose;
|
InvalidatePose();
|
||||||
set
|
|
||||||
{
|
|
||||||
_pose = value;
|
|
||||||
InvalidatePose();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(2)]
|
[SerializableField(2, fieldChanged: nameof(OnMaterialChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public StatueMaterial Material
|
private StatueMaterial _material;
|
||||||
|
|
||||||
|
private void OnMaterialChanged(StatueMaterial oldValue, StatueMaterial newValue)
|
||||||
{
|
{
|
||||||
get => _material;
|
InvalidateHues();
|
||||||
set
|
InvalidatePose();
|
||||||
{
|
|
||||||
_material = value;
|
|
||||||
InvalidateHues();
|
|
||||||
InvalidatePose();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnDoubleClick(Mobile from)
|
public override void OnDoubleClick(Mobile from)
|
||||||
|
|
|
||||||
|
|
@ -25,17 +25,13 @@ public partial class CharacterStatueMaker : Item, IRewardItem
|
||||||
|
|
||||||
public override int LabelNumber => 1076173; // Character Statue Maker
|
public override int LabelNumber => 1076173; // Character Statue Maker
|
||||||
|
|
||||||
[SerializableProperty(1)]
|
[SerializableField(1, fieldChanged: nameof(OnStatueTypeChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public StatueType StatueType
|
private StatueType _statueType;
|
||||||
|
|
||||||
|
private void OnStatueTypeChanged(StatueType oldValue, StatueType newValue)
|
||||||
{
|
{
|
||||||
get => _statueType;
|
InvalidateHue();
|
||||||
set
|
|
||||||
{
|
|
||||||
_statueType = value;
|
|
||||||
InvalidateHue();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnDoubleClick(Mobile from)
|
public override void OnDoubleClick(Mobile from)
|
||||||
|
|
|
||||||
|
|
@ -63,22 +63,14 @@ namespace Server.Items
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(1)]
|
[SerializableField(1, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
[InvalidateProperties]
|
||||||
{
|
private CraftResource _resource;
|
||||||
get => _resource;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_resource != value)
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(_resource);
|
|
||||||
|
|
||||||
InvalidateProperties();
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
this.MarkDirty();
|
{
|
||||||
}
|
Hue = CraftResources.GetHue(_resource);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item IAddon.Deed => Deed;
|
Item IAddon.Deed => Deed;
|
||||||
|
|
|
||||||
|
|
@ -41,22 +41,14 @@ namespace Server.Items
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(1)]
|
[SerializableField(1, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
[InvalidateProperties]
|
||||||
{
|
private CraftResource _resource;
|
||||||
get => _resource;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_resource != value)
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(_resource);
|
|
||||||
|
|
||||||
InvalidateProperties();
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
this.MarkDirty();
|
{
|
||||||
}
|
Hue = CraftResources.GetHue(_resource);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool RetainDeedHue => false;
|
public virtual bool RetainDeedHue => false;
|
||||||
|
|
|
||||||
|
|
@ -23,22 +23,14 @@ public abstract partial class BaseAddonContainerDeed : Item, ICraftable
|
||||||
|
|
||||||
public abstract BaseAddonContainer Addon { get; }
|
public abstract BaseAddonContainer Addon { get; }
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
[InvalidateProperties]
|
||||||
{
|
private CraftResource _resource;
|
||||||
get => _resource;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_resource != value)
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(_resource);
|
|
||||||
|
|
||||||
InvalidateProperties();
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
this.MarkDirty();
|
{
|
||||||
}
|
Hue = CraftResources.GetHue(_resource);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual int OnCraft(
|
public virtual int OnCraft(
|
||||||
|
|
|
||||||
|
|
@ -48,17 +48,19 @@ namespace Server.Items
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
public int MaxFlour => 2;
|
public int MaxFlour => 2;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnCurFlourChanged), allowFieldChange: nameof(AllowCurFlourChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int CurFlour
|
private int _curFlour;
|
||||||
|
|
||||||
|
private bool AllowCurFlourChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _curFlour;
|
value = Math.Clamp(value, 0, MaxFlour);
|
||||||
set
|
return true;
|
||||||
{
|
}
|
||||||
_curFlour = Math.Clamp(value, 0, MaxFlour);
|
|
||||||
UpdateStage();
|
private void OnCurFlourChanged(int oldValue, int newValue)
|
||||||
this.MarkDirty();
|
{
|
||||||
}
|
UpdateStage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartWorking(Mobile from)
|
public void StartWorking(Mobile from)
|
||||||
|
|
|
||||||
|
|
@ -35,16 +35,19 @@ namespace Server.Items
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
public int MaxFlour => 2;
|
public int MaxFlour => 2;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnCurFlourChanged), allowFieldChange: nameof(AllowCurFlourChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int CurFlour
|
private int _curFlour;
|
||||||
|
|
||||||
|
private bool AllowCurFlourChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _curFlour;
|
value = Math.Max(0, Math.Min(value, MaxFlour));
|
||||||
set
|
return true;
|
||||||
{
|
}
|
||||||
_curFlour = Math.Max(0, Math.Min(value, MaxFlour));
|
|
||||||
UpdateStage();
|
private void OnCurFlourChanged(int oldValue, int newValue)
|
||||||
}
|
{
|
||||||
|
UpdateStage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartWorking(Mobile from)
|
public void StartWorking(Mobile from)
|
||||||
|
|
|
||||||
|
|
@ -25,35 +25,27 @@ namespace Server.Items
|
||||||
_teleOffset = offset;
|
_teleOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnActiveChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public bool Active
|
private bool _active;
|
||||||
{
|
|
||||||
get => _active;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_active = value;
|
|
||||||
|
|
||||||
if (Addon is SHTeleporter sourceAddon)
|
private void OnActiveChanged(bool oldValue, bool newValue)
|
||||||
{
|
{
|
||||||
sourceAddon.ChangeActive(value);
|
if (Addon is SHTeleporter sourceAddon)
|
||||||
}
|
{
|
||||||
|
sourceAddon.ChangeActive(newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(1)]
|
[SerializableField(1, fieldChanged: nameof(OnTeleDestChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public SHTeleComponent TeleDest
|
private SHTeleComponent _teleDest;
|
||||||
{
|
|
||||||
get => _teleDest;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_teleDest = value;
|
|
||||||
|
|
||||||
if (Addon is SHTeleporter sourceAddon)
|
private void OnTeleDestChanged(SHTeleComponent oldValue, SHTeleComponent newValue)
|
||||||
{
|
{
|
||||||
sourceAddon.ChangeDest(value);
|
if (Addon is SHTeleporter sourceAddon)
|
||||||
}
|
{
|
||||||
|
sourceAddon.ChangeDest(newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,19 +30,14 @@ namespace Server.Items
|
||||||
|
|
||||||
public AquariumState(Aquarium parent) => _aquarium = parent;
|
public AquariumState(Aquarium parent) => _aquarium = parent;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, allowFieldChange: nameof(AllowStateChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int State
|
private int _state;
|
||||||
|
|
||||||
|
private bool AllowStateChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _state;
|
value = Math.Clamp(value, 0, 4);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
if (_state != value)
|
|
||||||
{
|
|
||||||
_state = Math.Clamp(value, 0, 4);
|
|
||||||
MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableField(1)]
|
[SerializableField(1)]
|
||||||
|
|
|
||||||
|
|
@ -219,25 +219,16 @@ namespace Server.Items
|
||||||
|
|
||||||
private bool ShouldSerializeDurability() => _durability != ArmorDurabilityLevel.Regular;
|
private bool ShouldSerializeDurability() => _durability != ArmorDurabilityLevel.Regular;
|
||||||
|
|
||||||
[SerializableProperty(13)]
|
[SerializableField(13, fieldChanged: nameof(OnProtectionLevelChanged))]
|
||||||
[SaveFlag(nameof(ShouldSerializeProtectionLevel))]
|
[SaveFlag(nameof(ShouldSerializeProtectionLevel))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public ArmorProtectionLevel ProtectionLevel
|
[InvalidateProperties]
|
||||||
|
private ArmorProtectionLevel _protectionLevel;
|
||||||
|
|
||||||
|
private void OnProtectionLevelChanged(ArmorProtectionLevel oldValue, ArmorProtectionLevel newValue)
|
||||||
{
|
{
|
||||||
get => _protectionLevel;
|
Invalidate();
|
||||||
set
|
(Parent as Mobile)?.UpdateResistances();
|
||||||
{
|
|
||||||
if (_protectionLevel != value)
|
|
||||||
{
|
|
||||||
_protectionLevel = value;
|
|
||||||
|
|
||||||
Invalidate();
|
|
||||||
InvalidateProperties();
|
|
||||||
|
|
||||||
(Parent as Mobile)?.UpdateResistances();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeProtectionLevel() => _protectionLevel != ArmorProtectionLevel.Regular;
|
private bool ShouldSerializeProtectionLevel() => _protectionLevel != ArmorProtectionLevel.Regular;
|
||||||
|
|
|
||||||
|
|
@ -33,32 +33,26 @@ namespace Server.Items
|
||||||
|
|
||||||
public override ArmorMeditationAllowance DefMedAllowance => ArmorMeditationAllowance.All;
|
public override ArmorMeditationAllowance DefMedAllowance => ArmorMeditationAllowance.All;
|
||||||
|
|
||||||
|
[SerializableField(0, fieldChanged: nameof(OnCurArcaneChargesChanged))]
|
||||||
[EncodedInt]
|
[EncodedInt]
|
||||||
[SerializableProperty(0)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[InvalidateProperties]
|
||||||
public int CurArcaneCharges
|
private int _curArcaneCharges;
|
||||||
|
|
||||||
|
private void OnCurArcaneChargesChanged(int oldValue, int newValue)
|
||||||
{
|
{
|
||||||
get => _curArcaneCharges;
|
Update();
|
||||||
set
|
|
||||||
{
|
|
||||||
_curArcaneCharges = value;
|
|
||||||
InvalidateProperties();
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SerializableField(1, fieldChanged: nameof(OnMaxArcaneChargesChanged))]
|
||||||
[EncodedInt]
|
[EncodedInt]
|
||||||
[SerializableProperty(1)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[InvalidateProperties]
|
||||||
public int MaxArcaneCharges
|
private int _maxArcaneCharges;
|
||||||
|
|
||||||
|
private void OnMaxArcaneChargesChanged(int oldValue, int newValue)
|
||||||
{
|
{
|
||||||
get => _maxArcaneCharges;
|
Update();
|
||||||
set
|
|
||||||
{
|
|
||||||
_maxArcaneCharges = value;
|
|
||||||
InvalidateProperties();
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
|
|
|
||||||
|
|
@ -32,32 +32,26 @@ namespace Server.Items
|
||||||
|
|
||||||
public override ArmorMeditationAllowance DefMedAllowance => ArmorMeditationAllowance.All;
|
public override ArmorMeditationAllowance DefMedAllowance => ArmorMeditationAllowance.All;
|
||||||
|
|
||||||
|
[SerializableField(0, fieldChanged: nameof(OnCurArcaneChargesChanged))]
|
||||||
[EncodedInt]
|
[EncodedInt]
|
||||||
[SerializableProperty(0)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[InvalidateProperties]
|
||||||
public int CurArcaneCharges
|
private int _curArcaneCharges;
|
||||||
|
|
||||||
|
private void OnCurArcaneChargesChanged(int oldValue, int newValue)
|
||||||
{
|
{
|
||||||
get => _curArcaneCharges;
|
Update();
|
||||||
set
|
|
||||||
{
|
|
||||||
_curArcaneCharges = value;
|
|
||||||
InvalidateProperties();
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SerializableField(1, fieldChanged: nameof(OnMaxArcaneChargesChanged))]
|
||||||
[EncodedInt]
|
[EncodedInt]
|
||||||
[SerializableProperty(1)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[InvalidateProperties]
|
||||||
public int MaxArcaneCharges
|
private int _maxArcaneCharges;
|
||||||
|
|
||||||
|
private void OnMaxArcaneChargesChanged(int oldValue, int newValue)
|
||||||
{
|
{
|
||||||
get => _maxArcaneCharges;
|
Update();
|
||||||
set
|
|
||||||
{
|
|
||||||
_maxArcaneCharges = value;
|
|
||||||
InvalidateProperties();
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
|
|
|
||||||
|
|
@ -113,19 +113,15 @@ namespace Server.Items
|
||||||
Resistances = new AosElementAttributes(this);
|
Resistances = new AosElementAttributes(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[SaveFlag(nameof(ShouldSerializeResource))]
|
[SaveFlag(nameof(ShouldSerializeResource))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
[InvalidateProperties]
|
||||||
|
private CraftResource _resource;
|
||||||
|
|
||||||
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
{
|
{
|
||||||
get => _resource;
|
Hue = CraftResources.GetHue(_resource);
|
||||||
set
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(_resource);
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(9, useField: nameof(_strReq))]
|
[SerializableProperty(9, useField: nameof(_strReq))]
|
||||||
|
|
|
||||||
|
|
@ -22,34 +22,26 @@ namespace Server.Items
|
||||||
|
|
||||||
public override double DefaultWeight => 5.0;
|
public override double DefaultWeight => 5.0;
|
||||||
|
|
||||||
|
[SerializableField(0, fieldChanged: nameof(OnCurArcaneChargesChanged))]
|
||||||
[EncodedInt]
|
[EncodedInt]
|
||||||
[SerializableProperty(0)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[InvalidateProperties]
|
||||||
public int CurArcaneCharges
|
private int _curArcaneCharges;
|
||||||
|
|
||||||
|
private void OnCurArcaneChargesChanged(int oldValue, int newValue)
|
||||||
{
|
{
|
||||||
get => _curArcaneCharges;
|
Update();
|
||||||
set
|
|
||||||
{
|
|
||||||
_curArcaneCharges = value;
|
|
||||||
this.MarkDirty();
|
|
||||||
InvalidateProperties();
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SerializableField(1, fieldChanged: nameof(OnMaxArcaneChargesChanged))]
|
||||||
[EncodedInt]
|
[EncodedInt]
|
||||||
[SerializableProperty(1)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[InvalidateProperties]
|
||||||
public int MaxArcaneCharges
|
private int _maxArcaneCharges;
|
||||||
|
|
||||||
|
private void OnMaxArcaneChargesChanged(int oldValue, int newValue)
|
||||||
{
|
{
|
||||||
get => _maxArcaneCharges;
|
Update();
|
||||||
set
|
|
||||||
{
|
|
||||||
_maxArcaneCharges = value;
|
|
||||||
this.MarkDirty();
|
|
||||||
InvalidateProperties();
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
|
|
|
||||||
|
|
@ -325,34 +325,26 @@ namespace Server.Items
|
||||||
|
|
||||||
public override double DefaultWeight => 3.0;
|
public override double DefaultWeight => 3.0;
|
||||||
|
|
||||||
|
[SerializableField(0, fieldChanged: nameof(OnCurArcaneChargesChanged))]
|
||||||
[EncodedInt]
|
[EncodedInt]
|
||||||
[SerializableProperty(0)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[InvalidateProperties]
|
||||||
public int CurArcaneCharges
|
private int _curArcaneCharges;
|
||||||
|
|
||||||
|
private void OnCurArcaneChargesChanged(int oldValue, int newValue)
|
||||||
{
|
{
|
||||||
get => _curArcaneCharges;
|
Update();
|
||||||
set
|
|
||||||
{
|
|
||||||
_curArcaneCharges = value;
|
|
||||||
InvalidateProperties();
|
|
||||||
Update();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SerializableField(1, fieldChanged: nameof(OnMaxArcaneChargesChanged))]
|
||||||
[EncodedInt]
|
[EncodedInt]
|
||||||
[SerializableProperty(1)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[InvalidateProperties]
|
||||||
public int MaxArcaneCharges
|
private int _maxArcaneCharges;
|
||||||
|
|
||||||
|
private void OnMaxArcaneChargesChanged(int oldValue, int newValue)
|
||||||
{
|
{
|
||||||
get => _maxArcaneCharges;
|
Update();
|
||||||
set
|
|
||||||
{
|
|
||||||
_maxArcaneCharges = value;
|
|
||||||
InvalidateProperties();
|
|
||||||
Update();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
|
|
|
||||||
|
|
@ -70,19 +70,15 @@ namespace Server.Items
|
||||||
|
|
||||||
public override CraftResource DefaultResource => CraftResource.RegularLeather;
|
public override CraftResource DefaultResource => CraftResource.RegularLeather;
|
||||||
|
|
||||||
|
[SerializableField(1, fieldChanged: nameof(OnMaxArcaneChargesChanged))]
|
||||||
[EncodedInt]
|
[EncodedInt]
|
||||||
[SerializableProperty(1)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[InvalidateProperties]
|
||||||
public int MaxArcaneCharges
|
private int _maxArcaneCharges;
|
||||||
|
|
||||||
|
private void OnMaxArcaneChargesChanged(int oldValue, int newValue)
|
||||||
{
|
{
|
||||||
get => _maxArcaneCharges;
|
Update();
|
||||||
set
|
|
||||||
{
|
|
||||||
_maxArcaneCharges = value;
|
|
||||||
InvalidateProperties();
|
|
||||||
Update();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
|
|
|
||||||
|
|
@ -74,43 +74,31 @@ public abstract partial class BaseDoor : Item, ILockable, ITelekinesisable
|
||||||
Movable = false;
|
Movable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(1)]
|
[SerializableField(1, fieldChanged: nameof(OnOpenChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public bool Open
|
private bool _open;
|
||||||
|
|
||||||
|
private void OnOpenChanged(bool oldValue, bool newValue)
|
||||||
{
|
{
|
||||||
get => _open;
|
ItemID = _open ? _openedId : _closedId;
|
||||||
set
|
if (_open)
|
||||||
{
|
{
|
||||||
if (_open != value)
|
Location = new Point3D(X + _offset.X, Y + _offset.Y, Z + _offset.Z);
|
||||||
{
|
}
|
||||||
_open = value;
|
else
|
||||||
|
{
|
||||||
ItemID = _open ? _openedId : _closedId;
|
Location = new Point3D(X - _offset.X, Y - _offset.Y, Z - _offset.Z);
|
||||||
|
}
|
||||||
if (_open)
|
Effects.PlaySound(this, _open ? OpenedSound : ClosedSound);
|
||||||
{
|
if (_open)
|
||||||
Location = new Point3D(X + _offset.X, Y + _offset.Y, Z + _offset.Z);
|
{
|
||||||
}
|
_timer ??= new InternalTimer(this);
|
||||||
else
|
_timer.Start();
|
||||||
{
|
}
|
||||||
Location = new Point3D(X - _offset.X, Y - _offset.Y, Z - _offset.Z);
|
else
|
||||||
}
|
{
|
||||||
|
_timer.Stop();
|
||||||
Effects.PlaySound(this, _open ? OpenedSound : ClosedSound);
|
_timer = null;
|
||||||
|
|
||||||
if (_open)
|
|
||||||
{
|
|
||||||
_timer ??= new InternalTimer(this);
|
|
||||||
_timer.Start();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_timer.Stop();
|
|
||||||
_timer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,23 +62,19 @@ public partial class MarkContainer : LockableContainer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnAutoLockChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public bool AutoLock
|
private bool _autoLock;
|
||||||
{
|
|
||||||
get => _autoLock;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_autoLock = value;
|
|
||||||
|
|
||||||
if (!_autoLock)
|
private void OnAutoLockChanged(bool oldValue, bool newValue)
|
||||||
{
|
{
|
||||||
StopTimer();
|
if (!_autoLock)
|
||||||
}
|
{
|
||||||
else if (!Locked)
|
StopTimer();
|
||||||
{
|
}
|
||||||
_relockTimer ??= new InternalTimer(this);
|
else if (!Locked)
|
||||||
}
|
{
|
||||||
|
_relockTimer ??= new InternalTimer(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,17 +28,14 @@ public partial class DragonBardingDeed : Item, ICraftable
|
||||||
|
|
||||||
public override int LabelNumber => _exceptional ? 1053181 : 1053012; // dragon barding deed
|
public override int LabelNumber => _exceptional ? 1053181 : 1053012; // dragon barding deed
|
||||||
|
|
||||||
[SerializableProperty(2)]
|
[SerializableField(2, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
[InvalidateProperties]
|
||||||
|
private CraftResource _resource;
|
||||||
|
|
||||||
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
{
|
{
|
||||||
get => _resource;
|
Hue = CraftResources.GetHue(newValue);
|
||||||
set
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(value);
|
|
||||||
InvalidateProperties();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int OnCraft(
|
public int OnCraft(
|
||||||
|
|
|
||||||
|
|
@ -324,27 +324,21 @@ public abstract partial class BaseBeverage : Item, IHasQuantity
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
public bool IsFull => _quantity >= MaxQuantity;
|
public bool IsFull => _quantity >= MaxQuantity;
|
||||||
|
|
||||||
[SerializableProperty(2)]
|
[SerializableField(2, fieldChanged: nameof(OnContentChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public BeverageType Content
|
[InvalidateProperties]
|
||||||
|
private BeverageType _content;
|
||||||
|
|
||||||
|
private void OnContentChanged(BeverageType oldValue, BeverageType newValue)
|
||||||
{
|
{
|
||||||
get => _content;
|
var itemID = ComputeItemID();
|
||||||
set
|
if (itemID > 0)
|
||||||
{
|
{
|
||||||
_content = value;
|
ItemID = itemID;
|
||||||
|
}
|
||||||
InvalidateProperties();
|
else
|
||||||
|
{
|
||||||
var itemID = ComputeItemID();
|
Delete();
|
||||||
|
|
||||||
if (itemID > 0)
|
|
||||||
{
|
|
||||||
ItemID = itemID;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Delete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,25 +76,25 @@ public partial class SackFlour : Item, IHasQuantity
|
||||||
|
|
||||||
public override double DefaultWeight => 5.0;
|
public override double DefaultWeight => 5.0;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnQuantityChanged), allowFieldChange: nameof(AllowQuantityChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Quantity
|
private int _quantity;
|
||||||
|
|
||||||
|
private bool AllowQuantityChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _quantity;
|
value = Math.Min(20, Math.Max(0, value));
|
||||||
set
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnQuantityChanged(int oldValue, int newValue)
|
||||||
|
{
|
||||||
|
if (_quantity == 0)
|
||||||
{
|
{
|
||||||
_quantity = Math.Min(20, Math.Max(0, value));
|
Delete();
|
||||||
|
}
|
||||||
if (_quantity == 0)
|
else if (_quantity < 20 && ItemID is 0x1039 or 0x1045)
|
||||||
{
|
{
|
||||||
Delete();
|
++ItemID;
|
||||||
}
|
|
||||||
else if (_quantity < 20 && ItemID is 0x1039 or 0x1045)
|
|
||||||
{
|
|
||||||
++ItemID;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,55 +55,33 @@ public partial class MahjongGame : Item, ISecurable
|
||||||
|
|
||||||
public override double DefaultWeight => 5.0;
|
public override double DefaultWeight => 5.0;
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializableField(6, fieldChanged: nameof(OnShowScoresChanged))]
|
||||||
[SerializableProperty(6)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public bool ShowScores
|
private bool _showScores;
|
||||||
|
|
||||||
|
private void OnShowScoresChanged(bool oldValue, bool newValue)
|
||||||
{
|
{
|
||||||
get => _showScores;
|
if (newValue)
|
||||||
set
|
|
||||||
{
|
{
|
||||||
if (_showScores == value)
|
_players.SendPlayersPacket(true, true);
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_showScores = value;
|
|
||||||
|
|
||||||
if (value)
|
|
||||||
{
|
|
||||||
_players.SendPlayersPacket(true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
_players.SendGeneralPacket(true, true);
|
|
||||||
_players.SendLocalizedMessage(value ? 1062777 : 1062778); // The dealer has enabled/disabled score display.
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
}
|
||||||
|
_players.SendGeneralPacket(true, true);
|
||||||
|
_players.SendLocalizedMessage(newValue ? 1062777 : 1062778); // The dealer has enabled/disabled score display.
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializableField(7, fieldChanged: nameof(OnSpectatorVisionChanged))]
|
||||||
[SerializableProperty(7)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public bool SpectatorVision
|
[InvalidateProperties]
|
||||||
|
private bool _spectatorVision;
|
||||||
|
|
||||||
|
private void OnSpectatorVisionChanged(bool oldValue, bool newValue)
|
||||||
{
|
{
|
||||||
get => _spectatorVision;
|
if (_players.IsInGamePlayer(_players.DealerPosition))
|
||||||
set
|
|
||||||
{
|
{
|
||||||
if (_spectatorVision == value)
|
_players.Dealer.NetState.SendMahjongGeneralInfo(this);
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_spectatorVision = value;
|
|
||||||
|
|
||||||
if (_players.IsInGamePlayer(_players.DealerPosition))
|
|
||||||
{
|
|
||||||
_players.Dealer.NetState.SendMahjongGeneralInfo(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
_players.SendTilesPacket(false, true);
|
|
||||||
_players.SendLocalizedMessage(value ? 1062715 : 1062716); // The dealer has enabled/disabled Spectator Vision.
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
}
|
||||||
|
_players.SendTilesPacket(false, true);
|
||||||
|
_players.SendLocalizedMessage(newValue ? 1062715 : 1062716); // The dealer has enabled/disabled Spectator Vision.
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BuildHorizontalWall(
|
private void BuildHorizontalWall(
|
||||||
|
|
|
||||||
|
|
@ -93,16 +93,13 @@ public abstract partial class BaseJewel : Item, ICraftable, IAosItem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(2)]
|
[SerializableField(2, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
private CraftResource _resource;
|
||||||
|
|
||||||
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
{
|
{
|
||||||
get => _resource;
|
Hue = CraftResources.GetHue(_resource);
|
||||||
set
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(_resource);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int PhysicalResistance => Resistances.Physical;
|
public override int PhysicalResistance => Resistances.Physical;
|
||||||
|
|
|
||||||
|
|
@ -275,8 +275,16 @@ public partial class BroadcastCrystal : Item
|
||||||
[SerializationGenerator(0)]
|
[SerializationGenerator(0)]
|
||||||
public partial class ReceiverCrystal : Item
|
public partial class ReceiverCrystal : Item
|
||||||
{
|
{
|
||||||
|
[SerializableField(0, fieldChanged: nameof(OnSenderChanged))]
|
||||||
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
private BroadcastCrystal _sender;
|
private BroadcastCrystal _sender;
|
||||||
|
|
||||||
|
private void OnSenderChanged(BroadcastCrystal oldValue, BroadcastCrystal newValue)
|
||||||
|
{
|
||||||
|
oldValue?.RemoveReceiver(this);
|
||||||
|
newValue?.AddReceiver(this);
|
||||||
|
}
|
||||||
|
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public ReceiverCrystal() : base(0x1ED0) => Light = LightType.Circle150;
|
public ReceiverCrystal() : base(0x1ED0) => Light = LightType.Circle150;
|
||||||
|
|
||||||
|
|
@ -297,20 +305,6 @@ public partial class ReceiverCrystal : Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(0, useField: nameof(_sender))]
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
|
||||||
public BroadcastCrystal Sender
|
|
||||||
{
|
|
||||||
get => _sender;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_sender?.RemoveReceiver(this);
|
|
||||||
_sender = value;
|
|
||||||
value?.AddReceiver(this);
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void GetProperties(IPropertyList list)
|
public override void GetProperties(IPropertyList list)
|
||||||
{
|
{
|
||||||
base.GetProperties(list);
|
base.GetProperties(list);
|
||||||
|
|
|
||||||
|
|
@ -30,20 +30,24 @@ public partial class MorphItem : Item
|
||||||
_outsideRange = outRange;
|
_outsideRange = outRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, allowFieldChange: nameof(AllowOutsideRangeChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int OutsideRange
|
private int _outsideRange;
|
||||||
|
|
||||||
|
private bool AllowOutsideRangeChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _outsideRange;
|
value = Math.Clamp(value, 0, 18);
|
||||||
set => _outsideRange = Math.Clamp(value, 0, 18);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(3)]
|
[SerializableField(3, allowFieldChange: nameof(AllowInsideRangeChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int InsideRange
|
private int _insideRange;
|
||||||
|
|
||||||
|
private bool AllowInsideRangeChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _insideRange;
|
value = Math.Clamp(value, 0, 18);
|
||||||
set => _insideRange = Math.Clamp(value, 0, 18);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,16 @@ public partial class WarningItem : Item
|
||||||
private TextDefinition _warningMessage;
|
private TextDefinition _warningMessage;
|
||||||
|
|
||||||
// Field 1
|
// Field 1
|
||||||
|
[SerializableField(1, allowFieldChange: nameof(AllowRangeChange))]
|
||||||
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
private int _range;
|
private int _range;
|
||||||
|
|
||||||
|
private bool AllowRangeChange(ref int value)
|
||||||
|
{
|
||||||
|
value = Math.Min(value, 18);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
[SerializableField(2)]
|
[SerializableField(2)]
|
||||||
private TimeSpan _resetDelay;
|
private TimeSpan _resetDelay;
|
||||||
|
|
||||||
|
|
@ -39,18 +47,6 @@ public partial class WarningItem : Item
|
||||||
_range = Math.Min(range, 18);
|
_range = Math.Min(range, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
|
||||||
[SerializableProperty(1, useField: nameof(_range))]
|
|
||||||
public int Range
|
|
||||||
{
|
|
||||||
get => _range;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_range = Math.Min(value, 18);
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool OnlyToTriggerer => false;
|
public virtual bool OnlyToTriggerer => false;
|
||||||
public virtual int NeighborRange => 5;
|
public virtual int NeighborRange => 5;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,22 +16,14 @@ public abstract partial class BaseIngot : Item, ICommodity
|
||||||
|
|
||||||
public override double DefaultWeight => 0.1;
|
public override double DefaultWeight => 0.1;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
[InvalidateProperties]
|
||||||
{
|
private CraftResource _resource;
|
||||||
get => _resource;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_resource != value)
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(value);
|
|
||||||
|
|
||||||
InvalidateProperties();
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
this.MarkDirty();
|
{
|
||||||
}
|
Hue = CraftResources.GetHue(newValue);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int LabelNumber
|
public override int LabelNumber
|
||||||
|
|
|
||||||
|
|
@ -17,22 +17,14 @@ public abstract partial class BaseOre : Item
|
||||||
_resource = resource;
|
_resource = resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
[InvalidateProperties]
|
||||||
{
|
private CraftResource _resource;
|
||||||
get => _resource;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_resource != value)
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(value);
|
|
||||||
|
|
||||||
InvalidateProperties();
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
this.MarkDirty();
|
{
|
||||||
}
|
Hue = CraftResources.GetHue(newValue);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int LabelNumber
|
public override int LabelNumber
|
||||||
|
|
|
||||||
|
|
@ -14,22 +14,14 @@ public abstract partial class BaseScales : Item, ICommodity
|
||||||
_resource = resource;
|
_resource = resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
[InvalidateProperties]
|
||||||
{
|
private CraftResource _resource;
|
||||||
get => _resource;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_resource != value)
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(value);
|
|
||||||
|
|
||||||
InvalidateProperties();
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
this.MarkDirty();
|
{
|
||||||
}
|
Hue = CraftResources.GetHue(newValue);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int LabelNumber => 1053139; // dragon scales
|
public override int LabelNumber => 1053139; // dragon scales
|
||||||
|
|
|
||||||
|
|
@ -15,22 +15,14 @@ public abstract partial class BaseGranite : Item
|
||||||
|
|
||||||
public override double DefaultWeight => Core.ML ? 1.0 : 10.0;
|
public override double DefaultWeight => Core.ML ? 1.0 : 10.0;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
[InvalidateProperties]
|
||||||
{
|
private CraftResource _resource;
|
||||||
get => _resource;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_resource != value)
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(value);
|
|
||||||
|
|
||||||
InvalidateProperties();
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
this.MarkDirty();
|
{
|
||||||
}
|
Hue = CraftResources.GetHue(newValue);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int LabelNumber => 1044607; // high quality granite
|
public override int LabelNumber => 1044607; // high quality granite
|
||||||
|
|
|
||||||
|
|
@ -15,22 +15,14 @@ public abstract partial class BaseHides : Item, ICommodity
|
||||||
|
|
||||||
public override double DefaultWeight => 5.0;
|
public override double DefaultWeight => 5.0;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
[InvalidateProperties]
|
||||||
{
|
private CraftResource _resource;
|
||||||
get => _resource;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_resource != value)
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(value);
|
|
||||||
|
|
||||||
InvalidateProperties();
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
this.MarkDirty();
|
{
|
||||||
}
|
Hue = CraftResources.GetHue(newValue);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int LabelNumber
|
public override int LabelNumber
|
||||||
|
|
|
||||||
|
|
@ -15,22 +15,14 @@ public abstract partial class BaseLeather : Item, ICommodity
|
||||||
|
|
||||||
public override double DefaultWeight => 1.0;
|
public override double DefaultWeight => 1.0;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
[InvalidateProperties]
|
||||||
{
|
private CraftResource _resource;
|
||||||
get => _resource;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_resource != value)
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(value);
|
|
||||||
|
|
||||||
InvalidateProperties();
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
this.MarkDirty();
|
{
|
||||||
}
|
Hue = CraftResources.GetHue(newValue);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int LabelNumber
|
public override int LabelNumber
|
||||||
|
|
|
||||||
|
|
@ -21,22 +21,14 @@ public partial class Board : Item, ICommodity
|
||||||
Hue = CraftResources.GetHue(resource);
|
Hue = CraftResources.GetHue(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
[InvalidateProperties]
|
||||||
{
|
private CraftResource _resource;
|
||||||
get => _resource;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_resource != value)
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(value);
|
|
||||||
|
|
||||||
InvalidateProperties();
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
this.MarkDirty();
|
{
|
||||||
}
|
Hue = CraftResources.GetHue(newValue);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ICommodity.DescriptionNumber
|
int ICommodity.DescriptionNumber
|
||||||
|
|
|
||||||
|
|
@ -25,16 +25,14 @@ public partial class MessageInABottle : Item
|
||||||
|
|
||||||
public override int LabelNumber => 1041080; // a message in a bottle
|
public override int LabelNumber => 1041080; // a message in a bottle
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, allowFieldChange: nameof(AllowLevelChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Level
|
private int _level;
|
||||||
|
|
||||||
|
private bool AllowLevelChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _level;
|
value = Math.Max(1, Math.Min(value, 4));
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_level = Math.Max(1, Math.Min(value, 4));
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetRandomLevel()
|
public static int GetRandomLevel()
|
||||||
|
|
|
||||||
|
|
@ -103,18 +103,20 @@ public partial class SOS : Item
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
public bool IsAncient => _level >= 4;
|
public bool IsAncient => _level >= 4;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnLevelChanged), allowFieldChange: nameof(AllowLevelChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Level
|
[InvalidateProperties]
|
||||||
|
private int _level;
|
||||||
|
|
||||||
|
private bool AllowLevelChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _level;
|
value = Math.Max(1, Math.Min(value, 4));
|
||||||
set
|
return true;
|
||||||
{
|
}
|
||||||
_level = Math.Max(1, Math.Min(value, 4));
|
|
||||||
UpdateHue();
|
private void OnLevelChanged(int oldValue, int newValue)
|
||||||
InvalidateProperties();
|
{
|
||||||
this.MarkDirty();
|
UpdateHue();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateHue() => Hue = IsAncient ? 0x481 : 0;
|
public void UpdateHue() => Hue = IsAncient ? 0x481 : 0;
|
||||||
|
|
|
||||||
|
|
@ -28,22 +28,14 @@ public partial class Log : Item, ICommodity, IAxe
|
||||||
|
|
||||||
public override double DefaultWeight => 2.0;
|
public override double DefaultWeight => 2.0;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
[InvalidateProperties]
|
||||||
{
|
private CraftResource _resource;
|
||||||
get => _resource;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_resource != value)
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(value);
|
|
||||||
|
|
||||||
InvalidateProperties();
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
this.MarkDirty();
|
{
|
||||||
}
|
Hue = CraftResources.GetHue(newValue);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool Axe(Mobile from, BaseAxe axe) => TryCreateBoards(from, 0, new Board());
|
public virtual bool Axe(Mobile from, BaseAxe axe) => TryCreateBoards(from, 0, new Board());
|
||||||
|
|
|
||||||
|
|
@ -47,36 +47,24 @@ public partial class RecallRune : Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(2)]
|
[SerializableField(2, fieldChanged: nameof(OnMarkedChanged))]
|
||||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||||
public bool Marked
|
[InvalidateProperties]
|
||||||
|
private bool _marked;
|
||||||
|
|
||||||
|
private void OnMarkedChanged(bool oldValue, bool newValue)
|
||||||
{
|
{
|
||||||
get => _marked;
|
CalculateHue();
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_marked != value)
|
|
||||||
{
|
|
||||||
_marked = value;
|
|
||||||
CalculateHue();
|
|
||||||
InvalidateProperties();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(4)]
|
[SerializableField(4, fieldChanged: nameof(OnTargetMapChanged))]
|
||||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||||
public Map TargetMap
|
[InvalidateProperties]
|
||||||
|
private Map _targetMap;
|
||||||
|
|
||||||
|
private void OnTargetMapChanged(Map oldValue, Map newValue)
|
||||||
{
|
{
|
||||||
get => _targetMap;
|
CalculateHue();
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_targetMap != value)
|
|
||||||
{
|
|
||||||
_targetMap = value;
|
|
||||||
CalculateHue();
|
|
||||||
InvalidateProperties();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Deserialize(IGenericReader reader, int version)
|
private void Deserialize(IGenericReader reader, int version)
|
||||||
|
|
|
||||||
|
|
@ -133,28 +133,19 @@ public partial class Spellbook : Item, ICraftable, ISlayer, IAosItem
|
||||||
public virtual int BookOffset => 0;
|
public virtual int BookOffset => 0;
|
||||||
public virtual int BookCount => 64;
|
public virtual int BookCount => 64;
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializableField(7, fieldChanged: nameof(OnContentChanged))]
|
||||||
[SerializableProperty(7)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public ulong Content
|
[InvalidateProperties]
|
||||||
|
private ulong _content;
|
||||||
|
|
||||||
|
private void OnContentChanged(ulong oldValue, ulong newValue)
|
||||||
{
|
{
|
||||||
get => _content;
|
// This assignment will mark it as dirty
|
||||||
set
|
SpellCount = 0;
|
||||||
|
while (newValue > 0)
|
||||||
{
|
{
|
||||||
if (_content != value)
|
_spellCount += (int)(newValue & 0x1);
|
||||||
{
|
newValue >>= 1;
|
||||||
_content = value;
|
|
||||||
|
|
||||||
// This assignment will mark it as dirty
|
|
||||||
SpellCount = 0;
|
|
||||||
|
|
||||||
while (value > 0)
|
|
||||||
{
|
|
||||||
_spellCount += (int)(value & 0x1);
|
|
||||||
value >>= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
InvalidateProperties();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,17 +62,15 @@ public partial class RepairDeed : Item
|
||||||
|
|
||||||
public override bool DisplayLootType => false;
|
public override bool DisplayLootType => false;
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializableField(1, allowFieldChange: nameof(AllowSkillLevelChange))]
|
||||||
[SerializableProperty(1)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public double SkillLevel
|
[InvalidateProperties]
|
||||||
|
private double _skillLevel;
|
||||||
|
|
||||||
|
private bool AllowSkillLevelChange(ref double value)
|
||||||
{
|
{
|
||||||
get => _skillLevel;
|
value = Math.Clamp(value, 0, 120.0);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_skillLevel = Math.Clamp(value, 0, 120.0);
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddNameProperty(IPropertyList list)
|
public override void AddNameProperty(IPropertyList list)
|
||||||
|
|
|
||||||
|
|
@ -74,16 +74,13 @@ public abstract partial class BaseInstrument : Item, ICraftable, ISlayer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(1)]
|
[SerializableField(1, fieldChanged: nameof(OnLastReplenishedChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public DateTime LastReplenished
|
private DateTime _lastReplenished;
|
||||||
|
|
||||||
|
private void OnLastReplenishedChanged(DateTime oldValue, DateTime newValue)
|
||||||
{
|
{
|
||||||
get => _lastReplenished;
|
CheckReplenishUses();
|
||||||
set
|
|
||||||
{
|
|
||||||
_lastReplenished = value;
|
|
||||||
CheckReplenishUses();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(3)]
|
[SerializableProperty(3)]
|
||||||
|
|
|
||||||
|
|
@ -41,20 +41,13 @@ namespace Server.Items
|
||||||
|
|
||||||
public virtual bool AllowDyables => true;
|
public virtual bool AllowDyables => true;
|
||||||
|
|
||||||
[SerializableProperty(2)]
|
[SerializableField(2, allowFieldChange: nameof(AllowDyedHueChange), fieldChanged: nameof(OnDyedHueChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int DyedHue
|
private int _dyedHue;
|
||||||
{
|
|
||||||
get => _dyedHue;
|
private bool AllowDyedHueChange(ref int value) => _redyable;
|
||||||
set
|
|
||||||
{
|
private void OnDyedHueChanged(int oldValue, int newValue) => Hue = newValue;
|
||||||
if (_redyable)
|
|
||||||
{
|
|
||||||
_dyedHue = value;
|
|
||||||
Hue = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Three metallic tubs now.
|
// Three metallic tubs now.
|
||||||
public virtual bool MetallicHues => false;
|
public virtual bool MetallicHues => false;
|
||||||
|
|
|
||||||
|
|
@ -60,17 +60,14 @@ public abstract partial class BaseRunicTool : BaseTool
|
||||||
|
|
||||||
public BaseRunicTool(CraftResource resource, int uses, int itemID) : base(uses, itemID) => _resource = resource;
|
public BaseRunicTool(CraftResource resource, int uses, int itemID) : base(uses, itemID) => _resource = resource;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnResourceChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource Resource
|
[InvalidateProperties]
|
||||||
|
private CraftResource _resource;
|
||||||
|
|
||||||
|
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
{
|
{
|
||||||
get => _resource;
|
Hue = CraftResources.GetHue(_resource);
|
||||||
set
|
|
||||||
{
|
|
||||||
_resource = value;
|
|
||||||
Hue = CraftResources.GetHue(_resource);
|
|
||||||
InvalidateProperties();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Deserialize(IGenericReader reader, int version)
|
private void Deserialize(IGenericReader reader, int version)
|
||||||
|
|
|
||||||
|
|
@ -54,17 +54,15 @@ public partial class FountainOfLife : BaseAddonContainer
|
||||||
public override int DefaultDropSound => 66;
|
public override int DefaultDropSound => 66;
|
||||||
public override int DefaultMaxItems => 125;
|
public override int DefaultMaxItems => 125;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, allowFieldChange: nameof(AllowChargesChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Charges
|
[InvalidateProperties]
|
||||||
|
private int _charges;
|
||||||
|
|
||||||
|
private bool AllowChargesChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _charges;
|
value = Math.Min(value, MaxCharges);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_charges = Math.Min(value, MaxCharges);
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnDragLift(Mobile from) => false;
|
public override bool OnDragLift(Mobile from) => false;
|
||||||
|
|
@ -183,16 +181,14 @@ public partial class FountainOfLifeDeed : BaseAddonContainerDeed
|
||||||
public override int LabelNumber => 1075197; // Fountain of Life
|
public override int LabelNumber => 1075197; // Fountain of Life
|
||||||
public override BaseAddonContainer Addon => new FountainOfLife(_charges);
|
public override BaseAddonContainer Addon => new FountainOfLife(_charges);
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, allowFieldChange: nameof(AllowChargesChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Charges
|
[InvalidateProperties]
|
||||||
|
private int _charges;
|
||||||
|
|
||||||
|
private bool AllowChargesChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _charges;
|
value = Math.Min(value, FountainOfLife.MaxCharges);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_charges = Math.Min(value, FountainOfLife.MaxCharges);
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,14 @@ public abstract partial class BaseFruitTreeAddon : BaseAddon
|
||||||
public abstract override BaseAddonDeed Deed { get; }
|
public abstract override BaseAddonDeed Deed { get; }
|
||||||
public abstract Item Fruit { get; }
|
public abstract Item Fruit { get; }
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, allowFieldChange: nameof(AllowFruitsChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Fruits
|
private int _fruits;
|
||||||
|
|
||||||
|
private bool AllowFruitsChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _fruits;
|
value = Math.Max(value, 0);
|
||||||
set => _fruits = Math.Max(value, 0);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnComponentUsed(AddonComponent c, Mobile from)
|
public override void OnComponentUsed(AddonComponent c, Mobile from)
|
||||||
|
|
|
||||||
|
|
@ -146,34 +146,24 @@ public partial class HouseRaffleStone : Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(3)]
|
[SerializableField(3, fieldChanged: nameof(OnPlotBoundsChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Seer)]
|
[SerializedCommandProperty(AccessLevel.GameMaster, AccessLevel.Seer)]
|
||||||
public Rectangle2D PlotBounds
|
[InvalidateProperties]
|
||||||
{
|
private Rectangle2D _plotBounds;
|
||||||
get => _plotBounds;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_plotBounds = value;
|
|
||||||
|
|
||||||
InvalidateRegion();
|
private void OnPlotBoundsChanged(Rectangle2D oldValue, Rectangle2D newValue)
|
||||||
InvalidateProperties();
|
{
|
||||||
this.MarkDirty();
|
InvalidateRegion();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(4)]
|
[SerializableField(4, fieldChanged: nameof(OnPlotFacetChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Seer)]
|
[SerializedCommandProperty(AccessLevel.GameMaster, AccessLevel.Seer)]
|
||||||
public Map PlotFacet
|
[InvalidateProperties]
|
||||||
{
|
private Map _plotFacet;
|
||||||
get => _plotFacet;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_plotFacet = value;
|
|
||||||
|
|
||||||
InvalidateRegion();
|
private void OnPlotFacetChanged(Map oldValue, Map newValue)
|
||||||
InvalidateProperties();
|
{
|
||||||
this.MarkDirty();
|
InvalidateRegion();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
|
|
@ -190,17 +180,15 @@ public partial class HouseRaffleStone : Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(6)]
|
[SerializableField(6, allowFieldChange: nameof(AllowTicketPriceChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Seer)]
|
[SerializedCommandProperty(AccessLevel.GameMaster, AccessLevel.Seer)]
|
||||||
public int TicketPrice
|
[InvalidateProperties]
|
||||||
|
private int _ticketPrice;
|
||||||
|
|
||||||
|
private bool AllowTicketPriceChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _ticketPrice;
|
value = Math.Max(0, value);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_ticketPrice = Math.Max(0, value);
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string DefaultName => "a house raffle stone";
|
public override string DefaultName => "a house raffle stone";
|
||||||
|
|
|
||||||
|
|
@ -162,21 +162,15 @@ public partial class MonsterStatuette : Item, IRewardItem, IGumpToggleItem
|
||||||
_ => fallback
|
_ => fallback
|
||||||
};
|
};
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnTypeChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public MonsterStatuetteType Type
|
[InvalidateProperties]
|
||||||
|
private MonsterStatuetteType _type;
|
||||||
|
|
||||||
|
private void OnTypeChanged(MonsterStatuetteType oldValue, MonsterStatuetteType newValue)
|
||||||
{
|
{
|
||||||
get => _type;
|
ItemID = MonsterStatuetteInfo.GetInfo(_type).ItemID;
|
||||||
set
|
Hue = GetStatuetteHue(_type, Hue);
|
||||||
{
|
|
||||||
_type = value;
|
|
||||||
ItemID = MonsterStatuetteInfo.GetInfo(_type).ItemID;
|
|
||||||
|
|
||||||
Hue = GetStatuetteHue(_type, Hue);
|
|
||||||
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int LabelNumber => MonsterStatuetteInfo.GetInfo(_type).LabelNumber;
|
public override int LabelNumber => MonsterStatuetteInfo.GetInfo(_type).LabelNumber;
|
||||||
|
|
|
||||||
|
|
@ -36,50 +36,41 @@ public partial class BagOfSending : Item, TranslocationItem
|
||||||
|
|
||||||
public override int LabelNumber => 1054104; // a bag of sending
|
public override int LabelNumber => 1054104; // a bag of sending
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnBagOfSendingHueChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public BagOfSendingHue BagOfSendingHue
|
private BagOfSendingHue _bagOfSendingHue;
|
||||||
{
|
|
||||||
get => _bagOfSendingHue;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_bagOfSendingHue = value;
|
|
||||||
|
|
||||||
Hue = value switch
|
private void OnBagOfSendingHueChanged(BagOfSendingHue oldValue, BagOfSendingHue newValue)
|
||||||
{
|
{
|
||||||
BagOfSendingHue.Yellow => 0x8A5,
|
Hue = newValue switch
|
||||||
BagOfSendingHue.Blue => 0x8AD,
|
{
|
||||||
BagOfSendingHue.Red => 0x89B,
|
BagOfSendingHue.Yellow => 0x8A5,
|
||||||
_ => Hue
|
BagOfSendingHue.Blue => 0x8AD,
|
||||||
};
|
BagOfSendingHue.Red => 0x89B,
|
||||||
this.MarkDirty();
|
_ => Hue
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(1)]
|
[SerializableField(1, allowFieldChange: nameof(AllowChargesChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Charges
|
[InvalidateProperties]
|
||||||
|
private int _charges;
|
||||||
|
|
||||||
|
private bool AllowChargesChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _charges;
|
value = Math.Clamp(value, 0, MaxCharges);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_charges = Math.Clamp(value, 0, MaxCharges);
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(2)]
|
[SerializableField(2, allowFieldChange: nameof(AllowRechargesChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Recharges
|
[InvalidateProperties]
|
||||||
|
private int _recharges;
|
||||||
|
|
||||||
|
private bool AllowRechargesChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _recharges;
|
value = Math.Clamp(value, 0, MaxRecharges);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_recharges = Math.Clamp(value, 0, MaxRecharges);
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
|
|
|
||||||
|
|
@ -29,30 +29,26 @@ public partial class BallOfSummoning : Item, TranslocationItem
|
||||||
|
|
||||||
public override double DefaultWeight => 10.0;
|
public override double DefaultWeight => 10.0;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, allowFieldChange: nameof(AllowRechargesChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Recharges
|
[InvalidateProperties]
|
||||||
|
private int _recharges;
|
||||||
|
|
||||||
|
private bool AllowRechargesChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _recharges;
|
value = Math.Clamp(value, 0, MaxRecharges);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_recharges = Math.Clamp(value, 0, MaxRecharges);
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(1)]
|
[SerializableField(1, allowFieldChange: nameof(AllowChargesChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Charges
|
[InvalidateProperties]
|
||||||
|
private int _charges;
|
||||||
|
|
||||||
|
private bool AllowChargesChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _charges;
|
value = Math.Clamp(value, 0, MaxCharges);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_charges = Math.Clamp(value, 0, MaxCharges);
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(2)]
|
[SerializableProperty(2)]
|
||||||
|
|
|
||||||
|
|
@ -27,30 +27,26 @@ public partial class BraceletOfBinding : BaseBracelet, TranslocationItem
|
||||||
|
|
||||||
public override double DefaultWeight => 1.0;
|
public override double DefaultWeight => 1.0;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, allowFieldChange: nameof(AllowRechargesChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Recharges
|
[InvalidateProperties]
|
||||||
|
private int _recharges;
|
||||||
|
|
||||||
|
private bool AllowRechargesChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _recharges;
|
value = Math.Clamp(value, 0, MaxRecharges);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_recharges = Math.Clamp(value, 0, MaxRecharges);
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(1)]
|
[SerializableField(1, allowFieldChange: nameof(AllowChargesChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Charges
|
[InvalidateProperties]
|
||||||
|
private int _charges;
|
||||||
|
|
||||||
|
private bool AllowChargesChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _charges;
|
value = Math.Clamp(value, 0, MaxCharges);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_charges = Math.Clamp(value, 0, MaxCharges);
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(3)]
|
[SerializableProperty(3)]
|
||||||
|
|
|
||||||
|
|
@ -83,20 +83,14 @@ public partial class SoulStone : Item, ISecurable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(6)]
|
[SerializableField(6, fieldChanged: nameof(OnSkillValueChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public double SkillValue
|
[InvalidateProperties]
|
||||||
|
private double _skillValue;
|
||||||
|
|
||||||
|
private void OnSkillValueChanged(double oldValue, double newValue)
|
||||||
{
|
{
|
||||||
get => _skillValue;
|
ItemID = IsEmpty ? _inactiveItemID : _activeItemID;
|
||||||
set
|
|
||||||
{
|
|
||||||
_skillValue = value;
|
|
||||||
|
|
||||||
ItemID = IsEmpty ? _inactiveItemID : _activeItemID;
|
|
||||||
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
|
|
|
||||||
|
|
@ -17,20 +17,9 @@ public abstract partial class BaseSuit : Item
|
||||||
|
|
||||||
public override double DefaultWeight => 1.0;
|
public override double DefaultWeight => 1.0;
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnAccessLevelChanged))]
|
||||||
public AccessLevel AccessLevel
|
[InvalidateProperties]
|
||||||
{
|
private AccessLevel _accessLevel;
|
||||||
get => _accessLevel;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
var oldAccessLevel = _accessLevel;
|
|
||||||
_accessLevel = value;
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
|
|
||||||
OnAccessLevelChanged(oldAccessLevel, _accessLevel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void OnAccessLevelChanged(AccessLevel oldAccessLevel, AccessLevel accessLevel)
|
public virtual void OnAccessLevelChanged(AccessLevel oldAccessLevel, AccessLevel accessLevel)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -279,23 +279,17 @@ public partial class BaseTalisman : Item, IAosItem
|
||||||
public override int LabelNumber => 1071023; // Talisman
|
public override int LabelNumber => 1071023; // Talisman
|
||||||
public virtual bool ForceShowName => false; // used to override default summoner/removal name
|
public virtual bool ForceShowName => false; // used to override default summoner/removal name
|
||||||
|
|
||||||
[SerializableProperty(10)]
|
[SerializableField(10, fieldChanged: nameof(OnChargesChanged))]
|
||||||
[SaveFlag(nameof(ShouldSerializeCharges))]
|
[SaveFlag(nameof(ShouldSerializeCharges))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Charges
|
[InvalidateProperties]
|
||||||
|
private int _charges;
|
||||||
|
|
||||||
|
private void OnChargesChanged(int oldValue, int newValue)
|
||||||
{
|
{
|
||||||
get => _charges;
|
if (_chargeTime > 0)
|
||||||
set
|
|
||||||
{
|
{
|
||||||
_charges = value;
|
StartTimer();
|
||||||
|
|
||||||
if (_chargeTime > 0)
|
|
||||||
{
|
|
||||||
StartTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,16 +36,14 @@ public partial class ShardPoller : Item
|
||||||
Movable = false;
|
Movable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, allowFieldChange: nameof(AllowTitleChange))]
|
||||||
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
[SerializedCommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||||
public string Title
|
private string _title;
|
||||||
|
|
||||||
|
private bool AllowTitleChange(ref string value)
|
||||||
{
|
{
|
||||||
get => _title;
|
value = ShardPollPrompt.UrlToHref(value);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_title = ShardPollPrompt.UrlToHref(value);
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||||
|
|
@ -54,31 +52,20 @@ public partial class ShardPoller : Item
|
||||||
? TimeSpan.Zero
|
? TimeSpan.Zero
|
||||||
: Utility.Max(StartTime + Duration - Core.Now, TimeSpan.Zero);
|
: Utility.Max(StartTime + Duration - Core.Now, TimeSpan.Zero);
|
||||||
|
|
||||||
[SerializableProperty(3)]
|
[SerializableField(3, fieldChanged: nameof(OnActiveChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
[SerializedCommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||||
public bool Active
|
private bool _active;
|
||||||
|
|
||||||
|
private void OnActiveChanged(bool oldValue, bool newValue)
|
||||||
{
|
{
|
||||||
get => _active;
|
if (_active)
|
||||||
set
|
|
||||||
{
|
{
|
||||||
if (_active == value)
|
StartTime = Core.Now;
|
||||||
{
|
_activePollers.Add(this);
|
||||||
return;
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
_active = value;
|
_activePollers.Remove(this);
|
||||||
|
|
||||||
if (_active)
|
|
||||||
{
|
|
||||||
StartTime = Core.Now;
|
|
||||||
_activePollers.Add(this);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_activePollers.Remove(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -250,15 +237,12 @@ public partial class ShardPollOption
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnTitleChanged))]
|
||||||
public string Title
|
private string _title;
|
||||||
|
|
||||||
|
private void OnTitleChanged(string oldValue, string newValue)
|
||||||
{
|
{
|
||||||
get => _title;
|
_lineBreaks = -1;
|
||||||
set
|
|
||||||
{
|
|
||||||
_title = value;
|
|
||||||
_lineBreaks = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Votes => Voters.Length;
|
public int Votes => Voters.Length;
|
||||||
|
|
|
||||||
|
|
@ -43,18 +43,14 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
public override string CorpseName => "a sheep corpse";
|
public override string CorpseName => "a sheep corpse";
|
||||||
|
|
||||||
|
[SerializableField(0, fieldChanged: nameof(OnNextWoolTimeChanged))]
|
||||||
[DeltaDateTime]
|
[DeltaDateTime]
|
||||||
[SerializableProperty(0)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
private DateTime _nextWoolTime;
|
||||||
public DateTime NextWoolTime
|
|
||||||
|
private void OnNextWoolTimeChanged(DateTime oldValue, DateTime newValue)
|
||||||
{
|
{
|
||||||
get => _nextWoolTime;
|
SheepBody();
|
||||||
set
|
|
||||||
{
|
|
||||||
_nextWoolTime = value;
|
|
||||||
SheepBody();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
|
|
||||||
|
|
@ -40,43 +40,27 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
public override double DefaultWeight => 1.0;
|
public override double DefaultWeight => 1.0;
|
||||||
|
|
||||||
[SerializableProperty(2)]
|
[SerializableField(2, fieldChanged: nameof(OnMountedIDChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int MountedID
|
private int _mountedID;
|
||||||
{
|
|
||||||
get => _mountedID;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_mountedID != value)
|
|
||||||
{
|
|
||||||
_mountedID = value;
|
|
||||||
|
|
||||||
if (_rider != null)
|
private void OnMountedIDChanged(int oldValue, int newValue)
|
||||||
{
|
{
|
||||||
ItemID = value;
|
if (_rider != null)
|
||||||
}
|
{
|
||||||
this.MarkDirty();
|
ItemID = newValue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(3)]
|
[SerializableField(3, fieldChanged: nameof(OnRegularIDChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public int RegularID
|
private int _regularID;
|
||||||
{
|
|
||||||
get => _regularID;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_regularID != value)
|
|
||||||
{
|
|
||||||
_regularID = value;
|
|
||||||
|
|
||||||
if (_rider == null)
|
private void OnRegularIDChanged(int oldValue, int newValue)
|
||||||
{
|
{
|
||||||
ItemID = value;
|
if (_rider == null)
|
||||||
}
|
{
|
||||||
this.MarkDirty();
|
ItemID = newValue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,17 +111,15 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
private bool ShouldSerializeRider() => _rider != null;
|
private bool ShouldSerializeRider() => _rider != null;
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializableField(5, allowFieldChange: nameof(AllowStepsChange))]
|
||||||
[SerializableProperty(5)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
[SaveFlag(nameof(ShouldSerializeSteps))]
|
[SaveFlag(nameof(ShouldSerializeSteps))]
|
||||||
public int Steps
|
private int _steps;
|
||||||
|
|
||||||
|
private bool AllowStepsChange(ref int value)
|
||||||
{
|
{
|
||||||
get => _steps;
|
value = Math.Clamp(value, 0, StepsMax);
|
||||||
set
|
return true;
|
||||||
{
|
|
||||||
_steps = Math.Clamp(value, 0, StepsMax);
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeSteps() => _steps != StepsMax;
|
private bool ShouldSerializeSteps() => _steps != StepsMax;
|
||||||
|
|
|
||||||
|
|
@ -62,48 +62,37 @@ namespace Server.Mobiles
|
||||||
[SerializableField(3)]
|
[SerializableField(3)]
|
||||||
private int _bardingHP;
|
private int _bardingHP;
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializableField(2, fieldChanged: nameof(OnHasBardingChanged))]
|
||||||
[SerializableProperty(2)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public bool HasBarding
|
[InvalidateProperties]
|
||||||
{
|
private bool _hasBarding;
|
||||||
get => _hasBarding;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_hasBarding = value;
|
|
||||||
|
|
||||||
if (_hasBarding)
|
private void OnHasBardingChanged(bool oldValue, bool newValue)
|
||||||
{
|
{
|
||||||
Hue = CraftResources.GetHue(_bardingResource);
|
if (_hasBarding)
|
||||||
Body = 0x31F;
|
{
|
||||||
ItemID = 0x3EBE;
|
Hue = CraftResources.GetHue(_bardingResource);
|
||||||
}
|
Body = 0x31F;
|
||||||
else
|
ItemID = 0x3EBE;
|
||||||
{
|
}
|
||||||
Hue = 0x851;
|
else
|
||||||
Body = 0x31A;
|
{
|
||||||
ItemID = 0x3EBD;
|
Hue = 0x851;
|
||||||
}
|
Body = 0x31A;
|
||||||
InvalidateProperties();
|
ItemID = 0x3EBD;
|
||||||
this.MarkDirty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializableField(4, fieldChanged: nameof(OnBardingResourceChanged))]
|
||||||
[SerializableProperty(4)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public CraftResource BardingResource
|
[InvalidateProperties]
|
||||||
|
private CraftResource _bardingResource;
|
||||||
|
|
||||||
|
private void OnBardingResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||||
{
|
{
|
||||||
get => _bardingResource;
|
if (_hasBarding)
|
||||||
set
|
|
||||||
{
|
{
|
||||||
_bardingResource = value;
|
Hue = CraftResources.GetHue(newValue);
|
||||||
|
|
||||||
if (_hasBarding)
|
|
||||||
{
|
|
||||||
Hue = CraftResources.GetHue(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,19 +23,14 @@ public partial class BaseHire : BaseCreature
|
||||||
|
|
||||||
public int GoldOnDeath { get; set; }
|
public int GoldOnDeath { get; set; }
|
||||||
|
|
||||||
[SerializableProperty(1)]
|
[SerializableField(1, fieldChanged: nameof(OnIsHiredChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public bool IsHired
|
[InvalidateProperties]
|
||||||
{
|
private bool _isHired;
|
||||||
get => _isHired;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_isHired = value;
|
|
||||||
|
|
||||||
Delta(MobileDelta.Noto);
|
private void OnIsHiredChanged(bool oldValue, bool newValue)
|
||||||
InvalidateProperties();
|
{
|
||||||
this.MarkDirty();
|
Delta(MobileDelta.Noto);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseHire(AIType AI) : base(AI, FightMode.Aggressor)
|
public BaseHire(AIType AI) : base(AI, FightMode.Aggressor)
|
||||||
|
|
|
||||||
|
|
@ -148,18 +148,13 @@ public partial class PlayerBarkeeper : BaseVendor
|
||||||
LoadSBInfo();
|
LoadSBInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(0)]
|
[SerializableField(0, fieldChanged: nameof(OnHouseChanged))]
|
||||||
public BaseHouse House
|
private BaseHouse _house;
|
||||||
{
|
|
||||||
get => _house;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_house?.PlayerBarkeepers.Remove(this);
|
|
||||||
value?.PlayerBarkeepers.Add(this);
|
|
||||||
|
|
||||||
_house = value;
|
private void OnHouseChanged(BaseHouse oldValue, BaseHouse newValue)
|
||||||
this.MarkDirty();
|
{
|
||||||
}
|
oldValue?.PlayerBarkeepers.Remove(this);
|
||||||
|
newValue?.PlayerBarkeepers.Add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsActiveBuyer => false;
|
public override bool IsActiveBuyer => false;
|
||||||
|
|
|
||||||
|
|
@ -94,18 +94,13 @@ public partial class PlayerVendor : Mobile
|
||||||
|
|
||||||
public PlayerVendorPlaceholder Placeholder { get; set; }
|
public PlayerVendorPlaceholder Placeholder { get; set; }
|
||||||
|
|
||||||
[SerializableProperty(2)]
|
[SerializableField(2, fieldChanged: nameof(OnHouseChanged))]
|
||||||
public BaseHouse House
|
private BaseHouse _house;
|
||||||
{
|
|
||||||
get => _house;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_house?.PlayerVendors.Remove(this);
|
|
||||||
value?.PlayerVendors.Add(this);
|
|
||||||
|
|
||||||
_house = value;
|
private void OnHouseChanged(BaseHouse oldValue, BaseHouse newValue)
|
||||||
this.MarkDirty();
|
{
|
||||||
}
|
oldValue?.PlayerVendors.Remove(this);
|
||||||
|
newValue?.PlayerVendors.Add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ChargePerDay
|
public int ChargePerDay
|
||||||
|
|
|
||||||
|
|
@ -32,18 +32,20 @@ public partial class VendorItem
|
||||||
public string FormattedPrice =>
|
public string FormattedPrice =>
|
||||||
Core.ML ? Price.ToString("N0", CultureInfo.GetCultureInfo("en-US")) : Price.ToString();
|
Core.ML ? Price.ToString("N0", CultureInfo.GetCultureInfo("en-US")) : Price.ToString();
|
||||||
|
|
||||||
[SerializableProperty(2)]
|
[SerializableField(2, fieldChanged: nameof(OnDescriptionChanged), allowFieldChange: nameof(AllowDescriptionChange))]
|
||||||
public string Description
|
private string _description;
|
||||||
{
|
|
||||||
get => _description;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_description = value ?? "";
|
|
||||||
|
|
||||||
if (Valid)
|
private bool AllowDescriptionChange(ref string value)
|
||||||
{
|
{
|
||||||
Item.InvalidateProperties();
|
value = value ?? "";
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDescriptionChanged(string oldValue, string newValue)
|
||||||
|
{
|
||||||
|
if (Valid)
|
||||||
|
{
|
||||||
|
Item.InvalidateProperties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,31 +136,23 @@ namespace Server.Multis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SerializableField(3, fieldChanged: nameof(OnTimeOfDecayChanged))]
|
||||||
[DeltaDateTime]
|
[DeltaDateTime]
|
||||||
[SerializableProperty(3)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
private DateTime _timeOfDecay;
|
||||||
public DateTime TimeOfDecay
|
|
||||||
|
private void OnTimeOfDecayChanged(DateTime oldValue, DateTime newValue)
|
||||||
{
|
{
|
||||||
get => _timeOfDecay;
|
TillerMan?.InvalidateProperties();
|
||||||
set
|
|
||||||
{
|
|
||||||
_timeOfDecay = value;
|
|
||||||
TillerMan?.InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializableProperty(10)]
|
[SerializableField(10, fieldChanged: nameof(OnShipNameChanged))]
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
public string ShipName
|
private string _shipName;
|
||||||
|
|
||||||
|
private void OnShipNameChanged(string oldValue, string newValue)
|
||||||
{
|
{
|
||||||
get => _shipName;
|
TillerMan?.InvalidateProperties();
|
||||||
set
|
|
||||||
{
|
|
||||||
_shipName = value;
|
|
||||||
TillerMan?.InvalidateProperties();
|
|
||||||
this.MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue