EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Bug Reports (https://www.eqemulator.org/forums/forumdisplay.php?f=591)
-   -   Return Home/Tutorial button issues (https://www.eqemulator.org/forums/showthread.php?t=37340)

Vexyl 09-30-2013 04:24 PM

Return Home/Tutorial button issues
 
This bug was already reported here: http://www.peqtgc.com/phpBB3/viewtopic.php?f=17&t=14123


The issue exists in Client::HandleEnterWorldPacket() from world/client.cpp.


So, from what little research I have done, it looks like the return home code is triggered if either button is clicked at the character selection screen.
That is, ew->return_home > 0 even if you click Tutorial and not Return Home which causes this if statement block to execute either way:

@line 712 of world/client.cpp
Code:

        if(!pZoning && ew->return_home)
        {
                ...
        }


I haven't used a packet sniffer or anything, but this is what I've found:

If Tutorial is clicked:
ew->return_home == 256
ew->tutorial == 1

If Return Home is clicked:
ew->return_home == 257
ew->tutorial == 0

If Enter World is clicked:
ew->return_home == 0
ew->tutorial == 0


Temporary fix:
Code:

--- client.cpp        2013-09-30 13:17:34.767489537 -0700
+++ eqemu/projecteqemu-read-only/world/client.cpp        2013-09-30 15:10:22.625739979 -0700
@@ -709,7 +709,7 @@
                return true;
        }
 
-        if(!pZoning && ew->return_home)
+        if(!pZoning && ew->return_home == 257)
        {
                CharacterSelect_Struct* cs = new CharacterSelect_Struct;
                memset(cs, 0, sizeof(CharacterSelect_Struct));
@@ -723,7 +723,6 @@
                                if(cs->gohome[x] == 1)
                                {
                                        home_enabled = true;
-                                        return true;
                                }
                        }
                }
@@ -755,7 +754,6 @@
                                if(cs->tutorial[x] == 1)
                                {
                                        tutorial_enabled = true;
-                                        return true;
                                }
                        }
                }


To get this to work, I had to remove the two returns since I don't really know why you'd want to return after confirming that the player can enter tutorial/return home.
(Again, I've done little research, so I may be missing something.)


Magic numbers are scary, so if anyone here that is knowledgeable of the zoning system and opcodes could find a more permanent solution, then that would be great.

demonstar55 10-11-2013 09:13 PM

If all clients act as you've stated, I think the best solution would be.

Code:

diff --git a/world/client.cpp b/world/client.cpp
index 57c60c0..0fd2117 100644
--- a/world/client.cpp
+++ b/world/client.cpp
@@ -709,7 +709,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
                return true;
        }
 
-        if(!pZoning && ew->return_home)
+        if(!pZoning && ew->return_home && !ew->tutorial)
        {
                CharacterSelect_Struct* cs = new CharacterSelect_Struct;
                memset(cs, 0, sizeof(CharacterSelect_Struct));

Unless someone chimes in and confirms what you said is true for all clients, some probably need to test them.

Vexyl 10-11-2013 09:18 PM

I've only done these tests on the supported RoF client, so it would be great if someone could test this on other clients.


Yeah, that code looks/works better:D

joligario 10-11-2013 10:33 PM

Titanium:
Tutorial button from char select screen works correctly.
Return home button from char select works correctly.
Tutorial button from create char screen still sends to home town.

SoD:
Tutorial button from char select screen works correctly.
Return home button from char select works correctly.
Tutorial button from create char screen works correctly.

demonstar55 10-11-2013 11:11 PM

I think for Titanium they do something weird in the case that is failing. If I had to guess, it is related to the StartInTutorial variable, which at least is appearing to be always false :P

Code:

                case OP_World_Client_CRC1:
                case OP_World_Client_CRC2:
                {
                        // There is no obvious entry in the CC struct to indicate that the 'Start Tutorial button
                        // is selected when a character is created. I have observed that in this case, OP_EnterWorld is sent
                        // before OP_World_Client_CRC1. Therefore, if we receive OP_World_Client_CRC1 before OP_EnterWorld,
                        // then 'Start Tutorial' was not chosen.
                        StartInTutorial = false;
                        return true;
                }

I'm not sure what to do, opcode stuff isn't my strong suite :P it sounds like from the comments that StartInTutorial should be set to true if OP_World_Client_CRC1 is sent before OP_EnterWorld, but I'm pretty sure just changing the false to true is probably not the right solution.

EDIT: Okay, this should be working now.

Uleat 10-17-2013 07:44 PM

I looked into the "Tutorial" issue a little bit more and could not come to a solution...

I know there are two rules to allow/disallow the use of the [Enter Tutorial] and [Go Home] buttons, and that
the server is coded to make use of these. However, I'm not completely sure we're using them appropriately
since I can't verfiy their behavior on live.


"What we do" (I think..based on in-game observations...)
Code:

WORLD SERVER:
        - Hard-coded to always enable 'Tutorial'
                -- Always shows 'Character Select' [Enter Tutorial] button
                -- Always shows 'Character Select' [Go Home] button
                -- Always shows 'Create Character' [Tutorial] button

CHARACTER SELECT:
        - [Enter Tutorial] button
                -- rule(EnableTutorialButton)
                [true]
                        --- Sends player to rule(TutorialZoneID)
                [false]
                        --- Button is [disabled]
       
        - [Go Home] button
                -- rule(EnableGoHomeButton)
                [true]
                        --- Sends player home (starting city or tutorial, depending on character creation method)
                [false]
                        --- Button is [disabled]

CREATE CHARACTER:
        - [Tutorial] button
        [selected]
                -- rule(EnableTutorialButton)
                [true]
                        --- Sends character to rule(TutorialZoneID) upon finalization
                [false]
                        --- Sends character to 'Starting City' upon finalization
        [de-selected]
                -- Returns to 'Character Select' screen with proper 'Starting City'

NOTES:
        - Current coding sets the character's starting city as the tutorial. (I thought this was a bit odd..but,
                Sorvani brought up that it may also be affecting 'Heritage' AA's as well... Unverified bug, tmk...)
        - When returning to 'Character Select' screen from 'Create Character,' using the [Enter Tutorial] button
                will send the player to rule(TutorialZoneID)..but, unknown atm if 'Starting City' is changed...


"What we should probably do" (Or something akin to this...)
Code:

WORLD SERVER:
        - rule(EnableTutorialButton)
        [true]
                -- Shows 'Character Select' [Enter Tutorial] button
                -- Shows 'Character Select' [Go Home] button
                -- Shows 'Create Character' [Tutorial] button
        [false]
                -- Hides 'Character Select' [Enter Tutorial] button
                -- Hides 'Character Select' [Go Home] button
                -- Hides 'Create Character' [Tutorial] button

CHARACTER SELECT:
        - rule(EnableTutorialButton)
        [true]
                -- [Enter Tutorial] button
                        --- 'Player Profile' ('Tutorial Complete' || 'Tutorial Active')
                        [true][x]
                                ---- Button is disabled
                        [false][true]
                                ---- Button is disabled
                        [false][false]
                                ---- Button is enabled, if appropriate criteria is met..otherwise disabled
                                ---- Pressing button
                                        ----- Sends player to rule(TutorialZoneID)
                                        ----- 'Player Profile' is tagged for 'Tutorial Active' [true]
                -- [Go Home] button
                        --- rule(EnableGoHomeButton)
                        [true]
                                ---- 'Player Profile' 'Tutorial Active'
                                [true]
                                        ----- Button is enabled
                                        ----- Pressing button sends player to 'Starting City'
                                        ----- Pressing button tags 'Player Profile' 'Tutorial Active' [false]
                                        ----- Pressing button tags 'Player Profile' 'Tutorial Complete' [true]
                                [false]
                                        ----- Button is enabled, if appropriate criteria is met..otherwise disabled
                        [false]
                                ---- Button is disabled, unless 'Tutorial Active' is [true] (see [true][true] above)
                -- [Enter World] button
                        --- 'Player Profile' ('Tutorial Complete' || 'Tutorial Active')
                        [true][true]
                                ---- Sends player to 'Current Zone' or 'Starting City'->SpawnPoint if (ZoneID = rule(TutorialZoneID))
                                ---- Tags 'Player Profile' 'Tutorial Active' [false]
                        [false][true]
                                ---- Sends player to rule(TutorialZoneID)
                        [x][false]
                                ---- Sends player to 'Current Zone' or 'Starting City'->SpawnPoint if (ZoneID = rule(TutorialZoneID))
        [false]
                -- [Enter Tutorial] button is hidden
                -- [Go Home] button is hidden

CREATE CHARACTER:
        - rule(EnableTutorialButton)
        [true]
                -- [Tutorial] button
                [selected]
                        --- Sends player to rule(TutorialZoneID) upon finalization
                        --- 'Player Profile' is tagged for 'Tutorial Active' [true]
                        --- 'Player Profile' is tagged for 'Tutorial Complete' [false]
                        --- 'Player Profile' 'Starting City' is set to proper 'Starting City'
                [de-selected]
                        --- Returns to 'Character Select' screen with proper 'Starting City'
                        --- 'Player Profile' is tagged for 'Tutorial Active' [false]
                        --- 'Player Profile' is tagged for 'Tutorial Complete' [false]
        [false]*
                -- [Tutorial] button is hidden
                -- Returns player to 'Character Select' screen upon finalization
                -- 'Player Profile' is tagged for 'Tutorial Active' [false]
                -- 'Player Profile' is tagged for 'Tutorial Complete' [false]
                * in case admin changes tutorial rule, this will allow permitted characters to still enter the tutorial
               
NOTES:
        - Disabling rule(EnableTutorialButton) would also disallow the use of the [Go Home] button.
        - Though a seperate rule could be made for setting the 'World Server' state, disabling the [Enter Tutorial]
                button would still cause a glitch when creating a character and the [Tutorial] button is [selected].
        - 'Player Profile' 'Tutorial Active' [true] always redirects zoning destinations to rule(TutorialZoneID)
        - 'Player Profile' 'Tutorial Active' [true] always overrides respawns to rule(TutorialZoneID)->SpawnPoint
        - 'Player Profile' 'Tutorial Active' [false] always diverts zoning destinations away from rule(TutorialZoneID)
        - 'Player Profile' 'Tutorial Active' [false] always diverts respawns away from rule(TutorialZoneID)
        - Status overrides may need to be added
        - (Conditions can be added, removed or changed as needed...)


The way this is setup, the only way to exit tutorial status is to click the [Go Home] button from the 'Character
Select' screen. These rules may need to be adjusted or changed to reflect a more appropriate behavior.

Titanium DOES support the world server tutorial rule, so we should be able to condense the code. The only thing
that I'm aware of that isn't supported is the alternative home city (Crescent Reach) and we can bypass that.

Again, this is only a concept based on my observations and may not reflect live-like behavior. I WILL NOT develop
or implement this without feedback or suggestions.


All times are GMT -4. The time now is 06:34 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.