|
|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
| Support::Windows Servers Support forum for Windows EQEMu users. |
 |
|
 |

10-01-2015, 08:55 PM
|
|
Discordant
|
|
Join Date: Dec 2013
Posts: 297
|
|
A bit of progress, not much though.
No entry being created like it does when zoning and using <SetPet(0);>
\zonedb.cpp - last 1/2 commented out, unsure what to do to make it create a new blank entry
When the part /* */ is uncommented it only removes `spell_id` in the DB - pet_struct maybe?
Code:
void ZoneDatabase::DeletePetInfo(Client *client)
{
std::string query = StringFormat("DELETE FROM `character_pet_info` WHERE `char_id` = %u AND `pet` = 0", client->CharacterID());
auto results = database.QueryDatabase(query);
if (!results.Success())
return;
query = StringFormat("DELETE FROM `character_pet_buffs` WHERE `char_id` = %u AND `pet` = 0", client->CharacterID());
results = database.QueryDatabase(query);
if (!results.Success())
return;
query = StringFormat("DELETE FROM `character_pet_inventory` WHERE `char_id` = %u AND `pet` = 0", client->CharacterID());
results = database.QueryDatabase(query);
if (!results.Success())
return;
// PetInfo *petinfo = nullptr;
/*
for (int pet = 0; pet < 2; pet++) {
PetInfo *petinfo = client->GetPetInfo(pet);
if (!petinfo)
continue;
query = StringFormat("INSERT INTO `character_pet_info` "
"(`char_id`, `pet`, `petname`, `petpower`, `spell_id`, `hp`, `mana`, `size`) "
"VALUES (%u, %u, '%s', %i, %u, %u, %u, %f) "
"ON DUPLICATE KEY UPDATE `petname` = '%s', `petpower` = %i, `spell_id` = %u, "
"`hp` = %u, `mana` = %u, `size` = %f",
client->CharacterID(), pet, petinfo->Name, petinfo->petpower, petinfo->SpellID,
petinfo->HP, petinfo->Mana, petinfo->size, // and now the ON DUPLICATE ENTRIES
petinfo->Name, petinfo->petpower, petinfo->SpellID, petinfo->HP, petinfo->Mana, petinfo->size);
results = database.QueryDatabase(query);
if (!results.Success())
return;
query.clear();
} */
}
\client_process.cpp
Code:
bool deletenorent = database.NoRentExpired(GetName());
if (deletenorent) { //client was offline for more than 30 minutes, delete no rent items
if (RuleB(Inventory, TransformSummonedBags))
DisenchantSummonedBags(false);
RemoveNoRent(false);
// added 9/30/15 no rent check (this may need fixing when introducing suspended minion - if this was an issue the queries below should fix it)
if (!RuleB(Pets, PetLogPersistence))
{
SetPet(0);
database.DeletePetInfo(this);
}
}
Thanks
|
 |
|
 |

10-02-2015, 12:42 AM
|
|
Discordant
|
|
Join Date: Dec 2013
Posts: 297
|
|
Added to \client_process.cpp - it's a little smoother, adds the blank row and saves it. The client still shows the pet window momentarily. I would prefer to put <memset(&m_petinfo, 0, sizeof(struct PetInfo));> in the DeletePetInfo part and then run w/e queries are needed to fill in the blanks allowing the removal of <database.SavePetInfo(this);> below.
I would prefer this whole process done a little earlier. Just a guess but, somewhere near <case ServerOP_SyncWorldTime:> (\zone\worldserver.cpp(744).
This also leaves out what Uleat said before about memory loss? which I have no clue about.
\client_process.cpp(841)
Code:
// added 9/30/15 no rent check (this may need fixing when introducing suspended minion - if this was an issue the queries below should fix it)
if (!RuleB(Pets, PetLogPersistence))
{
SetPet(0);
database.DeletePetInfo(this);
memset(&m_petinfo, 0, sizeof(struct PetInfo));
database.SavePetInfo(this);
}
}
|

10-02-2015, 03:06 AM
|
|
Discordant
|
|
Join Date: Dec 2013
Posts: 297
|
|
Last one for a bit:
The two lines below SetPet, <Mob* mypet =......etc.>, gives the same resulting appearance as <SetPet(0);>. (takes a moment to depop) I am unsure if one is better than the other.
\client_process.cpp(841)
Code:
if (!RuleB(Pets, PetLogPersistence))
{
SetPet(0);
// or
Mob* mypet = this->GetPet();
mypet->CastToNPC()->Depop();
database.DeletePetInfo(this);
memset(&m_petinfo, 0, sizeof(struct PetInfo));
database.SavePetInfo(this);
}
}
|
 |
|
 |

10-03-2015, 10:26 AM
|
|
Discordant
|
|
Join Date: Dec 2013
Posts: 297
|
|
A little more progress on the pet thing.
The entire delete/save process (creating a new blank entry in table `character_pet_info`) for the DB in one spot. This eliminates running a couple unneeded queries from using the <SavePetInfo> function.
The pet window still appears on client. I don't know if this is avoidable by doing the norent check somewhere earlier in the process. It's not a big deal unless there is a cleaner/more efficient way to do this.
\client_process.cpp
Code:
bool deletenorent = database.NoRentExpired(GetName());
if (deletenorent) { //client was offline for more than 30 minutes, delete no rent items
if (RuleB(Inventory, TransformSummonedBags))
DisenchantSummonedBags(false);
RemoveNoRent(false);
// added 9/30/15 no rent check (updated 10/3/15)
if (!RuleB(Pets, PetLogPersistence))
{
SetPet(0);
database.DeletePetInfo(this);
}
}
\zonedb.cpp
Code:
void ZoneDatabase::DeletePetInfo(Client *client)
{
std::string query = StringFormat("DELETE FROM `character_pet_info` WHERE `char_id` = %u AND `pet` = 0", client->CharacterID());
auto results = database.QueryDatabase(query);
if (!results.Success())
return;
query = StringFormat("DELETE FROM `character_pet_buffs` WHERE `char_id` = %u AND `pet` = 0", client->CharacterID());
results = database.QueryDatabase(query);
if (!results.Success())
return;
query = StringFormat("DELETE FROM `character_pet_inventory` WHERE `char_id` = %u AND `pet` = 0", client->CharacterID());
results = database.QueryDatabase(query);
if (!results.Success())
return;
PetInfo *petinfo = client->GetPetInfo(0);
memset(petinfo, 0, sizeof(struct PetInfo));
int pet = 0;
query = StringFormat("INSERT INTO `character_pet_info` "
"(`char_id`, `pet`, `petname`, `petpower`, `spell_id`, `hp`, `mana`, `size`) "
"VALUES (%u, %u, '%s', %i, %u, %u, %u, %f) "
"ON DUPLICATE KEY UPDATE `petname` = '%s', `petpower` = %i, `spell_id` = %u, "
"`hp` = %u, `mana` = %u, `size` = %f",
client->CharacterID(), pet, petinfo->Name, petinfo->petpower, petinfo->SpellID,
petinfo->HP, petinfo->Mana, petinfo->size, // and now the ON DUPLICATE ENTRIES
petinfo->Name, petinfo->petpower, petinfo->SpellID, petinfo->HP, petinfo->Mana, petinfo->size);
results = database.QueryDatabase(query);
if (!results.Success())
return;
query.clear();
}
As an aside: While going through this process I noticed some queries are ran anywhere between 2-6 times from this maybe? <database.QueryDatabase(query);>
I understand my tinkering may have caused some of this but, I'm curious to know the purpose of this.
Thanks
EDIT:
Not sure if I mentioned this before. I had to add the line below when I created the item in \zonedb.cpp. Can't take it for granted.
\zonedb.h
Code:
void DeletePetInfo(Client *c);
|
 |
|
 |

10-09-2015, 03:30 PM
|
|
Discordant
|
|
Join Date: Dec 2013
Posts: 297
|
|
Good day.
I created a rule to force training of certain melee skills. The intention is to only force training if the skill is acquired after level 1.
For Riposte below,
\zone\attack.cpp(412)
Code:
if (IsClient()) {
if (!RuleB(Skills, TrainMeleeSkills)) {
CastToClient()->CheckIncreaseSkill(SkillRiposte, other, -10);
}
else if (RuleB(Skills, TrainMeleeSkills) && CastToClient()->HasSkill(SkillRiposte)) {
(CastToClient()->CheckIncreaseSkill(SkillRiposte, other, -10));
}
}
I'm concerned about what will happen when the rule is true and the character does not have <SkillRiposte>. Do I need some kind of escape from this if it goes beyond <else if>? There is quite a bit more code after what is quoted above.
This question applies to several similar issues I had concern about.
Thanks
|
| Thread Tools |
|
|
| Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 06:54 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |