Rework OPCharCreate logic with tutorial flag

Hopefully resolves issues with toons on Titanium spawning out of bounds
when starting in tutorial.

Resolves setting home bind to tutorial and being out of bounds.
This commit is contained in:
Michael Cook (mackal) 2014-10-07 23:40:13 -04:00
parent 45ef740244
commit 2dacb523fc
11 changed files with 50 additions and 49 deletions

View File

@ -1,5 +1,8 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 10/07/2014 ==
demonstar55: Identified tutorial flag in all charcreate packets, reworked logic to correctly set homes binds
== 10/05/2014 ==
Uleat: Added Server<->Corpse slot translators needed for re-enumeration (inactive until phased in)

View File

@ -689,7 +689,7 @@ struct CharCreate_Struct
/*0076*/ uint32 drakkin_heritage; // added for SoF
/*0080*/ uint32 drakkin_tattoo; // added for SoF
/*0084*/ uint32 drakkin_details; // added for SoF
/*0088*/
/*0088*/ uint32 tutorial;
};
/*

View File

@ -1038,6 +1038,7 @@ namespace Client62
IN(face);
IN(eyecolor1);
IN(eyecolor2);
IN(tutorial);
FINISH_DIRECT_DECODE();
}

View File

@ -558,7 +558,7 @@ struct CharCreate_Struct
/*0128*/ uint32 face;
/*0132*/ uint32 eyecolor1; //its possiable we could have these switched
/*0136*/ uint32 eyecolor2; //since setting one sets the other we really can't check
/*0140*/ uint32 unknown140;
/*0140*/ uint32 tutorial; //assumptions are bad! But guessed
};
/*

View File

@ -4036,12 +4036,7 @@ namespace RoF
IN(race);
IN(class_);
IN(deity);
if (RuleB(World, EnableTutorialButton) && eq->tutorial)
emu->start_zone = RuleI(World, TutorialZoneID);
else
emu->start_zone = eq->start_zone;
IN(start_zone);
IN(haircolor);
IN(beard);
IN(beardcolor);
@ -4059,7 +4054,7 @@ namespace RoF
IN(WIS);
IN(INT);
IN(CHA);
//IN(tutorial);
IN(tutorial);
FINISH_DIRECT_DECODE();
}

View File

@ -2705,12 +2705,7 @@ namespace SoD
IN(hairstyle);
IN(gender);
IN(race);
if (RuleB(World, EnableTutorialButton) && eq->tutorial)
emu->start_zone = RuleI(World, TutorialZoneID);
else
emu->start_zone = eq->start_zone;
IN(start_zone);
IN(haircolor);
IN(deity);
IN(STR);
@ -2723,6 +2718,7 @@ namespace SoD
IN(face);
IN(eyecolor1);
IN(eyecolor2);
IN(tutorial);
IN(drakkin_heritage);
IN(drakkin_tattoo);
IN(drakkin_details);

View File

@ -2105,12 +2105,7 @@ namespace SoF
IN(hairstyle);
IN(gender);
IN(race);
if (RuleB(World, EnableTutorialButton) && eq->tutorial)
emu->start_zone = RuleI(World, TutorialZoneID);
else
emu->start_zone = eq->start_zone;
IN(start_zone);
IN(haircolor);
IN(deity);
IN(STR);
@ -2123,6 +2118,7 @@ namespace SoF
IN(face);
IN(eyecolor1);
IN(eyecolor2);
IN(tutorial);
IN(drakkin_heritage);
IN(drakkin_tattoo);
IN(drakkin_details);

View File

@ -1395,6 +1395,7 @@ namespace Titanium
IN(face);
IN(eyecolor1);
IN(eyecolor2);
IN(tutorial);
FINISH_DIRECT_DECODE();
}

View File

@ -565,7 +565,7 @@ struct CharCreate_Struct
/*0064*/ uint32 face; // Could be unknown0076
/*0068*/ uint32 eyecolor1; //its possiable we could have these switched
/*0073*/ uint32 eyecolor2; //since setting one sets the other we really can't check
/*0076*/ uint32 unknown0076; // Could be face
/*0076*/ uint32 tutorial;
/*0080*/
};

View File

@ -3007,12 +3007,7 @@ namespace Underfoot
IN(hairstyle);
IN(gender);
IN(race);
if (RuleB(World, EnableTutorialButton) && eq->tutorial)
emu->start_zone = RuleI(World, TutorialZoneID);
else
emu->start_zone = eq->start_zone;
IN(start_zone);
IN(haircolor);
IN(deity);
IN(STR);
@ -3025,6 +3020,7 @@ namespace Underfoot
IN(face);
IN(eyecolor1);
IN(eyecolor2);
IN(tutorial);
IN(drakkin_heritage);
IN(drakkin_tattoo);
IN(drakkin_details);

View File

@ -1345,22 +1345,23 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) {
char startzone[50]={0};
uint32 i;
struct in_addr in;
int stats_sum = cc->STR + cc->STA + cc->AGI + cc->DEX + cc->WIS + cc->INT + cc->CHA;
in.s_addr = GetIP();
clog(WORLD__CLIENT,"Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort());
clog(WORLD__CLIENT,"Name: %s", name);
clog(WORLD__CLIENT,"Race: %d Class: %d Gender: %d Deity: %d Start zone: %d",
clog(WORLD__CLIENT, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort());
clog(WORLD__CLIENT, "Name: %s", name);
clog(WORLD__CLIENT, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d",
cc->race, cc->class_, cc->gender, cc->deity, cc->start_zone);
clog(WORLD__CLIENT,"STR STA AGI DEX WIS INT CHA Total");
clog(WORLD__CLIENT,"%3d %3d %3d %3d %3d %3d %3d %3d",
clog(WORLD__CLIENT, "STR STA AGI DEX WIS INT CHA Total");
clog(WORLD__CLIENT, "%3d %3d %3d %3d %3d %3d %3d %3d",
cc->STR, cc->STA, cc->AGI, cc->DEX, cc->WIS, cc->INT, cc->CHA,
stats_sum);
clog(WORLD__CLIENT,"Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2);
clog(WORLD__CLIENT,"Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor);
clog(WORLD__CLIENT,"Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor);
clog(WORLD__CLIENT, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2);
clog(WORLD__CLIENT, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor);
clog(WORLD__CLIENT, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor);
clog(WORLD__CLIENT, "Home: %d Tutorial: %d", cc->start_zone, cc->tutorial);
/* Validate the char creation struct */
if(ClientVersionBit & BIT_SoFAndLater) {
@ -1475,22 +1476,34 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) {
pp.x = pp.y = pp.z = -1;
}
if(!pp.binds[0].zoneId) {
pp.binds[0].zoneId = pp.zone_id;
pp.binds[0].x = pp.x;
pp.binds[0].y = pp.y;
pp.binds[0].z = pp.z;
pp.binds[0].heading = pp.heading;
/* Set Home Binds */
if(!pp.binds[4].zoneId) {
pp.binds[4].zoneId = pp.zone_id;
pp.binds[4].x = pp.x;
pp.binds[4].y = pp.y;
pp.binds[4].z = pp.z;
pp.binds[4].heading = pp.heading;
}
/* Set Starting city */
pp.binds[4] = pp.binds[0];
/* Overrides if we have the tutorial flag set! */
if (cc->tutorial && RuleB(World, EnableTutorialButton)) {
pp.zone_id = RuleI(World, TutorialZoneID);
database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z);
}
/* Will either be the same as home or tutorial */
pp.binds[0].zoneId = pp.zone_id;
pp.binds[0].x = pp.x;
pp.binds[0].y = pp.y;
pp.binds[0].z = pp.z;
pp.binds[0].heading = pp.heading;
clog(WORLD__CLIENT,"Current location: %s %0.2f, %0.2f, %0.2f, %0.2f",
database.GetZoneName(pp.zone_id), pp.x, pp.y, pp.z, pp.heading);
clog(WORLD__CLIENT,"Bind location: %s %0.2f, %0.2f, %0.2f",
database.GetZoneName(pp.binds[0].zoneId), pp.binds[0].x, pp.binds[0].y, pp.binds[0].z);
clog(WORLD__CLIENT,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f",
database.GetZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading);
clog(WORLD__CLIENT,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f",
database.GetZoneName(pp.binds[0].zoneId), pp.binds[0].zoneId, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z);
clog(WORLD__CLIENT,"Home location: %s (%d) %0.2f, %0.2f, %0.2f",
database.GetZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z);
/* Starting Items inventory */
database.SetStartingItems(&pp, &inv, pp.race, pp.class_, pp.deity, pp.zone_id, pp.name, GetAdmin());