Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Trust Basics #364

Merged
merged 116 commits into from
Mar 26, 2020
Merged

Trust Basics #364

merged 116 commits into from
Mar 26, 2020

Conversation

zach2good
Copy link
Contributor

@zach2good zach2good commented Feb 20, 2020

I affirm:

  • that I agree to Project Topaz's Limited Contributor License Agreement, as written on this date
  • that I've tested my code since the last commit in the PR, and will test after any later commits

This PR topaz-ifys @Omnione's PR (with their blessing) and allows trusts to be cast (but they don't do anything).

With contributions also from @Safhaven's Trust PR.

GOAL:

  • Take the existing work of others and get it into topaz, so it isn't as daunting to start working on trusts.
  • Put in basic plumbing, limit checking etc.

DONE:
trustutils, CTrustEntity and some misc trust changes in core
Bindings: getTrustID and getPartyTrusts, make getPartyCount more usable
Audit the mobpools and mob_spell_lists of all trusts, basic nation trusts have correct spell lists
isValidHealTarget helper in magic.lua to simplify checks going forward
spell/trust entries for a bunch of trusts, which are pretty much empty husks for now
trust.lua global with tpz.trust.canCast which handles:

  • Rejecting casting if you're in an alliance
  • Rejecting casting if you're not the party leader
  • Rejecting you if you try to cast the same trust twice
  • Rejecting you if you try to cast related trusts (See all the Shantotto spell/trust entries).
  • Rejecting you if you push the party size above 6 (tested with multiple PCs, trusts and combinations thereof)
  • Rejecting you if you try to cast more trusts than you have the ROV KI's for (easily removable)

Bindings for trust Spawn/Despawn/Die messages
Commands: /returnfaith, /refa, /returntrust and /retr (+all) work
Fix client crash on casting spells directly on trusts. (Seems hacky, but it's stable at least!)
Trusts despawn and die correctly, when you kill them, or when you die/zone
Trusts will wait for you to engage and start an enmity list before they run in and melee your target
Basic spellcasting if a trust has spells assigned in mob_spell_lists.sql

Starter trust missions are being worked on in a branch off of this branch viewable here:
zach2good/server@trust_list...zach2good:trust_starter_quests

@KnowOne134 KnowOne134 added the WIP PR is a work in progress, remove when its ready label Feb 22, 2020
@ibm2431 ibm2431 changed the base branch from master to trust February 24, 2020 20:04
* Add getJobLevel() binding
* Add hasJob binding
@ibm2431 ibm2431 self-assigned this Feb 25, 2020
@ibm2431 ibm2431 requested a review from Wiggo32 February 25, 2020 13:05
@ibm2431
Copy link
Contributor

ibm2431 commented Feb 25, 2020

Merging master into a feature branch might pose problems when it comes time to merge the finished feature into stable - all the unrelated commits in master would becoming too~ 😅

@ibm2431
Copy link
Contributor

ibm2431 commented Feb 25, 2020

Commits from Omnione were originally based off of sidestream, changing Shantotto's file here threw merge conflicts with our master, one thing led to another, and I felt a straight up rebase off of our current master was in order.

I know how it looks, but I didn't want to attach my name to those commits, I swear!

src/map/entities/battleentity.cpp Outdated Show resolved Hide resolved
scripts/globals/spells/trust/ajido-marujido.lua Outdated Show resolved Hide resolved
sql/mob_pools.sql Outdated Show resolved Hide resolved
src/map/lua/lua_baseentity.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@ibm2431 ibm2431 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're pretty close to "merge ready"!

To others: With the exception of commits addressing review comments, I intend for this to be my last in-depth review for this PR! So if you think I may have missed something, get those reviews in~

end

function onMobWeaponSkill(target, mob, skill)
target:addEnmity(mob, 1, 1800)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly to everyone, not necessarily you, Zach:
I'm okay with these new scripts for now as a testing bed, but we're going to have to come up with some solution to trusts having all the same abilities that players do! The last thing I want is additional burden to maintain an additional copy of weaponskills.

require("scripts/globals/trust")
-----------------------------------------

function onMagicCastingCheck(caster, target, spell)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need some additional Unity logic later. I don't know how we'd handle adding/removing Unity trusts. But this is far, far in the future. Just noting it here.

And our favorite head of a criminal organization might need to check for himself.

scripts/globals/spells/trust/arciela_ii.lua Outdated Show resolved Hide resolved
scripts/globals/spells/trust/arciela_ii.lua Outdated Show resolved Hide resolved
scripts/globals/spells/trust/balamor.lua Outdated Show resolved Hide resolved
sql/mob_pools.sql Outdated Show resolved Hide resolved
INSERT INTO `mob_pools` VALUES (5929,'najelith','Najelith',149,0x0000D90B00000000000000000000000000000000,11,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0);
INSERT INTO `mob_pools` VALUES (5930,'aldo','Aldo',149,0x0000DA0B00000000000000000000000000000000,6,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0);
INSERT INTO `mob_pools` VALUES (5931,'moogle','Moogle',185,0x0000DB0B00000000000000000000000000000000,21,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0);
INSERT INTO `mob_pools` VALUES (5932,'fablinix','Fablinix',327,0x0000DC0B00000000000000000000000000000000,6,4,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyone have ideas how to handle "dual mains" like Fablinix and King of Hearts?

sql/mob_pools.sql Outdated Show resolved Hide resolved
sql/mob_pools.sql Outdated Show resolved Hide resolved
INSERT INTO `mob_pools` VALUES (6013,'lilisette_ii','Lilisette',484,0x00000C0C00000000000000000000000000000000,19,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0);
INSERT INTO `mob_pools` VALUES (6014,'tenzen_ii','Tenzen',149,0x0000190C00000000000000000000000000000000,12,11,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0);
INSERT INTO `mob_pools` VALUES (6015,'mumor_ii','Mumor',149,0x0000200C00000000000000000000000000000000,4,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0);
INSERT INTO `mob_pools` VALUES (6016,'ingrid_ii','Ingrid',149,0x00001E0C00000000000000000000000000000000,4,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ingrid II here is supposed to be WHM though.

Others: I have checked main/sub jobs for all other trusts as of this commit. You don't need to.

@ibm2431 ibm2431 added reviewed Has been reviewed by at least one Staff Member and removed WIP PR is a work in progress, remove when its ready labels Mar 26, 2020
@zach2good
Copy link
Contributor Author

@ibm2431 Thanks for the in-depth review 🙏

@zach2good
Copy link
Contributor Author

After addressing some points from IBM's review, I thought it might be useful to write up some of my choices about this PR for newcomers to this PR (if there are any):

The crux of this entire PR:
The packet logic change in magic_state.cpp. I don't know if this is correct, I found this while desperately wrestling with the client crash there. It works, it's stable and I haven't noticed any strangeness.

Design decisions:
I wanted Core to be totally unrestricted, and any restrictions to exist in Lua. The Lua restricts things down to a retail-like experience, but if operators wanted to clear out all of the restrictions in tpz.trust.canCast, there's nothing stopping them:

  • Having trusts in Jeuno
  • An alliance full of trusts
  • 22 Shantottos nuking things

Trusts are "kind of" treated like party members. I've added ForPartyWithTrusts and :getPartyWithTrusts for anything that might need to iterate over the party including trusts. I did experiment with treating them as full members, but there were all sorts of explosions with Latents, OnMobDeathEx, etc. so I skirted around it.

Magic, Skills and AI:
What I've put in at the moment is just a fun frame that allows you to play with a party of Kupipi, Naji and Shantotto.

@@ -6050,12 +6050,12 @@ INSERT INTO `mob_pools` VALUES (5988,'makki-chebukki','Makki-Chebukki',153,0x000
INSERT INTO `mob_pools` VALUES (5989,'king_of_hearts','KingOfHearts',61,0x0000230C00000000000000000000000000000000,5,3,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0);
INSERT INTO `mob_pools` VALUES (5990,'morimar','Morimar',149,0x0000240C00000000000000000000000000000000,9,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0);
INSERT INTO `mob_pools` VALUES (5991,'darrcuiln','Darrcuiln',489,0x0000250C00000000000000000000000000000000,1,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0);
INSERT INTO `mob_pools` VALUES (5992,'aahm','ArkHM',149,0x0000290C00000000000000000000000000000000,13,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0);
INSERT INTO `mob_pools` VALUES (5992,'aahm','ArkHM',149,0x0000290C00000000000000000000000000000000,1,13,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget the weapon type in the core for mobs is currently bs, and that field controls if a mob double swings or not. IIRC hume ark angel dual wields. So you'd have to set his type "wrong" here to get correct behavior in that case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"But /NIN gives Dual Wield!"
"Not until main level is 20."

If that's the case, then Luzaf and a few others might encounter difficulties too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ibm2431 Mobs, pets, and trusts don't obey those rules so that won't come into play at all. Whatever the pool value says they should do, they will do at any level.

And on retail trusts that dual wield will do so at any level afaik (I haven't seen any example to the contrary).

Copy link
Contributor

@ibm2431 ibm2431 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe I am okay with this! There's still more to do (and we may want to compile a semi-official TODO list based off of review comments and things you've noticed), but this PR does what it set out to do and then some.

I am giving it a green checkmark.

@ibm2431 ibm2431 added merge ready reviewed and deemed ready to merge and removed reviewed Has been reviewed by at least one Staff Member labels Mar 26, 2020
@zircon-tpl zircon-tpl merged commit 86fd9f3 into project-topaz:trust Mar 26, 2020
@zach2good zach2good deleted the trust_list branch March 27, 2020 07:58
@zircon-tpl zircon-tpl added the focus Related to a current project focus label Jul 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
focus Related to a current project focus merge ready reviewed and deemed ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants