-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moved Identify to WorldObject #473
Moved Identify to WorldObject #473
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of moving the Identify response functionality into the WorldObject is to use inheritance to break down the different behaviors of identify.
Consequently, there are a lot of parts of the identify packet that should be handled by overriding the virtual method in subclasses. Some of those subclasses don't exist yet (weapon, armor), but others do (creature). For the classes that do exist, you should handle this functionality appropriately, and for the classes that don't you should at minimum place a TODO in the code.
Source/ACE/Entity/WorldObject.cs
Outdated
// TODO: There are probably other checks that need to be made here | ||
if (ItemType == ItemType.Creature && GetType().Name != "DebugObject") | ||
{ | ||
WriteIdentifyObjectCreatureProfile(writer, (Creature)this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be handled in the "Creature" class via virtual method override, not here, as it is a creature exclusive profile.
Source/ACE/Entity/WorldObject.cs
Outdated
WriteIdentifyObjectStringsProperties(writer, flags, propertiesString); | ||
WriteIdentifyObjectDidProperties(writer, flags, propertiesDid); | ||
WriteIdentifyObjectSpellIdProperties(writer, flags, propertiesSpellId); | ||
WriteIdentifyObjectArmorProfile(writer, flags, propertiesArmor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually this should probably be moved to an "Armor" subclass
Source/ACE/Entity/WorldObject.cs
Outdated
{ | ||
WriteIdentifyObjectCreatureProfile(writer, (Creature)this); | ||
} | ||
WriteIdentifyObjectWeaponsProfile(writer, flags, propertiesWeaponsD, propertiesWeaponsI); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to "Armor", this will need to go into a "Weapon" subclass.
@ddevec This closer to what you're expecting? It will break most of the creature assessment panels as 99% of the objects in the world are not Creatures yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its not exactly well refactored. There is a lot of code duplication, and that is a bad thing 99.9% of the time.
Source/ACE/Entity/Creature.cs
Outdated
@@ -495,5 +497,162 @@ protected virtual void UpdateVitalInternal(CreatureVital vital, uint newVal) | |||
new ActionChain(this, () => VitalTickInternal(vital)).EnqueueChain(); | |||
} | |||
} | |||
|
|||
public override void SerializeIdentifyObjectResponse(BinaryWriter writer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has a signficiant amount of duplicated code with WorldObject's SerializeIdentifyObjectResponse. Consider calling "base.SerializeIdentifyObjectResponse", or if that is inappropriate, refactoring such that you deduplicate the code between the two calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did no refactoring, just trying to see if this is generally what you were saying
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is generally right then.
If breaking creature identification for non-creatures DebugObjects is a problem, we may consider not doing this refactor yet.
I would argue that there is little point returning a proper identification for an improperly implemented underlying type, but I'm not working with general WorldObject properties or their uses, and I have a limited view in this realm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be fair, most of the stuff returned in the creatureprofile displayed in the client are bad numbers/stats, so i'm kinda okay with breaking it in one regard..
i've got some thoughts on how to implement weenietype and delete debugobject going forward but it'll take some db work + thinking/coding time to propose properly, possibly looking to do that in a week or so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in short, the way we key object creation is bad and unsustainable. ObjectDescriptionFlags is more mutable than we originally suspected.
Source/ACE/Entity/Creature.cs
Outdated
flags |= IdentifyResponseFlags.ArmorProfile; | ||
} | ||
|
||
// Weapons Profile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do creatures deal with weapons and armor profiles?
No description provided.