Implementing: Heroic Opportunity (0.7.3)

EQ2Emulator Development forum.

Moderator: Team Members

User avatar
Zcoretri
Team Member
Posts: 1642
Joined: Fri Jul 27, 2007 12:55 pm
Location: SoCal

Re: Implementing: Heroic Opportunity (0.7.3)

Post by Zcoretri » Sat Jan 11, 2014 6:45 pm

Yeah, as foof has stated, the buffs/specials just aren't worth it anymore so it sits unused.

At least we can make it worthwhile once again in the emu :mrgreen:

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Heroic Opportunity (0.7.3)

Post by Jabantiz » Sat Jan 25, 2014 5:21 pm

I think I am overthinking this system and getting no where. The simplest way I can think of doing it right now is having a table for starter chains and a table for the wheel chain. The starter chains table would need an entry for every possibility, so for a priest it would need an entry for the hammer and an entry for the coin. The table for the wheel would need all the icons to complete it, if it is ordered or not, the spell to cast once completed, and an id to the starter chain that can trigger this wheel.

I am not sure I am explaining this well as I am having problems picturing it in my head. Any one have thoughts on a simpler way to store the data needed?

EDIT: Made the tables on my end for examples to better explain it, this is all possible HO's for a priest
Starter:
HOStarterTable.jpg
Wheel:
HOWheelTable.jpg
starter_class is the base class of the player starting the ho, priest in this example, also default of 65535(0xFFFF) for abilities/icons as 0 is a valid icon for a fighter
You do not have the required permissions to view the files attached to this post.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Implementing: Heroic Opportunity (0.7.3)

Post by John Adams » Sun Jan 26, 2014 10:00 am

imo, since you are redundantly using *_ability across both tables, why not just combine them into 1, all fields in 1 table, even if 2 fields are redundant, the "normalizing" police will not scold you ;) You'll just load the data differently. ie., add a column that declares "type" and make it "starter" or "wheel" (enum?) so when you load it into World, you can WHERE type = "blah" to get them into the proper maps (or whatever you're using to hold the data in memory).

Maybe something like this:

Code: Select all

CREATE TABLE `heroic_ops` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `ho_type` enum('Starter','Wheel') NOT NULL DEFAULT 'Starter',
  `starter_link_id` int(10) unsigned NOT NULL DEFAULT '0',
  `starter_class` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `chain_order` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `spell_id` int(10) unsigned NOT NULL DEFAULT '0',
  `ability1` smallint(5) unsigned NOT NULL DEFAULT '65535',
  `ability2` smallint(5) unsigned NOT NULL DEFAULT '65535',
  `ability3` smallint(5) unsigned NOT NULL DEFAULT '65535',
  `ability4` smallint(5) unsigned NOT NULL DEFAULT '65535',
  `ability5` smallint(5) unsigned NOT NULL DEFAULT '65535',
  `ability6` smallint(5) unsigned NOT NULL DEFAULT '65535',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
Example:
heroic_ops.jpg
Just threw it together in minutes, got someone coming over any second lol... so sorry if this makes no sense. If it doesn't, then your layout is fine with me.

I just don't care for the multiple column names for ability, when that too could be normalized (I mean, if you're going to do it, go all the way!) I'd also drop the "eq2_" from the table name, as we kinda know it's eq2 :D lol... maybe spell the table name out better... `heroic_op_starters` and `heroic_op_wheels` or something. My 2cp.
You do not have the required permissions to view the files attached to this post.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Heroic Opportunity (0.7.3)

Post by Jabantiz » Sun Jan 26, 2014 2:10 pm

That makes sense and I can do it that way, also eq2 in the table name is actually the database I am using, heidiSQL always adds the DB name before the table name. Now that the table is set I will see about getting it coded up and working, I would like to get working by the end of the day but we will see. I will also do my best to heavily comment the code and explain how it works here so others understand how it works.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Heroic Opportunity (0.7.3)

Post by Jabantiz » Tue Jan 28, 2014 8:32 pm

Jabantiz wrote:I would like to get working by the end of the day but we will see.
RL and a cold has put me way behind on this goal, but I am making progress.
HOStart.jpg
Started with a spell, and good news is the client will handle the flashing of the icons to be used next.
You do not have the required permissions to view the files attached to this post.

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Re: Implementing: Heroic Opportunity (0.7.3)

Post by thefoof » Tue Jan 28, 2014 8:41 pm

Nice!

User avatar
Zcoretri
Team Member
Posts: 1642
Joined: Fri Jul 27, 2007 12:55 pm
Location: SoCal

Re: Implementing: Heroic Opportunity (0.7.3)

Post by Zcoretri » Tue Jan 28, 2014 9:22 pm

Jabantiz wrote:
Jabantiz wrote:I would like to get working by the end of the day but we will see.
RL and a cold has put me way behind on this goal, but I am making progress.
HOStart.jpg
Started with a spell, and good news is the client will handle the flashing of the icons to be used next.
Nice start Jabantiz :D

I got hit with flu bug :cry: been out since last friday

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Heroic Opportunity (0.7.3)

Post by Jabantiz » Tue Jan 28, 2014 11:06 pm

Zcoretri wrote:Nice start Jabantiz :D

I got hit with flu bug :cry: been out since last friday
Luckily I didn't get the flu, as I am already getting over it, but whatever this is sure wiped me out yesterday, not really with it today either but good enough I can code so been doing that when I can.

As for the HO's I got it working mostly, can start it with a lua function and advance it to the wheel, can complete the wheel or let it time out. All that is left to do is cast the spell when complete and to attach the HO to the target so only spells on that target advance the HO and if the npc dies the HO gets killed.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Heroic Opportunity (0.7.3)

Post by Jabantiz » Wed Jan 29, 2014 6:47 pm

Shocker I know but the DB patcher isn't letting me put the table up
Create Table: table already exists!
Even adding the drop myself I get the same error, though the table is not listed on the patcher.

Here is the table I was trying to add.

Code: Select all

DROP TABLE IF EXISTS `heroic_ops`;
CREATE TABLE IF NOT EXISTS `heroic_ops` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `ho_type` enum('Starter','Wheel') COLLATE latin1_general_ci NOT NULL DEFAULT 'Starter',
  `starter_link_id` int(10) unsigned NOT NULL DEFAULT '0',
  `starter_class` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `starter_icon` smallint(5) unsigned NOT NULL DEFAULT '65535',
  `chain_order` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `shift_icon` smallint(5) unsigned NOT NULL DEFAULT '41',
  `spell_id` int(10) unsigned NOT NULL DEFAULT '0',
  `chance` float unsigned NOT NULL DEFAULT '0',
  `ability1` smallint(5) unsigned NOT NULL DEFAULT '65535',
  `ability2` smallint(5) unsigned NOT NULL DEFAULT '65535',
  `ability3` smallint(5) unsigned NOT NULL DEFAULT '65535',
  `ability4` smallint(5) unsigned NOT NULL DEFAULT '65535',
  `ability5` smallint(5) unsigned NOT NULL DEFAULT '65535',
  `ability6` smallint(5) unsigned NOT NULL DEFAULT '65535',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Heroic Opportunity (0.7.3)

Post by Jabantiz » Wed Jan 29, 2014 9:35 pm

Committed my code, what I have so far, as well as project files/filters (some one will need to tell me if I did the Linux files right). Commented out the loading until the table can be put on the patcher.

This should be functional, and you should be able to do an HO through to completion, only a few tweaks left to do, like adding the ability to shift the wheel.

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Re: Implementing: Heroic Opportunity (0.7.3)

Post by thefoof » Wed Jan 29, 2014 10:13 pm

Jabantiz wrote: (some one will need to tell me if I did the Linux files right)
Just had to change the backslashes in RaceTypes.h to forward slashes but other than that it compiled fine (the "../../common/types.h" include)

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Heroic Opportunity (0.7.3)

Post by Jabantiz » Wed Jan 29, 2014 10:33 pm

I am usually good with the slashes, thought for sure any mistakes would be in the makefiles. Thanks for checking and fixing it.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Implementing: Heroic Opportunity (0.7.3)

Post by John Adams » Thu Jan 30, 2014 8:23 am

Hah, have we just not added a new table in forever? I'll take a look at it now.


edit: wow, epic fail on my part. The lookup query goes to information_schema and doesn't limit the existence to the eq2dev database, so ANY database on my server with that table was returning "exists".

Code: Select all

SELECT COUNT(*) AS cnt FROM information_schema.TABLES WHERE table_name = 'heroic_ops'
Needed to be

Code: Select all

SELECT COUNT(*) AS cnt FROM information_schema.TABLES WHERE table_schema = 'eq2dev' AND table_name = 'heroic_ops'
Should work now.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Heroic Opportunity (0.7.3)

Post by Jabantiz » Thu Jan 30, 2014 12:03 pm

Works now, thanks. Going to commit the version.h and enable the loading of ho's now, will work on an explanation of the table and how to set every thing up through out the day.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Heroic Opportunity (0.7.3)

Post by Jabantiz » Thu Jan 30, 2014 3:37 pm

Will do my best to explain how this all works, with pictures, first lets look at the DB
HODB.jpg
Both the wheel and starter chains are stored in the same table, for a starter chain you can ignore the `starter_link_id`, `chain_order`, `shift_icon`, `spell_id`, and `chance` fields, they have no use for a starter chain. ability1 - ability6 is the icons needed to advance the chain to a wheel.
HOStarter.jpg
1 = `starter_icon`
2 = `abilityX`

If you just started the HO only ability1 will show
HODBStarter.jpg
So 14 and 41, when a spell with one of those HO icons are used it will adavance to ability2 on the chains that contains that icon and drop the rest, if it finds a value of 0xFFFF (65535) it will advance to the wheel
HOWheel.jpg
For the wheel you can ignore the `starter_icon` and `starter_class`.

`starter_link_id` defines what starter chain this wheel will belong to.
`chain_order` is how the wheel needs to be completed, 0 for any, 1 for clockwise, 2 for counter clockwise (icons will flip to the left side of the wheel as well).
`shift_icon` is the symbol used to reroll the wheel, defaults to 41 (coin) but can be changed, this is not implemented yet though.
`spell_id` is the spell to cast when the wheel is complete
`chance` is the chance this wheel will be picked when the starter chain is finished (not implemented yet, currently picks at random of the available wheels)
`ability1` - `ability6` are all used at once in this case and start at the top and go clock wise (for order = any/clockwise), the name below is determined by the spell id given

The lua command to start an HO is StartHeroicOpportunity(Spawn, int8).
Spawn is the caster, target of the HO will be the target of the caster (HO starters are self target spells) this will probably need to be changed to be more reliable.
int8 is the class id will start the ho based on starter chains with a matching `starter_class`.

I chose to have the class id provided by lua so you can customize HO's and have special ones for say a paladin and not all grouped by the base class.
You do not have the required permissions to view the files attached to this post.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests