Merge master, pretty close to RC atm

This commit is contained in:
KimLS
2013-06-26 12:52:00 -07:00
36 changed files with 483 additions and 292 deletions
+159 -31
View File
@@ -317,6 +317,8 @@ Client::Client(EQStreamInterface* ieqs)
MaxXTargets = 5;
XTargetAutoAddHaters = true;
LoadAccountFlags();
initial_respawn_selection = 0;
}
Client::~Client() {
@@ -409,6 +411,8 @@ Client::~Client() {
safe_delete_array(adv_requested_data);
safe_delete_array(adv_data);
ClearRespawnOptions();
numclients--;
UpdateWindowTitle();
if(zone)
@@ -4288,45 +4292,68 @@ void Client::SendRespawnBinds()
// Client will respond with a 4 byte packet that includes the number of the selection made
//
//If no options have been given, default to Bind + Rez
if (respawn_options.empty())
{
BindStruct* b = &m_pp.binds[0];
RespawnOption opt;
opt.name = "Bind Location";
opt.zoneid = b->zoneId;
opt.x = b->x;
opt.y = b->y;
opt.z = b->z;
opt.heading = b->heading;
respawn_options.push_front(opt);
}
//Rez is always added at the end
RespawnOption rez;
rez.name = "Resurrect";
rez.zoneid = zone->GetZoneID();
rez.x = GetX();
rez.y = GetY();
rez.z = GetZ();
rez.heading = GetHeading();
respawn_options.push_back(rez);
const char* BindName = "Bind Location";
const char* Resurrect = "Resurrect";
int num_options = respawn_options.size();
uint32 PacketLength = 17 + (26 * num_options); //Header size + per-option invariant size
std::list<RespawnOption>::iterator itr;
RespawnOption* opt;
int PacketLength;
//Find string size for each option
for (itr = respawn_options.begin(); itr != respawn_options.end(); ++itr)
{
opt = &(*itr);
PacketLength += opt->name.size() + 1; //+1 for cstring
}
PacketLength = 17 + (26 * 2) + strlen(BindName) + strlen(Resurrect); // SoF
EQApplicationPacket* outapp = new EQApplicationPacket(OP_RespawnWindow, PacketLength);
char* buffer = (char*)outapp->pBuffer;
EQApplicationPacket *outapp = new EQApplicationPacket(OP_RespawnWindow, PacketLength);
//Packet header
VARSTRUCT_ENCODE_TYPE(uint32, buffer, initial_respawn_selection); //initial selection (from 0)
VARSTRUCT_ENCODE_TYPE(uint32, buffer, RuleI(Character, RespawnFromHoverTimer) * 1000);
VARSTRUCT_ENCODE_TYPE(uint32, buffer, 0); //unknown
VARSTRUCT_ENCODE_TYPE(uint32, buffer, num_options); //number of options to display
char *Buffer = (char *)outapp->pBuffer;
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // Unknown
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, RuleI(Character, RespawnFromHoverTimer) * 1000);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // Unknown
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 2); // Two options, Bind or Rez
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // Entry 0
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, m_pp.binds[0].zoneId);
VARSTRUCT_ENCODE_TYPE(float, Buffer, m_pp.binds[0].x);
VARSTRUCT_ENCODE_TYPE(float, Buffer, m_pp.binds[0].y);
VARSTRUCT_ENCODE_TYPE(float, Buffer, m_pp.binds[0].z);
VARSTRUCT_ENCODE_TYPE(float, Buffer, m_pp.binds[0].heading);
VARSTRUCT_ENCODE_STRING(Buffer, BindName);
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 1); // Entry 1
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, zone->GetZoneID());
VARSTRUCT_ENCODE_TYPE(float, Buffer, GetX());
VARSTRUCT_ENCODE_TYPE(float, Buffer, GetY());
VARSTRUCT_ENCODE_TYPE(float, Buffer, GetZ());
VARSTRUCT_ENCODE_TYPE(float, Buffer, GetHeading());
VARSTRUCT_ENCODE_STRING(Buffer, Resurrect);
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 1);
//Individual options
int count = 0;
for (itr = respawn_options.begin(); itr != respawn_options.end(); ++itr)
{
opt = &(*itr);
VARSTRUCT_ENCODE_TYPE(uint32, buffer, count++); //option num (from 0)
VARSTRUCT_ENCODE_TYPE(uint32, buffer, opt->zoneid);
VARSTRUCT_ENCODE_TYPE(float, buffer, opt->x);
VARSTRUCT_ENCODE_TYPE(float, buffer, opt->y);
VARSTRUCT_ENCODE_TYPE(float, buffer, opt->z);
VARSTRUCT_ENCODE_TYPE(float, buffer, opt->heading);
VARSTRUCT_ENCODE_STRING(buffer, opt->name.c_str());
VARSTRUCT_ENCODE_TYPE(uint8, buffer, (count == num_options)); //is this one Rez (the last option)?
}
QueuePacket(outapp);
safe_delete(outapp);
return;
}
@@ -7827,3 +7854,104 @@ void Client::SendItemScale(ItemInst *inst) {
CalcBonuses();
}
}
void Client::AddRespawnOption(std::string option_name, uint32 zoneid, float x, float y, float z, float heading, bool initial_selection, int8 position)
{
//If respawn window is already open, any changes would create an inconsistency with the client
if (IsHoveringForRespawn()) { return; }
if (zoneid == 0)
zoneid = zone->GetZoneID();
//Create respawn option
RespawnOption res_opt;
res_opt.name = option_name;
res_opt.zoneid = zoneid;
res_opt.x = x;
res_opt.y = y;
res_opt.z = z;
res_opt.heading = heading;
if (position == -1 || position >= respawn_options.size())
{
//No position specified, or specified beyond the end, simply append
respawn_options.push_back(res_opt);
//Make this option the initial selection for the window if desired
if (initial_selection)
initial_respawn_selection = static_cast<uint8>(respawn_options.size()) - 1;
}
else if (position == 0)
{
respawn_options.push_front(res_opt);
if (initial_selection)
initial_respawn_selection = 0;
}
else
{
//Insert new option between existing options
std::list<RespawnOption>::iterator itr;
uint8 pos = 0;
for (itr = respawn_options.begin(); itr != respawn_options.end(); ++itr)
{
if (pos++ == position)
{
respawn_options.insert(itr,res_opt);
//Make this option the initial selection for the window if desired
if (initial_selection)
initial_respawn_selection = pos;
return;
}
}
}
}
bool Client::RemoveRespawnOption(std::string option_name)
{
//If respawn window is already open, any changes would create an inconsistency with the client
if (IsHoveringForRespawn() || respawn_options.empty()) { return false; }
bool had = false;
RespawnOption* opt;
std::list<RespawnOption>::iterator itr;
for (itr = respawn_options.begin(); itr != respawn_options.end(); ++itr)
{
opt = &(*itr);
if (opt->name.compare(option_name) == 0)
{
respawn_options.erase(itr);
had = true;
//could be more with the same name, so keep going...
}
}
return had;
}
bool Client::RemoveRespawnOption(uint8 position)
{
//If respawn window is already open, any changes would create an inconsistency with the client
if (IsHoveringForRespawn() || respawn_options.empty()) { return false; }
//Easy cases first...
if (position == 0)
{
respawn_options.pop_front();
return true;
}
else if (position == (respawn_options.size() - 1))
{
respawn_options.pop_back();
return true;
}
std::list<RespawnOption>::iterator itr;
uint8 pos = 0;
for (itr = respawn_options.begin(); itr != respawn_options.end(); ++itr)
{
if (pos++ == position)
{
respawn_options.erase(itr);
return true;
}
}
return false;
}
+17
View File
@@ -178,6 +178,16 @@ struct XTarget_Struct
char Name[65];
};
struct RespawnOption
{
std::string name;
uint32 zoneid;
float x;
float y;
float z;
float heading;
};
const uint32 POPUPID_UPDATE_SHOWSTATSWINDOW = 1000000;
@@ -1048,6 +1058,11 @@ public:
bool MoveItemToInventory(ItemInst *BInst, bool UpdateClient = false);
void HandleRespawnFromHover(uint32 Option);
bool IsHoveringForRespawn() { return RespawnFromHoverTimer.Enabled(); }
std::list<RespawnOption> respawn_options;
void AddRespawnOption(std::string option_name, uint32 zoneid, float x, float y, float z, float h = 0, bool initial_selection = false, int8 position = -1);
bool RemoveRespawnOption(std::string option_name);
bool RemoveRespawnOption(uint8 position);
void ClearRespawnOptions() { respawn_options.clear(); }
void SetPendingRezzData(int XP, uint32 DBID, uint16 SpellID, const char *CorpseName) { PendingRezzXP = XP; PendingRezzDBID = DBID; PendingRezzSpellID = SpellID; PendingRezzCorpseName = CorpseName; }
bool IsRezzPending() { return PendingRezzSpellID > 0; }
void ClearHover();
@@ -1454,6 +1469,8 @@ private:
Timer ItemTickTimer;
Timer ItemQuestTimer;
std::map<std::string,std::string> accountflags;
uint8 initial_respawn_selection;
};
#endif
+11 -11
View File
@@ -3879,7 +3879,7 @@ void Client::Handle_OP_LDoNInspect(const EQApplicationPacket *app)
void Client::Handle_OP_Dye(const EQApplicationPacket *app)
{
if(app->size!=sizeof(DyeStruct))
printf("Wrong size of DyeStruct, Got: %i, Expected: %i\n",app->size,sizeof(DyeStruct));
printf("Wrong size of DyeStruct, Got: %i, Expected: %zu\n",app->size,sizeof(DyeStruct));
else{
DyeStruct* dye = (DyeStruct*)app->pBuffer;
DyeArmor(dye);
@@ -3950,7 +3950,7 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app)
if (app->size < sizeof(GuildUpdate_PublicNote)) {
// client calls for a motd on login even if they arent in a guild
printf("Error: app size of %i < size of OP_GuildPublicNote of %i\n",app->size,sizeof(GuildUpdate_PublicNote));
printf("Error: app size of %i < size of OP_GuildPublicNote of %zu\n",app->size,sizeof(GuildUpdate_PublicNote));
return;
}
GuildUpdate_PublicNote* gpn=(GuildUpdate_PublicNote*)app->pBuffer;
@@ -4008,7 +4008,7 @@ void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app)
if (app->size != sizeof(GuildMOTD_Struct)) {
// client calls for a motd on login even if they arent in a guild
printf("Error: app size of %i != size of GuildMOTD_Struct of %i\n",app->size,sizeof(GuildMOTD_Struct));
printf("Error: app size of %i != size of GuildMOTD_Struct of %zu\n",app->size,sizeof(GuildMOTD_Struct));
return;
}
if(!IsInAGuild()) {
@@ -6894,7 +6894,7 @@ void Client::Handle_OP_DeleteSpell(const EQApplicationPacket *app)
void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app)
{
if(app->size!=sizeof(LoadSpellSet_Struct)) {
printf("Wrong size of LoadSpellSet_Struct! Expected: %i, Got: %i\n",sizeof(LoadSpellSet_Struct),app->size);
printf("Wrong size of LoadSpellSet_Struct! Expected: %zu, Got: %i\n",sizeof(LoadSpellSet_Struct),app->size);
return;
}
int i;
@@ -6909,7 +6909,7 @@ void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app)
void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app)
{
if(app->size!=sizeof(PetitionBug_Struct))
printf("Wrong size of BugStruct! Expected: %i, Got: %i\n",sizeof(PetitionBug_Struct),app->size);
printf("Wrong size of BugStruct! Expected: %zu, Got: %i\n",sizeof(PetitionBug_Struct),app->size);
else{
Message(0, "Petition Bugs are not supported, please use /bug.");
}
@@ -6919,7 +6919,7 @@ void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app)
void Client::Handle_OP_Bug(const EQApplicationPacket *app)
{
if(app->size!=sizeof(BugStruct))
printf("Wrong size of BugStruct got %d expected %i!\n", app->size, sizeof(BugStruct));
printf("Wrong size of BugStruct got %d expected %zu!\n", app->size, sizeof(BugStruct));
else{
BugStruct* bug=(BugStruct*)app->pBuffer;
database.UpdateBug(bug);
@@ -8315,7 +8315,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app)
_pkt(TRIBUTE__IN, app);
if(app->size != sizeof(StartTribute_Struct))
printf("Error in OP_OpenTributeMaster. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
printf("Error in OP_OpenTributeMaster. Expected size of: %zu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
else {
//Opens the tribute master window
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
@@ -8340,7 +8340,7 @@ void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app)
_pkt(TRIBUTE__IN, app);
if(app->size != sizeof(StartTribute_Struct))
printf("Error in OP_OpenGuildTributeMaster. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
printf("Error in OP_OpenGuildTributeMaster. Expected size of: %zu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
else {
//Opens the guild tribute master window
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
@@ -8366,7 +8366,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app)
//player donates an item...
if(app->size != sizeof(TributeItem_Struct))
printf("Error in OP_TributeItem. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
printf("Error in OP_TributeItem. Expected size of: %zu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
else {
TributeItem_Struct* t = (TributeItem_Struct*)app->pBuffer;
@@ -8395,7 +8395,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app)
//player donates money
if(app->size != sizeof(TributeMoney_Struct))
printf("Error in OP_TributeMoney. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
printf("Error in OP_TributeMoney. Expected size of: %zu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
else {
TributeMoney_Struct* t = (TributeMoney_Struct*)app->pBuffer;
@@ -8543,7 +8543,7 @@ void Client::Handle_OP_Ignore(const EQApplicationPacket *app)
void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app)
{
if(app->size != sizeof(FindPersonRequest_Struct))
printf("Error in FindPersonRequest_Struct. Expected size of: %i, but got: %i\n",sizeof(FindPersonRequest_Struct),app->size);
printf("Error in FindPersonRequest_Struct. Expected size of: %zu, but got: %i\n",sizeof(FindPersonRequest_Struct),app->size);
else {
FindPersonRequest_Struct* t = (FindPersonRequest_Struct*)app->pBuffer;
+133 -79
View File
@@ -2032,87 +2032,140 @@ void Client::HandleRespawnFromHover(uint32 Option)
{
RespawnFromHoverTimer.Disable();
if(Option == 1) // Resurrect
RespawnOption* chosen = nullptr;
bool is_rez = false;
//Find the selected option
if (Option == 0)
{
if((PendingRezzXP < 0) || (PendingRezzSpellID == 0))
{
_log(SPELLS__REZ, "Unexpected Rezz from hover request.");
return;
}
SetHP(GetMaxHP() / 5);
Corpse* corpse = entity_list.GetCorpseByName(PendingRezzCorpseName.c_str());
if(corpse)
{
x_pos = corpse->GetX();
y_pos = corpse->GetY();
z_pos = corpse->GetZ();
}
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + 10);
ZonePlayerToBind_Struct* gmg = (ZonePlayerToBind_Struct*) outapp->pBuffer;
gmg->bind_zone_id = zone->GetZoneID();
gmg->bind_instance_id = zone->GetInstanceID();
gmg->x = GetX();
gmg->y = GetY();
gmg->z = GetZ();
gmg->heading = GetHeading();
strcpy(gmg->zone_name, "Resurrect");
FastQueuePacket(&outapp);
ClearHover();
SendHPUpdate();
OPRezzAnswer(1, PendingRezzSpellID, zone->GetZoneID(), zone->GetInstanceID(), GetX(), GetY(), GetZ());
if (corpse && corpse->IsCorpse()) {
_log(SPELLS__REZ, "Hover Rez in zone %s for corpse %s",
zone->GetShortName(), PendingRezzCorpseName.c_str());
_log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed.");
corpse->Rezzed(true);
corpse->CompleteRezz();
}
return;
chosen = &respawn_options.front();
}
// Respawn at Bind Point.
//
if(m_pp.binds[0].zoneId == zone->GetZoneID())
else if (Option == (respawn_options.size() - 1))
{
PendingRezzSpellID = 0;
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + 14);
ZonePlayerToBind_Struct* gmg = (ZonePlayerToBind_Struct*) outapp->pBuffer;
gmg->bind_zone_id = m_pp.binds[0].zoneId;
gmg->x = m_pp.binds[0].x;
gmg->y = m_pp.binds[0].y;
gmg->z = m_pp.binds[0].z;
gmg->heading = 0;
strcpy(gmg->zone_name, "Bind Location");
FastQueuePacket(&outapp);
CalcBonuses();
SetHP(GetMaxHP());
SetMana(GetMaxMana());
SetEndurance(GetMaxEndurance());
x_pos = m_pp.binds[0].x;
y_pos = m_pp.binds[0].y;
z_pos = m_pp.binds[0].z;
ClearHover();
entity_list.RefreshClientXTargets(this);
SendHPUpdate();
chosen = &respawn_options.back();
is_rez = true; //Rez must always be the last option
}
else
{
std::list<RespawnOption>::iterator itr;
uint32 pos = 0;
for (itr = respawn_options.begin(); itr != respawn_options.end(); ++itr)
{
if (pos++ == Option)
{
chosen = &(*itr);
break;
}
}
}
//If they somehow chose an option they don't have, just send them to bind
RespawnOption* default_to_bind = nullptr;
if (!chosen)
{
/* put error logging here */
BindStruct* b = &m_pp.binds[0];
default_to_bind = new RespawnOption;
default_to_bind->name = "Bind Location";
default_to_bind->zoneid = b->zoneId;
default_to_bind->x = b->x;
default_to_bind->y = b->y;
default_to_bind->z = b->z;
default_to_bind->heading = b->heading;
chosen = default_to_bind;
is_rez = false;
}
if (chosen->zoneid == zone->GetZoneID()) //If they should respawn in the current zone...
{
if (is_rez)
{
if (PendingRezzXP < 0 || PendingRezzSpellID == 0)
{
_log(SPELLS__REZ, "Unexpected Rezz from hover request.");
return;
}
SetHP(GetMaxHP() / 5);
Corpse* corpse = entity_list.GetCorpseByName(PendingRezzCorpseName.c_str());
if (corpse)
{
x_pos = corpse->GetX();
y_pos = corpse->GetY();
z_pos = corpse->GetZ();
}
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + 10);
ZonePlayerToBind_Struct* gmg = (ZonePlayerToBind_Struct*) outapp->pBuffer;
gmg->bind_zone_id = zone->GetZoneID();
gmg->bind_instance_id = zone->GetInstanceID();
gmg->x = GetX();
gmg->y = GetY();
gmg->z = GetZ();
gmg->heading = GetHeading();
strcpy(gmg->zone_name, "Resurrect");
FastQueuePacket(&outapp);
ClearHover();
SendHPUpdate();
OPRezzAnswer(1, PendingRezzSpellID, zone->GetZoneID(), zone->GetInstanceID(), GetX(), GetY(), GetZ());
if (corpse && corpse->IsCorpse())
{
_log(SPELLS__REZ, "Hover Rez in zone %s for corpse %s",
zone->GetShortName(), PendingRezzCorpseName.c_str());
_log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed.");
corpse->Rezzed(true);
corpse->CompleteRezz();
}
}
else //Not rez
{
PendingRezzSpellID = 0;
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + chosen->name.length() + 1);
ZonePlayerToBind_Struct* gmg = (ZonePlayerToBind_Struct*) outapp->pBuffer;
gmg->bind_zone_id = zone->GetZoneID();
gmg->x = chosen->x;
gmg->y = chosen->y;
gmg->z = chosen->z;
gmg->heading = chosen->heading;
strcpy(gmg->zone_name, chosen->name.c_str());
FastQueuePacket(&outapp);
CalcBonuses();
SetHP(GetMaxHP());
SetMana(GetMaxMana());
SetEndurance(GetMaxEndurance());
x_pos = chosen->x;
y_pos = chosen->y;
z_pos = chosen->z;
heading = chosen->heading;
ClearHover();
entity_list.RefreshClientXTargets(this);
SendHPUpdate();
}
//After they've respawned into the same zone, trigger EVENT_RESPAWN
parse->EventPlayer(EVENT_RESPAWN, this, static_cast<std::string>(itoa(Option)), is_rez ? 1 : 0);
//Pop Rez option from the respawn options list;
//easiest way to make sure it stays at the end and
//doesn't disrupt adding/removing scripted options
respawn_options.pop_back();
}
else
{
//Heading to a different zone
if(isgrouped)
{
Group *g = GetGroup();
@@ -2121,18 +2174,19 @@ void Client::HandleRespawnFromHover(uint32 Option)
}
Raid* r = entity_list.GetRaidByClient(this);
if(r)
r->MemberZoned(this);
m_pp.zone_id = m_pp.binds[0].zoneId;
m_pp.zone_id = chosen->zoneid;
m_pp.zoneInstance = 0;
database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(m_pp.zone_id));
database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(chosen->zoneid));
Save();
GoToDeath();
MovePC(chosen->zoneid,chosen->x,chosen->y,chosen->z,chosen->heading,1);
}
safe_delete(default_to_bind);
}
void Client::ClearHover()
+20 -20
View File
@@ -9500,22 +9500,22 @@ void command_object(Client *c, const Seperator *sep)
od.object_type = atoi(row[col++]);
icon = atoi(row[col++]);
od.unknown008[0] = atoi(row[col++]);
od.unknown008[1] = atoi(row[col++]);
od.unknown008 = atoi(row[col++]);
od.unknown010 = atoi(row[col++]);
od.unknown020 = atoi(row[col++]);
switch (od.object_type)
{
case 0: // Static Object
case TempStaticType: // Static Object unlocked for changes
if (od.unknown008[0] == 0) // Unknown08 field is optional Size parameter for static objects
if (od.unknown008 == 0) // Unknown08 field is optional Size parameter for static objects
{
od.unknown008[0] = 100; // Static object default Size is 100%
od.unknown008 = 100; // Static object default Size is 100%
}
c->Message(0,
"- STATIC Object (%s): id %u, x %.1f, y %.1f, z %.1f, h %.1f, model %s, size %u, solidtype %u, incline %u",
(od.object_type == 0) ? "locked" : "unlocked", id, od.x, od.y, od.z, od.heading, od.object_name, od.unknown008[0], od.unknown008[1], od.unknown020);
(od.object_type == 0) ? "locked" : "unlocked", id, od.x, od.y, od.z, od.heading, od.object_name, od.unknown008, od.unknown010, od.unknown020);
break;
case OT_DROPPEDITEM: // Ground Spawn
c->Message(0,
@@ -9581,11 +9581,11 @@ void command_object(Client *c, const Seperator *sep)
case 0: // Static Object
if ((sep->argnum - col) > 3)
{
od.unknown008[0] = atoi(sep->arg[4 + col]); // Size specified
od.unknown008 = atoi(sep->arg[4 + col]); // Size specified
if ((sep->argnum - col) > 4)
{
od.unknown008[1] = atoi(sep->arg[5 + col]); // SolidType specified
od.unknown010 = atoi(sep->arg[5 + col]); // SolidType specified
if ((sep->argnum - col) > 5)
{
@@ -9972,15 +9972,15 @@ void command_object(Client *c, const Seperator *sep)
return;
}
od.unknown008[0] = atoi(sep->arg[4]);
od.unknown008 = atoi(sep->arg[4]);
o->SetObjectData(&od);
if (od.unknown008[0] == 0) // 0 == unspecified == 100%
if (od.unknown008 == 0) // 0 == unspecified == 100%
{
od.unknown008[0] = 100;
od.unknown008 = 100;
}
c->Message(0, "Static Object %u set to %u%% size. Size will take effect when you commit to the database with '#object Save', after which the object will be unchangeable until you unlock it again with '#object Edit' and zone out and back in.", id, od.unknown008[0]);
c->Message(0, "Static Object %u set to %u%% size. Size will take effect when you commit to the database with '#object Save', after which the object will be unchangeable until you unlock it again with '#object Edit' and zone out and back in.", id, od.unknown008);
}
else if (strcmp(sep->arg[3], "solidtype") == 0)
{
@@ -9998,10 +9998,10 @@ void command_object(Client *c, const Seperator *sep)
return;
}
od.unknown008[1] = atoi(sep->arg[4]);
od.unknown010 = atoi(sep->arg[4]);
o->SetObjectData(&od);
c->Message(0, "Static Object %u set to SolidType %u. Change will take effect when you commit to the database with '#object Save'. Support for this property is on a per-model basis, mostly seen in smaller objects such as chests and tables.", id, od.unknown008[1]);
c->Message(0, "Static Object %u set to SolidType %u. Change will take effect when you commit to the database with '#object Save'. Support for this property is on a per-model basis, mostly seen in smaller objects such as chests and tables.", id, od.unknown010);
}
else
{
@@ -10352,7 +10352,7 @@ void command_object(Client *c, const Seperator *sep)
zone->GetZoneID(), zone->GetInstanceVersion(),
od.x, od.y, od.z, od.heading,
od.object_name, od.object_type, icon,
od.unknown008[0], od.unknown008[1], od.unknown020);
od.unknown008, od.unknown010, od.unknown020);
}
else
{
@@ -10362,7 +10362,7 @@ void command_object(Client *c, const Seperator *sep)
id, zone->GetZoneID(), zone->GetInstanceVersion(),
od.x, od.y, od.z, od.heading,
od.object_name, od.object_type, icon,
od.unknown008[0], od.unknown008[1], od.unknown020);
od.unknown008, od.unknown010, od.unknown020);
}
}
else
@@ -10377,7 +10377,7 @@ void command_object(Client *c, const Seperator *sep)
zone->GetZoneID(), zone->GetInstanceVersion(),
od.x, od.y, od.z, od.heading,
od.object_name, od.object_type, icon,
od.unknown008[0], od.unknown008[1], od.unknown020,
od.unknown008, od.unknown010, od.unknown020,
id);
}
@@ -10455,12 +10455,12 @@ void command_object(Client *c, const Seperator *sep)
memcpy(door.dest_zone, "NONE", 5);
if ((door.size = od.unknown008[0]) == 0) // unknown08 = optional size percentage
if ((door.size = od.unknown008) == 0) // unknown08 = optional size percentage
{
door.size = 100;
}
switch (door.opentype = od.unknown008[1]) // unknown10 = optional request_nonsolid (0 or 1 or experimental number)
switch (door.opentype = od.unknown010) // unknown10 = optional request_nonsolid (0 or 1 or experimental number)
{
case 0:
door.opentype = 31;
@@ -10747,8 +10747,8 @@ void command_object(Client *c, const Seperator *sep)
strn0cpy(od.object_name, row[col++], sizeof(od.object_name));
od.object_type = atoi(row[col++]);
icon = atoi(row[col++]);
od.unknown008[0] = atoi(row[col++]);
od.unknown008[1] = atoi(row[col++]);
od.unknown008 = atoi(row[col++]);
od.unknown010 = atoi(row[col++]);
od.unknown020 = atoi(row[col++]);
if (od.object_type == 0)
+8 -1
View File
@@ -109,7 +109,8 @@ const char *QuestEventSubroutines[_LargestEventID] = {
"EVENT_AUGMENT_INSERT",
"EVENT_AUGMENT_REMOVE",
"EVENT_ENTER_AREA",
"EVENT_LEAVE_AREA"
"EVENT_LEAVE_AREA",
"EVENT_RESPAWN"
};
PerlembParser::PerlembParser() : perl(nullptr), event_queue_in_use_(false) {
@@ -1381,6 +1382,12 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID
break;
}
case EVENT_RESPAWN: {
ExportVar(package_name.c_str(), "option", data);
ExportVar(package_name.c_str(), "resurrect", extradata);
break;
}
default: {
break;
}
+1
View File
@@ -78,6 +78,7 @@ typedef enum {
EVENT_AUGMENT_REMOVE,
EVENT_ENTER_AREA,
EVENT_LEAVE_AREA,
EVENT_RESPAWN,
_LargestEventID
} QuestEventID;
+3 -1
View File
@@ -110,7 +110,8 @@ const char *LuaEvents[_LargestEventID] = {
"event_augment_insert",
"event_augment_remove",
"event_enter_area",
"event_leave_area"
"event_leave_area",
"event_respawn"
};
extern Zone *zone;
@@ -184,6 +185,7 @@ LuaParser::LuaParser() {
PlayerArgumentDispatch[EVENT_FEIGN_DEATH] = handle_player_feign;
PlayerArgumentDispatch[EVENT_ENTER_AREA] = handle_player_area;
PlayerArgumentDispatch[EVENT_LEAVE_AREA] = handle_player_area;
PlayerArgumentDispatch[EVENT_RESPAWN] = handle_player_respawn;
ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click;
ItemArgumentDispatch[EVENT_ITEM_CLICK_CAST] = handle_item_click;
+12
View File
@@ -1,3 +1,4 @@
#ifdef LUA_EQEMU
#include <sstream>
#include "lua.hpp"
@@ -462,6 +463,15 @@ void handle_player_area(QuestInterface *parse, lua_State* L, Client* client, std
lua_setfield(L, -2, "area_type");
}
void handle_player_respawn(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<void*> *extra_pointers) {
lua_pushinteger(L, std::stoi(data));
lua_setfield(L, -2, "option");
lua_pushboolean(L, extra_data == 1 ? true : false);
lua_setfield(L, -2, "resurrect");
}
void handle_player_null(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<void*> *extra_pointers) {
}
@@ -665,3 +675,5 @@ void handle_translocate_finish(QuestInterface *parse, lua_State* L, NPC* npc, Cl
void handle_spell_null(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
std::vector<void*> *extra_pointers) {
}
#endif
+2
View File
@@ -86,6 +86,8 @@ void handle_player_feign(QuestInterface *parse, lua_State* L, Client* client, st
std::vector<void*> *extra_pointers);
void handle_player_area(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<void*> *extra_pointers);
void handle_player_respawn(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<void*> *extra_pointers);
void handle_player_null(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<void*> *extra_pointers);
+1 -1
View File
@@ -5730,7 +5730,7 @@ bool Merc::AddMercToGroup(Merc* merc, Group* group) {
void Client::InitializeMercInfo() {
for(int i=0; i<MAXMERCS; i++) {
m_mercinfo[i].mercid = 0;
m_mercinfo[i] = MercInfo();
}
}
+3 -1
View File
@@ -226,7 +226,8 @@ Mob::Mob(const char* in_name,
PermaProcs[j].chance = 0;
PermaProcs[j].base_spellID = SPELL_UNKNOWN;
SpellProcs[j].spellID = SPELL_UNKNOWN;
SpellProcs[j].chance = 0;
SpellProcs[j].base_spellID = SPELL_UNKNOWN;
DefensiveProcs[j].spellID = SPELL_UNKNOWN;
DefensiveProcs[j].chance = 0;
DefensiveProcs[j].base_spellID = SPELL_UNKNOWN;
@@ -271,6 +272,7 @@ Mob::Mob(const char* in_name,
casting_spell_timer = 0;
casting_spell_timer_duration = 0;
casting_spell_type = 0;
casting_spell_inventory_slot = 0;
target = 0;
memset(&itembonuses, 0, sizeof(StatBonuses));
+10 -9
View File
@@ -73,7 +73,7 @@
#undef new
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif
#ifdef _WINDOWS
#include <conio.h>
#include <process.h>
@@ -143,7 +143,7 @@ int main(int argc, char** argv) {
_log(ZONE__INIT, "Loading server configuration..");
if (!ZoneConfig::LoadConfig()) {
_log(ZONE__INIT_ERR, "Loading server configuration failed.");
return(1);
return 1;
}
const ZoneConfig *Config=ZoneConfig::get();
@@ -162,7 +162,7 @@ int main(int argc, char** argv) {
Config->DatabaseDB.c_str(),
Config->DatabasePort)) {
_log(ZONE__INIT_ERR, "Cannot continue without a database connection.");
return(1);
return 1;
}
dbasync = new DBAsync(&database);
dbasync->AddFQ(&MTdbafq);
@@ -181,16 +181,16 @@ int main(int argc, char** argv) {
*/
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
_log(ZONE__INIT_ERR, "Could not set signal handler");
return 0;
return 1;
}
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
_log(ZONE__INIT_ERR, "Could not set signal handler");
return 0;
return 1;
}
#ifndef WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
_log(ZONE__INIT_ERR, "Could not set signal handler");
return 0;
return 1;
}
#endif
@@ -216,19 +216,19 @@ int main(int argc, char** argv) {
if (!database.LoadNPCFactionLists()) {
_log(ZONE__INIT_ERR, "Loading npcs faction lists FAILED!");
CheckEQEMuErrorAndPause();
return 0;
return 1;
}
_log(ZONE__INIT, "Loading loot tables");
if (!database.LoadLoot()) {
_log(ZONE__INIT_ERR, "Loading loot FAILED!");
CheckEQEMuErrorAndPause();
return 0;
return 1;
}
_log(ZONE__INIT, "Loading skill caps");
if (!database.LoadSkillCaps()) {
_log(ZONE__INIT_ERR, "Loading skill caps FAILED!");
CheckEQEMuErrorAndPause();
return 0;
return 1;
}
_log(ZONE__INIT, "Loading spells");
@@ -479,6 +479,7 @@ int main(int argc, char** argv) {
#endif
safe_delete(mmf);
safe_delete(Config);
if (zone != 0)
Zone::Shutdown(true);
+23 -18
View File
@@ -248,25 +248,25 @@ bool Zone::LoadZoneObjects() {
uint32 idx = 0;
int16 charges = 0;
id = (uint32)atoi(row[idx++]);
data.zone_id = atoi(row[idx++]);
data.x = atof(row[idx++]);
data.y = atof(row[idx++]);
data.z = atof(row[idx++]);
data.heading = atof(row[idx++]);
itemid = (uint32)atoi(row[idx++]);
charges = (int16)atoi(row[idx++]);
strcpy(data.object_name, row[idx++]);
type = (uint8)atoi(row[idx++]);
icon = (uint32)atoi(row[idx++]);
data.object_type = (uint32)atoi(row[idx++]);
id = (uint32)atoi(row[0]);
data.zone_id = atoi(row[1]);
data.x = atof(row[2]);
data.y = atof(row[3]);
data.z = atof(row[4]);
data.heading = atof(row[5]);
itemid = (uint32)atoi(row[6]);
charges = (int16)atoi(row[7]);
strcpy(data.object_name, row[8]);
type = (uint8)atoi(row[9]);
icon = (uint32)atoi(row[10]);
data.object_type = type;
data.linked_list_addr[0] = 0;
data.linked_list_addr[1] = 0;
data.unknown008[0] = (uint32)atoi(row[idx++]);
data.unknown008[1] = (uint32)atoi(row[idx++]);
data.unknown020 = (uint32)atoi(row[idx++]);
data.unknown024 = (uint32)atoi(row[idx++]);
data.unknown076 = (uint32)atoi(row[idx++]);
data.unknown008 = (uint32)atoi(row[11]);
data.unknown010 = (uint32)atoi(row[12]);
data.unknown020 = (uint32)atoi(row[13]);
data.unknown024 = (uint32)atoi(row[14]);
data.unknown076 = (uint32)atoi(row[15]);
data.unknown084 = 0;
ItemInst* inst = nullptr;
@@ -664,7 +664,7 @@ void Zone::LoadLevelEXPMods(){
mysql_free_result(DatasetResult);
}
safe_delete(Query);
safe_delete_array(Query);
Query = 0;
if(!errorMessage.empty()) {
@@ -866,6 +866,11 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
qGlobals = nullptr;
default_ruleset = 0;
loglevelvar = 0;
merchantvar = 0;
tradevar = 0;
lootvar = 0;
if(RuleB(TaskSystem, EnableTaskSystem)) {
taskmanager->LoadProximities(zoneid);
}