Page 4 of 6

Re: Implementing: Instancing

Posted: Sat Aug 31, 2013 7:48 pm
by Jabantiz
This is the new table I have come up with, think it covers everything needed for the packets

Code: Select all

CREATE TABLE `character_instances` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`char_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`instance_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`instance_zone_name` VARCHAR(64) NOT NULL,
	`instance_type` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
	`last_success_timestamp` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`last_failure_timestamp` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`success_lockout_time` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`failure_lockout_time` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	PRIMARY KEY (`id`),
	INDEX `CharacterIDX` (`char_id`),
	INDEX `InstanceIDX` (`instance_zone_name`)
)
COLLATE='latin1_general_ci'
ENGINE=InnoDB
Entries in this table should never be deleted as long as the character exists so my plan is to update instance_id and set it to 0 when an instance expires. I haven't committed code to support this or put it on the DB patcher yet as I would like to get base functionality before I commit my changes.

Re: Implementing: Instancing

Posted: Sun Sep 01, 2013 12:45 pm
by John Adams
Looks good to me, Jab.

Re: Implementing: Instancing

Posted: Sun Sep 01, 2013 8:01 pm
by Jabantiz
Making progress
EQ2EmuInstanceTest.jpg
Still have work to do as you are not actually prevented from entering an instance you are locked out of, but lock out and persistent are tracked in the window now. Also some issues with the current code with the DB updating wrong but it is slowly starting to get there, NOT on SVN yet as it is not 100% functional yet.

Re: Implementing: Instancing

Posted: Sun Sep 01, 2013 8:27 pm
by thefoof
Lookin good.

Re: Implementing: Instancing

Posted: Mon Sep 02, 2013 2:33 am
by alfa
Reset button pop up when you select an item in the list too ?

Re: Implementing: Instancing

Posted: Mon Sep 02, 2013 11:28 am
by Jabantiz
Is there a reset button for the lockout instances? There is one on the persistent tab but haven't worked on getting them functioning properly so not sure if there is something special needed to activate the button.

Have plans for lockout instances and hopefully will have them working tonight, I will then move on to the persistent instances and I am hoping they will be easier to deal with. Also going to add some more lua functions to set lockout / success times.

Re: Implementing: Instancing

Posted: Mon Sep 02, 2013 11:51 am
by alfa
My bad, only on persistant

Re: Implementing: Instancing

Posted: Mon Sep 02, 2013 6:07 pm
by Jabantiz
Got the DB updating properly and lockout instances will actually lock you out now. Need to get a /log or packet log of the actual messages for both being locked out of a zone do to failure and success. Still some timer update stuff I need to figure out but it is starting to come together, at least lockout instances are.

Re: Implementing: Instancing

Posted: Tue Sep 03, 2013 4:31 pm
by Jabantiz
This ended up a lot more work then I was expecting but getting to a point where I think it is stable enough to commit, will hopefully be able to do that tonight.

Just a quick question for john, is it ok to put a drop table statement on the DB patcher to update the table or should I get the alter code for it?

Re: Implementing: Instancing

Posted: Tue Sep 03, 2013 5:18 pm
by John Adams
If it is a currently unused table, you can do a DROP yourself (ie., don't DROP the spawn table :D)

FYI: The Alter/Update script does not assume this, but the Create script does (adds the DROP for you).

Re: Implementing: Instancing

Posted: Tue Sep 03, 2013 7:29 pm
by Jabantiz
Table is on the DB patcher, and code is on Dev SVN.

In the zones table `default_reenter_time` = failure lockout time for lockout instances and min duration for persistent instances.
`default_lockout_time` = success lockout time for lockouts and max duration for persistent instances

Those fields may need to be renamed to make it clearer what they do, I just used what was already there.

Currently success timer will bet set when you zone into a lockout, mainly for testing, still need to implement the lua functions to set the timers. The instance window (default: alt + z) should work for lockout instances, mostly work for persistent but not 100%, can't reset an instance and doesn't show you locked to an instance currently.

Also did a lot of DB work so John may want to go over that code, I suck with DB's...

This is still a work in progress, left a lot of comments to show my intentions, most work in the future will probably be in Client::TryZoneInstance()

Re: Implementing: Instancing

Posted: Tue Sep 03, 2013 7:45 pm
by John Adams
Jabantiz wrote:Also did a lot of DB work so John may want to go over that code, I suck with DB's...
You do just fine :) I'll take a look at it this week/weekend. Thanks!

Re: Implementing: Instancing

Posted: Thu Sep 05, 2013 7:12 pm
by Jabantiz
Dev SVN wrote: Added: SetSuccessTimer lua function
Added: SetFailureTimer lua function
Added: Comments to CharacterInstances code
Fixed: Moved CharacterInstances code out of player.h and into Player.cpp
Fixed: Success timer will no longer be set for lockout zones when a player zones into it
Fixed: Persistent instances will display better in the zone window (default: alt + z)
Fixed: Few errors in the packet for the zone window
The persistent window now works better and the reset button activates after min duration has passed, got the command figured out, was simple 1 param command, but haven't coded it yet. Also found a bug where the timers could expire for a lockout and you could zone back in but the instance wasn't cleared from the char so you would end up in the last instance you did and not a new one.

For those of you who know instances, is the "time left" in the persistent window suppose to be red when you can't reset it? Right now on the emu it is green and haven't figured out how to make it red, if it ever is red.

Re: Implementing: Instancing

Posted: Thu Sep 05, 2013 8:02 pm
by xinux
I zoned into The Estate of Unrest and i have 25 minutes left and it is green and the reset timer is greyed out but i'm pretty sure the reset timer won't be available till my time left has expired.

Re: Implementing: Instancing

Posted: Thu Sep 05, 2013 8:16 pm
by thefoof
Here's a screenshot of some different messages. I think you get one in-game when an instance expires too but not 100% sure. The yes and no window is when leaving a lockout instance that isn't persistent and you have a lockout, the first message is when a lockout is set, the second is trying to go back into a locked instance.