Skip to content
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

Merged
merged 8 commits into from
Jul 22, 2017

Conversation

LtRipley36706
Copy link
Member

No description provided.

Copy link
Contributor

@ddevec ddevec left a 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.

// TODO: There are probably other checks that need to be made here
if (ItemType == ItemType.Creature && GetType().Name != "DebugObject")
{
WriteIdentifyObjectCreatureProfile(writer, (Creature)this);
Copy link
Contributor

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.

WriteIdentifyObjectStringsProperties(writer, flags, propertiesString);
WriteIdentifyObjectDidProperties(writer, flags, propertiesDid);
WriteIdentifyObjectSpellIdProperties(writer, flags, propertiesSpellId);
WriteIdentifyObjectArmorProfile(writer, flags, propertiesArmor);
Copy link
Contributor

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

{
WriteIdentifyObjectCreatureProfile(writer, (Creature)this);
}
WriteIdentifyObjectWeaponsProfile(writer, flags, propertiesWeaponsD, propertiesWeaponsI);
Copy link
Contributor

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.

@LtRipley36706
Copy link
Member Author

@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.

Copy link
Contributor

@ddevec ddevec left a 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.

@@ -495,5 +497,162 @@ protected virtual void UpdateVitalInternal(CreatureVital vital, uint newVal)
new ActionChain(this, () => VitalTickInternal(vital)).EnqueueChain();
}
}

public override void SerializeIdentifyObjectResponse(BinaryWriter writer)
Copy link
Contributor

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.

Copy link
Member Author

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

Copy link
Contributor

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.

Copy link
Member Author

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

Copy link
Member Author

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.

flags |= IdentifyResponseFlags.ArmorProfile;
}

// Weapons Profile
Copy link
Contributor

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?

@LtRipley36706 LtRipley36706 merged commit 9f1a295 into ACEmulator:master Jul 22, 2017
@LtRipley36706 LtRipley36706 deleted the MoveIdentifyToWO branch July 23, 2017 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants