fix(core): Fixes some properties that cannot be modified ingame (#604)
- [X] Adds a property to `CommandProperty` to allow modifying `PropertyObject` where there is no property setter that is accessible.
- [X] Updates AosAttributes and friends
Example of how to make this work:
```cs
[CommandProperty(AccessLevel.GameMaster, canModify: true)]
public AosWeaponAttributes WeaponAttributes { get; private set; }
```
This fix is necessary because in release mode the optimizer will sometimes _entirely remove the setter_ because it knows it can do something that is more efficient _when the property setter is private_. RunUO got around this by declaring a public setter explicitly that _was empty_.
### Screenshot
<img width="313" alt="Screen Shot 2021-05-15 at 11 34 01 PM" src="https://user-images.githubusercontent.com/3953314/118387955-49293c00-b5d6-11eb-8f31-a3b5e31bd18b.png">
This commit is contained in:
parent
3023254d87
commit
db02a6b6e9
16 changed files with 98 additions and 99 deletions
|
|
@ -229,9 +229,7 @@ namespace Server.Gumps
|
|||
|
||||
var cpa = GetCPA(prop);
|
||||
|
||||
// !prop.GetType().IsValueType
|
||||
|
||||
if (prop.CanWrite && m_Mobile.AccessLevel >= cpa?.WriteLevel && !cpa.ReadOnly)
|
||||
if (cpa?.ReadOnly == false && m_Mobile.AccessLevel >= cpa.WriteLevel && (prop.CanWrite || cpa.CanModify))
|
||||
{
|
||||
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + 3);
|
||||
}
|
||||
|
|
@ -295,10 +293,10 @@ namespace Server.Gumps
|
|||
return;
|
||||
}
|
||||
|
||||
var attr = GetCPA(prop);
|
||||
var cpa = GetCPA(prop);
|
||||
|
||||
if (!prop.CanWrite || attr == null ||
|
||||
from.AccessLevel < attr.WriteLevel || attr.ReadOnly)
|
||||
if (cpa == null || !(prop.CanWrite || cpa.CanModify) || cpa.ReadOnly ||
|
||||
from.AccessLevel < cpa.WriteLevel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue