mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 09:06:46 +00:00
Compare commits
69 Commits
v22.4.3
...
item-updates
| Author | SHA1 | Date | |
|---|---|---|---|
| d6bdaa5c6e | |||
| 593127fb7e | |||
| 67df6f62b7 | |||
| 4572dbc426 | |||
| e8cc160572 | |||
| 8c9adca852 | |||
| b53310e23b | |||
| 14f01dc2d7 | |||
| a4d6509e6d | |||
| fc835bfb0e | |||
| 9ec4e5ade0 | |||
| 6b65e93a06 | |||
| a0a28fef04 | |||
| 034feb4ff4 | |||
| 65c14b160e | |||
| c21d47f450 | |||
| 83ea9816b8 | |||
| e3f9b396ab | |||
| 2a6cf8c8e7 | |||
| be567af70d | |||
| 6494fbf916 | |||
| 2cc61ef8c1 | |||
| 5d7a7bb4b2 | |||
| 00f82f43a6 | |||
| d3ca636a70 | |||
| 01855d40df | |||
| 748602b04e | |||
| a97a9a0d1c | |||
| a78c754c0e | |||
| ef214f91e9 | |||
| 04a74df0b2 | |||
| c15bfe12eb | |||
| 5702f7bcd1 | |||
| 9a5bf53e11 | |||
| 69c6a7b89a | |||
| 2f0dbc5d15 | |||
| 93c79817cd | |||
| 3296287d70 | |||
| 774a7fa779 | |||
| 1ff4541a9f | |||
| 3448758c03 | |||
| ff4ccfa98f | |||
| d2c3c14ae0 | |||
| a470931fdd | |||
| 078db3460d | |||
| 0980a780d0 | |||
| 7f01bb509c | |||
| 4bb189cbf4 | |||
| b03e8ff0fb | |||
| 6179b7481e | |||
| 5f68e4a41a | |||
| e103422ca5 | |||
| 0cbfad975d | |||
| 2a20c69c69 | |||
| de2dfc1a7e | |||
| bad631df59 | |||
| e8f1aa253a | |||
| 889e57a5af | |||
| 5cfdeb928e | |||
| 7519b0225e | |||
| 04fdc54522 | |||
| f39155952f | |||
| 5acc181d64 | |||
| 2ae0b7dd3e | |||
| b0d4f095ef | |||
| 7c7a88650b | |||
| afaa8f4100 | |||
| 0d72295cc9 | |||
| 9d4f231619 |
@@ -1,3 +1,92 @@
|
|||||||
|
## [22.4.5] - 03/03/2023
|
||||||
|
|
||||||
|
### Bots
|
||||||
|
|
||||||
|
* Add additional Heroic Sta/Wis/Int bonuses for Bots. ([#3013](https://github.com/EQEmu/Server/pull/3013)) @Aeadoin 2023-03-01
|
||||||
|
* Cleanup AI_IdleCastCheck Logic ([#3004](https://github.com/EQEmu/Server/pull/3004)) @Aeadoin 2023-02-26
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
* Delete unused zone/skills.h ([#3007](https://github.com/EQEmu/Server/pull/3007)) @Kinglykrab 2023-02-27
|
||||||
|
* Remove DumpPacketProfile() from client.h ([#3000](https://github.com/EQEmu/Server/pull/3000)) @Kinglykrab 2023-02-26
|
||||||
|
* Remove GetCombinedAC_TEST() from client.h ([#2999](https://github.com/EQEmu/Server/pull/2999)) @Kinglykrab 2023-02-26
|
||||||
|
* Remove GetDamageMultiplier() from client.h ([#3001](https://github.com/EQEmu/Server/pull/3001)) @Kinglykrab 2023-02-26
|
||||||
|
* Remove NumberOfAvailableTitles() from titles.h ([#3006](https://github.com/EQEmu/Server/pull/3006)) @Kinglykrab 2023-02-27
|
||||||
|
* Remove ReturnItemPacket from client.h/inventory.cpp ([#3002](https://github.com/EQEmu/Server/pull/3002)) @Kinglykrab 2023-02-26
|
||||||
|
* Remove class EGNode from mob.h ([#3003](https://github.com/EQEmu/Server/pull/3003)) @Kinglykrab 2023-02-26
|
||||||
|
* Remove unused ClientFactory in client.h ([#2998](https://github.com/EQEmu/Server/pull/2998)) @Kinglykrab 2023-02-26
|
||||||
|
* Remove unused iterator from LoadCharacterDisciplines ([#3012](https://github.com/EQEmu/Server/pull/3012)) @Aeadoin 2023-03-02
|
||||||
|
|
||||||
|
### Crash
|
||||||
|
|
||||||
|
* Fix crash in CheckTradeskillLoreConflict ([#3009](https://github.com/EQEmu/Server/pull/3009)) @Aeadoin 2023-02-28
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Account for bad data in Tradeskill Recipe Entries ([#2991](https://github.com/EQEmu/Server/pull/2991)) @Aeadoin 2023-02-25
|
||||||
|
* Fix DoAnim quest method default speed ([#3016](https://github.com/EQEmu/Server/pull/3016)) @Kinglykrab 2023-03-01
|
||||||
|
* Fix an issue where EVENT_TIMER timers would not be cleaned up after zone ([#3018](https://github.com/EQEmu/Server/pull/3018)) @noudess 2023-03-03
|
||||||
|
* Fix for Discipline Loading from Database causing issues with slot_ids ([#3008](https://github.com/EQEmu/Server/pull/3008)) @Aeadoin 2023-02-28
|
||||||
|
* Fix for Lore Components where component is returned. ([#3005](https://github.com/EQEmu/Server/pull/3005)) @Aeadoin 2023-02-27
|
||||||
|
* Fix issue where quest saylink responses would occur before the NPC's response ([#3010](https://github.com/EQEmu/Server/pull/3010)) @Akkadius 2023-03-01
|
||||||
|
* Fix log messages when players join channel ([#2992](https://github.com/EQEmu/Server/pull/2992)) @Valorith 2023-03-03
|
||||||
|
* Fix npcfeature and playerfeature ([#3017](https://github.com/EQEmu/Server/pull/3017)) @Kinglykrab 2023-03-02
|
||||||
|
|
||||||
|
### Quest API
|
||||||
|
|
||||||
|
* Add GetDefaultRaceSize() to Perl/Lua ([#2993](https://github.com/EQEmu/Server/pull/2993)) @Kinglykrab 2023-02-27
|
||||||
|
* Add HasSpecialAbilities() to Perl/Lua ([#2994](https://github.com/EQEmu/Server/pull/2994)) @Kinglykrab 2023-02-27
|
||||||
|
* Add IsBerserk() to Perl/Lua ([#2997](https://github.com/EQEmu/Server/pull/2997)) @Kinglykrab 2023-03-01
|
||||||
|
* Add IsFindable() and IsTrackable() to Perl/Lua ([#2996](https://github.com/EQEmu/Server/pull/2996)) @Kinglykrab 2023-03-01
|
||||||
|
* Add IsUnderwaterOnly() to Perl/Lua ([#2995](https://github.com/EQEmu/Server/pull/2995)) @Kinglykrab 2023-03-01
|
||||||
|
|
||||||
|
## [22.4.4] - 02/24/2023
|
||||||
|
|
||||||
|
### Bots
|
||||||
|
|
||||||
|
* Add Caster Range Command, and IsValidSpellRange Checks ([#2942](https://github.com/EQEmu/Server/pull/2942)) ([Aeadoin](https://github.com/Aeadoin)) 2023-02-23
|
||||||
|
* Cleanup BotDatabase::LoadBuffs ([#2981](https://github.com/EQEmu/Server/pull/2981)) ([Aeadoin](https://github.com/Aeadoin)) 2023-02-24
|
||||||
|
* Verify Bots Group Integrity on join ([#2980](https://github.com/EQEmu/Server/pull/2980)) ([Aeadoin](https://github.com/Aeadoin)) 2023-02-23
|
||||||
|
|
||||||
|
### Commands
|
||||||
|
|
||||||
|
* Cleanup #peekinv Command ([#2969](https://github.com/EQEmu/Server/pull/2969)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-02-23
|
||||||
|
|
||||||
|
### Doors
|
||||||
|
|
||||||
|
* Fix doors triggering invalid zone fetches of dest_zone of "none" ([#2985](https://github.com/EQEmu/Server/pull/2985)) ([Akkadius](https://github.com/Akkadius)) 2023-02-24
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Adjust database manifest to include .sql extension ([Akkadius](https://github.com/Akkadius)) 2023-02-25
|
||||||
|
* Correct Mend reuse time and add reduction support. ([#2972](https://github.com/EQEmu/Server/pull/2972)) ([nytmyr](https://github.com/nytmyr)) 2023-02-23
|
||||||
|
* Fix Beneficial Target of Target procs ([#2987](https://github.com/EQEmu/Server/pull/2987)) ([Aeadoin](https://github.com/Aeadoin)) 2023-02-24
|
||||||
|
* Fix for undefined MySQL library behavior. ([#2834](https://github.com/EQEmu/Server/pull/2834)) ([KimLS](https://github.com/KimLS)) 2023-02-25
|
||||||
|
|
||||||
|
### Pathing
|
||||||
|
|
||||||
|
* Improve roambox logic ([#2983](https://github.com/EQEmu/Server/pull/2983)) ([Akkadius](https://github.com/Akkadius)) 2023-02-24
|
||||||
|
* More z-clip improvements, Wurm and Spectral Iksar race adjustments ([#2988](https://github.com/EQEmu/Server/pull/2988)) ([Akkadius](https://github.com/Akkadius)) 2023-02-25
|
||||||
|
* Smoother pathing z-correction ([#2982](https://github.com/EQEmu/Server/pull/2982)) ([Akkadius](https://github.com/Akkadius)) 2023-02-24
|
||||||
|
|
||||||
|
### Player Events
|
||||||
|
|
||||||
|
* Add QS processing, mutex tweaks ([#2984](https://github.com/EQEmu/Server/pull/2984)) ([Akkadius](https://github.com/Akkadius)) 2023-02-25
|
||||||
|
|
||||||
|
### Quest API
|
||||||
|
|
||||||
|
* Add IsAutoAttackEnabled() to Perl/Lua ([#2979](https://github.com/EQEmu/Server/pull/2979)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-02-23
|
||||||
|
* Add IsAutoFireEnabled() to Perl/Lua ([#2978](https://github.com/EQEmu/Server/pull/2978)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-02-23
|
||||||
|
* Fix EVENT_TIMER crash when entity is no longer available ([#2986](https://github.com/EQEmu/Server/pull/2986)) ([Akkadius](https://github.com/Akkadius)) 2023-02-24
|
||||||
|
|
||||||
|
### Scaling
|
||||||
|
|
||||||
|
* Add support for zone ID and instance version to NPC Scaling ([#2968](https://github.com/EQEmu/Server/pull/2968)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-02-25
|
||||||
|
|
||||||
|
### Tradeskills
|
||||||
|
|
||||||
|
* Fix for Lore Conflict ([#2977](https://github.com/EQEmu/Server/pull/2977)) ([Aeadoin](https://github.com/Aeadoin)) 2023-02-24
|
||||||
|
|
||||||
## [22.4.3] - 02/21/2023
|
## [22.4.3] - 02/21/2023
|
||||||
|
|
||||||
### Bots
|
### Bots
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
content_db.SetMysql(database.getMySQL());
|
content_db.SetMySQL(database);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
LogSys.SetDatabase(&database)
|
||||||
@@ -183,7 +183,7 @@ bool SkillUsable(SharedDatabase *db, int skill_id, int class_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
if (row[0] && atoi(row[0]) > 0) {
|
if (row[0] && Strings::ToInt(row[0]) > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
return atoi(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportSkillCaps(SharedDatabase *db)
|
void ExportSkillCaps(SharedDatabase *db)
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ int main(int argc, char **argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
content_db.SetMysql(database.getMySQL());
|
content_db.SetMySQL(database);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
LogSys.SetDatabase(&database)
|
||||||
@@ -241,10 +241,10 @@ void ImportSkillCaps(SharedDatabase *db) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int class_id, skill_id, level, cap;
|
int class_id, skill_id, level, cap;
|
||||||
class_id = atoi(split[0].c_str());
|
class_id = Strings::ToInt(split[0].c_str());
|
||||||
skill_id = atoi(split[1].c_str());
|
skill_id = Strings::ToInt(split[1].c_str());
|
||||||
level = atoi(split[2].c_str());
|
level = Strings::ToInt(split[2].c_str());
|
||||||
cap = atoi(split[3].c_str());
|
cap = Strings::ToInt(split[3].c_str());
|
||||||
|
|
||||||
std::string sql = StringFormat("INSERT INTO skill_caps(class, skillID, level, cap) VALUES(%d, %d, %d, %d)",
|
std::string sql = StringFormat("INSERT INTO skill_caps(class, skillID, level, cap) VALUES(%d, %d, %d, %d)",
|
||||||
class_id, skill_id, level, cap);
|
class_id, skill_id, level, cap);
|
||||||
@@ -280,16 +280,16 @@ void ImportBaseData(SharedDatabase *db) {
|
|||||||
int level, class_id;
|
int level, class_id;
|
||||||
double hp, mana, end, unk1, unk2, hp_fac, mana_fac, end_fac;
|
double hp, mana, end, unk1, unk2, hp_fac, mana_fac, end_fac;
|
||||||
|
|
||||||
level = atoi(split[0].c_str());
|
level = Strings::ToInt(split[0].c_str());
|
||||||
class_id = atoi(split[1].c_str());
|
class_id = Strings::ToInt(split[1].c_str());
|
||||||
hp = atof(split[2].c_str());
|
hp = Strings::ToFloat(split[2].c_str());
|
||||||
mana = atof(split[3].c_str());
|
mana = Strings::ToFloat(split[3].c_str());
|
||||||
end = atof(split[4].c_str());
|
end = Strings::ToFloat(split[4].c_str());
|
||||||
unk1 = atof(split[5].c_str());
|
unk1 = Strings::ToFloat(split[5].c_str());
|
||||||
unk2 = atof(split[6].c_str());
|
unk2 = Strings::ToFloat(split[6].c_str());
|
||||||
hp_fac = atof(split[7].c_str());
|
hp_fac = Strings::ToFloat(split[7].c_str());
|
||||||
mana_fac = atof(split[8].c_str());
|
mana_fac = Strings::ToFloat(split[8].c_str());
|
||||||
end_fac = atof(split[9].c_str());
|
end_fac = Strings::ToFloat(split[9].c_str());
|
||||||
|
|
||||||
sql = StringFormat("INSERT INTO base_data(level, class, hp, mana, end, unk1, unk2, hp_fac, "
|
sql = StringFormat("INSERT INTO base_data(level, class, hp, mana, end, unk1, unk2, hp_fac, "
|
||||||
"mana_fac, end_fac) VALUES(%d, %d, %f, %f, %f, %f, %f, %f, %f, %f)",
|
"mana_fac, end_fac) VALUES(%d, %d, %f, %f, %f, %f, %f, %f, %f, %f)",
|
||||||
@@ -339,8 +339,8 @@ void ImportDBStrings(SharedDatabase *db) {
|
|||||||
int id, type;
|
int id, type;
|
||||||
std::string value;
|
std::string value;
|
||||||
|
|
||||||
id = atoi(split[0].c_str());
|
id = Strings::ToInt(split[0].c_str());
|
||||||
type = atoi(split[1].c_str());
|
type = Strings::ToInt(split[1].c_str());
|
||||||
|
|
||||||
if(split.size() >= 3) {
|
if(split.size() >= 3) {
|
||||||
value = ::Strings::Escape(split[2]);
|
value = ::Strings::Escape(split[2]);
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ namespace cron
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return static_cast<cron_int>(std::stoul(text.data()));
|
return static_cast<cron_int>(Strings::ToUnsignedInt(text.data()));
|
||||||
}
|
}
|
||||||
catch (std::exception const & ex)
|
catch (std::exception const & ex)
|
||||||
{
|
{
|
||||||
|
|||||||
+64
-64
@@ -121,10 +121,10 @@ uint32 Database::CheckLogin(const char* name, const char* password, const char *
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
auto id = std::stoul(row[0]);
|
auto id = Strings::ToUnsignedInt(row[0]);
|
||||||
|
|
||||||
if (oStatus) {
|
if (oStatus) {
|
||||||
*oStatus = std::stoi(row[1]);
|
*oStatus = Strings::ToInt(row[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
@@ -202,11 +202,11 @@ int16 Database::CheckStatus(uint32 account_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
int16 status = std::stoi(row[0]);
|
int16 status = Strings::ToInt(row[0]);
|
||||||
int32 date_diff = 0;
|
int32 date_diff = 0;
|
||||||
|
|
||||||
if (row[1]) {
|
if (row[1]) {
|
||||||
date_diff = std::stoi(row[1]);
|
date_diff = Strings::ToInt(row[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (date_diff > 0) {
|
if (date_diff > 0) {
|
||||||
@@ -345,7 +345,7 @@ bool Database::ReserveName(uint32 account_id, char* name) {
|
|||||||
std::string query = StringFormat("SELECT `account_id`, `name` FROM `character_data` WHERE `name` = '%s'", name);
|
std::string query = StringFormat("SELECT `account_id`, `name` FROM `character_data` WHERE `name` = '%s'", name);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
if (row[0] && atoi(row[0]) > 0){
|
if (row[0] && Strings::ToInt(row[0]) > 0){
|
||||||
LogInfo("Account: [{}] tried to request name: [{}], but it is already taken", account_id, name);
|
LogInfo("Account: [{}] tried to request name: [{}], but it is already taken", account_id, name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -387,7 +387,7 @@ bool Database::DeleteCharacter(char *character_name)
|
|||||||
std::string query = StringFormat("SELECT `id` from `character_data` WHERE `name` = '%s'", character_name);
|
std::string query = StringFormat("SELECT `id` from `character_data` WHERE `name` = '%s'", character_name);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
character_id = atoi(row[0]);
|
character_id = Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (character_id <= 0) {
|
if (character_id <= 0) {
|
||||||
@@ -787,7 +787,7 @@ uint32 Database::GetCharacterID(const char *name) {
|
|||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
if (results.RowCount() == 1)
|
if (results.RowCount() == 1)
|
||||||
{
|
{
|
||||||
return atoi(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -812,10 +812,10 @@ uint32 Database::GetAccountIDByChar(const char* charname, uint32* oCharID) {
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
uint32 accountId = atoi(row[0]);
|
uint32 accountId = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
if (oCharID)
|
if (oCharID)
|
||||||
*oCharID = atoi(row[1]);
|
*oCharID = Strings::ToInt(row[1]);
|
||||||
|
|
||||||
return accountId;
|
return accountId;
|
||||||
}
|
}
|
||||||
@@ -832,7 +832,7 @@ uint32 Database::GetAccountIDByChar(uint32 char_id) {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
return atoi(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Database::GetAccountIDByName(std::string account_name, std::string loginserver, int16* status, uint32* lsid) {
|
uint32 Database::GetAccountIDByName(std::string account_name, std::string loginserver, int16* status, uint32* lsid) {
|
||||||
@@ -852,14 +852,14 @@ uint32 Database::GetAccountIDByName(std::string account_name, std::string logins
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
auto account_id = std::stoul(row[0]);
|
auto account_id = Strings::ToUnsignedInt(row[0]);
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
*status = static_cast<int16>(std::stoi(row[1]));
|
*status = static_cast<int16>(Strings::ToInt(row[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lsid) {
|
if (lsid) {
|
||||||
*lsid = row[2] ? std::stoul(row[2]) : 0;
|
*lsid = row[2] ? Strings::ToUnsignedInt(row[2]) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return account_id;
|
return account_id;
|
||||||
@@ -880,7 +880,7 @@ void Database::GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID
|
|||||||
|
|
||||||
strcpy(name, row[0]);
|
strcpy(name, row[0]);
|
||||||
if (row[1] && oLSAccountID) {
|
if (row[1] && oLSAccountID) {
|
||||||
*oLSAccountID = atoi(row[1]);
|
*oLSAccountID = Strings::ToInt(row[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -968,7 +968,7 @@ bool Database::LoadVariables() {
|
|||||||
|
|
||||||
std::string key, value;
|
std::string key, value;
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
varcache.last_update = atoi(row[2]); // ahh should we be comparing if this is newer?
|
varcache.last_update = Strings::ToInt(row[2]); // ahh should we be comparing if this is newer?
|
||||||
key = row[0];
|
key = row[0];
|
||||||
value = row[1];
|
value = row[1];
|
||||||
std::transform(std::begin(key), std::end(key), std::begin(key), ::tolower); // keys are lower case, DB doesn't have to be
|
std::transform(std::begin(key), std::end(key), std::begin(key), ::tolower); // keys are lower case, DB doesn't have to be
|
||||||
@@ -1052,15 +1052,15 @@ bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zon
|
|||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
if(graveyard_zoneid != nullptr)
|
if(graveyard_zoneid != nullptr)
|
||||||
*graveyard_zoneid = atoi(row[0]);
|
*graveyard_zoneid = Strings::ToInt(row[0]);
|
||||||
if(graveyard_x != nullptr)
|
if(graveyard_x != nullptr)
|
||||||
*graveyard_x = atof(row[1]);
|
*graveyard_x = Strings::ToFloat(row[1]);
|
||||||
if(graveyard_y != nullptr)
|
if(graveyard_y != nullptr)
|
||||||
*graveyard_y = atof(row[2]);
|
*graveyard_y = Strings::ToFloat(row[2]);
|
||||||
if(graveyard_z != nullptr)
|
if(graveyard_z != nullptr)
|
||||||
*graveyard_z = atof(row[3]);
|
*graveyard_z = Strings::ToFloat(row[3]);
|
||||||
if(graveyard_heading != nullptr)
|
if(graveyard_heading != nullptr)
|
||||||
*graveyard_heading = atof(row[4]);
|
*graveyard_heading = Strings::ToFloat(row[4]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1168,13 +1168,13 @@ uint32 Database::GetAccountIDFromLSID(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
account_id = std::stoi(row[0]);
|
account_id = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
if (in_account_name) {
|
if (in_account_name) {
|
||||||
strcpy(in_account_name, row[1]);
|
strcpy(in_account_name, row[1]);
|
||||||
}
|
}
|
||||||
if (in_status) {
|
if (in_status) {
|
||||||
*in_status = std::stoi(row[2]);
|
*in_status = Strings::ToInt(row[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1198,7 +1198,7 @@ void Database::GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus) {
|
|||||||
if (oAccountName)
|
if (oAccountName)
|
||||||
strcpy(oAccountName, row[0]);
|
strcpy(oAccountName, row[0]);
|
||||||
if (oStatus)
|
if (oStatus)
|
||||||
*oStatus = atoi(row[1]);
|
*oStatus = Strings::ToInt(row[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::ClearMerchantTemp(){
|
void Database::ClearMerchantTemp(){
|
||||||
@@ -1244,7 +1244,7 @@ uint8 Database::GetServerType() {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
return atoi(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Database::MoveCharacterToZone(uint32 character_id, uint32 zone_id)
|
bool Database::MoveCharacterToZone(uint32 character_id, uint32 zone_id)
|
||||||
@@ -1296,7 +1296,7 @@ uint8 Database::GetRaceSkill(uint8 skillid, uint8 in_race)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
return atoi(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 Database::GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16 in_level)
|
uint8 Database::GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16 in_level)
|
||||||
@@ -1312,12 +1312,12 @@ uint8 Database::GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16
|
|||||||
if (results.Success() && results.RowsAffected() != 0)
|
if (results.Success() && results.RowsAffected() != 0)
|
||||||
{
|
{
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
skill_level = atoi(row[0]);
|
skill_level = Strings::ToInt(row[0]);
|
||||||
skill_formula = atoi(row[1]);
|
skill_formula = Strings::ToInt(row[1]);
|
||||||
skill_cap = atoi(row[2]);
|
skill_cap = Strings::ToInt(row[2]);
|
||||||
if (atoi(row[3]) > skill_cap)
|
if (Strings::ToInt(row[3]) > skill_cap)
|
||||||
skill_cap2 = (atoi(row[3])-skill_cap)/10; //Split the post-50 skill cap into difference between pre-50 cap and post-50 cap / 10 to determine amount of points per level.
|
skill_cap2 = (Strings::ToInt(row[3])-skill_cap)/10; //Split the post-50 skill cap into difference between pre-50 cap and post-50 cap / 10 to determine amount of points per level.
|
||||||
skill_cap3 = atoi(row[4]);
|
skill_cap3 = Strings::ToInt(row[4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int race_skill = GetRaceSkill(skillid,in_race);
|
int race_skill = GetRaceSkill(skillid,in_race);
|
||||||
@@ -1362,10 +1362,10 @@ uint32 Database::GetCharacterInfo(std::string character_name, uint32 *account_id
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
auto character_id = std::stoul(row[0]);
|
auto character_id = Strings::ToUnsignedInt(row[0]);
|
||||||
*account_id = std::stoul(row[1]);
|
*account_id = Strings::ToUnsignedInt(row[1]);
|
||||||
*zone_id = std::stoul(row[2]);
|
*zone_id = Strings::ToUnsignedInt(row[2]);
|
||||||
*instance_id = std::stoul(row[3]);
|
*instance_id = Strings::ToUnsignedInt(row[3]);
|
||||||
|
|
||||||
return character_id;
|
return character_id;
|
||||||
}
|
}
|
||||||
@@ -1488,7 +1488,7 @@ uint32 Database::GetGroupID(const char* name){
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
return atoi(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Database::GetGroupLeaderForLogin(std::string character_name) {
|
std::string Database::GetGroupLeaderForLogin(std::string character_name) {
|
||||||
@@ -1502,7 +1502,7 @@ std::string Database::GetGroupLeaderForLogin(std::string character_name) {
|
|||||||
|
|
||||||
if (results.Success() && results.RowCount()) {
|
if (results.Success() && results.RowCount()) {
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
group_id = std::stoul(row[0]);
|
group_id = Strings::ToUnsignedInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!group_id) {
|
if (!group_id) {
|
||||||
@@ -1591,7 +1591,7 @@ char *Database::GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* mainta
|
|||||||
strcpy(mentoree, row[5]);
|
strcpy(mentoree, row[5]);
|
||||||
|
|
||||||
if (mentor_percent)
|
if (mentor_percent)
|
||||||
*mentor_percent = atoi(row[6]);
|
*mentor_percent = Strings::ToInt(row[6]);
|
||||||
|
|
||||||
if(GLAA && results.LengthOfColumn(7) == sizeof(GroupLeadershipAA_Struct))
|
if(GLAA && results.LengthOfColumn(7) == sizeof(GroupLeadershipAA_Struct))
|
||||||
memcpy(GLAA, row[7], sizeof(GroupLeadershipAA_Struct));
|
memcpy(GLAA, row[7], sizeof(GroupLeadershipAA_Struct));
|
||||||
@@ -1638,7 +1638,7 @@ uint8 Database::GetAgreementFlag(uint32 acctid) {
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
return atoi(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::SetAgreementFlag(uint32 acctid) {
|
void Database::SetAgreementFlag(uint32 acctid) {
|
||||||
@@ -1724,7 +1724,7 @@ uint32 Database::GetRaidID(const char* name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (row[0]) // would it ever be possible to have a null here?
|
if (row[0]) // would it ever be possible to have a null here?
|
||||||
return atoi(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1807,7 +1807,7 @@ void Database::GetGroupLeadershipInfo(uint32 gid, uint32 rid, char *maintank,
|
|||||||
strcpy(mentoree, row[4]);
|
strcpy(mentoree, row[4]);
|
||||||
|
|
||||||
if (mentor_percent)
|
if (mentor_percent)
|
||||||
*mentor_percent = atoi(row[5]);
|
*mentor_percent = Strings::ToInt(row[5]);
|
||||||
|
|
||||||
if (GLAA && results.LengthOfColumn(6) == sizeof(GroupLeadershipAA_Struct))
|
if (GLAA && results.LengthOfColumn(6) == sizeof(GroupLeadershipAA_Struct))
|
||||||
memcpy(GLAA, row[6], sizeof(GroupLeadershipAA_Struct));
|
memcpy(GLAA, row[6], sizeof(GroupLeadershipAA_Struct));
|
||||||
@@ -1980,16 +1980,16 @@ bool Database::GetAdventureStats(uint32 char_id, AdventureStats_Struct *as)
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
as->success.guk = atoi(row[0]);
|
as->success.guk = Strings::ToInt(row[0]);
|
||||||
as->success.mir = atoi(row[1]);
|
as->success.mir = Strings::ToInt(row[1]);
|
||||||
as->success.mmc = atoi(row[2]);
|
as->success.mmc = Strings::ToInt(row[2]);
|
||||||
as->success.ruj = atoi(row[3]);
|
as->success.ruj = Strings::ToInt(row[3]);
|
||||||
as->success.tak = atoi(row[4]);
|
as->success.tak = Strings::ToInt(row[4]);
|
||||||
as->failure.guk = atoi(row[5]);
|
as->failure.guk = Strings::ToInt(row[5]);
|
||||||
as->failure.mir = atoi(row[6]);
|
as->failure.mir = Strings::ToInt(row[6]);
|
||||||
as->failure.mmc = atoi(row[7]);
|
as->failure.mmc = Strings::ToInt(row[7]);
|
||||||
as->failure.ruj = atoi(row[8]);
|
as->failure.ruj = Strings::ToInt(row[8]);
|
||||||
as->failure.tak = atoi(row[9]);
|
as->failure.tak = Strings::ToInt(row[9]);
|
||||||
as->failure.total = as->failure.guk + as->failure.mir + as->failure.mmc + as->failure.ruj + as->failure.tak;
|
as->failure.total = as->failure.guk + as->failure.mir + as->failure.mmc + as->failure.ruj + as->failure.tak;
|
||||||
as->success.total = as->success.guk + as->success.mir + as->success.mmc + as->success.ruj + as->success.tak;
|
as->success.total = as->success.guk + as->success.mir + as->success.mmc + as->success.ruj + as->success.tak;
|
||||||
|
|
||||||
@@ -2008,7 +2008,7 @@ uint32 Database::GetGuildIDByCharID(uint32 character_id)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
return atoi(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Database::GetGroupIDByCharID(uint32 character_id)
|
uint32 Database::GetGroupIDByCharID(uint32 character_id)
|
||||||
@@ -2030,7 +2030,7 @@ uint32 Database::GetGroupIDByCharID(uint32 character_id)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
return atoi(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Database::GetRaidIDByCharID(uint32 character_id) {
|
uint32 Database::GetRaidIDByCharID(uint32 character_id) {
|
||||||
@@ -2044,7 +2044,7 @@ uint32 Database::GetRaidIDByCharID(uint32 character_id) {
|
|||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
return atoi(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2058,7 +2058,7 @@ int Database::CountInvSnapshots() {
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
int64 count = atoll(row[0]);
|
int64 count = Strings::ToBigInt(row[0]);
|
||||||
if (count > 2147483647)
|
if (count > 2147483647)
|
||||||
return -2;
|
return -2;
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
@@ -2094,12 +2094,12 @@ struct TimeOfDay_Struct Database::LoadTime(time_t &realtime)
|
|||||||
else{
|
else{
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
eqTime.minute = atoi(row[0]);
|
eqTime.minute = Strings::ToInt(row[0]);
|
||||||
eqTime.hour = atoi(row[1]);
|
eqTime.hour = Strings::ToInt(row[1]);
|
||||||
eqTime.day = atoi(row[2]);
|
eqTime.day = Strings::ToInt(row[2]);
|
||||||
eqTime.month = atoi(row[3]);
|
eqTime.month = Strings::ToInt(row[3]);
|
||||||
eqTime.year = atoi(row[4]);
|
eqTime.year = Strings::ToInt(row[4]);
|
||||||
realtime = atoi(row[5]);
|
realtime = Strings::ToInt(row[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return eqTime;
|
return eqTime;
|
||||||
@@ -2126,7 +2126,7 @@ int Database::GetIPExemption(std::string account_ip) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
return std::stoi(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::SetIPExemption(std::string account_ip, int exemption_amount) {
|
void Database::SetIPExemption(std::string account_ip, int exemption_amount) {
|
||||||
@@ -2140,7 +2140,7 @@ void Database::SetIPExemption(std::string account_ip, int exemption_amount) {
|
|||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (results.Success() && results.RowCount()) {
|
if (results.Success() && results.RowCount()) {
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
exemption_id = std::stoul(row[0]);
|
exemption_id = Strings::ToUnsignedInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
query = fmt::format(
|
query = fmt::format(
|
||||||
@@ -2166,7 +2166,7 @@ int Database::GetInstanceID(uint32 char_id, uint32 zone_id) {
|
|||||||
|
|
||||||
if (results.Success() && results.RowCount() > 0) {
|
if (results.Success() && results.RowCount() > 0) {
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
return atoi(row[0]);;
|
return Strings::ToInt(row[0]);;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -34,8 +34,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
//atoi is not uint32 or uint32 safe!!!!
|
|
||||||
#define atoul(str) strtoul(str, nullptr, 10)
|
|
||||||
|
|
||||||
class MySQLRequestResult;
|
class MySQLRequestResult;
|
||||||
class Client;
|
class Client;
|
||||||
|
|||||||
@@ -530,7 +530,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
|
|||||||
rquery = StringFormat("SELECT COUNT(`id`) FROM `character_`");
|
rquery = StringFormat("SELECT COUNT(`id`) FROM `character_`");
|
||||||
results = QueryDatabase(rquery);
|
results = QueryDatabase(rquery);
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
number_of_characters = atoi(row[0]);
|
number_of_characters = Strings::ToInt(row[0]);
|
||||||
printf("Number of Characters in Database: %i \n", number_of_characters);
|
printf("Number of Characters in Database: %i \n", number_of_characters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -929,19 +929,19 @@ bool Database::CheckDatabaseConvertPPDeblob(){
|
|||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
char_iter_count++;
|
char_iter_count++;
|
||||||
squery = StringFormat("SELECT `id`, `profile`, `name`, `level`, `account_id`, `firstlogon`, `lfg`, `lfp`, `mailkey`, `xtargets`, `inspectmessage`, `extprofile` FROM `character_` WHERE `id` = %i", atoi(row[0]));
|
squery = StringFormat("SELECT `id`, `profile`, `name`, `level`, `account_id`, `firstlogon`, `lfg`, `lfp`, `mailkey`, `xtargets`, `inspectmessage`, `extprofile` FROM `character_` WHERE `id` = %i", Strings::ToInt(row[0]));
|
||||||
auto results2 = QueryDatabase(squery);
|
auto results2 = QueryDatabase(squery);
|
||||||
auto row2 = results2.begin();
|
auto row2 = results2.begin();
|
||||||
pp = (Convert::PlayerProfile_Struct*)row2[1];
|
pp = (Convert::PlayerProfile_Struct*)row2[1];
|
||||||
e_pp = (ExtendedProfile_Struct*)row2[11];
|
e_pp = (ExtendedProfile_Struct*)row2[11];
|
||||||
character_id = atoi(row[0]);
|
character_id = Strings::ToInt(row[0]);
|
||||||
account_id = atoi(row2[4]);
|
account_id = Strings::ToInt(row2[4]);
|
||||||
/* Convert some data from the character_ table that is still relevant */
|
/* Convert some data from the character_ table that is still relevant */
|
||||||
firstlogon = atoi(row2[5]);
|
firstlogon = Strings::ToInt(row2[5]);
|
||||||
lfg = atoi(row2[6]);
|
lfg = Strings::ToInt(row2[6]);
|
||||||
lfp = atoi(row2[7]);
|
lfp = Strings::ToInt(row2[7]);
|
||||||
mailkey = row2[8];
|
mailkey = row2[8];
|
||||||
xtargets = atoi(row2[9]);
|
xtargets = Strings::ToInt(row2[9]);
|
||||||
inspectmessage = row2[10];
|
inspectmessage = row2[10];
|
||||||
|
|
||||||
/* Verify PP Integrity */
|
/* Verify PP Integrity */
|
||||||
@@ -1567,7 +1567,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
|||||||
rquery = StringFormat("SELECT DISTINCT charid FROM character_corpses");
|
rquery = StringFormat("SELECT DISTINCT charid FROM character_corpses");
|
||||||
results = QueryDatabase(rquery);
|
results = QueryDatabase(rquery);
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
std::string squery = StringFormat("SELECT id, charname, data, time_of_death, is_rezzed FROM character_corpses WHERE `charid` = %i", atoi(row[0]));
|
std::string squery = StringFormat("SELECT id, charname, data, time_of_death, is_rezzed FROM character_corpses WHERE `charid` = %i", Strings::ToInt(row[0]));
|
||||||
auto results2 = QueryDatabase(squery);
|
auto results2 = QueryDatabase(squery);
|
||||||
for (auto row2 = results2.begin(); row2 != results2.end(); ++row2) {
|
for (auto row2 = results2.begin(); row2 != results2.end(); ++row2) {
|
||||||
in_datasize = results2.LengthOfColumn(2);
|
in_datasize = results2.LengthOfColumn(2);
|
||||||
@@ -1599,7 +1599,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
|||||||
c_type = "NULL";
|
c_type = "NULL";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::cout << "Converting Corpse: [OK] [" << c_type << "]: " << "ID: " << atoi(row2[0]) << std::endl;
|
std::cout << "Converting Corpse: [OK] [" << c_type << "]: " << "ID: " << Strings::ToInt(row2[0]) << std::endl;
|
||||||
|
|
||||||
if (is_sof){
|
if (is_sof){
|
||||||
scquery = StringFormat("UPDATE `character_corpses` SET \n"
|
scquery = StringFormat("UPDATE `character_corpses` SET \n"
|
||||||
@@ -1670,7 +1670,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
|||||||
dbpc->item_tint[6].color,
|
dbpc->item_tint[6].color,
|
||||||
dbpc->item_tint[7].color,
|
dbpc->item_tint[7].color,
|
||||||
dbpc->item_tint[8].color,
|
dbpc->item_tint[8].color,
|
||||||
atoi(row2[0])
|
Strings::ToInt(row2[0])
|
||||||
);
|
);
|
||||||
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); }
|
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); }
|
||||||
|
|
||||||
@@ -1682,7 +1682,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
|||||||
scquery = StringFormat("REPLACE INTO `character_corpse_items` \n"
|
scquery = StringFormat("REPLACE INTO `character_corpse_items` \n"
|
||||||
" (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, aug_6, attuned) \n"
|
" (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, aug_6, attuned) \n"
|
||||||
" VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
|
" VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
|
||||||
atoi(row2[0]),
|
Strings::ToInt(row2[0]),
|
||||||
dbpc->items[i].equipSlot,
|
dbpc->items[i].equipSlot,
|
||||||
dbpc->items[i].item_id,
|
dbpc->items[i].item_id,
|
||||||
dbpc->items[i].charges,
|
dbpc->items[i].charges,
|
||||||
@@ -1698,7 +1698,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
|
scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
|
||||||
atoi(row2[0]),
|
Strings::ToInt(row2[0]),
|
||||||
dbpc->items[i].equipSlot,
|
dbpc->items[i].equipSlot,
|
||||||
dbpc->items[i].item_id,
|
dbpc->items[i].item_id,
|
||||||
dbpc->items[i].charges,
|
dbpc->items[i].charges,
|
||||||
@@ -1778,7 +1778,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
|||||||
dbpc_c->item_tint[6].color,
|
dbpc_c->item_tint[6].color,
|
||||||
dbpc_c->item_tint[7].color,
|
dbpc_c->item_tint[7].color,
|
||||||
dbpc_c->item_tint[8].color,
|
dbpc_c->item_tint[8].color,
|
||||||
atoi(row2[0])
|
Strings::ToInt(row2[0])
|
||||||
);
|
);
|
||||||
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); }
|
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); }
|
||||||
|
|
||||||
@@ -1791,7 +1791,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
|||||||
scquery = StringFormat("REPLACE INTO `character_corpse_items` \n"
|
scquery = StringFormat("REPLACE INTO `character_corpse_items` \n"
|
||||||
" (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, aug_6, attuned) \n"
|
" (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, aug_6, attuned) \n"
|
||||||
" VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
|
" VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
|
||||||
atoi(row2[0]),
|
Strings::ToInt(row2[0]),
|
||||||
dbpc_c->items[i].equipSlot,
|
dbpc_c->items[i].equipSlot,
|
||||||
dbpc_c->items[i].item_id,
|
dbpc_c->items[i].item_id,
|
||||||
dbpc_c->items[i].charges,
|
dbpc_c->items[i].charges,
|
||||||
@@ -1807,7 +1807,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
|
scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
|
||||||
atoi(row2[0]),
|
Strings::ToInt(row2[0]),
|
||||||
dbpc_c->items[i].equipSlot,
|
dbpc_c->items[i].equipSlot,
|
||||||
dbpc_c->items[i].item_id,
|
dbpc_c->items[i].item_id,
|
||||||
dbpc_c->items[i].charges,
|
dbpc_c->items[i].charges,
|
||||||
|
|||||||
@@ -167,8 +167,8 @@ bool Database::GetUnusedInstanceID(uint16 &instance_id)
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
if (atoi(row[0]) <= max) {
|
if (Strings::ToInt(row[0]) <= max) {
|
||||||
instance_id = atoi(row[0]);
|
instance_id = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -194,7 +194,7 @@ bool Database::GetUnusedInstanceID(uint16 &instance_id)
|
|||||||
max_reserved_instance_id++;
|
max_reserved_instance_id++;
|
||||||
|
|
||||||
for (auto row : results) {
|
for (auto row : results) {
|
||||||
if (max_reserved_instance_id < std::stoul(row[0])) {
|
if (max_reserved_instance_id < Strings::ToUnsignedInt(row[0])) {
|
||||||
instance_id = max_reserved_instance_id;
|
instance_id = max_reserved_instance_id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -301,7 +301,7 @@ uint16 Database::GetInstanceID(uint32 zone_id, uint32 character_id, int16 versio
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
return static_cast<uint16>(std::stoul(row[0]));
|
return static_cast<uint16>(Strings::ToUnsignedInt(row[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint16> Database::GetInstanceIDs(uint32 zone_id, uint32 character_id)
|
std::vector<uint16> Database::GetInstanceIDs(uint32 zone_id, uint32 character_id)
|
||||||
@@ -328,7 +328,7 @@ std::vector<uint16> Database::GetInstanceIDs(uint32 zone_id, uint32 character_id
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto row : results) {
|
for (auto row : results) {
|
||||||
l.push_back(static_cast<uint16>(std::stoul(row[0])));
|
l.push_back(static_cast<uint16>(Strings::ToUnsignedInt(row[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
|
|||||||
+38
-40
@@ -34,7 +34,8 @@
|
|||||||
|
|
||||||
DBcore::DBcore()
|
DBcore::DBcore()
|
||||||
{
|
{
|
||||||
mysql_init(&mysql);
|
mysql = mysql_init(nullptr);
|
||||||
|
mysqlOwner = true;
|
||||||
pHost = nullptr;
|
pHost = nullptr;
|
||||||
pUser = nullptr;
|
pUser = nullptr;
|
||||||
pPassword = nullptr;
|
pPassword = nullptr;
|
||||||
@@ -42,6 +43,7 @@ DBcore::DBcore()
|
|||||||
pCompress = false;
|
pCompress = false;
|
||||||
pSSL = false;
|
pSSL = false;
|
||||||
pStatus = Closed;
|
pStatus = Closed;
|
||||||
|
m_mutex = new Mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBcore::~DBcore()
|
DBcore::~DBcore()
|
||||||
@@ -51,16 +53,10 @@ DBcore::~DBcore()
|
|||||||
* are re-using the default database connection pointer when we dont have an
|
* are re-using the default database connection pointer when we dont have an
|
||||||
* external configuration setup ex: (content_database)
|
* external configuration setup ex: (content_database)
|
||||||
*/
|
*/
|
||||||
std::string mysql_connection_host;
|
if (mysqlOwner) {
|
||||||
if (mysql.host) {
|
mysql_close(mysql);
|
||||||
mysql_connection_host = mysql.host;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetOriginHost() != mysql_connection_host) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mysql_close(&mysql);
|
|
||||||
safe_delete_array(pHost);
|
safe_delete_array(pHost);
|
||||||
safe_delete_array(pUser);
|
safe_delete_array(pUser);
|
||||||
safe_delete_array(pPassword);
|
safe_delete_array(pPassword);
|
||||||
@@ -70,19 +66,17 @@ DBcore::~DBcore()
|
|||||||
// Sends the MySQL server a keepalive
|
// Sends the MySQL server a keepalive
|
||||||
void DBcore::ping()
|
void DBcore::ping()
|
||||||
{
|
{
|
||||||
if (!m_query_lock.try_lock()) {
|
if (!m_mutex->trylock()) {
|
||||||
// well, if's it's locked, someone's using it. If someone's using it, it doesnt need a keepalive
|
// well, if's it's locked, someone's using it. If someone's using it, it doesnt need a keepalive
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mysql_ping(&mysql);
|
mysql_ping(mysql);
|
||||||
m_query_lock.unlock();
|
m_mutex->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureOnce)
|
MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureOnce)
|
||||||
{
|
{
|
||||||
m_query_lock.lock();
|
|
||||||
auto r = QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce);
|
auto r = QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce);
|
||||||
m_query_lock.unlock();
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,14 +92,16 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
|
|||||||
BenchTimer timer;
|
BenchTimer timer;
|
||||||
timer.reset();
|
timer.reset();
|
||||||
|
|
||||||
|
LockMutex lock(m_mutex);
|
||||||
|
|
||||||
// Reconnect if we are not connected before hand.
|
// Reconnect if we are not connected before hand.
|
||||||
if (pStatus != Connected) {
|
if (pStatus != Connected) {
|
||||||
Open();
|
Open();
|
||||||
}
|
}
|
||||||
|
|
||||||
// request query. != 0 indicates some kind of error.
|
// request query. != 0 indicates some kind of error.
|
||||||
if (mysql_real_query(&mysql, query, querylen) != 0) {
|
if (mysql_real_query(mysql, query, querylen) != 0) {
|
||||||
unsigned int errorNumber = mysql_errno(&mysql);
|
unsigned int errorNumber = mysql_errno(mysql);
|
||||||
|
|
||||||
if (errorNumber == CR_SERVER_GONE_ERROR) {
|
if (errorNumber == CR_SERVER_GONE_ERROR) {
|
||||||
pStatus = Error;
|
pStatus = Error;
|
||||||
@@ -129,26 +125,26 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
|
|||||||
|
|
||||||
auto errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
auto errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
||||||
|
|
||||||
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(mysql), mysql_error(mysql));
|
||||||
|
|
||||||
return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32) mysql_errno(&mysql), errorBuffer);
|
return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32) mysql_errno(mysql), errorBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
auto errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
||||||
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(mysql), mysql_error(mysql));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error logging
|
* Error logging
|
||||||
*/
|
*/
|
||||||
if (mysql_errno(&mysql) > 0 && strlen(query) > 0) {
|
if (mysql_errno(mysql) > 0 && strlen(query) > 0) {
|
||||||
LogMySQLError("[{}] [{}]\n[{}]", mysql_errno(&mysql), mysql_error(&mysql), query);
|
LogMySQLError("[{}] [{}]\n[{}]", mysql_errno(mysql), mysql_error(mysql), query);
|
||||||
}
|
}
|
||||||
|
|
||||||
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql), errorBuffer);
|
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(mysql), errorBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// successful query. get results.
|
// successful query. get results.
|
||||||
MYSQL_RES *res = mysql_store_result(&mysql);
|
MYSQL_RES *res = mysql_store_result(mysql);
|
||||||
uint32 rowCount = 0;
|
uint32 rowCount = 0;
|
||||||
|
|
||||||
if (res != nullptr) {
|
if (res != nullptr) {
|
||||||
@@ -157,10 +153,10 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
|
|||||||
|
|
||||||
MySQLRequestResult requestResult(
|
MySQLRequestResult requestResult(
|
||||||
res,
|
res,
|
||||||
(uint32) mysql_affected_rows(&mysql),
|
(uint32) mysql_affected_rows(mysql),
|
||||||
rowCount,
|
rowCount,
|
||||||
(uint32) mysql_field_count(&mysql),
|
(uint32) mysql_field_count(mysql),
|
||||||
(uint32) mysql_insert_id(&mysql)
|
(uint32) mysql_insert_id(mysql)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
|
if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
|
||||||
@@ -206,7 +202,7 @@ uint32 DBcore::DoEscapeString(char *tobuf, const char *frombuf, uint32 fromlen)
|
|||||||
{
|
{
|
||||||
// No good reason to lock the DB, we only need it in the first place to check char encoding.
|
// No good reason to lock the DB, we only need it in the first place to check char encoding.
|
||||||
// LockMutex lock(&MDatabase);
|
// LockMutex lock(&MDatabase);
|
||||||
return mysql_real_escape_string(&mysql, tobuf, frombuf, fromlen);
|
return mysql_real_escape_string(mysql, tobuf, frombuf, fromlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DBcore::Open(
|
bool DBcore::Open(
|
||||||
@@ -221,7 +217,7 @@ bool DBcore::Open(
|
|||||||
bool iSSL
|
bool iSSL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
LockMutex lock(&MDatabase);
|
LockMutex lock(m_mutex);
|
||||||
safe_delete_array(pHost);
|
safe_delete_array(pHost);
|
||||||
safe_delete_array(pUser);
|
safe_delete_array(pUser);
|
||||||
safe_delete_array(pPassword);
|
safe_delete_array(pPassword);
|
||||||
@@ -241,13 +237,13 @@ bool DBcore::Open(uint32 *errnum, char *errbuf)
|
|||||||
if (errbuf) {
|
if (errbuf) {
|
||||||
errbuf[0] = 0;
|
errbuf[0] = 0;
|
||||||
}
|
}
|
||||||
LockMutex lock(&MDatabase);
|
LockMutex lock(m_mutex);
|
||||||
if (GetStatus() == Connected) {
|
if (GetStatus() == Connected) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (GetStatus() == Error) {
|
if (GetStatus() == Error) {
|
||||||
mysql_close(&mysql);
|
mysql_close(mysql);
|
||||||
mysql_init(&mysql); // Initialize structure again
|
mysql_init(mysql); // Initialize structure again
|
||||||
}
|
}
|
||||||
if (!pHost) {
|
if (!pHost) {
|
||||||
return false;
|
return false;
|
||||||
@@ -264,7 +260,7 @@ bool DBcore::Open(uint32 *errnum, char *errbuf)
|
|||||||
if (pSSL) {
|
if (pSSL) {
|
||||||
flags |= CLIENT_SSL;
|
flags |= CLIENT_SSL;
|
||||||
}
|
}
|
||||||
if (mysql_real_connect(&mysql, pHost, pUser, pPassword, pDatabase, pPort, 0, flags)) {
|
if (mysql_real_connect(mysql, pHost, pUser, pPassword, pDatabase, pPort, 0, flags)) {
|
||||||
pStatus = Connected;
|
pStatus = Connected;
|
||||||
|
|
||||||
std::string connected_origin_host = pHost;
|
std::string connected_origin_host = pHost;
|
||||||
@@ -274,21 +270,16 @@ bool DBcore::Open(uint32 *errnum, char *errbuf)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (errnum) {
|
if (errnum) {
|
||||||
*errnum = mysql_errno(&mysql);
|
*errnum = mysql_errno(mysql);
|
||||||
}
|
}
|
||||||
if (errbuf) {
|
if (errbuf) {
|
||||||
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(mysql), mysql_error(mysql));
|
||||||
}
|
}
|
||||||
pStatus = Error;
|
pStatus = Error;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBcore::SetMysql(MYSQL *mysql)
|
|
||||||
{
|
|
||||||
DBcore::mysql = *mysql;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string &DBcore::GetOriginHost() const
|
const std::string &DBcore::GetOriginHost() const
|
||||||
{
|
{
|
||||||
return origin_host;
|
return origin_host;
|
||||||
@@ -303,7 +294,14 @@ std::string DBcore::Escape(const std::string& s)
|
|||||||
{
|
{
|
||||||
const std::size_t s_len = s.length();
|
const std::size_t s_len = s.length();
|
||||||
std::vector<char> temp((s_len * 2) + 1, '\0');
|
std::vector<char> temp((s_len * 2) + 1, '\0');
|
||||||
mysql_real_escape_string(&mysql, temp.data(), s.c_str(), s_len);
|
mysql_real_escape_string(mysql, temp.data(), s.c_str(), s_len);
|
||||||
|
|
||||||
return temp.data();
|
return temp.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DBcore::SetMutex(Mutex *mutex)
|
||||||
|
{
|
||||||
|
safe_delete(m_mutex);
|
||||||
|
|
||||||
|
DBcore::m_mutex = mutex;
|
||||||
|
}
|
||||||
|
|||||||
+10
-4
@@ -31,14 +31,19 @@ public:
|
|||||||
std::string Escape(const std::string& s);
|
std::string Escape(const std::string& s);
|
||||||
uint32 DoEscapeString(char *tobuf, const char *frombuf, uint32 fromlen);
|
uint32 DoEscapeString(char *tobuf, const char *frombuf, uint32 fromlen);
|
||||||
void ping();
|
void ping();
|
||||||
MYSQL *getMySQL() { return &mysql; }
|
|
||||||
void SetMysql(MYSQL *mysql);
|
|
||||||
|
|
||||||
const std::string &GetOriginHost() const;
|
const std::string &GetOriginHost() const;
|
||||||
void SetOriginHost(const std::string &origin_host);
|
void SetOriginHost(const std::string &origin_host);
|
||||||
|
|
||||||
bool DoesTableExist(std::string table_name);
|
bool DoesTableExist(std::string table_name);
|
||||||
|
|
||||||
|
void SetMySQL(const DBcore &o)
|
||||||
|
{
|
||||||
|
mysql = o.mysql;
|
||||||
|
mysqlOwner = false;
|
||||||
|
}
|
||||||
|
void SetMutex(Mutex *mutex);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool Open(
|
bool Open(
|
||||||
const char *iHost,
|
const char *iHost,
|
||||||
@@ -55,8 +60,9 @@ protected:
|
|||||||
private:
|
private:
|
||||||
bool Open(uint32 *errnum = nullptr, char *errbuf = nullptr);
|
bool Open(uint32 *errnum = nullptr, char *errbuf = nullptr);
|
||||||
|
|
||||||
MYSQL mysql;
|
MYSQL* mysql;
|
||||||
Mutex MDatabase;
|
bool mysqlOwner;
|
||||||
|
Mutex *m_mutex;
|
||||||
eStatus pStatus;
|
eStatus pStatus;
|
||||||
|
|
||||||
std::mutex m_query_lock{};
|
std::mutex m_query_lock{};
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ void Discord::SendWebhookMessage(const std::string &message, const std::string &
|
|||||||
LogDiscord("JSON serialization failure [{}] via [{}]", ex.what(), res->body);
|
LogDiscord("JSON serialization failure [{}] via [{}]", ex.what(), res->body);
|
||||||
}
|
}
|
||||||
|
|
||||||
retry_timer = std::stoi(response["retry_after"].asString()) + 500;
|
retry_timer = Strings::ToInt(response["retry_after"].asString()) + 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogDiscord("Rate limited... retrying message in [{}ms]", retry_timer);
|
LogDiscord("Rate limited... retrying message in [{}ms]", retry_timer);
|
||||||
@@ -125,7 +125,7 @@ void Discord::SendPlayerEventMessage(
|
|||||||
LogDiscord("JSON serialization failure [{}] via [{}]", ex.what(), res->body);
|
LogDiscord("JSON serialization failure [{}] via [{}]", ex.what(), res->body);
|
||||||
}
|
}
|
||||||
|
|
||||||
retry_timer = std::stoi(response["retry_after"].asString()) + 500;
|
retry_timer = Strings::ToInt(response["retry_after"].asString()) + 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogDiscord("Rate limited... retrying message in [{}ms]", retry_timer);
|
LogDiscord("Rate limited... retrying message in [{}ms]", retry_timer);
|
||||||
|
|||||||
+19
-18
@@ -19,6 +19,7 @@
|
|||||||
#include "../common/global_define.h"
|
#include "../common/global_define.h"
|
||||||
#include "eqemu_config.h"
|
#include "eqemu_config.h"
|
||||||
#include "misc_functions.h"
|
#include "misc_functions.h"
|
||||||
|
#include "strings.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -33,13 +34,13 @@ void EQEmuConfig::parse_config()
|
|||||||
LongName = _root["server"]["world"].get("longname", "").asString();
|
LongName = _root["server"]["world"].get("longname", "").asString();
|
||||||
WorldAddress = _root["server"]["world"].get("address", "").asString();
|
WorldAddress = _root["server"]["world"].get("address", "").asString();
|
||||||
LocalAddress = _root["server"]["world"].get("localaddress", "").asString();
|
LocalAddress = _root["server"]["world"].get("localaddress", "").asString();
|
||||||
MaxClients = atoi(_root["server"]["world"].get("maxclients", "-1").asString().c_str());
|
MaxClients = Strings::ToInt(_root["server"]["world"].get("maxclients", "-1").asString().c_str());
|
||||||
SharedKey = _root["server"]["world"].get("key", "").asString();
|
SharedKey = _root["server"]["world"].get("key", "").asString();
|
||||||
LoginCount = 0;
|
LoginCount = 0;
|
||||||
|
|
||||||
if (_root["server"]["world"]["loginserver"].isObject()) {
|
if (_root["server"]["world"]["loginserver"].isObject()) {
|
||||||
LoginHost = _root["server"]["world"]["loginserver"].get("host", "login.eqemulator.net").asString();
|
LoginHost = _root["server"]["world"]["loginserver"].get("host", "login.eqemulator.net").asString();
|
||||||
LoginPort = atoi(_root["server"]["world"]["loginserver"].get("port", "5998").asString().c_str());
|
LoginPort = Strings::ToInt(_root["server"]["world"]["loginserver"].get("port", "5998").asString().c_str());
|
||||||
LoginLegacy = false;
|
LoginLegacy = false;
|
||||||
if (_root["server"]["world"]["loginserver"].get("legacy", "0").asString() == "1") { LoginLegacy = true; }
|
if (_root["server"]["world"]["loginserver"].get("legacy", "0").asString() == "1") { LoginLegacy = true; }
|
||||||
LoginAccount = _root["server"]["world"]["loginserver"].get("account", "").asString();
|
LoginAccount = _root["server"]["world"]["loginserver"].get("account", "").asString();
|
||||||
@@ -62,7 +63,7 @@ void EQEmuConfig::parse_config()
|
|||||||
|
|
||||||
auto loginconfig = new LoginConfig;
|
auto loginconfig = new LoginConfig;
|
||||||
loginconfig->LoginHost = _root["server"]["world"][str].get("host", "login.eqemulator.net").asString();
|
loginconfig->LoginHost = _root["server"]["world"][str].get("host", "login.eqemulator.net").asString();
|
||||||
loginconfig->LoginPort = atoi(_root["server"]["world"][str].get("port", "5998").asString().c_str());
|
loginconfig->LoginPort = Strings::ToInt(_root["server"]["world"][str].get("port", "5998").asString().c_str());
|
||||||
loginconfig->LoginAccount = _root["server"]["world"][str].get("account", "").asString();
|
loginconfig->LoginAccount = _root["server"]["world"][str].get("account", "").asString();
|
||||||
loginconfig->LoginPassword = _root["server"]["world"][str].get("password", "").asString();
|
loginconfig->LoginPassword = _root["server"]["world"][str].get("password", "").asString();
|
||||||
|
|
||||||
@@ -85,15 +86,15 @@ void EQEmuConfig::parse_config()
|
|||||||
Locked = false;
|
Locked = false;
|
||||||
if (_root["server"]["world"].get("locked", "false").asString() == "true") { Locked = true; }
|
if (_root["server"]["world"].get("locked", "false").asString() == "true") { Locked = true; }
|
||||||
WorldIP = _root["server"]["world"]["tcp"].get("host", "127.0.0.1").asString();
|
WorldIP = _root["server"]["world"]["tcp"].get("host", "127.0.0.1").asString();
|
||||||
WorldTCPPort = atoi(_root["server"]["world"]["tcp"].get("port", "9000").asString().c_str());
|
WorldTCPPort = Strings::ToInt(_root["server"]["world"]["tcp"].get("port", "9000").asString().c_str());
|
||||||
|
|
||||||
TelnetIP = _root["server"]["world"]["telnet"].get("ip", "127.0.0.1").asString();
|
TelnetIP = _root["server"]["world"]["telnet"].get("ip", "127.0.0.1").asString();
|
||||||
TelnetTCPPort = atoi(_root["server"]["world"]["telnet"].get("port", "9001").asString().c_str());
|
TelnetTCPPort = Strings::ToInt(_root["server"]["world"]["telnet"].get("port", "9001").asString().c_str());
|
||||||
TelnetEnabled = false;
|
TelnetEnabled = false;
|
||||||
if (_root["server"]["world"]["telnet"].get("enabled", "false").asString() == "true") { TelnetEnabled = true; }
|
if (_root["server"]["world"]["telnet"].get("enabled", "false").asString() == "true") { TelnetEnabled = true; }
|
||||||
|
|
||||||
WorldHTTPMimeFile = _root["server"]["world"]["http"].get("mimefile", "mime.types").asString();
|
WorldHTTPMimeFile = _root["server"]["world"]["http"].get("mimefile", "mime.types").asString();
|
||||||
WorldHTTPPort = atoi(_root["server"]["world"]["http"].get("port", "9080").asString().c_str());
|
WorldHTTPPort = Strings::ToInt(_root["server"]["world"]["http"].get("port", "9080").asString().c_str());
|
||||||
WorldHTTPEnabled = false;
|
WorldHTTPEnabled = false;
|
||||||
|
|
||||||
if (_root["server"]["world"]["http"].get("enabled", "false").asString() == "true") {
|
if (_root["server"]["world"]["http"].get("enabled", "false").asString() == "true") {
|
||||||
@@ -108,9 +109,9 @@ void EQEmuConfig::parse_config()
|
|||||||
* UCS
|
* UCS
|
||||||
*/
|
*/
|
||||||
ChatHost = _root["server"]["chatserver"].get("host", "eqchat.eqemulator.net").asString();
|
ChatHost = _root["server"]["chatserver"].get("host", "eqchat.eqemulator.net").asString();
|
||||||
ChatPort = atoi(_root["server"]["chatserver"].get("port", "7778").asString().c_str());
|
ChatPort = Strings::ToInt(_root["server"]["chatserver"].get("port", "7778").asString().c_str());
|
||||||
MailHost = _root["server"]["mailserver"].get("host", "eqmail.eqemulator.net").asString();
|
MailHost = _root["server"]["mailserver"].get("host", "eqmail.eqemulator.net").asString();
|
||||||
MailPort = atoi(_root["server"]["mailserver"].get("port", "7778").asString().c_str());
|
MailPort = Strings::ToInt(_root["server"]["mailserver"].get("port", "7778").asString().c_str());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database
|
* Database
|
||||||
@@ -118,7 +119,7 @@ void EQEmuConfig::parse_config()
|
|||||||
DatabaseUsername = _root["server"]["database"].get("username", "eq").asString();
|
DatabaseUsername = _root["server"]["database"].get("username", "eq").asString();
|
||||||
DatabasePassword = _root["server"]["database"].get("password", "eq").asString();
|
DatabasePassword = _root["server"]["database"].get("password", "eq").asString();
|
||||||
DatabaseHost = _root["server"]["database"].get("host", "localhost").asString();
|
DatabaseHost = _root["server"]["database"].get("host", "localhost").asString();
|
||||||
DatabasePort = atoi(_root["server"]["database"].get("port", "3306").asString().c_str());
|
DatabasePort = Strings::ToInt(_root["server"]["database"].get("port", "3306").asString().c_str());
|
||||||
DatabaseDB = _root["server"]["database"].get("db", "eq").asString();
|
DatabaseDB = _root["server"]["database"].get("db", "eq").asString();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,14 +128,14 @@ void EQEmuConfig::parse_config()
|
|||||||
ContentDbUsername = _root["server"]["content_database"].get("username", "").asString();
|
ContentDbUsername = _root["server"]["content_database"].get("username", "").asString();
|
||||||
ContentDbPassword = _root["server"]["content_database"].get("password", "").asString();
|
ContentDbPassword = _root["server"]["content_database"].get("password", "").asString();
|
||||||
ContentDbHost = _root["server"]["content_database"].get("host", "").asString();
|
ContentDbHost = _root["server"]["content_database"].get("host", "").asString();
|
||||||
ContentDbPort = atoi(_root["server"]["content_database"].get("port", 0).asString().c_str());
|
ContentDbPort = Strings::ToInt(_root["server"]["content_database"].get("port", 0).asString().c_str());
|
||||||
ContentDbName = _root["server"]["content_database"].get("db", "").asString();
|
ContentDbName = _root["server"]["content_database"].get("db", "").asString();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* QS
|
* QS
|
||||||
*/
|
*/
|
||||||
QSDatabaseHost = _root["server"]["qsdatabase"].get("host", "localhost").asString();
|
QSDatabaseHost = _root["server"]["qsdatabase"].get("host", "localhost").asString();
|
||||||
QSDatabasePort = atoi(_root["server"]["qsdatabase"].get("port", "3306").asString().c_str());
|
QSDatabasePort = Strings::ToInt(_root["server"]["qsdatabase"].get("port", "3306").asString().c_str());
|
||||||
QSDatabaseUsername = _root["server"]["qsdatabase"].get("username", "eq").asString();
|
QSDatabaseUsername = _root["server"]["qsdatabase"].get("username", "eq").asString();
|
||||||
QSDatabasePassword = _root["server"]["qsdatabase"].get("password", "eq").asString();
|
QSDatabasePassword = _root["server"]["qsdatabase"].get("password", "eq").asString();
|
||||||
QSDatabaseDB = _root["server"]["qsdatabase"].get("db", "eq").asString();
|
QSDatabaseDB = _root["server"]["qsdatabase"].get("db", "eq").asString();
|
||||||
@@ -142,9 +143,9 @@ void EQEmuConfig::parse_config()
|
|||||||
/**
|
/**
|
||||||
* Zones
|
* Zones
|
||||||
*/
|
*/
|
||||||
DefaultStatus = atoi(_root["server"]["zones"].get("defaultstatus", 0).asString().c_str());
|
DefaultStatus = Strings::ToInt(_root["server"]["zones"].get("defaultstatus", 0).asString().c_str());
|
||||||
ZonePortLow = atoi(_root["server"]["zones"]["ports"].get("low", "7000").asString().c_str());
|
ZonePortLow = Strings::ToInt(_root["server"]["zones"]["ports"].get("low", "7000").asString().c_str());
|
||||||
ZonePortHigh = atoi(_root["server"]["zones"]["ports"].get("high", "7999").asString().c_str());
|
ZonePortHigh = Strings::ToInt(_root["server"]["zones"]["ports"].get("high", "7999").asString().c_str());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Files
|
* Files
|
||||||
@@ -174,10 +175,10 @@ void EQEmuConfig::parse_config()
|
|||||||
/**
|
/**
|
||||||
* Launcher
|
* Launcher
|
||||||
*/
|
*/
|
||||||
RestartWait = atoi(_root["server"]["launcher"]["timers"].get("restart", "10000").asString().c_str());
|
RestartWait = Strings::ToInt(_root["server"]["launcher"]["timers"].get("restart", "10000").asString().c_str());
|
||||||
TerminateWait = atoi(_root["server"]["launcher"]["timers"].get("reterminate", "10000").asString().c_str());
|
TerminateWait = Strings::ToInt(_root["server"]["launcher"]["timers"].get("reterminate", "10000").asString().c_str());
|
||||||
InitialBootWait = atoi(_root["server"]["launcher"]["timers"].get("initial", "20000").asString().c_str());
|
InitialBootWait = Strings::ToInt(_root["server"]["launcher"]["timers"].get("initial", "20000").asString().c_str());
|
||||||
ZoneBootInterval = atoi(_root["server"]["launcher"]["timers"].get("interval", "2000").asString().c_str());
|
ZoneBootInterval = Strings::ToInt(_root["server"]["launcher"]["timers"].get("interval", "2000").asString().c_str());
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
ZoneExe = _root["server"]["launcher"].get("exe", "zone.exe").asString();
|
ZoneExe = _root["server"]["launcher"].get("exe", "zone.exe").asString();
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -140,10 +140,6 @@ void PlayerEventLogs::AddToQueue(const PlayerEventLogsRepository::PlayerEventLog
|
|||||||
m_batch_queue_lock.lock();
|
m_batch_queue_lock.lock();
|
||||||
m_record_batch_queue.emplace_back(log);
|
m_record_batch_queue.emplace_back(log);
|
||||||
m_batch_queue_lock.unlock();
|
m_batch_queue_lock.unlock();
|
||||||
|
|
||||||
if (m_record_batch_queue.size() >= RuleI(Logging, BatchPlayerEventProcessChunkSize)) {
|
|
||||||
ProcessBatchQueue();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// fills common event data in the SendEvent function
|
// fills common event data in the SendEvent function
|
||||||
@@ -607,10 +603,10 @@ std::string PlayerEventLogs::GetDiscordPayloadFromEvent(const PlayerEvent::Playe
|
|||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
// general process function, used in world or UCS depending on rule Logging:PlayerEventsQSProcess
|
// general process function, used in world or QS depending on rule Logging:PlayerEventsQSProcess
|
||||||
void PlayerEventLogs::Process()
|
void PlayerEventLogs::Process()
|
||||||
{
|
{
|
||||||
if (m_process_batch_events_timer.Check()) {
|
if (m_process_batch_events_timer.Check() || m_record_batch_queue.size() >= RuleI(Logging, BatchPlayerEventProcessChunkSize)) {
|
||||||
ProcessBatchQueue();
|
ProcessBatchQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -132,7 +132,7 @@ enum { //reuse times
|
|||||||
InstillDoubtReuseTime = 9,
|
InstillDoubtReuseTime = 9,
|
||||||
FishingReuseTime = 11,
|
FishingReuseTime = 11,
|
||||||
ForagingReuseTime = 50,
|
ForagingReuseTime = 50,
|
||||||
MendReuseTime = 290,
|
MendReuseTime = 360,
|
||||||
BashReuseTime = 5,
|
BashReuseTime = 5,
|
||||||
BackstabReuseTime = 9,
|
BackstabReuseTime = 9,
|
||||||
KickReuseTime = 5,
|
KickReuseTime = 5,
|
||||||
|
|||||||
+17
-17
@@ -61,7 +61,7 @@ bool BaseGuildManager::LoadGuilds() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto row=results.begin();row!=results.end();++row)
|
for (auto row=results.begin();row!=results.end();++row)
|
||||||
_CreateGuild(atoi(row[0]), row[1], atoi(row[2]), atoi(row[3]), row[4], row[5], row[6], row[7]);
|
_CreateGuild(Strings::ToInt(row[0]), row[1], Strings::ToInt(row[2]), Strings::ToInt(row[3]), row[4], row[5], row[6], row[7]);
|
||||||
|
|
||||||
LogInfo("Loaded [{}] Guilds", Strings::Commify(std::to_string(results.RowCount())));
|
LogInfo("Loaded [{}] Guilds", Strings::Commify(std::to_string(results.RowCount())));
|
||||||
|
|
||||||
@@ -75,8 +75,8 @@ bool BaseGuildManager::LoadGuilds() {
|
|||||||
|
|
||||||
for (auto row=results.begin();row!=results.end();++row)
|
for (auto row=results.begin();row!=results.end();++row)
|
||||||
{
|
{
|
||||||
uint32 guild_id = atoi(row[0]);
|
uint32 guild_id = Strings::ToInt(row[0]);
|
||||||
uint8 rankn = atoi(row[1]);
|
uint8 rankn = Strings::ToInt(row[1]);
|
||||||
|
|
||||||
if(rankn > GUILD_MAX_RANK) {
|
if(rankn > GUILD_MAX_RANK) {
|
||||||
LogGuilds("Found invalid (too high) rank [{}] for guild [{}], skipping", rankn, guild_id);
|
LogGuilds("Found invalid (too high) rank [{}] for guild [{}], skipping", rankn, guild_id);
|
||||||
@@ -131,7 +131,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
info = _CreateGuild(guild_id, row[0], atoi(row[1]), atoi(row[2]), row[3], row[4], row[5], row[6]);
|
info = _CreateGuild(guild_id, row[0], Strings::ToInt(row[1]), Strings::ToInt(row[2]), row[3], row[4], row[5], row[6]);
|
||||||
|
|
||||||
query = StringFormat("SELECT guild_id, `rank`, title, can_hear, can_speak, can_invite, can_remove, can_promote, can_demote, can_motd, can_warpeace "
|
query = StringFormat("SELECT guild_id, `rank`, title, can_hear, can_speak, can_invite, can_remove, can_promote, can_demote, can_motd, can_warpeace "
|
||||||
"FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id);
|
"FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id);
|
||||||
@@ -144,7 +144,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
|
|||||||
|
|
||||||
for (auto row=results.begin();row!=results.end();++row)
|
for (auto row=results.begin();row!=results.end();++row)
|
||||||
{
|
{
|
||||||
uint8 rankn = atoi(row[1]);
|
uint8 rankn = Strings::ToInt(row[1]);
|
||||||
|
|
||||||
if(rankn > GUILD_MAX_RANK) {
|
if(rankn > GUILD_MAX_RANK) {
|
||||||
LogGuilds("Found invalid (too high) rank [{}] for guild [{}], skipping", rankn, guild_id);
|
LogGuilds("Found invalid (too high) rank [{}] for guild [{}], skipping", rankn, guild_id);
|
||||||
@@ -787,7 +787,7 @@ bool BaseGuildManager::GetBankerFlag(uint32 CharID)
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
bool IsBanker = atoi(row[0]);
|
bool IsBanker = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
return IsBanker;
|
return IsBanker;
|
||||||
}
|
}
|
||||||
@@ -817,7 +817,7 @@ bool BaseGuildManager::GetAltFlag(uint32 CharID)
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
bool IsAlt = atoi(row[0]);
|
bool IsAlt = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
return IsAlt;
|
return IsAlt;
|
||||||
}
|
}
|
||||||
@@ -873,19 +873,19 @@ bool BaseGuildManager::QueryWithLogging(std::string query, const char *errmsg) {
|
|||||||
" FROM `character_data` AS c LEFT JOIN `guild_members` AS g ON c.`id` = g.`char_id` "
|
" FROM `character_data` AS c LEFT JOIN `guild_members` AS g ON c.`id` = g.`char_id` "
|
||||||
static void ProcessGuildMember(MySQLRequestRow row, CharGuildInfo &into) {
|
static void ProcessGuildMember(MySQLRequestRow row, CharGuildInfo &into) {
|
||||||
//fields from `characer_`
|
//fields from `characer_`
|
||||||
into.char_id = atoi(row[0]);
|
into.char_id = Strings::ToInt(row[0]);
|
||||||
into.char_name = row[1];
|
into.char_name = row[1];
|
||||||
into.class_ = atoi(row[2]);
|
into.class_ = Strings::ToInt(row[2]);
|
||||||
into.level = atoi(row[3]);
|
into.level = Strings::ToInt(row[3]);
|
||||||
into.time_last_on = atoul(row[4]);
|
into.time_last_on = Strings::ToUnsignedInt(row[4]);
|
||||||
into.zone_id = atoi(row[5]);
|
into.zone_id = Strings::ToInt(row[5]);
|
||||||
|
|
||||||
//fields from `guild_members`, leave at defaults if missing
|
//fields from `guild_members`, leave at defaults if missing
|
||||||
into.guild_id = row[6] ? atoi(row[6]) : GUILD_NONE;
|
into.guild_id = row[6] ? Strings::ToInt(row[6]) : GUILD_NONE;
|
||||||
into.rank = row[7] ? atoi(row[7]) : (GUILD_MAX_RANK+1);
|
into.rank = row[7] ? Strings::ToInt(row[7]) : (GUILD_MAX_RANK+1);
|
||||||
into.tribute_enable = row[8] ? (row[8][0] == '0'?false:true) : false;
|
into.tribute_enable = row[8] ? (row[8][0] == '0'?false:true) : false;
|
||||||
into.total_tribute = row[9] ? atoi(row[9]) : 0;
|
into.total_tribute = row[9] ? Strings::ToInt(row[9]) : 0;
|
||||||
into.last_tribute = row[10]? atoul(row[10]) : 0; //timestamp
|
into.last_tribute = row[10]? Strings::ToUnsignedInt(row[10]) : 0; //timestamp
|
||||||
into.banker = row[11]? (row[11][0] == '0'?false:true) : false;
|
into.banker = row[11]? (row[11][0] == '0'?false:true) : false;
|
||||||
into.public_note = row[12]? row[12] : "";
|
into.public_note = row[12]? row[12] : "";
|
||||||
into.alt = row[13]? (row[13][0] == '0'?false:true) : false;
|
into.alt = row[13]? (row[13][0] == '0'?false:true) : false;
|
||||||
@@ -1258,7 +1258,7 @@ uint32 BaseGuildManager::GetGuildIDByCharacterID(uint32 character_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
auto guild_id = std::stoul(row[0]);
|
auto guild_id = Strings::ToUnsignedInt(row[0]);
|
||||||
return guild_id;
|
return guild_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -272,6 +272,8 @@ inline const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *asn1) {
|
|||||||
#include <brotli/encode.h>
|
#include <brotli/encode.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "../strings.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Declaration
|
* Declaration
|
||||||
*/
|
*/
|
||||||
@@ -3812,12 +3814,12 @@ inline bool brotli_decompressor::decompress(const char *data,
|
|||||||
if (std::regex_match(b, e, cm, re_another_range)) {
|
if (std::regex_match(b, e, cm, re_another_range)) {
|
||||||
ssize_t first = -1;
|
ssize_t first = -1;
|
||||||
if (!cm.str(1).empty()) {
|
if (!cm.str(1).empty()) {
|
||||||
first = static_cast<ssize_t>(std::stoll(cm.str(1)));
|
first = static_cast<ssize_t>(Strings::ToBigInt(cm.str(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t last = -1;
|
ssize_t last = -1;
|
||||||
if (!cm.str(2).empty()) {
|
if (!cm.str(2).empty()) {
|
||||||
last = static_cast<ssize_t>(std::stoll(cm.str(2)));
|
last = static_cast<ssize_t>(Strings::ToBigInt(cm.str(2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (first != -1 && last != -1 && first > last) {
|
if (first != -1 && last != -1 && first > last) {
|
||||||
|
|||||||
+33
-11
@@ -24,16 +24,16 @@
|
|||||||
#include "rulesys.h"
|
#include "rulesys.h"
|
||||||
#include "shareddb.h"
|
#include "shareddb.h"
|
||||||
#include "strings.h"
|
#include "strings.h"
|
||||||
|
#include "util/uuid.h"
|
||||||
//#include "../common/light_source.h"
|
//#include "../common/light_source.h"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
//#include <iostream>
|
//#include <iostream>
|
||||||
|
|
||||||
int32 NextItemInstSerialNumber = 1;
|
uint32 NextItemInstSerialNumber = 1;
|
||||||
|
|
||||||
static inline int32 GetNextItemInstSerialNumber() {
|
static inline uint32 GetNextItemInstSerialNumber() {
|
||||||
|
|
||||||
// The Bazaar relies on each item a client has up for Trade having a unique
|
// The Bazaar relies on each item a client has up for Trade having a unique
|
||||||
// identifier. This 'SerialNumber' is sent in Serialized item packets and
|
// identifier. This 'SerialNumber' is sent in Serialized item packets and
|
||||||
@@ -45,7 +45,7 @@ static inline int32 GetNextItemInstSerialNumber() {
|
|||||||
// NextItemInstSerialNumber is the next one to hand out.
|
// NextItemInstSerialNumber is the next one to hand out.
|
||||||
//
|
//
|
||||||
// It is very unlikely to reach 2,147,483,647. Maybe we should call abort(), rather than wrapping back to 1.
|
// It is very unlikely to reach 2,147,483,647. Maybe we should call abort(), rather than wrapping back to 1.
|
||||||
if(NextItemInstSerialNumber >= INT_MAX)
|
if(NextItemInstSerialNumber >= UINT_MAX)
|
||||||
NextItemInstSerialNumber = 1;
|
NextItemInstSerialNumber = 1;
|
||||||
else
|
else
|
||||||
NextItemInstSerialNumber++;
|
NextItemInstSerialNumber++;
|
||||||
@@ -56,13 +56,21 @@ static inline int32 GetNextItemInstSerialNumber() {
|
|||||||
//
|
//
|
||||||
// class EQ::ItemInstance
|
// class EQ::ItemInstance
|
||||||
//
|
//
|
||||||
EQ::ItemInstance::ItemInstance(const ItemData* item, int16 charges) {
|
EQ::ItemInstance::ItemInstance(const ItemData* item, const std::string& guid, int16 charges) {
|
||||||
m_use_type = ItemInstNormal;
|
m_use_type = ItemInstNormal;
|
||||||
if(item) {
|
if(item) {
|
||||||
m_item = new ItemData(*item);
|
m_item = new ItemData(*item);
|
||||||
} else {
|
} else {
|
||||||
m_item = nullptr;
|
m_item = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (guid.empty()) {
|
||||||
|
m_guid = EQ::Util::UUID::Generate().ToString();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_guid = guid;
|
||||||
|
}
|
||||||
|
|
||||||
m_charges = charges;
|
m_charges = charges;
|
||||||
m_price = 0;
|
m_price = 0;
|
||||||
m_attuned = false;
|
m_attuned = false;
|
||||||
@@ -72,7 +80,7 @@ EQ::ItemInstance::ItemInstance(const ItemData* item, int16 charges) {
|
|||||||
else
|
else
|
||||||
m_color = 0;
|
m_color = 0;
|
||||||
m_merchantcount = 1;
|
m_merchantcount = 1;
|
||||||
m_SerialNumber = GetNextItemInstSerialNumber();
|
m_serial_number = GetNextItemInstSerialNumber();
|
||||||
|
|
||||||
m_exp = 0;
|
m_exp = 0;
|
||||||
m_evolveLvl = 0;
|
m_evolveLvl = 0;
|
||||||
@@ -85,9 +93,10 @@ EQ::ItemInstance::ItemInstance(const ItemData* item, int16 charges) {
|
|||||||
m_ornament_hero_model = 0;
|
m_ornament_hero_model = 0;
|
||||||
m_recast_timestamp = 0;
|
m_recast_timestamp = 0;
|
||||||
m_new_id_file = 0;
|
m_new_id_file = 0;
|
||||||
|
m_currentslot = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges) {
|
EQ::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, const std::string& guid, int16 charges) {
|
||||||
m_use_type = ItemInstNormal;
|
m_use_type = ItemInstNormal;
|
||||||
m_item = db->GetItem(item_id);
|
m_item = db->GetItem(item_id);
|
||||||
if(m_item) {
|
if(m_item) {
|
||||||
@@ -97,6 +106,13 @@ EQ::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges
|
|||||||
m_item = nullptr;
|
m_item = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (guid.empty()) {
|
||||||
|
m_guid = EQ::Util::UUID::Generate().ToString();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_guid = guid;
|
||||||
|
}
|
||||||
|
|
||||||
m_charges = charges;
|
m_charges = charges;
|
||||||
m_price = 0;
|
m_price = 0;
|
||||||
m_merchantslot = 0;
|
m_merchantslot = 0;
|
||||||
@@ -106,7 +122,7 @@ EQ::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges
|
|||||||
else
|
else
|
||||||
m_color = 0;
|
m_color = 0;
|
||||||
m_merchantcount = 1;
|
m_merchantcount = 1;
|
||||||
m_SerialNumber = GetNextItemInstSerialNumber();
|
m_serial_number = GetNextItemInstSerialNumber();
|
||||||
|
|
||||||
m_exp = 0;
|
m_exp = 0;
|
||||||
m_evolveLvl = 0;
|
m_evolveLvl = 0;
|
||||||
@@ -119,17 +135,20 @@ EQ::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges
|
|||||||
m_ornament_hero_model = 0;
|
m_ornament_hero_model = 0;
|
||||||
m_recast_timestamp = 0;
|
m_recast_timestamp = 0;
|
||||||
m_new_id_file = 0;
|
m_new_id_file = 0;
|
||||||
|
m_currentslot = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::ItemInstance::ItemInstance(ItemInstTypes use_type) {
|
EQ::ItemInstance::ItemInstance(ItemInstTypes use_type) {
|
||||||
m_use_type = use_type;
|
m_use_type = use_type;
|
||||||
|
|
||||||
|
m_guid = EQ::Util::UUID::Generate().ToString();
|
||||||
m_item = nullptr;
|
m_item = nullptr;
|
||||||
m_charges = 0;
|
m_charges = 0;
|
||||||
m_price = 0;
|
m_price = 0;
|
||||||
m_attuned = false;
|
m_attuned = false;
|
||||||
m_merchantslot = 0;
|
m_merchantslot = 0;
|
||||||
m_color = 0;
|
m_color = 0;
|
||||||
|
m_serial_number = 0;
|
||||||
m_exp = 0;
|
m_exp = 0;
|
||||||
m_evolveLvl = 0;
|
m_evolveLvl = 0;
|
||||||
m_activated = false;
|
m_activated = false;
|
||||||
@@ -141,6 +160,8 @@ EQ::ItemInstance::ItemInstance(ItemInstTypes use_type) {
|
|||||||
m_ornament_hero_model = 0;
|
m_ornament_hero_model = 0;
|
||||||
m_recast_timestamp = 0;
|
m_recast_timestamp = 0;
|
||||||
m_new_id_file = 0;
|
m_new_id_file = 0;
|
||||||
|
m_currentslot = 0;
|
||||||
|
m_merchantcount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make a copy of an EQ::ItemInstance object
|
// Make a copy of an EQ::ItemInstance object
|
||||||
@@ -152,6 +173,7 @@ EQ::ItemInstance::ItemInstance(const ItemInstance& copy)
|
|||||||
else
|
else
|
||||||
m_item = nullptr;
|
m_item = nullptr;
|
||||||
|
|
||||||
|
m_guid = copy.m_guid;
|
||||||
m_charges=copy.m_charges;
|
m_charges=copy.m_charges;
|
||||||
m_price=copy.m_price;
|
m_price=copy.m_price;
|
||||||
m_color=copy.m_color;
|
m_color=copy.m_color;
|
||||||
@@ -176,7 +198,7 @@ EQ::ItemInstance::ItemInstance(const ItemInstance& copy)
|
|||||||
for (iter = copy.m_custom_data.begin(); iter != copy.m_custom_data.end(); ++iter) {
|
for (iter = copy.m_custom_data.begin(); iter != copy.m_custom_data.end(); ++iter) {
|
||||||
m_custom_data[iter->first] = iter->second;
|
m_custom_data[iter->first] = iter->second;
|
||||||
}
|
}
|
||||||
m_SerialNumber = copy.m_SerialNumber;
|
m_serial_number = copy.m_serial_number;
|
||||||
m_custom_data = copy.m_custom_data;
|
m_custom_data = copy.m_custom_data;
|
||||||
m_timers = copy.m_timers;
|
m_timers = copy.m_timers;
|
||||||
|
|
||||||
@@ -610,7 +632,7 @@ bool EQ::ItemInstance::UpdateOrnamentationInfo() {
|
|||||||
SetOrnamentHeroModel(ornamentItem->HerosForgeModel);
|
SetOrnamentHeroModel(ornamentItem->HerosForgeModel);
|
||||||
if (strlen(ornamentItem->IDFile) > 2)
|
if (strlen(ornamentItem->IDFile) > 2)
|
||||||
{
|
{
|
||||||
SetOrnamentationIDFile(atoi(&ornamentItem->IDFile[2]));
|
SetOrnamentationIDFile(Strings::ToInt(&ornamentItem->IDFile[2]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -69,9 +69,9 @@ namespace EQ
|
|||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
||||||
// Constructors/Destructor
|
// Constructors/Destructor
|
||||||
ItemInstance(const ItemData* item = nullptr, int16 charges = 0);
|
ItemInstance(const ItemData* item, const std::string& guid, int16 charges);
|
||||||
|
|
||||||
ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges = 0);
|
ItemInstance(SharedDatabase *db, uint32 item_id, const std::string &guid, int16 charges);
|
||||||
|
|
||||||
ItemInstance(ItemInstTypes use_type);
|
ItemInstance(ItemInstTypes use_type);
|
||||||
|
|
||||||
@@ -79,6 +79,8 @@ namespace EQ
|
|||||||
|
|
||||||
~ItemInstance();
|
~ItemInstance();
|
||||||
|
|
||||||
|
inline std::string GetGuid() const { return m_guid; }
|
||||||
|
|
||||||
// Query item type
|
// Query item type
|
||||||
bool IsType(item::ItemClass item_class) const;
|
bool IsType(item::ItemClass item_class) const;
|
||||||
|
|
||||||
@@ -225,8 +227,8 @@ namespace EQ
|
|||||||
std::string Serialize(int16 slot_id) const { InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(InternalSerializedItem_Struct)); return ser; }
|
std::string Serialize(int16 slot_id) const { InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(InternalSerializedItem_Struct)); return ser; }
|
||||||
void Serialize(OutBuffer& ob, int16 slot_id) const { InternalSerializedItem_Struct isi; isi.slot_id = slot_id; isi.inst = (const void*)this; ob.write((const char*)&isi, sizeof(isi)); }
|
void Serialize(OutBuffer& ob, int16 slot_id) const { InternalSerializedItem_Struct isi; isi.slot_id = slot_id; isi.inst = (const void*)this; ob.write((const char*)&isi, sizeof(isi)); }
|
||||||
|
|
||||||
inline int32 GetSerialNumber() const { return m_SerialNumber; }
|
inline int32 GetSerialNumber() const { return m_serial_number; }
|
||||||
inline void SetSerialNumber(int32 id) { m_SerialNumber = id; }
|
inline void SetSerialNumber(int32 id) { m_serial_number = id; }
|
||||||
|
|
||||||
std::map<std::string, ::Timer>& GetTimers() { return m_timers; }
|
std::map<std::string, ::Timer>& GetTimers() { return m_timers; }
|
||||||
void SetTimer(std::string name, uint32 time);
|
void SetTimer(std::string name, uint32 time);
|
||||||
@@ -303,6 +305,7 @@ namespace EQ
|
|||||||
|
|
||||||
void _PutItem(uint8 index, ItemInstance* inst) { m_contents[index] = inst; }
|
void _PutItem(uint8 index, ItemInstance* inst) { m_contents[index] = inst; }
|
||||||
|
|
||||||
|
std::string m_guid;
|
||||||
ItemInstTypes m_use_type; // Usage type for item
|
ItemInstTypes m_use_type; // Usage type for item
|
||||||
const ItemData* m_item; // Ptr to item data
|
const ItemData* m_item; // Ptr to item data
|
||||||
int16 m_charges; // # of charges for chargeable items
|
int16 m_charges; // # of charges for chargeable items
|
||||||
@@ -312,7 +315,7 @@ namespace EQ
|
|||||||
int16 m_currentslot;
|
int16 m_currentslot;
|
||||||
bool m_attuned;
|
bool m_attuned;
|
||||||
int32 m_merchantcount; //number avaliable on the merchant, -1=unlimited
|
int32 m_merchantcount; //number avaliable on the merchant, -1=unlimited
|
||||||
int32 m_SerialNumber; // Unique identifier for this instance of an item. Needed for Bazaar.
|
uint32 m_serial_number; // Unique identifier for this instance of an item. Needed for Bazaar.
|
||||||
uint32 m_exp;
|
uint32 m_exp;
|
||||||
int8 m_evolveLvl;
|
int8 m_evolveLvl;
|
||||||
bool m_activated;
|
bool m_activated;
|
||||||
|
|||||||
+2
-1
@@ -18,6 +18,7 @@
|
|||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include "strings.h"
|
||||||
|
|
||||||
std::map<int,std::string> DBFieldNames;
|
std::map<int,std::string> DBFieldNames;
|
||||||
|
|
||||||
@@ -150,7 +151,7 @@ static char *temp=nullptr;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
uint32 id = atoi(field[id_pos].c_str());
|
uint32 id = Strings::ToInt(field[id_pos].c_str());
|
||||||
items[id]=field;
|
items[id]=field;
|
||||||
|
|
||||||
for(i=0;i<10;i++) {
|
for(i=0;i<10;i++) {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "misc_functions.h"
|
#include "misc_functions.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include "strings.h"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
@@ -130,7 +131,7 @@ bool ParseAddress(const char* iAddress, uint32* oIP, uint16* oPort, char* errbuf
|
|||||||
if (*oIP == 0)
|
if (*oIP == 0)
|
||||||
return false;
|
return false;
|
||||||
if (oPort)
|
if (oPort)
|
||||||
*oPort = atoi(sep.arg[1]);
|
*oPort = Strings::ToInt(sep.arg[1]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -2095,13 +2095,13 @@ namespace SoF
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val = atoi(&emu->lastName[2]);
|
val = Strings::ToInt(&emu->lastName[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sep[0] = nullptr;
|
sep[0] = nullptr;
|
||||||
ofs = atoi(&emu->lastName[2]);
|
ofs = Strings::ToInt(&emu->lastName[2]);
|
||||||
sep[0] = '=';
|
sep[0] = '=';
|
||||||
if ((sep[1] < '0') || (sep[1] > '9'))
|
if ((sep[1] < '0') || (sep[1] > '9'))
|
||||||
{
|
{
|
||||||
@@ -2109,7 +2109,7 @@ namespace SoF
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val = atoi(&sep[1]);
|
val = Strings::ToInt(&sep[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -288,7 +288,7 @@ bool PTimerList::Load(Database *db) {
|
|||||||
PersistentTimer *cur;
|
PersistentTimer *cur;
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
type = atoi(row[0]);
|
type = Strings::ToInt(row[0]);
|
||||||
start_time = strtoul(row[1], nullptr, 10);
|
start_time = strtoul(row[1], nullptr, 10);
|
||||||
timer_time = strtoul(row[2], nullptr, 10);
|
timer_time = strtoul(row[2], nullptr, 10);
|
||||||
enabled = (row[3][0] == '1');
|
enabled = (row[3][0] == '1');
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ public:
|
|||||||
int32_t expansion_bitmask;
|
int32_t expansion_bitmask;
|
||||||
uint8_t enforce_spell_settings;
|
uint8_t enforce_spell_settings;
|
||||||
uint8_t archery_setting;
|
uint8_t archery_setting;
|
||||||
|
uint32_t caster_range;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -129,6 +130,7 @@ public:
|
|||||||
"expansion_bitmask",
|
"expansion_bitmask",
|
||||||
"enforce_spell_settings",
|
"enforce_spell_settings",
|
||||||
"archery_setting",
|
"archery_setting",
|
||||||
|
"caster_range",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,6 +187,7 @@ public:
|
|||||||
"expansion_bitmask",
|
"expansion_bitmask",
|
||||||
"enforce_spell_settings",
|
"enforce_spell_settings",
|
||||||
"archery_setting",
|
"archery_setting",
|
||||||
|
"caster_range",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,6 +278,7 @@ public:
|
|||||||
e.expansion_bitmask = -1;
|
e.expansion_bitmask = -1;
|
||||||
e.enforce_spell_settings = 0;
|
e.enforce_spell_settings = 0;
|
||||||
e.archery_setting = 0;
|
e.archery_setting = 0;
|
||||||
|
e.caster_range = 0;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -361,6 +365,7 @@ public:
|
|||||||
e.expansion_bitmask = static_cast<int32_t>(atoi(row[47]));
|
e.expansion_bitmask = static_cast<int32_t>(atoi(row[47]));
|
||||||
e.enforce_spell_settings = static_cast<uint8_t>(strtoul(row[48], nullptr, 10));
|
e.enforce_spell_settings = static_cast<uint8_t>(strtoul(row[48], nullptr, 10));
|
||||||
e.archery_setting = static_cast<uint8_t>(strtoul(row[49], nullptr, 10));
|
e.archery_setting = static_cast<uint8_t>(strtoul(row[49], nullptr, 10));
|
||||||
|
e.caster_range = static_cast<uint32_t>(strtoul(row[50], nullptr, 10));
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -443,6 +448,7 @@ public:
|
|||||||
v.push_back(columns[47] + " = " + std::to_string(e.expansion_bitmask));
|
v.push_back(columns[47] + " = " + std::to_string(e.expansion_bitmask));
|
||||||
v.push_back(columns[48] + " = " + std::to_string(e.enforce_spell_settings));
|
v.push_back(columns[48] + " = " + std::to_string(e.enforce_spell_settings));
|
||||||
v.push_back(columns[49] + " = " + std::to_string(e.archery_setting));
|
v.push_back(columns[49] + " = " + std::to_string(e.archery_setting));
|
||||||
|
v.push_back(columns[50] + " = " + std::to_string(e.caster_range));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -514,6 +520,7 @@ public:
|
|||||||
v.push_back(std::to_string(e.expansion_bitmask));
|
v.push_back(std::to_string(e.expansion_bitmask));
|
||||||
v.push_back(std::to_string(e.enforce_spell_settings));
|
v.push_back(std::to_string(e.enforce_spell_settings));
|
||||||
v.push_back(std::to_string(e.archery_setting));
|
v.push_back(std::to_string(e.archery_setting));
|
||||||
|
v.push_back(std::to_string(e.caster_range));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -593,6 +600,7 @@ public:
|
|||||||
v.push_back(std::to_string(e.expansion_bitmask));
|
v.push_back(std::to_string(e.expansion_bitmask));
|
||||||
v.push_back(std::to_string(e.enforce_spell_settings));
|
v.push_back(std::to_string(e.enforce_spell_settings));
|
||||||
v.push_back(std::to_string(e.archery_setting));
|
v.push_back(std::to_string(e.archery_setting));
|
||||||
|
v.push_back(std::to_string(e.caster_range));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -676,6 +684,7 @@ public:
|
|||||||
e.expansion_bitmask = static_cast<int32_t>(atoi(row[47]));
|
e.expansion_bitmask = static_cast<int32_t>(atoi(row[47]));
|
||||||
e.enforce_spell_settings = static_cast<uint8_t>(strtoul(row[48], nullptr, 10));
|
e.enforce_spell_settings = static_cast<uint8_t>(strtoul(row[48], nullptr, 10));
|
||||||
e.archery_setting = static_cast<uint8_t>(strtoul(row[49], nullptr, 10));
|
e.archery_setting = static_cast<uint8_t>(strtoul(row[49], nullptr, 10));
|
||||||
|
e.caster_range = static_cast<uint32_t>(strtoul(row[50], nullptr, 10));
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -750,6 +759,7 @@ public:
|
|||||||
e.expansion_bitmask = static_cast<int32_t>(atoi(row[47]));
|
e.expansion_bitmask = static_cast<int32_t>(atoi(row[47]));
|
||||||
e.enforce_spell_settings = static_cast<uint8_t>(strtoul(row[48], nullptr, 10));
|
e.enforce_spell_settings = static_cast<uint8_t>(strtoul(row[48], nullptr, 10));
|
||||||
e.archery_setting = static_cast<uint8_t>(strtoul(row[49], nullptr, 10));
|
e.archery_setting = static_cast<uint8_t>(strtoul(row[49], nullptr, 10));
|
||||||
|
e.caster_range = static_cast<uint32_t>(strtoul(row[50], nullptr, 10));
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,14 @@
|
|||||||
#include "../../strings.h"
|
#include "../../strings.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
|
|
||||||
class BaseNpcScaleGlobalBaseRepository {
|
class BaseNpcScaleGlobalBaseRepository {
|
||||||
public:
|
public:
|
||||||
struct NpcScaleGlobalBase {
|
struct NpcScaleGlobalBase {
|
||||||
int32_t type;
|
int32_t type;
|
||||||
int32_t level;
|
int32_t level;
|
||||||
|
std::string zone_id_list;
|
||||||
|
std::string instance_version_list;
|
||||||
int32_t ac;
|
int32_t ac;
|
||||||
int32_t hp;
|
int32_t hp;
|
||||||
int32_t accuracy;
|
int32_t accuracy;
|
||||||
@@ -59,6 +62,8 @@ public:
|
|||||||
return {
|
return {
|
||||||
"type",
|
"type",
|
||||||
"level",
|
"level",
|
||||||
|
"zone_id_list",
|
||||||
|
"instance_version_list",
|
||||||
"ac",
|
"ac",
|
||||||
"hp",
|
"hp",
|
||||||
"accuracy",
|
"accuracy",
|
||||||
@@ -93,6 +98,8 @@ public:
|
|||||||
return {
|
return {
|
||||||
"type",
|
"type",
|
||||||
"level",
|
"level",
|
||||||
|
"zone_id_list",
|
||||||
|
"instance_version_list",
|
||||||
"ac",
|
"ac",
|
||||||
"hp",
|
"hp",
|
||||||
"accuracy",
|
"accuracy",
|
||||||
@@ -161,6 +168,8 @@ public:
|
|||||||
|
|
||||||
e.type = 0;
|
e.type = 0;
|
||||||
e.level = 0;
|
e.level = 0;
|
||||||
|
e.zone_id_list = "";
|
||||||
|
e.instance_version_list = "";
|
||||||
e.ac = 0;
|
e.ac = 0;
|
||||||
e.hp = 0;
|
e.hp = 0;
|
||||||
e.accuracy = 0;
|
e.accuracy = 0;
|
||||||
@@ -212,8 +221,9 @@ public:
|
|||||||
{
|
{
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} WHERE id = {} LIMIT 1",
|
"{} WHERE {} = {} LIMIT 1",
|
||||||
BaseSelect(),
|
BaseSelect(),
|
||||||
|
PrimaryKey(),
|
||||||
npc_scale_global_base_id
|
npc_scale_global_base_id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -224,32 +234,34 @@ public:
|
|||||||
|
|
||||||
e.type = static_cast<int32_t>(atoi(row[0]));
|
e.type = static_cast<int32_t>(atoi(row[0]));
|
||||||
e.level = static_cast<int32_t>(atoi(row[1]));
|
e.level = static_cast<int32_t>(atoi(row[1]));
|
||||||
e.ac = static_cast<int32_t>(atoi(row[2]));
|
e.zone_id_list = row[2] ? row[2] : "";
|
||||||
e.hp = static_cast<int32_t>(atoi(row[3]));
|
e.instance_version_list = row[3] ? row[3] : "";
|
||||||
e.accuracy = static_cast<int32_t>(atoi(row[4]));
|
e.ac = static_cast<int32_t>(atoi(row[4]));
|
||||||
e.slow_mitigation = static_cast<int32_t>(atoi(row[5]));
|
e.hp = static_cast<int32_t>(atoi(row[5]));
|
||||||
e.attack = static_cast<int32_t>(atoi(row[6]));
|
e.accuracy = static_cast<int32_t>(atoi(row[6]));
|
||||||
e.strength = static_cast<int32_t>(atoi(row[7]));
|
e.slow_mitigation = static_cast<int32_t>(atoi(row[7]));
|
||||||
e.stamina = static_cast<int32_t>(atoi(row[8]));
|
e.attack = static_cast<int32_t>(atoi(row[8]));
|
||||||
e.dexterity = static_cast<int32_t>(atoi(row[9]));
|
e.strength = static_cast<int32_t>(atoi(row[9]));
|
||||||
e.agility = static_cast<int32_t>(atoi(row[10]));
|
e.stamina = static_cast<int32_t>(atoi(row[10]));
|
||||||
e.intelligence = static_cast<int32_t>(atoi(row[11]));
|
e.dexterity = static_cast<int32_t>(atoi(row[11]));
|
||||||
e.wisdom = static_cast<int32_t>(atoi(row[12]));
|
e.agility = static_cast<int32_t>(atoi(row[12]));
|
||||||
e.charisma = static_cast<int32_t>(atoi(row[13]));
|
e.intelligence = static_cast<int32_t>(atoi(row[13]));
|
||||||
e.magic_resist = static_cast<int32_t>(atoi(row[14]));
|
e.wisdom = static_cast<int32_t>(atoi(row[14]));
|
||||||
e.cold_resist = static_cast<int32_t>(atoi(row[15]));
|
e.charisma = static_cast<int32_t>(atoi(row[15]));
|
||||||
e.fire_resist = static_cast<int32_t>(atoi(row[16]));
|
e.magic_resist = static_cast<int32_t>(atoi(row[16]));
|
||||||
e.poison_resist = static_cast<int32_t>(atoi(row[17]));
|
e.cold_resist = static_cast<int32_t>(atoi(row[17]));
|
||||||
e.disease_resist = static_cast<int32_t>(atoi(row[18]));
|
e.fire_resist = static_cast<int32_t>(atoi(row[18]));
|
||||||
e.corruption_resist = static_cast<int32_t>(atoi(row[19]));
|
e.poison_resist = static_cast<int32_t>(atoi(row[19]));
|
||||||
e.physical_resist = static_cast<int32_t>(atoi(row[20]));
|
e.disease_resist = static_cast<int32_t>(atoi(row[20]));
|
||||||
e.min_dmg = static_cast<int32_t>(atoi(row[21]));
|
e.corruption_resist = static_cast<int32_t>(atoi(row[21]));
|
||||||
e.max_dmg = static_cast<int32_t>(atoi(row[22]));
|
e.physical_resist = static_cast<int32_t>(atoi(row[22]));
|
||||||
e.hp_regen_rate = static_cast<int32_t>(atoi(row[23]));
|
e.min_dmg = static_cast<int32_t>(atoi(row[23]));
|
||||||
e.attack_delay = static_cast<int32_t>(atoi(row[24]));
|
e.max_dmg = static_cast<int32_t>(atoi(row[24]));
|
||||||
e.spell_scale = static_cast<int32_t>(atoi(row[25]));
|
e.hp_regen_rate = static_cast<int32_t>(atoi(row[25]));
|
||||||
e.heal_scale = static_cast<int32_t>(atoi(row[26]));
|
e.attack_delay = static_cast<int32_t>(atoi(row[26]));
|
||||||
e.special_abilities = row[27] ? row[27] : "";
|
e.spell_scale = static_cast<int32_t>(atoi(row[27]));
|
||||||
|
e.heal_scale = static_cast<int32_t>(atoi(row[28]));
|
||||||
|
e.special_abilities = row[29] ? row[29] : "";
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -285,32 +297,34 @@ public:
|
|||||||
|
|
||||||
v.push_back(columns[0] + " = " + std::to_string(e.type));
|
v.push_back(columns[0] + " = " + std::to_string(e.type));
|
||||||
v.push_back(columns[1] + " = " + std::to_string(e.level));
|
v.push_back(columns[1] + " = " + std::to_string(e.level));
|
||||||
v.push_back(columns[2] + " = " + std::to_string(e.ac));
|
v.push_back(columns[2] + " = '" + Strings::Escape(e.zone_id_list) + "'");
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.hp));
|
v.push_back(columns[3] + " = '" + Strings::Escape(e.instance_version_list) + "'");
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.accuracy));
|
v.push_back(columns[4] + " = " + std::to_string(e.ac));
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.slow_mitigation));
|
v.push_back(columns[5] + " = " + std::to_string(e.hp));
|
||||||
v.push_back(columns[6] + " = " + std::to_string(e.attack));
|
v.push_back(columns[6] + " = " + std::to_string(e.accuracy));
|
||||||
v.push_back(columns[7] + " = " + std::to_string(e.strength));
|
v.push_back(columns[7] + " = " + std::to_string(e.slow_mitigation));
|
||||||
v.push_back(columns[8] + " = " + std::to_string(e.stamina));
|
v.push_back(columns[8] + " = " + std::to_string(e.attack));
|
||||||
v.push_back(columns[9] + " = " + std::to_string(e.dexterity));
|
v.push_back(columns[9] + " = " + std::to_string(e.strength));
|
||||||
v.push_back(columns[10] + " = " + std::to_string(e.agility));
|
v.push_back(columns[10] + " = " + std::to_string(e.stamina));
|
||||||
v.push_back(columns[11] + " = " + std::to_string(e.intelligence));
|
v.push_back(columns[11] + " = " + std::to_string(e.dexterity));
|
||||||
v.push_back(columns[12] + " = " + std::to_string(e.wisdom));
|
v.push_back(columns[12] + " = " + std::to_string(e.agility));
|
||||||
v.push_back(columns[13] + " = " + std::to_string(e.charisma));
|
v.push_back(columns[13] + " = " + std::to_string(e.intelligence));
|
||||||
v.push_back(columns[14] + " = " + std::to_string(e.magic_resist));
|
v.push_back(columns[14] + " = " + std::to_string(e.wisdom));
|
||||||
v.push_back(columns[15] + " = " + std::to_string(e.cold_resist));
|
v.push_back(columns[15] + " = " + std::to_string(e.charisma));
|
||||||
v.push_back(columns[16] + " = " + std::to_string(e.fire_resist));
|
v.push_back(columns[16] + " = " + std::to_string(e.magic_resist));
|
||||||
v.push_back(columns[17] + " = " + std::to_string(e.poison_resist));
|
v.push_back(columns[17] + " = " + std::to_string(e.cold_resist));
|
||||||
v.push_back(columns[18] + " = " + std::to_string(e.disease_resist));
|
v.push_back(columns[18] + " = " + std::to_string(e.fire_resist));
|
||||||
v.push_back(columns[19] + " = " + std::to_string(e.corruption_resist));
|
v.push_back(columns[19] + " = " + std::to_string(e.poison_resist));
|
||||||
v.push_back(columns[20] + " = " + std::to_string(e.physical_resist));
|
v.push_back(columns[20] + " = " + std::to_string(e.disease_resist));
|
||||||
v.push_back(columns[21] + " = " + std::to_string(e.min_dmg));
|
v.push_back(columns[21] + " = " + std::to_string(e.corruption_resist));
|
||||||
v.push_back(columns[22] + " = " + std::to_string(e.max_dmg));
|
v.push_back(columns[22] + " = " + std::to_string(e.physical_resist));
|
||||||
v.push_back(columns[23] + " = " + std::to_string(e.hp_regen_rate));
|
v.push_back(columns[23] + " = " + std::to_string(e.min_dmg));
|
||||||
v.push_back(columns[24] + " = " + std::to_string(e.attack_delay));
|
v.push_back(columns[24] + " = " + std::to_string(e.max_dmg));
|
||||||
v.push_back(columns[25] + " = " + std::to_string(e.spell_scale));
|
v.push_back(columns[25] + " = " + std::to_string(e.hp_regen_rate));
|
||||||
v.push_back(columns[26] + " = " + std::to_string(e.heal_scale));
|
v.push_back(columns[26] + " = " + std::to_string(e.attack_delay));
|
||||||
v.push_back(columns[27] + " = '" + Strings::Escape(e.special_abilities) + "'");
|
v.push_back(columns[27] + " = " + std::to_string(e.spell_scale));
|
||||||
|
v.push_back(columns[28] + " = " + std::to_string(e.heal_scale));
|
||||||
|
v.push_back(columns[29] + " = '" + Strings::Escape(e.special_abilities) + "'");
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -334,6 +348,8 @@ public:
|
|||||||
|
|
||||||
v.push_back(std::to_string(e.type));
|
v.push_back(std::to_string(e.type));
|
||||||
v.push_back(std::to_string(e.level));
|
v.push_back(std::to_string(e.level));
|
||||||
|
v.push_back("'" + Strings::Escape(e.zone_id_list) + "'");
|
||||||
|
v.push_back("'" + Strings::Escape(e.instance_version_list) + "'");
|
||||||
v.push_back(std::to_string(e.ac));
|
v.push_back(std::to_string(e.ac));
|
||||||
v.push_back(std::to_string(e.hp));
|
v.push_back(std::to_string(e.hp));
|
||||||
v.push_back(std::to_string(e.accuracy));
|
v.push_back(std::to_string(e.accuracy));
|
||||||
@@ -391,6 +407,8 @@ public:
|
|||||||
|
|
||||||
v.push_back(std::to_string(e.type));
|
v.push_back(std::to_string(e.type));
|
||||||
v.push_back(std::to_string(e.level));
|
v.push_back(std::to_string(e.level));
|
||||||
|
v.push_back("'" + Strings::Escape(e.zone_id_list) + "'");
|
||||||
|
v.push_back("'" + Strings::Escape(e.instance_version_list) + "'");
|
||||||
v.push_back(std::to_string(e.ac));
|
v.push_back(std::to_string(e.ac));
|
||||||
v.push_back(std::to_string(e.hp));
|
v.push_back(std::to_string(e.hp));
|
||||||
v.push_back(std::to_string(e.accuracy));
|
v.push_back(std::to_string(e.accuracy));
|
||||||
@@ -452,32 +470,34 @@ public:
|
|||||||
|
|
||||||
e.type = static_cast<int32_t>(atoi(row[0]));
|
e.type = static_cast<int32_t>(atoi(row[0]));
|
||||||
e.level = static_cast<int32_t>(atoi(row[1]));
|
e.level = static_cast<int32_t>(atoi(row[1]));
|
||||||
e.ac = static_cast<int32_t>(atoi(row[2]));
|
e.zone_id_list = row[2] ? row[2] : "";
|
||||||
e.hp = static_cast<int32_t>(atoi(row[3]));
|
e.instance_version_list = row[3] ? row[3] : "";
|
||||||
e.accuracy = static_cast<int32_t>(atoi(row[4]));
|
e.ac = static_cast<int32_t>(atoi(row[4]));
|
||||||
e.slow_mitigation = static_cast<int32_t>(atoi(row[5]));
|
e.hp = static_cast<int32_t>(atoi(row[5]));
|
||||||
e.attack = static_cast<int32_t>(atoi(row[6]));
|
e.accuracy = static_cast<int32_t>(atoi(row[6]));
|
||||||
e.strength = static_cast<int32_t>(atoi(row[7]));
|
e.slow_mitigation = static_cast<int32_t>(atoi(row[7]));
|
||||||
e.stamina = static_cast<int32_t>(atoi(row[8]));
|
e.attack = static_cast<int32_t>(atoi(row[8]));
|
||||||
e.dexterity = static_cast<int32_t>(atoi(row[9]));
|
e.strength = static_cast<int32_t>(atoi(row[9]));
|
||||||
e.agility = static_cast<int32_t>(atoi(row[10]));
|
e.stamina = static_cast<int32_t>(atoi(row[10]));
|
||||||
e.intelligence = static_cast<int32_t>(atoi(row[11]));
|
e.dexterity = static_cast<int32_t>(atoi(row[11]));
|
||||||
e.wisdom = static_cast<int32_t>(atoi(row[12]));
|
e.agility = static_cast<int32_t>(atoi(row[12]));
|
||||||
e.charisma = static_cast<int32_t>(atoi(row[13]));
|
e.intelligence = static_cast<int32_t>(atoi(row[13]));
|
||||||
e.magic_resist = static_cast<int32_t>(atoi(row[14]));
|
e.wisdom = static_cast<int32_t>(atoi(row[14]));
|
||||||
e.cold_resist = static_cast<int32_t>(atoi(row[15]));
|
e.charisma = static_cast<int32_t>(atoi(row[15]));
|
||||||
e.fire_resist = static_cast<int32_t>(atoi(row[16]));
|
e.magic_resist = static_cast<int32_t>(atoi(row[16]));
|
||||||
e.poison_resist = static_cast<int32_t>(atoi(row[17]));
|
e.cold_resist = static_cast<int32_t>(atoi(row[17]));
|
||||||
e.disease_resist = static_cast<int32_t>(atoi(row[18]));
|
e.fire_resist = static_cast<int32_t>(atoi(row[18]));
|
||||||
e.corruption_resist = static_cast<int32_t>(atoi(row[19]));
|
e.poison_resist = static_cast<int32_t>(atoi(row[19]));
|
||||||
e.physical_resist = static_cast<int32_t>(atoi(row[20]));
|
e.disease_resist = static_cast<int32_t>(atoi(row[20]));
|
||||||
e.min_dmg = static_cast<int32_t>(atoi(row[21]));
|
e.corruption_resist = static_cast<int32_t>(atoi(row[21]));
|
||||||
e.max_dmg = static_cast<int32_t>(atoi(row[22]));
|
e.physical_resist = static_cast<int32_t>(atoi(row[22]));
|
||||||
e.hp_regen_rate = static_cast<int32_t>(atoi(row[23]));
|
e.min_dmg = static_cast<int32_t>(atoi(row[23]));
|
||||||
e.attack_delay = static_cast<int32_t>(atoi(row[24]));
|
e.max_dmg = static_cast<int32_t>(atoi(row[24]));
|
||||||
e.spell_scale = static_cast<int32_t>(atoi(row[25]));
|
e.hp_regen_rate = static_cast<int32_t>(atoi(row[25]));
|
||||||
e.heal_scale = static_cast<int32_t>(atoi(row[26]));
|
e.attack_delay = static_cast<int32_t>(atoi(row[26]));
|
||||||
e.special_abilities = row[27] ? row[27] : "";
|
e.spell_scale = static_cast<int32_t>(atoi(row[27]));
|
||||||
|
e.heal_scale = static_cast<int32_t>(atoi(row[28]));
|
||||||
|
e.special_abilities = row[29] ? row[29] : "";
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -504,32 +524,34 @@ public:
|
|||||||
|
|
||||||
e.type = static_cast<int32_t>(atoi(row[0]));
|
e.type = static_cast<int32_t>(atoi(row[0]));
|
||||||
e.level = static_cast<int32_t>(atoi(row[1]));
|
e.level = static_cast<int32_t>(atoi(row[1]));
|
||||||
e.ac = static_cast<int32_t>(atoi(row[2]));
|
e.zone_id_list = row[2] ? row[2] : "";
|
||||||
e.hp = static_cast<int32_t>(atoi(row[3]));
|
e.instance_version_list = row[3] ? row[3] : "";
|
||||||
e.accuracy = static_cast<int32_t>(atoi(row[4]));
|
e.ac = static_cast<int32_t>(atoi(row[4]));
|
||||||
e.slow_mitigation = static_cast<int32_t>(atoi(row[5]));
|
e.hp = static_cast<int32_t>(atoi(row[5]));
|
||||||
e.attack = static_cast<int32_t>(atoi(row[6]));
|
e.accuracy = static_cast<int32_t>(atoi(row[6]));
|
||||||
e.strength = static_cast<int32_t>(atoi(row[7]));
|
e.slow_mitigation = static_cast<int32_t>(atoi(row[7]));
|
||||||
e.stamina = static_cast<int32_t>(atoi(row[8]));
|
e.attack = static_cast<int32_t>(atoi(row[8]));
|
||||||
e.dexterity = static_cast<int32_t>(atoi(row[9]));
|
e.strength = static_cast<int32_t>(atoi(row[9]));
|
||||||
e.agility = static_cast<int32_t>(atoi(row[10]));
|
e.stamina = static_cast<int32_t>(atoi(row[10]));
|
||||||
e.intelligence = static_cast<int32_t>(atoi(row[11]));
|
e.dexterity = static_cast<int32_t>(atoi(row[11]));
|
||||||
e.wisdom = static_cast<int32_t>(atoi(row[12]));
|
e.agility = static_cast<int32_t>(atoi(row[12]));
|
||||||
e.charisma = static_cast<int32_t>(atoi(row[13]));
|
e.intelligence = static_cast<int32_t>(atoi(row[13]));
|
||||||
e.magic_resist = static_cast<int32_t>(atoi(row[14]));
|
e.wisdom = static_cast<int32_t>(atoi(row[14]));
|
||||||
e.cold_resist = static_cast<int32_t>(atoi(row[15]));
|
e.charisma = static_cast<int32_t>(atoi(row[15]));
|
||||||
e.fire_resist = static_cast<int32_t>(atoi(row[16]));
|
e.magic_resist = static_cast<int32_t>(atoi(row[16]));
|
||||||
e.poison_resist = static_cast<int32_t>(atoi(row[17]));
|
e.cold_resist = static_cast<int32_t>(atoi(row[17]));
|
||||||
e.disease_resist = static_cast<int32_t>(atoi(row[18]));
|
e.fire_resist = static_cast<int32_t>(atoi(row[18]));
|
||||||
e.corruption_resist = static_cast<int32_t>(atoi(row[19]));
|
e.poison_resist = static_cast<int32_t>(atoi(row[19]));
|
||||||
e.physical_resist = static_cast<int32_t>(atoi(row[20]));
|
e.disease_resist = static_cast<int32_t>(atoi(row[20]));
|
||||||
e.min_dmg = static_cast<int32_t>(atoi(row[21]));
|
e.corruption_resist = static_cast<int32_t>(atoi(row[21]));
|
||||||
e.max_dmg = static_cast<int32_t>(atoi(row[22]));
|
e.physical_resist = static_cast<int32_t>(atoi(row[22]));
|
||||||
e.hp_regen_rate = static_cast<int32_t>(atoi(row[23]));
|
e.min_dmg = static_cast<int32_t>(atoi(row[23]));
|
||||||
e.attack_delay = static_cast<int32_t>(atoi(row[24]));
|
e.max_dmg = static_cast<int32_t>(atoi(row[24]));
|
||||||
e.spell_scale = static_cast<int32_t>(atoi(row[25]));
|
e.hp_regen_rate = static_cast<int32_t>(atoi(row[25]));
|
||||||
e.heal_scale = static_cast<int32_t>(atoi(row[26]));
|
e.attack_delay = static_cast<int32_t>(atoi(row[26]));
|
||||||
e.special_abilities = row[27] ? row[27] : "";
|
e.spell_scale = static_cast<int32_t>(atoi(row[27]));
|
||||||
|
e.heal_scale = static_cast<int32_t>(atoi(row[28]));
|
||||||
|
e.special_abilities = row[29] ? row[29] : "";
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -141,11 +141,11 @@ bool RuleManager::SetRule(const std::string &rule_name, const std::string &rule_
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case IntRule:
|
case IntRule:
|
||||||
m_RuleIntValues[index] = atoi(rule_value.c_str());
|
m_RuleIntValues[index] = Strings::ToInt(rule_value.c_str());
|
||||||
LogRules("Set rule [{}] to value [{}]", rule_name, m_RuleIntValues[index]);
|
LogRules("Set rule [{}] to value [{}]", rule_name, m_RuleIntValues[index]);
|
||||||
break;
|
break;
|
||||||
case RealRule:
|
case RealRule:
|
||||||
m_RuleRealValues[index] = atof(rule_value.c_str());
|
m_RuleRealValues[index] = Strings::ToFloat(rule_value.c_str());
|
||||||
LogRules("Set rule [{}] to value [{:.2f}]", rule_name, m_RuleRealValues[index]);
|
LogRules("Set rule [{}] to value [{:.2f}]", rule_name, m_RuleRealValues[index]);
|
||||||
break;
|
break;
|
||||||
case BoolRule:
|
case BoolRule:
|
||||||
|
|||||||
+8
-1
@@ -93,6 +93,12 @@ RULE_INT(Character, ItemEnduranceRegenCap, 15, "Limit on endurance regeneration
|
|||||||
RULE_INT(Character, ItemExtraDmgCap, 150, "Cap for bonuses to melee skills like Bash, Frenzy, etc.")
|
RULE_INT(Character, ItemExtraDmgCap, 150, "Cap for bonuses to melee skills like Bash, Frenzy, etc.")
|
||||||
RULE_INT(Character, HasteCap, 100, "Haste cap for non-v3(over haste) haste")
|
RULE_INT(Character, HasteCap, 100, "Haste cap for non-v3(over haste) haste")
|
||||||
RULE_INT(Character, Hastev3Cap, 25, "Haste cap for v3(over haste) haste")
|
RULE_INT(Character, Hastev3Cap, 25, "Haste cap for v3(over haste) haste")
|
||||||
|
RULE_REAL(Character, HeroicStrengthMultiplier, 1.00, "Multplier scales benefits from Heroic Strength. Grants 25 Base Endurance, 0.05 Endurance Regen, 1 Melee Damage each Hit, and 1 Shield AC per 10 Heroic Strength.")
|
||||||
|
RULE_REAL(Character, HeroicStaminaMultiplier, 1.00, "Multplier scales benefits from Heroic Stamina. Grants 25 Base Endurance, 0.05 Endurance Regen, 100 Base HP, and 0.5 HP Regen per 10 Heroic Stamina.")
|
||||||
|
RULE_REAL(Character, HeroicAgilityMultiplier, 1.00, "Multplier scales benefits from Heroic Agility. Grants 25 Base Endurance, 0.05 Endurance Regen, and 1 Avoidance AC per 10 Heroic Agility. (Rule does not change Dodge Chance)")
|
||||||
|
RULE_REAL(Character, HeroicDexterityMultiplier, 1.00, "Multplier scales benefits from Heroic Dexterity. Grants 25 Base Endurance, 0.05 Endurance Regen, and 1 Archery/Throwing Damage each hit per 10 Heroic Dexterity. (Rule does not change Assassinate/Headshot/Block/Parry/Riposte Chances)")
|
||||||
|
RULE_REAL(Character, HeroicWisdomMultiplier, 1.00, "Multplier scales benefits from Heroic Wisdom. Grants 250 Base Mana, 1 Mana Regen per 25 Heroic Wisdom.")
|
||||||
|
RULE_REAL(Character, HeroicIntelligenceMultiplier, 1.00, "Multplier scales benefits from Heroic Intelligence. Grants 250 Base Mana, 1 Mana Regen per 25 Heroic Intelligence.")
|
||||||
RULE_INT(Character, SkillUpModifier, 100, "The probability for a skill-up is multiplied by value/100")
|
RULE_INT(Character, SkillUpModifier, 100, "The probability for a skill-up is multiplied by value/100")
|
||||||
RULE_BOOL(Character, SharedBankPlat, false, "Shared bank platinum. Off by default to prevent duplication")
|
RULE_BOOL(Character, SharedBankPlat, false, "Shared bank platinum. Off by default to prevent duplication")
|
||||||
RULE_BOOL(Character, BindAnywhere, false, "Allows players to bind their soul anywhere in the world")
|
RULE_BOOL(Character, BindAnywhere, false, "Allows players to bind their soul anywhere in the world")
|
||||||
@@ -204,6 +210,7 @@ RULE_REAL(Character, FullGroupEXPModifier, 2.16, "Sets the group experience modi
|
|||||||
RULE_BOOL(Character, IgnoreLevelBasedHasteCaps, false, "Ignores hard coded level based haste caps.")
|
RULE_BOOL(Character, IgnoreLevelBasedHasteCaps, false, "Ignores hard coded level based haste caps.")
|
||||||
RULE_BOOL(Character, EnableRaidEXPModifier, true, "Enable or disable the raid experience modifier, default is true")
|
RULE_BOOL(Character, EnableRaidEXPModifier, true, "Enable or disable the raid experience modifier, default is true")
|
||||||
RULE_BOOL(Character, EnableRaidMemberEXPModifier, true, "Enable or disable the raid experience modifier based on members in raid, default is true")
|
RULE_BOOL(Character, EnableRaidMemberEXPModifier, true, "Enable or disable the raid experience modifier based on members in raid, default is true")
|
||||||
|
RULE_BOOL(Character, LeaveCursorMoneyOnCorpse, false, "Enable or disable leaving cursor money on player corpses")
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Mercs)
|
RULE_CATEGORY(Mercs)
|
||||||
@@ -319,7 +326,6 @@ RULE_CATEGORY_END()
|
|||||||
RULE_CATEGORY(Map)
|
RULE_CATEGORY(Map)
|
||||||
RULE_BOOL(Map, FixPathingZOnSendTo, false, "Try to repair Z coordinates in the SendTo routine as well")
|
RULE_BOOL(Map, FixPathingZOnSendTo, false, "Try to repair Z coordinates in the SendTo routine as well")
|
||||||
RULE_BOOL(Map, FixZWhenPathing, true, "Automatically fix NPC Z coordinates when moving/pathing/engaged (Far less CPU intensive than its predecessor)")
|
RULE_BOOL(Map, FixZWhenPathing, true, "Automatically fix NPC Z coordinates when moving/pathing/engaged (Far less CPU intensive than its predecessor)")
|
||||||
RULE_REAL(Map, DistanceCanTravelBeforeAdjustment, 10.0, "Distance a mob can path before FixZ is called, depends on FixZWhenPathing")
|
|
||||||
RULE_BOOL(Map, MobZVisualDebug, false, "Displays spell effects determining whether or not NPC is hitting Best Z calcs (blue for hit, red for miss)")
|
RULE_BOOL(Map, MobZVisualDebug, false, "Displays spell effects determining whether or not NPC is hitting Best Z calcs (blue for hit, red for miss)")
|
||||||
RULE_BOOL(Map, MobPathingVisualDebug, false, "Displays nodes in pathing points in realtime to help with visual debugging")
|
RULE_BOOL(Map, MobPathingVisualDebug, false, "Displays nodes in pathing points in realtime to help with visual debugging")
|
||||||
RULE_REAL(Map, FixPathingZMaxDeltaSendTo, 20, "At runtime in SendTo: maximum change in Z to allow the BestZ code to apply")
|
RULE_REAL(Map, FixPathingZMaxDeltaSendTo, 20, "At runtime in SendTo: maximum change in Z to allow the BestZ code to apply")
|
||||||
@@ -435,6 +441,7 @@ RULE_BOOL(Spells, IllusionsAlwaysPersist, false, "Allows Illusions to persist be
|
|||||||
RULE_BOOL(Spells, UseItemCastMessage, false, "Enable to use the \"item begins to glow\" messages when casting from an item.")
|
RULE_BOOL(Spells, UseItemCastMessage, false, "Enable to use the \"item begins to glow\" messages when casting from an item.")
|
||||||
RULE_BOOL(Spells, TargetsTargetRequiresCombatRange, true, "Disable to remove combat range requirement from Target's Target Spell Target Type")
|
RULE_BOOL(Spells, TargetsTargetRequiresCombatRange, true, "Disable to remove combat range requirement from Target's Target Spell Target Type")
|
||||||
RULE_BOOL(Spells, NPCBuffLevelRestrictions, false, "Impose BuffLevelRestrictions on NPCs if true")
|
RULE_BOOL(Spells, NPCBuffLevelRestrictions, false, "Impose BuffLevelRestrictions on NPCs if true")
|
||||||
|
RULE_BOOL(Spells, ResurrectionEffectsBlock, true, "If enabled, resurrection effects cannot be overwritten.")
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Combat)
|
RULE_CATEGORY(Combat)
|
||||||
|
|||||||
+410
-405
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -139,7 +139,7 @@ public:
|
|||||||
uint32 aug6 = 0,
|
uint32 aug6 = 0,
|
||||||
bool attuned = 0
|
bool attuned = 0
|
||||||
);
|
);
|
||||||
EQ::ItemInstance *CreateBaseItem(const EQ::ItemData *item, int16 charges = 0);
|
EQ::ItemInstance *CreateBaseItem(const EQ::ItemData *item, const std::string &guid, int16 charges);
|
||||||
|
|
||||||
void GetItemsCount(int32 &item_count, uint32 &max_id);
|
void GetItemsCount(int32 &item_count, uint32 &max_id);
|
||||||
void LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id);
|
void LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id);
|
||||||
|
|||||||
+78
-14
@@ -191,24 +191,23 @@ std::string Strings::Escape(const std::string &s)
|
|||||||
|
|
||||||
bool Strings::IsNumber(const std::string &s)
|
bool Strings::IsNumber(const std::string &s)
|
||||||
{
|
{
|
||||||
try {
|
for (char const &c: s) {
|
||||||
auto r = stoi(s);
|
if (c == s[0] && s[0] == '-') {
|
||||||
return true;
|
continue;
|
||||||
}
|
}
|
||||||
catch (std::exception &) {
|
if (std::isdigit(c) == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Strings::IsFloat(const std::string &s)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
auto r = stof(s);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (std::exception &) {
|
|
||||||
return false;
|
bool Strings::IsFloat(const std::string &s)
|
||||||
}
|
{
|
||||||
|
char* ptr;
|
||||||
|
strtof(s.c_str(), &ptr);
|
||||||
|
return (*ptr) == '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Strings::Join(const std::vector<std::string> &ar, const std::string &delim)
|
std::string Strings::Join(const std::vector<std::string> &ar, const std::string &delim)
|
||||||
@@ -728,7 +727,7 @@ uint32 Strings::TimeToSeconds(std::string time_string)
|
|||||||
time_unit.end()
|
time_unit.end()
|
||||||
);
|
);
|
||||||
|
|
||||||
auto unit = std::stoul(time_unit);
|
auto unit = Strings::ToUnsignedInt(time_unit);
|
||||||
uint32 duration = 0;
|
uint32 duration = 0;
|
||||||
|
|
||||||
if (Strings::Contains(time_string, "s")) {
|
if (Strings::Contains(time_string, "s")) {
|
||||||
@@ -755,7 +754,7 @@ bool Strings::ToBool(std::string bool_string)
|
|||||||
Strings::Contains(bool_string, "on") ||
|
Strings::Contains(bool_string, "on") ||
|
||||||
Strings::Contains(bool_string, "enable") ||
|
Strings::Contains(bool_string, "enable") ||
|
||||||
Strings::Contains(bool_string, "enabled") ||
|
Strings::Contains(bool_string, "enabled") ||
|
||||||
(Strings::IsNumber(bool_string) && std::stoi(bool_string))
|
(Strings::IsNumber(bool_string) && Strings::ToInt(bool_string))
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -782,7 +781,72 @@ std::string Strings::Random(size_t length)
|
|||||||
// fails to cast to a number
|
// fails to cast to a number
|
||||||
int Strings::ToInt(const std::string &s, int fallback)
|
int Strings::ToInt(const std::string &s, int fallback)
|
||||||
{
|
{
|
||||||
return Strings::IsNumber(s) ? std::stoi(s) : fallback;
|
if (!Strings::IsNumber(s)) {
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return std::stoi(s);
|
||||||
|
}
|
||||||
|
catch (std::exception &) {
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int64 Strings::ToBigInt(const std::string &s, int64 fallback)
|
||||||
|
{
|
||||||
|
if (!Strings::IsNumber(s)) {
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return std::stoll(s);
|
||||||
|
}
|
||||||
|
catch (std::exception &) {
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 Strings::ToUnsignedInt(const std::string &s, uint32 fallback)
|
||||||
|
{
|
||||||
|
if (!Strings::IsNumber(s)) {
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return std::stoul(s);
|
||||||
|
}
|
||||||
|
catch (std::exception &) {
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64 Strings::ToUnsignedBigInt(const std::string &s, uint64 fallback)
|
||||||
|
{
|
||||||
|
if (!Strings::IsNumber(s)) {
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return std::stoull(s);
|
||||||
|
}
|
||||||
|
catch (std::exception &) {
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float Strings::ToFloat(const std::string &s, float fallback)
|
||||||
|
{
|
||||||
|
if (!Strings::IsFloat(s)) {
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return std::stof(s);
|
||||||
|
}
|
||||||
|
catch (std::exception &) {
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Strings::RemoveNumbers(std::string s)
|
std::string Strings::RemoveNumbers(std::string s)
|
||||||
|
|||||||
@@ -87,6 +87,10 @@ public:
|
|||||||
static bool Contains(std::vector<std::string> container, std::string element);
|
static bool Contains(std::vector<std::string> container, std::string element);
|
||||||
static bool Contains(const std::string& subject, const std::string& search);
|
static bool Contains(const std::string& subject, const std::string& search);
|
||||||
static int ToInt(const std::string &s, int fallback = 0);
|
static int ToInt(const std::string &s, int fallback = 0);
|
||||||
|
static int64 ToBigInt(const std::string &s, int64 fallback = 0);
|
||||||
|
static uint32 ToUnsignedInt(const std::string &s, uint32 fallback = 0);
|
||||||
|
static uint64 ToUnsignedBigInt(const std::string &s, uint64 fallback = 0);
|
||||||
|
static float ToFloat(const std::string &s, float fallback = 0.0f);
|
||||||
static bool IsNumber(const std::string &s);
|
static bool IsNumber(const std::string &s);
|
||||||
static std::string RemoveNumbers(std::string s);
|
static std::string RemoveNumbers(std::string s);
|
||||||
static bool IsFloat(const std::string &s);
|
static bool IsFloat(const std::string &s);
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ bool atobool(const char *iBool)
|
|||||||
if (!strcasecmp(iBool, "n")) {
|
if (!strcasecmp(iBool, "n")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (atoi(iBool)) {
|
if (Strings::ToInt(iBool)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
inline bool g_is_forced_tty = std::getenv("IS_TTY");
|
||||||
|
|
||||||
namespace rang {
|
namespace rang {
|
||||||
|
|
||||||
/* For better compability with most of terminals do not use any style settings
|
/* For better compability with most of terminals do not use any style settings
|
||||||
@@ -220,6 +222,10 @@ inline bool isMsysPty(int fd) noexcept
|
|||||||
|
|
||||||
inline bool isTerminal(const std::streambuf *osbuf) noexcept
|
inline bool isTerminal(const std::streambuf *osbuf) noexcept
|
||||||
{
|
{
|
||||||
|
if (g_is_forced_tty) {
|
||||||
|
return g_is_forced_tty;
|
||||||
|
}
|
||||||
|
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
using std::clog;
|
using std::clog;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
|
|||||||
+3
-3
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
// Build variables
|
// Build variables
|
||||||
// these get injected during the build pipeline
|
// these get injected during the build pipeline
|
||||||
#define CURRENT_VERSION "22.4.3-dev" // always append -dev to the current version for custom-builds
|
#define CURRENT_VERSION "22.4.5-dev" // always append -dev to the current version for custom-builds
|
||||||
#define LOGIN_VERSION "0.8.0"
|
#define LOGIN_VERSION "0.8.0"
|
||||||
#define COMPILE_DATE __DATE__
|
#define COMPILE_DATE __DATE__
|
||||||
#define COMPILE_TIME __TIME__
|
#define COMPILE_TIME __TIME__
|
||||||
@@ -42,8 +42,8 @@
|
|||||||
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CURRENT_BINARY_DATABASE_VERSION 9220
|
#define CURRENT_BINARY_DATABASE_VERSION 9222
|
||||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9037
|
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9038
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ uint32 AccountManagement::CheckExternalLoginserverUserCredentials(
|
|||||||
auto s = Strings::Split(server.options.GetEQEmuLoginServerAddress(), ':');
|
auto s = Strings::Split(server.options.GetEQEmuLoginServerAddress(), ':');
|
||||||
if (s.size() == 2) {
|
if (s.size() == 2) {
|
||||||
auto address = s[0];
|
auto address = s[0];
|
||||||
auto port = std::stoi(s[1]);
|
auto port = Strings::ToInt(s[1]);
|
||||||
|
|
||||||
EQ::Net::DNSLookup(
|
EQ::Net::DNSLookup(
|
||||||
address, port, false, [&](const std::string &addr) {
|
address, port, false, [&](const std::string &addr) {
|
||||||
|
|||||||
+11
-11
@@ -32,7 +32,7 @@ Database::Database(
|
|||||||
user.c_str(),
|
user.c_str(),
|
||||||
pass.c_str(),
|
pass.c_str(),
|
||||||
name.c_str(),
|
name.c_str(),
|
||||||
std::stoi(port),
|
Strings::ToInt(port),
|
||||||
&errnum,
|
&errnum,
|
||||||
errbuf
|
errbuf
|
||||||
)
|
)
|
||||||
@@ -93,7 +93,7 @@ bool Database::GetLoginDataFromAccountInfo(
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
id = atoi(row[0]);
|
id = Strings::ToInt(row[0]);
|
||||||
password = row[1];
|
password = row[1];
|
||||||
|
|
||||||
LogDebug(
|
LogDebug(
|
||||||
@@ -145,7 +145,7 @@ bool Database::GetLoginTokenDataFromToken(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(row[2], "login_server_id") == 0) {
|
if (strcmp(row[2], "login_server_id") == 0) {
|
||||||
db_account_id = atoi(row[3]);
|
db_account_id = Strings::ToInt(row[3]);
|
||||||
found_login_id = true;
|
found_login_id = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,7 @@ unsigned int Database::GetFreeID(const std::string &loginserver)
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
return std::stoi(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -368,12 +368,12 @@ Database::DbWorldRegistration Database::GetWorldRegistration(
|
|||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
r.loaded = true;
|
r.loaded = true;
|
||||||
r.server_id = std::stoi(row[0]);
|
r.server_id = Strings::ToInt(row[0]);
|
||||||
r.server_description = row[1];
|
r.server_description = row[1];
|
||||||
r.server_list_type = std::stoi(row[3]);
|
r.server_list_type = Strings::ToInt(row[3]);
|
||||||
r.is_server_trusted = std::stoi(row[2]) > 0;
|
r.is_server_trusted = Strings::ToInt(row[2]) > 0;
|
||||||
r.server_list_description = row[4];
|
r.server_list_description = row[4];
|
||||||
r.server_admin_id = std::stoi(row[5]);
|
r.server_admin_id = Strings::ToInt(row[5]);
|
||||||
|
|
||||||
if (r.server_admin_id <= 0) {
|
if (r.server_admin_id <= 0) {
|
||||||
return r;
|
return r;
|
||||||
@@ -513,7 +513,7 @@ bool Database::CreateWorldRegistration(
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
id = std::stoi(row[0]);
|
id = Strings::ToInt(row[0]);
|
||||||
auto insert_query = fmt::format(
|
auto insert_query = fmt::format(
|
||||||
"INSERT INTO login_world_servers SET id = {0}, long_name = '{1}', short_name = '{2}', last_ip_address = '{3}', \n"
|
"INSERT INTO login_world_servers SET id = {0}, long_name = '{1}', short_name = '{2}', last_ip_address = '{3}', \n"
|
||||||
"login_server_list_type_id = 3, login_server_admin_id = {4}, is_server_trusted = 0, tag_description = ''",
|
"login_server_list_type_id = 3, login_server_admin_id = {4}, is_server_trusted = 0, tag_description = ''",
|
||||||
@@ -647,7 +647,7 @@ Database::DbLoginServerAdmin Database::GetLoginServerAdmin(const std::string &ac
|
|||||||
if (results.RowCount() == 1) {
|
if (results.RowCount() == 1) {
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
r.loaded = true;
|
r.loaded = true;
|
||||||
r.id = std::stoi(row[0]);
|
r.id = Strings::ToInt(row[0]);
|
||||||
r.account_name = row[1];
|
r.account_name = row[1];
|
||||||
r.account_password = row[2];
|
r.account_password = row[2];
|
||||||
r.first_name = row[3];
|
r.first_name = row[3];
|
||||||
@@ -683,7 +683,7 @@ Database::DbLoginServerAccount Database::GetLoginServerAccountByAccountName(
|
|||||||
if (results.RowCount() == 1) {
|
if (results.RowCount() == 1) {
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
r.loaded = true;
|
r.loaded = true;
|
||||||
r.id = std::stoi(row[0]);
|
r.id = Strings::ToInt(row[0]);
|
||||||
r.account_name = row[1];
|
r.account_name = row[1];
|
||||||
r.account_password = row[2];
|
r.account_password = row[2];
|
||||||
r.account_email = row[3];
|
r.account_email = row[3];
|
||||||
|
|||||||
@@ -480,8 +480,8 @@ namespace LoginserverWebserver {
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
LoginserverWebserver::TokenManager::token_data token_data;
|
LoginserverWebserver::TokenManager::token_data token_data;
|
||||||
token_data.token = row[0];
|
token_data.token = row[0];
|
||||||
token_data.can_write = std::stoi(row[1]) > 0;
|
token_data.can_write = Strings::ToInt(row[1]) > 0;
|
||||||
token_data.can_read = std::stoi(row[2]) > 0;
|
token_data.can_read = Strings::ToInt(row[2]) > 0;
|
||||||
|
|
||||||
LogDebug(
|
LogDebug(
|
||||||
"Inserting api token to internal list [{0}] write {1} read {2}",
|
"Inserting api token to internal list [{0}] write {1} read {2}",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "eqemu-server",
|
"name": "eqemu-server",
|
||||||
"version": "22.4.3",
|
"version": "22.4.5",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/EQEmu/Server.git"
|
"url": "https://github.com/EQEmu/Server.git"
|
||||||
|
|||||||
@@ -33,8 +33,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
//atoi is not uint32 or uint32 safe!!!!
|
|
||||||
#define atoul(str) strtoul(str, nullptr, 10)
|
|
||||||
|
|
||||||
class QSDatabase : public Database {
|
class QSDatabase : public Database {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -44,15 +44,15 @@ bool LFGuildManager::LoadDatabase()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
uint32 type = atoul(row[0]);
|
uint32 type = Strings::ToUnsignedInt(row[0]);
|
||||||
if(type == 0)
|
if(type == 0)
|
||||||
{
|
{
|
||||||
PlayerLookingForGuild p(row[1], row[2], atoul(row[3]), atoul(row[5]), atoul(row[6]), atoul(row[7]), atoul(row[8]));
|
PlayerLookingForGuild p(row[1], row[2], Strings::ToUnsignedInt(row[3]), Strings::ToUnsignedInt(row[5]), Strings::ToUnsignedInt(row[6]), Strings::ToUnsignedInt(row[7]), Strings::ToUnsignedInt(row[8]));
|
||||||
Players.push_back(p);
|
Players.push_back(p);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildLookingForPlayers g(row[1], row[2], atoul(row[3]), atoul(row[4]), atoul(row[5]), atoul(row[6]), atoul(row[7]), atoul(row[8]));
|
GuildLookingForPlayers g(row[1], row[2], Strings::ToUnsignedInt(row[3]), Strings::ToUnsignedInt(row[4]), Strings::ToUnsignedInt(row[5]), Strings::ToUnsignedInt(row[6]), Strings::ToUnsignedInt(row[7]), Strings::ToUnsignedInt(row[8]));
|
||||||
Guilds.push_back(g);
|
Guilds.push_back(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include "worldserver.h"
|
#include "worldserver.h"
|
||||||
#include "../common/path_manager.h"
|
#include "../common/path_manager.h"
|
||||||
#include "../common/zone_store.h"
|
#include "../common/zone_store.h"
|
||||||
|
#include "../common/events/player_event_logs.h"
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
@@ -47,6 +48,7 @@ WorldServer *worldserver = 0;
|
|||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
PathManager path;
|
PathManager path;
|
||||||
ZoneStore zone_store;
|
ZoneStore zone_store;
|
||||||
|
PlayerEventLogs player_event_logs;
|
||||||
|
|
||||||
void CatchSignal(int sig_num)
|
void CatchSignal(int sig_num)
|
||||||
{
|
{
|
||||||
@@ -106,6 +108,9 @@ int main()
|
|||||||
/* Load Looking For Guild Manager */
|
/* Load Looking For Guild Manager */
|
||||||
lfguildmanager.LoadDatabase();
|
lfguildmanager.LoadDatabase();
|
||||||
|
|
||||||
|
Timer player_event_process_timer(1000);
|
||||||
|
player_event_logs.SetDatabase(&database)->Init();
|
||||||
|
|
||||||
auto loop_fn = [&](EQ::Timer* t) {
|
auto loop_fn = [&](EQ::Timer* t) {
|
||||||
Timer::SetCurrentTime();
|
Timer::SetCurrentTime();
|
||||||
|
|
||||||
@@ -117,6 +122,10 @@ int main()
|
|||||||
if (LFGuildExpireTimer.Check()) {
|
if (LFGuildExpireTimer.Check()) {
|
||||||
lfguildmanager.ExpireEntries();
|
lfguildmanager.ExpireEntries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player_event_process_timer.Check()) {
|
||||||
|
player_event_logs.Process();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
EQ::Timer process_timer(loop_fn);
|
EQ::Timer process_timer(loop_fn);
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include "lfguild.h"
|
#include "lfguild.h"
|
||||||
#include "queryservconfig.h"
|
#include "queryservconfig.h"
|
||||||
#include "worldserver.h"
|
#include "worldserver.h"
|
||||||
|
#include "../common/events/player_events.h"
|
||||||
|
#include "../common/events/player_event_logs.h"
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -89,6 +91,17 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
|||||||
case 0: {
|
case 0: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ServerOP_PlayerEvent: {
|
||||||
|
auto n = PlayerEvent::PlayerEventContainer{};
|
||||||
|
auto s = (ServerSendPlayerEvent_Struct *) p.Data();
|
||||||
|
EQ::Util::MemoryStreamReader ss(s->cereal_data, s->cereal_size);
|
||||||
|
cereal::BinaryInputArchive archive(ss);
|
||||||
|
archive(n);
|
||||||
|
|
||||||
|
player_event_logs.AddToQueue(n.player_event_log);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ServerOP_KeepAlive: {
|
case ServerOP_KeepAlive: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
content_db.SetMysql(database.getMySQL());
|
content_db.SetMySQL(database);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
LogSys.SetDatabase(&database)
|
||||||
|
|||||||
+4
-3
@@ -46,8 +46,7 @@ int main()
|
|||||||
auto ConfigLoadResult = EQEmuConfig::LoadConfig();
|
auto ConfigLoadResult = EQEmuConfig::LoadConfig();
|
||||||
Config = EQEmuConfig::get();
|
Config = EQEmuConfig::get();
|
||||||
try {
|
try {
|
||||||
std::ofstream outfile("test_output.txt");
|
std::unique_ptr<Test::Output> output(new Test::TextOutput(Test::TextOutput::Verbose));
|
||||||
std::unique_ptr<Test::Output> output(new Test::TextOutput(Test::TextOutput::Verbose, outfile));
|
|
||||||
Test::Suite tests;
|
Test::Suite tests;
|
||||||
tests.add(new MemoryMappedFileTest());
|
tests.add(new MemoryMappedFileTest());
|
||||||
tests.add(new IPCMutexTest());
|
tests.add(new IPCMutexTest());
|
||||||
@@ -60,7 +59,9 @@ int main()
|
|||||||
tests.add(new SkillsUtilsTest());
|
tests.add(new SkillsUtilsTest());
|
||||||
tests.add(new TaskStateTest());
|
tests.add(new TaskStateTest());
|
||||||
tests.run(*output, true);
|
tests.run(*output, true);
|
||||||
} catch (...) {
|
}
|
||||||
|
catch (std::exception &ex) {
|
||||||
|
LogError("Test Failure [{}]", ex.what());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ public:
|
|||||||
TEST_ADD(StringUtilTest::SearchDeliminatedStringTest);
|
TEST_ADD(StringUtilTest::SearchDeliminatedStringTest);
|
||||||
TEST_ADD(StringUtilTest::SplitStringTest);
|
TEST_ADD(StringUtilTest::SplitStringTest);
|
||||||
TEST_ADD(StringUtilTest::FromCharsTest);
|
TEST_ADD(StringUtilTest::FromCharsTest);
|
||||||
|
TEST_ADD(StringUtilTest::TestIsFloat);
|
||||||
|
TEST_ADD(StringUtilTest::TestIsNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
~StringUtilTest() {
|
~StringUtilTest() {
|
||||||
@@ -116,6 +118,26 @@ public:
|
|||||||
TEST_ASSERT(float_value == 3.14f);
|
TEST_ASSERT(float_value == 3.14f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestIsFloat() {
|
||||||
|
TEST_ASSERT_EQUALS(Strings::IsFloat("0.23424523"), true);
|
||||||
|
TEST_ASSERT_EQUALS(Strings::IsFloat("12312312313.23424523"), true);
|
||||||
|
TEST_ASSERT_EQUALS(Strings::IsFloat("12312312313"), true);
|
||||||
|
TEST_ASSERT_EQUALS(Strings::IsFloat(".234234"), true);
|
||||||
|
TEST_ASSERT_EQUALS(Strings::IsFloat(".234234f"), false);
|
||||||
|
TEST_ASSERT_EQUALS(Strings::IsFloat("Johnson"), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestIsNumber() {
|
||||||
|
TEST_ASSERT_EQUALS(Strings::IsNumber("0.23424523"), false);
|
||||||
|
TEST_ASSERT_EQUALS(Strings::IsNumber("12312312313.23424523"), false);
|
||||||
|
TEST_ASSERT_EQUALS(Strings::IsNumber("12312312313"), true);
|
||||||
|
TEST_ASSERT_EQUALS(Strings::IsNumber("12312312313f"), false); // character at end
|
||||||
|
TEST_ASSERT_EQUALS(Strings::IsNumber("18446744073709551616"), true); // 64
|
||||||
|
TEST_ASSERT_EQUALS(Strings::IsNumber("-18"), true);
|
||||||
|
TEST_ASSERT_EQUALS(Strings::IsNumber("-f18"), false);
|
||||||
|
TEST_ASSERT_EQUALS(Strings::IsNumber("-18446744073709551616"), true); // 64
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+6
-6
@@ -48,10 +48,10 @@ ChatChannel::ChatChannel(std::string inName, std::string inOwner, std::string in
|
|||||||
m_moderated = false;
|
m_moderated = false;
|
||||||
|
|
||||||
LogDebug(
|
LogDebug(
|
||||||
"New ChatChannel created: Name: [{}], Owner: [{}], Password: [{}], MinStatus: [{}]",
|
"New ChatChannel created: Name: [{}] Owner: [{}] Password: [{}] MinStatus: [{}]",
|
||||||
m_name.c_str(),
|
m_name,
|
||||||
m_owner.c_str(),
|
m_owner,
|
||||||
m_password.c_str(),
|
m_password,
|
||||||
m_minimum_status
|
m_minimum_status
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -657,7 +657,7 @@ ChatChannel *ChatChannelList::RemoveClientFromChannel(const std::string& in_chan
|
|||||||
std::string channel_name = in_channel_name;
|
std::string channel_name = in_channel_name;
|
||||||
|
|
||||||
if (in_channel_name.length() > 0 && isdigit(channel_name[0])) {
|
if (in_channel_name.length() > 0 && isdigit(channel_name[0])) {
|
||||||
channel_name = c->ChannelSlotName(atoi(in_channel_name.c_str()));
|
channel_name = c->ChannelSlotName(Strings::ToInt(in_channel_name.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *required_channel = FindChannel(channel_name);
|
auto *required_channel = FindChannel(channel_name);
|
||||||
@@ -667,7 +667,7 @@ ChatChannel *ChatChannelList::RemoveClientFromChannel(const std::string& in_chan
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogDebug("Client [{}] removed from channel [{}]. Channel is owned by {}. Command directed: {}", c->GetName(), channel_name, required_channel->GetOwnerName(), command_directed);
|
LogDebug("Client [{}] removed from channel [{}]. Channel is owned by {}. Command directed: {}", c->GetName(), channel_name, required_channel->GetOwnerName(), command_directed);
|
||||||
if (c->GetName() == required_channel->GetOwnerName() && command_directed) { // Check if the client that is leaving is the the channel owner
|
if (c->GetName() == required_channel->GetOwnerName() && command_directed) { // Check if the client that is leaving is the channel owner
|
||||||
LogDebug("Owner left the channel [{}], removing channel from database...", channel_name);
|
LogDebug("Owner left the channel [{}], removing channel from database...", channel_name);
|
||||||
database.DeleteChatChannel(channel_name); // Remove the channel from the database.
|
database.DeleteChatChannel(channel_name); // Remove the channel from the database.
|
||||||
LogDebug("Flagging [{}] channel as temporary...", channel_name);
|
LogDebug("Flagging [{}] channel as temporary...", channel_name);
|
||||||
|
|||||||
+18
-15
@@ -379,14 +379,14 @@ static void ProcessSetMessageStatus(std::string SetMessageCommand) {
|
|||||||
|
|
||||||
if (NumEnd == std::string::npos) {
|
if (NumEnd == std::string::npos) {
|
||||||
|
|
||||||
MessageNumber = atoi(SetMessageCommand.substr(NumStart).c_str());
|
MessageNumber = Strings::ToInt(SetMessageCommand.substr(NumStart).c_str());
|
||||||
|
|
||||||
database.SetMessageStatus(MessageNumber, Status);
|
database.SetMessageStatus(MessageNumber, Status);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageNumber = atoi(SetMessageCommand.substr(NumStart, NumEnd - NumStart).c_str());
|
MessageNumber = Strings::ToInt(SetMessageCommand.substr(NumStart, NumEnd - NumStart).c_str());
|
||||||
|
|
||||||
database.SetMessageStatus(MessageNumber, Status);
|
database.SetMessageStatus(MessageNumber, Status);
|
||||||
|
|
||||||
@@ -793,7 +793,10 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string command_string, boo
|
|||||||
case CommandJoin:
|
case CommandJoin:
|
||||||
if (!command_directed) {
|
if (!command_directed) {
|
||||||
//Append saved channels to params
|
//Append saved channels to params
|
||||||
parameters = parameters + ", " + database.CurrentPlayerChannels(c->GetName());
|
const auto saved_channels = database.CurrentPlayerChannels(c->GetName());
|
||||||
|
if (!saved_channels.empty()) {
|
||||||
|
parameters += fmt::format(", {}", Strings::Join(saved_channels, ", "));
|
||||||
|
}
|
||||||
parameters = RemoveDuplicateChannels(parameters);
|
parameters = RemoveDuplicateChannels(parameters);
|
||||||
}
|
}
|
||||||
c->JoinChannels(parameters, command_directed);
|
c->JoinChannels(parameters, command_directed);
|
||||||
@@ -873,7 +876,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string command_string, boo
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CommandGetBody:
|
case CommandGetBody:
|
||||||
database.SendBody(c, atoi(parameters.c_str()));
|
database.SendBody(c, Strings::ToInt(parameters.c_str()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CommandMailTo:
|
case CommandMailTo:
|
||||||
@@ -888,7 +891,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string command_string, boo
|
|||||||
case CommandSelectMailBox:
|
case CommandSelectMailBox:
|
||||||
{
|
{
|
||||||
std::string::size_type NumStart = parameters.find_first_of("0123456789");
|
std::string::size_type NumStart = parameters.find_first_of("0123456789");
|
||||||
c->ChangeMailBox(atoi(parameters.substr(NumStart).c_str()));
|
c->ChangeMailBox(Strings::ToInt(parameters.substr(NumStart).c_str()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CommandSetMailForwarding:
|
case CommandSetMailForwarding:
|
||||||
@@ -1250,7 +1253,7 @@ void Client::ProcessChannelList(std::string Input) {
|
|||||||
std::string ChannelName = Input;
|
std::string ChannelName = Input;
|
||||||
|
|
||||||
if (isdigit(ChannelName[0]))
|
if (isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
||||||
|
|
||||||
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
||||||
|
|
||||||
@@ -1411,7 +1414,7 @@ void Client::SendChannelMessageByNumber(std::string Message) {
|
|||||||
if (MessageStart == std::string::npos)
|
if (MessageStart == std::string::npos)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int ChannelNumber = atoi(Message.substr(0, MessageStart).c_str());
|
int ChannelNumber = Strings::ToInt(Message.substr(0, MessageStart).c_str());
|
||||||
|
|
||||||
if ((ChannelNumber < 1) || (ChannelNumber > MAX_JOINED_CHANNELS)) {
|
if ((ChannelNumber < 1) || (ChannelNumber > MAX_JOINED_CHANNELS)) {
|
||||||
|
|
||||||
@@ -1654,7 +1657,7 @@ void Client::SetChannelPassword(std::string ChannelPassword) {
|
|||||||
std::string ChannelName = ChannelPassword.substr(ChannelStart);
|
std::string ChannelName = ChannelPassword.substr(ChannelStart);
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
||||||
|
|
||||||
std::string Message;
|
std::string Message;
|
||||||
|
|
||||||
@@ -1719,7 +1722,7 @@ void Client::SetChannelOwner(std::string CommandString) {
|
|||||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
||||||
|
|
||||||
LogInfo("Set owner of channel [[{}]] to [[{}]]", ChannelName.c_str(), NewOwner.c_str());
|
LogInfo("Set owner of channel [[{}]] to [[{}]]", ChannelName.c_str(), NewOwner.c_str());
|
||||||
|
|
||||||
@@ -1765,7 +1768,7 @@ void Client::OPList(std::string CommandString) {
|
|||||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
||||||
|
|
||||||
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
||||||
|
|
||||||
@@ -1808,7 +1811,7 @@ void Client::ChannelInvite(std::string CommandString) {
|
|||||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
||||||
|
|
||||||
LogInfo("[[{}]] invites [[{}]] to channel [[{}]]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str());
|
LogInfo("[[{}]] invites [[{}]] to channel [[{}]]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str());
|
||||||
|
|
||||||
@@ -1878,7 +1881,7 @@ void Client::ChannelModerate(std::string CommandString) {
|
|||||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
||||||
|
|
||||||
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
||||||
|
|
||||||
@@ -1936,7 +1939,7 @@ void Client::ChannelGrantModerator(std::string CommandString) {
|
|||||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
||||||
|
|
||||||
LogInfo("[[{}]] gives [[{}]] moderator rights to channel [[{}]]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str());
|
LogInfo("[[{}]] gives [[{}]] moderator rights to channel [[{}]]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str());
|
||||||
|
|
||||||
@@ -2017,7 +2020,7 @@ void Client::ChannelGrantVoice(std::string CommandString) {
|
|||||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
||||||
|
|
||||||
LogInfo("[[{}]] gives [[{}]] voice to channel [[{}]]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str());
|
LogInfo("[[{}]] gives [[{}]] voice to channel [[{}]]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str());
|
||||||
|
|
||||||
@@ -2105,7 +2108,7 @@ void Client::ChannelKick(std::string CommandString) {
|
|||||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
||||||
|
|
||||||
LogInfo("[[{}]] kicks [[{}]] from channel [[{}]]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str());
|
LogInfo("[[{}]] kicks [[{}]] from channel [[{}]]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str());
|
||||||
|
|
||||||
|
|||||||
+20
-19
@@ -84,10 +84,10 @@ void UCSDatabase::GetAccountStatus(Client *client)
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
client->SetAccountStatus(atoi(row[0]));
|
client->SetAccountStatus(Strings::ToInt(row[0]));
|
||||||
client->SetHideMe(atoi(row[1]) != 0);
|
client->SetHideMe(Strings::ToInt(row[1]) != 0);
|
||||||
client->SetKarma(atoi(row[2]));
|
client->SetKarma(Strings::ToInt(row[2]));
|
||||||
client->SetRevoked((atoi(row[3]) == 1 ? true : false));
|
client->SetRevoked((Strings::ToInt(row[3]) == 1 ? true : false));
|
||||||
|
|
||||||
LogDebug(
|
LogDebug(
|
||||||
"Set account status to [{}], hideme to [{}] and karma to [{}] for [{}]",
|
"Set account status to [{}], hideme to [{}] and karma to [{}] for [{}]",
|
||||||
@@ -119,9 +119,9 @@ int UCSDatabase::FindAccount(const char *characterName, Client *client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
client->AddCharacter(atoi(row[0]), characterName, atoi(row[2]));
|
client->AddCharacter(Strings::ToInt(row[0]), characterName, Strings::ToInt(row[2]));
|
||||||
|
|
||||||
int accountID = atoi(row[1]);
|
int accountID = Strings::ToInt(row[1]);
|
||||||
|
|
||||||
LogInfo("Account ID for [{}] is [{}]", characterName, accountID);
|
LogInfo("Account ID for [{}] is [{}]", characterName, accountID);
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ int UCSDatabase::FindAccount(const char *characterName, Client *client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row)
|
for (auto row = results.begin(); row != results.end(); ++row)
|
||||||
client->AddCharacter(atoi(row[0]), row[1], atoi(row[2]));
|
client->AddCharacter(Strings::ToInt(row[0]), row[1], Strings::ToInt(row[2]));
|
||||||
|
|
||||||
return accountID;
|
return accountID;
|
||||||
}
|
}
|
||||||
@@ -197,7 +197,7 @@ int UCSDatabase::FindCharacter(const char *characterName)
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
int characterID = atoi(row[0]);
|
int characterID = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
return characterID;
|
return characterID;
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@ bool UCSDatabase::LoadChatChannels()
|
|||||||
auto channel_min_status = row[3];
|
auto channel_min_status = row[3];
|
||||||
|
|
||||||
if (!ChannelList->FindChannel(channel_name)) {
|
if (!ChannelList->FindChannel(channel_name)) {
|
||||||
ChannelList->CreateChannel(channel_name, channel_owner, channel_password, true, atoi(channel_min_status), false);
|
ChannelList->CreateChannel(channel_name, channel_owner, channel_password, true, Strings::ToInt(channel_min_status), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -336,16 +336,17 @@ void UCSDatabase::DeleteChatChannel(const std::string& channel_name)
|
|||||||
LogInfo("Deleting channel [{}] from the database.", channel_name);
|
LogInfo("Deleting channel [{}] from the database.", channel_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UCSDatabase::CurrentPlayerChannels(const std::string& player_name) {
|
std::vector<std::string> UCSDatabase::CurrentPlayerChannels(const std::string& player_name) {
|
||||||
int current_player_channel_count = CurrentPlayerChannelCount(player_name);
|
auto rows = ChatchannelsRepository::GetWhere(*this, fmt::format("`owner` = '{}'", Strings::Escape(player_name)));
|
||||||
if (current_player_channel_count == 0) {
|
if (rows.empty()) {
|
||||||
return "";
|
return {};
|
||||||
}
|
}
|
||||||
const auto rquery = fmt::format("SELECT GROUP_CONCAT(`name` SEPARATOR ', ') FROM chatchannels WHERE `owner` = '{}'; ", Strings::Escape(player_name));
|
std::vector<std::string> channels = {};
|
||||||
auto results = QueryDatabase(rquery);
|
channels.reserve(rows.size());
|
||||||
auto row = results.begin();
|
for (auto &e: rows) {
|
||||||
std::string channels = row[0];
|
channels.emplace_back(e.name);
|
||||||
LogDebug("Player [{}] has the following permanent channels saved to the database: [{}].", player_name, channels);
|
}
|
||||||
|
LogDebug("Player [{}] has the following [{}] permanent channels saved to the database: [{}].", player_name, rows.size(), Strings::Join(channels, ", "));
|
||||||
return channels;
|
return channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -742,7 +743,7 @@ void UCSDatabase::GetFriendsAndIgnore(const int& charID, std::vector<std::string
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
std::string name = row[1];
|
std::string name = row[1];
|
||||||
|
|
||||||
if (atoi(row[0]) == 0) {
|
if (Strings::ToInt(row[0]) == 0) {
|
||||||
ignorees.push_back(name);
|
ignorees.push_back(name);
|
||||||
LogInfo("Added Ignoree from DB [{}]", name.c_str());
|
LogInfo("Added Ignoree from DB [{}]", name.c_str());
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
+1
-3
@@ -35,8 +35,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
//atoi is not uint32 or uint32 safe!!!!
|
|
||||||
#define atoul(str) strtoul(str, nullptr, 10)
|
|
||||||
|
|
||||||
class UCSDatabase : public Database {
|
class UCSDatabase : public Database {
|
||||||
public:
|
public:
|
||||||
@@ -52,7 +50,7 @@ public:
|
|||||||
void SaveChatChannel(const std::string& channel_name, const std::string& channel_owner, const std::string& channel_password, const uint16& min_status);
|
void SaveChatChannel(const std::string& channel_name, const std::string& channel_owner, const std::string& channel_password, const uint16& min_status);
|
||||||
void DeleteChatChannel(const std::string& channel_name);
|
void DeleteChatChannel(const std::string& channel_name);
|
||||||
int CurrentPlayerChannelCount(const std::string& player_name);
|
int CurrentPlayerChannelCount(const std::string& player_name);
|
||||||
std::string CurrentPlayerChannels(const std::string& player_name);
|
std::vector<std::string> CurrentPlayerChannels(const std::string& player_name);
|
||||||
void GetAccountStatus(Client *c);
|
void GetAccountStatus(Client *c);
|
||||||
void SetChannelPassword(const std::string& channel_name, const std::string& password);
|
void SetChannelPassword(const std::string& channel_name, const std::string& password);
|
||||||
void SetChannelOwner(const std::string& channel_name, const std::string& owner);
|
void SetChannelOwner(const std::string& channel_name, const std::string& owner);
|
||||||
|
|||||||
@@ -507,11 +507,11 @@ void MainFrame::SaveActivity(wxCommandEvent& event)
|
|||||||
ourAct.optional = mActivityOptional->GetValue();
|
ourAct.optional = mActivityOptional->GetValue();
|
||||||
|
|
||||||
getStr = mActID->GetValue();
|
getStr = mActID->GetValue();
|
||||||
ourAct.activityId = atoi(getStr.mb_str());
|
ourAct.activityId = Strings::ToInt(getStr.mb_str());
|
||||||
getStr.Clear();
|
getStr.Clear();
|
||||||
|
|
||||||
getStr = mActStep->GetValue();
|
getStr = mActStep->GetValue();
|
||||||
ourAct.step = atoi(getStr.mb_str());
|
ourAct.step = Strings::ToInt(getStr.mb_str());
|
||||||
getStr.Clear();
|
getStr.Clear();
|
||||||
|
|
||||||
int type = mActType->GetSelection();
|
int type = mActType->GetSelection();
|
||||||
@@ -530,17 +530,17 @@ void MainFrame::SaveActivity(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
getStr = mActDeliver->GetValue();
|
getStr = mActDeliver->GetValue();
|
||||||
ourAct.deliverToNpc = atoi(getStr.mb_str());
|
ourAct.deliverToNpc = Strings::ToInt(getStr.mb_str());
|
||||||
getStr.Clear();
|
getStr.Clear();
|
||||||
|
|
||||||
ourAct.goalmethod = mActMethod->GetSelection();
|
ourAct.goalmethod = mActMethod->GetSelection();
|
||||||
|
|
||||||
getStr = mActGoalID->GetValue();
|
getStr = mActGoalID->GetValue();
|
||||||
ourAct.goalid = atoi(getStr.mb_str());
|
ourAct.goalid = Strings::ToInt(getStr.mb_str());
|
||||||
getStr.Clear();
|
getStr.Clear();
|
||||||
|
|
||||||
getStr = mActGoalCount->GetValue();
|
getStr = mActGoalCount->GetValue();
|
||||||
ourAct.goalcount = atoi(getStr.mb_str());
|
ourAct.goalcount = Strings::ToInt(getStr.mb_str());
|
||||||
getStr.Clear();
|
getStr.Clear();
|
||||||
|
|
||||||
if(ourAct.activityId == openedActivity.activityid && ourAct.id == openedActivity.id){
|
if(ourAct.activityId == openedActivity.activityid && ourAct.id == openedActivity.id){
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ bool MainFrame::LoadItems(){
|
|||||||
while ((row = mysql_fetch_row(res)) != NULL){
|
while ((row = mysql_fetch_row(res)) != NULL){
|
||||||
eqitem newIT;
|
eqitem newIT;
|
||||||
strcpy(newIT.name, row[0]);
|
strcpy(newIT.name, row[0]);
|
||||||
newIT.id = atoi(row[1]);
|
newIT.id = Strings::ToInt(row[1]);
|
||||||
itemList.push_back(newIT);
|
itemList.push_back(newIT);
|
||||||
itemsLoaded++;
|
itemsLoaded++;
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ bool MainFrame::LoadZones()
|
|||||||
eqtask_zones newZ;
|
eqtask_zones newZ;
|
||||||
strcpy(newZ.name, row[0]);
|
strcpy(newZ.name, row[0]);
|
||||||
|
|
||||||
newZ.id = atoi(row[1]);
|
newZ.id = Strings::ToInt(row[1]);
|
||||||
taskZoneList.push_back(newZ);
|
taskZoneList.push_back(newZ);
|
||||||
|
|
||||||
int * zoneId = new int;
|
int * zoneId = new int;
|
||||||
@@ -168,7 +168,7 @@ bool MainFrame::LoadTasks()
|
|||||||
res = mysql_use_result(mMysql);
|
res = mysql_use_result(mMysql);
|
||||||
while ((row = mysql_fetch_row(res)) != NULL){
|
while ((row = mysql_fetch_row(res)) != NULL){
|
||||||
eqtask newT;
|
eqtask newT;
|
||||||
newT.id = atoi(row[0]);
|
newT.id = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
//This isn't all that safe
|
//This isn't all that safe
|
||||||
//Working under the assumption that:
|
//Working under the assumption that:
|
||||||
@@ -185,15 +185,15 @@ bool MainFrame::LoadTasks()
|
|||||||
if(newT.id > highestIndex)
|
if(newT.id > highestIndex)
|
||||||
highestIndex = newT.id;
|
highestIndex = newT.id;
|
||||||
|
|
||||||
newT.rewardid = atoi(row[4]);
|
newT.rewardid = Strings::ToInt(row[4]);
|
||||||
newT.cashreward = atoi(row[5]);
|
newT.cashreward = Strings::ToInt(row[5]);
|
||||||
newT.xpreward = atoi(row[6]);
|
newT.xpreward = Strings::ToInt(row[6]);
|
||||||
newT.rewardmethod = atoi(row[7]);
|
newT.rewardmethod = Strings::ToInt(row[7]);
|
||||||
newT.startzone = atoi(row[8]);
|
newT.startzone = Strings::ToInt(row[8]);
|
||||||
newT.duration = atoi(row[9]);
|
newT.duration = Strings::ToInt(row[9]);
|
||||||
newT.level_min = atoi(row[10]);
|
newT.level_min = Strings::ToInt(row[10]);
|
||||||
newT.level_max = atoi(row[11]);
|
newT.level_max = Strings::ToInt(row[11]);
|
||||||
newT.repeatable = atoi(row[12]) ? true : false;
|
newT.repeatable = Strings::ToInt(row[12]) ? true : false;
|
||||||
|
|
||||||
taskList.push_back(newT);
|
taskList.push_back(newT);
|
||||||
|
|
||||||
@@ -225,8 +225,8 @@ bool MainFrame::LoadGoals()
|
|||||||
res = mysql_use_result(mMysql);
|
res = mysql_use_result(mMysql);
|
||||||
while ((row = mysql_fetch_row(res)) != NULL){
|
while ((row = mysql_fetch_row(res)) != NULL){
|
||||||
eqtask_goallist newGL;
|
eqtask_goallist newGL;
|
||||||
newGL.id = atoi(row[0]);
|
newGL.id = Strings::ToInt(row[0]);
|
||||||
newGL.value = atoi(row[1]);
|
newGL.value = Strings::ToInt(row[1]);
|
||||||
goalTaskList.push_back(newGL);
|
goalTaskList.push_back(newGL);
|
||||||
|
|
||||||
goalsLoaded++;
|
goalsLoaded++;
|
||||||
@@ -258,19 +258,19 @@ bool MainFrame::LoadActivities() {
|
|||||||
while ((row = mysql_fetch_row(res)) != NULL) {
|
while ((row = mysql_fetch_row(res)) != NULL) {
|
||||||
eqtask_activities newAL;
|
eqtask_activities newAL;
|
||||||
|
|
||||||
newAL.id = atoi(row[0]);
|
newAL.id = Strings::ToInt(row[0]);
|
||||||
newAL.activityId = atoi(row[1]);
|
newAL.activityId = Strings::ToInt(row[1]);
|
||||||
newAL.step = atoi(row[2]);
|
newAL.step = Strings::ToInt(row[2]);
|
||||||
newAL.activityType = atoi(row[3]);
|
newAL.activityType = Strings::ToInt(row[3]);
|
||||||
strcpy(newAL.text1, row[4]);
|
strcpy(newAL.text1, row[4]);
|
||||||
strcpy(newAL.text2, row[5]);
|
strcpy(newAL.text2, row[5]);
|
||||||
strcpy(newAL.text3, row[6]);
|
strcpy(newAL.text3, row[6]);
|
||||||
newAL.goalid = atoi(row[7]);
|
newAL.goalid = Strings::ToInt(row[7]);
|
||||||
newAL.goalmethod = atoi(row[8]);
|
newAL.goalmethod = Strings::ToInt(row[8]);
|
||||||
newAL.goalcount = atoi(row[9]);
|
newAL.goalcount = Strings::ToInt(row[9]);
|
||||||
newAL.deliverToNpc = atoi(row[10]);
|
newAL.deliverToNpc = Strings::ToInt(row[10]);
|
||||||
newAL.zoneid = atoi(row[11]);
|
newAL.zoneid = Strings::ToInt(row[11]);
|
||||||
newAL.optional = atoi(row[12]) ? true : false;
|
newAL.optional = Strings::ToInt(row[12]) ? true : false;
|
||||||
|
|
||||||
taskActivitiesList.push_back(newAL);
|
taskActivitiesList.push_back(newAL);
|
||||||
activitiesLoaded++;
|
activitiesLoaded++;
|
||||||
@@ -301,8 +301,8 @@ bool MainFrame::LoadProximity()
|
|||||||
while ((row = mysql_fetch_row(res)) != NULL){
|
while ((row = mysql_fetch_row(res)) != NULL){
|
||||||
eqtask_proximity newPR;
|
eqtask_proximity newPR;
|
||||||
|
|
||||||
newPR.zoneid = atoi(row[0]);
|
newPR.zoneid = Strings::ToInt(row[0]);
|
||||||
newPR.exploreid = atoi(row[1]);
|
newPR.exploreid = Strings::ToInt(row[1]);
|
||||||
newPR.minx = atof(row[2]);
|
newPR.minx = atof(row[2]);
|
||||||
newPR.maxx = atof(row[3]);
|
newPR.maxx = atof(row[3]);
|
||||||
newPR.miny = atof(row[4]);
|
newPR.miny = atof(row[4]);
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ void MainFrame::SaveProximity(wxCommandEvent& event)
|
|||||||
|
|
||||||
inStr.Clear();
|
inStr.Clear();
|
||||||
inStr = mProxId->GetValue();
|
inStr = mProxId->GetValue();
|
||||||
toSave.exploreid = atoi(inStr.mb_str());
|
toSave.exploreid = Strings::ToInt(inStr.mb_str());
|
||||||
|
|
||||||
inStr.Clear();
|
inStr.Clear();
|
||||||
inStr = mProxMinx->GetValue();
|
inStr = mProxMinx->GetValue();
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ void MainFrame::OnRewardButton(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
wxString ridStr = mRewardID->GetValue();
|
wxString ridStr = mRewardID->GetValue();
|
||||||
int rtype = mRewardMethod->GetCurrentSelection();
|
int rtype = mRewardMethod->GetCurrentSelection();
|
||||||
int rid = atoi(ridStr.mb_str());
|
int rid = Strings::ToInt(ridStr.mb_str());
|
||||||
|
|
||||||
ShowRewardChange(rtype,rid);
|
ShowRewardChange(rtype,rid);
|
||||||
}
|
}
|
||||||
@@ -224,15 +224,15 @@ void MainFrame::SaveTask(wxCommandEvent& event)
|
|||||||
getStr.Clear();
|
getStr.Clear();
|
||||||
|
|
||||||
getStr = mTaskMinLvl->GetValue();
|
getStr = mTaskMinLvl->GetValue();
|
||||||
ourTask.level_min = atoi(getStr.mb_str());
|
ourTask.level_min = Strings::ToInt(getStr.mb_str());
|
||||||
getStr.Clear();
|
getStr.Clear();
|
||||||
|
|
||||||
getStr = mTaskMaxLvl->GetValue();
|
getStr = mTaskMaxLvl->GetValue();
|
||||||
ourTask.level_max = atoi(getStr.mb_str());
|
ourTask.level_max = Strings::ToInt(getStr.mb_str());
|
||||||
getStr.Clear();
|
getStr.Clear();
|
||||||
|
|
||||||
getStr = mTaskDuration->GetValue();
|
getStr = mTaskDuration->GetValue();
|
||||||
ourTask.duration = atoi(getStr.mb_str());
|
ourTask.duration = Strings::ToInt(getStr.mb_str());
|
||||||
getStr.Clear();
|
getStr.Clear();
|
||||||
|
|
||||||
getStr = mRewardName->GetValue();
|
getStr = mRewardName->GetValue();
|
||||||
@@ -240,15 +240,15 @@ void MainFrame::SaveTask(wxCommandEvent& event)
|
|||||||
getStr.Clear();
|
getStr.Clear();
|
||||||
|
|
||||||
getStr = mRewardID->GetValue();
|
getStr = mRewardID->GetValue();
|
||||||
ourTask.rewardid = atoi(getStr.mb_str());
|
ourTask.rewardid = Strings::ToInt(getStr.mb_str());
|
||||||
getStr.Clear();
|
getStr.Clear();
|
||||||
|
|
||||||
getStr = mRewardCash->GetValue();
|
getStr = mRewardCash->GetValue();
|
||||||
ourTask.cashreward = atoi(getStr.mb_str());
|
ourTask.cashreward = Strings::ToInt(getStr.mb_str());
|
||||||
getStr.Clear();
|
getStr.Clear();
|
||||||
|
|
||||||
getStr = mRewardXP->GetValue();
|
getStr = mRewardXP->GetValue();
|
||||||
ourTask.xpreward = atoi(getStr.mb_str());
|
ourTask.xpreward = Strings::ToInt(getStr.mb_str());
|
||||||
getStr.Clear();
|
getStr.Clear();
|
||||||
|
|
||||||
int * i = (int*)mStartZone->GetClientData(mStartZone->GetSelection());
|
int * i = (int*)mStartZone->GetClientData(mStartZone->GetSelection());
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ bool load_paths_from_db(MYSQL *m, Map *map, const char *zone, list<PathGraph*> &
|
|||||||
cur->x = atof(row[0]);
|
cur->x = atof(row[0]);
|
||||||
cur->y = atof(row[1]);
|
cur->y = atof(row[1]);
|
||||||
cur->z = atof(row[2]);
|
cur->z = atof(row[2]);
|
||||||
cur_g = atoi(row[3]);
|
cur_g = Strings::ToInt(row[3]);
|
||||||
if(cur_g != last_g) {
|
if(cur_g != last_g) {
|
||||||
if(g != NULL) {
|
if(g != NULL) {
|
||||||
//if we have a first and last node for this path
|
//if we have a first and last node for this path
|
||||||
@@ -206,8 +206,8 @@ bool load_hints_from_db(MYSQL *m, const char *zone, list<PathNode*> &db_spawns)
|
|||||||
cur->x = atof(row[0]);
|
cur->x = atof(row[0]);
|
||||||
cur->y = atof(row[1]);
|
cur->y = atof(row[1]);
|
||||||
cur->z = atof(row[2]);
|
cur->z = atof(row[2]);
|
||||||
cur->forced = atoi(row[3])?true:false;
|
cur->forced = Strings::ToInt(row[3])?true:false;
|
||||||
cur->disjoint = atoi(row[4])?true:false;
|
cur->disjoint = Strings::ToInt(row[4])?true:false;
|
||||||
db_spawns.push_back(cur);
|
db_spawns.push_back(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,27 +242,27 @@ bool load_settings_from_db(MYSQL *m, const char *zone) {
|
|||||||
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
if((row = mysql_fetch_row(res))) {
|
if((row = mysql_fetch_row(res))) {
|
||||||
INCLUDE_DOORS = atoi(row[r++])?true:false;
|
INCLUDE_DOORS = Strings::ToInt(row[r++])?true:false;
|
||||||
MIN_FIX_Z = atof(row[r++]);
|
MIN_FIX_Z = atof(row[r++]);
|
||||||
FEAR_MAXIMUM_DISTANCE = atof(row[r++]);
|
FEAR_MAXIMUM_DISTANCE = atof(row[r++]);
|
||||||
IMAGE_SCALE = atoi(row[r++]);
|
IMAGE_SCALE = Strings::ToInt(row[r++]);
|
||||||
SPLIT_INVALID_PATHS = atoi(row[r++])?true:false;
|
SPLIT_INVALID_PATHS = Strings::ToInt(row[r++])?true:false;
|
||||||
LINK_PATH_ENDPOINTS = atoi(row[r++])?true:false;
|
LINK_PATH_ENDPOINTS = Strings::ToInt(row[r++])?true:false;
|
||||||
ENDPOINT_CONNECT_MAX_DISTANCE = atof(row[r++]);
|
ENDPOINT_CONNECT_MAX_DISTANCE = atof(row[r++]);
|
||||||
SPLIT_LINE_LENGTH = atof(row[r++]);
|
SPLIT_LINE_LENGTH = atof(row[r++]);
|
||||||
SPLIT_LINE_INTERVAL = atof(row[r++]);
|
SPLIT_LINE_INTERVAL = atof(row[r++]);
|
||||||
CLOSE_ENOUGH = atof(row[r++]);
|
CLOSE_ENOUGH = atof(row[r++]);
|
||||||
CLOSE_ENOUGH_COMBINE = atof(row[r++]);
|
CLOSE_ENOUGH_COMBINE = atof(row[r++]);
|
||||||
MERGE_MIN_SECOND_DIST = atof(row[r++]);
|
MERGE_MIN_SECOND_DIST = atof(row[r++]);
|
||||||
COMBINE_CHECK_ALL_LOS = atoi(row[r++])?true:false;
|
COMBINE_CHECK_ALL_LOS = Strings::ToInt(row[r++])?true:false;
|
||||||
CROSS_REDUCE_COUNT = atoi(row[r++]);
|
CROSS_REDUCE_COUNT = Strings::ToInt(row[r++]);
|
||||||
CROSS_MIN_LENGTH = atof(row[r++]);
|
CROSS_MIN_LENGTH = atof(row[r++]);
|
||||||
CROSS_MAX_Z_DIFF = atof(row[r++]);
|
CROSS_MAX_Z_DIFF = atof(row[r++]);
|
||||||
CLOSE_ENOUGH_CROSS = atof(row[r++]);
|
CLOSE_ENOUGH_CROSS = atof(row[r++]);
|
||||||
|
|
||||||
SPAWN_MIN_SECOND_DIST = atof(row[r++]);
|
SPAWN_MIN_SECOND_DIST = atof(row[r++]);
|
||||||
MAX_LINK_SPAWN_DIST = atof(row[r++]);
|
MAX_LINK_SPAWN_DIST = atof(row[r++]);
|
||||||
int sc = atoi(row[r++]);
|
int sc = Strings::ToInt(row[r++]);
|
||||||
SPAWN_LINK_TWICE = sc >= 2?true:false;
|
SPAWN_LINK_TWICE = sc >= 2?true:false;
|
||||||
SPAWN_LINK_THRICE = sc >= 3?true:false;
|
SPAWN_LINK_THRICE = sc >= 3?true:false;
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
|
|||||||
@@ -1118,7 +1118,7 @@ void QTBuilder::AddPlaceable(FileLoader *fileloader, char *ZoneFileName, bool Li
|
|||||||
if((ch==EOF)||(ch=='\n')) {
|
if((ch==EOF)||(ch=='\n')) {
|
||||||
IniBuffer[StrIndex] = '\0';
|
IniBuffer[StrIndex] = '\0';
|
||||||
if(State == ReadingModelNumbers) {
|
if(State == ReadingModelNumbers) {
|
||||||
ModelNumber = atoi(IniBuffer);
|
ModelNumber = Strings::ToInt(IniBuffer);
|
||||||
if((ModelNumber >= 0) && (ModelNumber < fileloader->model_data.model_count))
|
if((ModelNumber >= 0) && (ModelNumber < fileloader->model_data.model_count))
|
||||||
{
|
{
|
||||||
fileloader->model_data.models[ModelNumber]->IncludeInMap = true;
|
fileloader->model_data.models[ModelNumber]->IncludeInMap = true;
|
||||||
@@ -1146,7 +1146,7 @@ void QTBuilder::AddPlaceable(FileLoader *fileloader, char *ZoneFileName, bool Li
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ModelNumber = atoi(IniBuffer);
|
ModelNumber = Strings::ToInt(IniBuffer);
|
||||||
if((ModelNumber >= 0) && (ModelNumber < fileloader->model_data.model_count))
|
if((ModelNumber >= 0) && (ModelNumber < fileloader->model_data.model_count))
|
||||||
{
|
{
|
||||||
fileloader->model_data.models[ModelNumber]->IncludeInMap = true;
|
fileloader->model_data.models[ModelNumber]->IncludeInMap = true;
|
||||||
@@ -1323,7 +1323,7 @@ void QTBuilder::AddPlaceableV4(FileLoader *fileloader, char *ZoneFileName, bool
|
|||||||
Group = true;
|
Group = true;
|
||||||
strcpy(IniBuffer, IniBuffer+1);
|
strcpy(IniBuffer, IniBuffer+1);
|
||||||
}
|
}
|
||||||
ModelNumber = atoi(IniBuffer);
|
ModelNumber = Strings::ToInt(IniBuffer);
|
||||||
if(!Group)
|
if(!Group)
|
||||||
{
|
{
|
||||||
if((ModelNumber >= 0) && (ModelNumber < fileloader->model_data.model_count))
|
if((ModelNumber >= 0) && (ModelNumber < fileloader->model_data.model_count))
|
||||||
@@ -1369,7 +1369,7 @@ void QTBuilder::AddPlaceableV4(FileLoader *fileloader, char *ZoneFileName, bool
|
|||||||
Group = true;
|
Group = true;
|
||||||
strcpy(IniBuffer, IniBuffer+1);
|
strcpy(IniBuffer, IniBuffer+1);
|
||||||
}
|
}
|
||||||
ModelNumber = atoi(IniBuffer);
|
ModelNumber = Strings::ToInt(IniBuffer);
|
||||||
if(!Group)
|
if(!Group)
|
||||||
{
|
{
|
||||||
if((ModelNumber >= 0) && (ModelNumber < fileloader->model_data.model_count))
|
if((ModelNumber >= 0) && (ModelNumber < fileloader->model_data.model_count))
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) {
|
|||||||
if(Token == "*QUADSPERTILE")
|
if(Token == "*QUADSPERTILE")
|
||||||
{
|
{
|
||||||
Token = GetToken(ZonBuffer, ZonPosition);
|
Token = GetToken(ZonBuffer, ZonPosition);
|
||||||
QuadsPerTile = atoi(Token.c_str());
|
QuadsPerTile = Strings::ToInt(Token.c_str());
|
||||||
#ifdef DEBUGDAT
|
#ifdef DEBUGDAT
|
||||||
printf("Set QuadsPerTile to %i\n", QuadsPerTile);
|
printf("Set QuadsPerTile to %i\n", QuadsPerTile);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ FRAG_CONSTRUCTOR(Data15) {
|
|||||||
plac->scale[1] = hdr->scale[1];
|
plac->scale[1] = hdr->scale[1];
|
||||||
plac->scale[2] = hdr->scale[1];
|
plac->scale[2] = hdr->scale[1];
|
||||||
|
|
||||||
plac->model = atoi((const char*)&wld->sHash[-(int)hdr->ref]);
|
plac->model = Strings::ToInt((const char*)&wld->sHash[-(int)hdr->ref]);
|
||||||
|
|
||||||
pl = new Placeable *[wld->model_data.plac_count + 1];
|
pl = new Placeable *[wld->model_data.plac_count + 1];
|
||||||
memcpy(pl, wld->model_data.placeable, sizeof(Placeable *) * wld->model_data.plac_count);
|
memcpy(pl, wld->model_data.placeable, sizeof(Placeable *) * wld->model_data.plac_count);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
if(argc != 3)
|
if(argc != 3)
|
||||||
usage();
|
usage();
|
||||||
int charid = atoi(argv[1]);
|
int charid = Strings::ToInt(argv[1]);
|
||||||
if(charid == 0)
|
if(charid == 0)
|
||||||
usage();
|
usage();
|
||||||
outfile = argv[2];
|
outfile = argv[2];
|
||||||
@@ -91,7 +91,7 @@ int main(int argc, char *argv[]) {
|
|||||||
header.y = atof(row[4]);
|
header.y = atof(row[4]);
|
||||||
header.z = atof(row[5]);
|
header.z = atof(row[5]);
|
||||||
strcpy(header.zone_name, row[6]);
|
strcpy(header.zone_name, row[6]);
|
||||||
header.zone_id = atoi(row[7]);
|
header.zone_id = Strings::ToInt(row[7]);
|
||||||
//copy in blobs
|
//copy in blobs
|
||||||
ppbuffer = new char[header.profile_length];
|
ppbuffer = new char[header.profile_length];
|
||||||
eppbuffer = new char[header.extprofile_length];
|
eppbuffer = new char[header.extprofile_length];
|
||||||
@@ -114,8 +114,8 @@ int main(int argc, char *argv[]) {
|
|||||||
vector<FactionValueRecord> fr;
|
vector<FactionValueRecord> fr;
|
||||||
while((row = mysql_fetch_row(res))) {
|
while((row = mysql_fetch_row(res))) {
|
||||||
FactionValueRecord r;
|
FactionValueRecord r;
|
||||||
r.faction_id = atoi(row[0]);
|
r.faction_id = Strings::ToInt(row[0]);
|
||||||
r.current_value = atoi(row[1]);
|
r.current_value = Strings::ToInt(row[1]);
|
||||||
fr.push_back(r);
|
fr.push_back(r);
|
||||||
}
|
}
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
@@ -134,15 +134,15 @@ int main(int argc, char *argv[]) {
|
|||||||
vector<InventoryEntry> inv;
|
vector<InventoryEntry> inv;
|
||||||
while((row = mysql_fetch_row(res))) {
|
while((row = mysql_fetch_row(res))) {
|
||||||
InventoryEntry r;
|
InventoryEntry r;
|
||||||
r.slotid = atoi(row[0]);
|
r.slotid = Strings::ToInt(row[0]);
|
||||||
r.itemid = atoi(row[1]);
|
r.itemid = Strings::ToInt(row[1]);
|
||||||
r.charges = atoi(row[2]);
|
r.charges = Strings::ToInt(row[2]);
|
||||||
r.colors = atoi(row[3]);
|
r.colors = Strings::ToInt(row[3]);
|
||||||
r.augs[0] = atoi(row[4]);
|
r.augs[0] = Strings::ToInt(row[4]);
|
||||||
r.augs[1] = atoi(row[5]);
|
r.augs[1] = Strings::ToInt(row[5]);
|
||||||
r.augs[2] = atoi(row[6]);
|
r.augs[2] = Strings::ToInt(row[6]);
|
||||||
r.augs[3] = atoi(row[7]);
|
r.augs[3] = Strings::ToInt(row[7]);
|
||||||
r.augs[4] = atoi(row[8]);
|
r.augs[4] = Strings::ToInt(row[8]);
|
||||||
inv.push_back(r);
|
inv.push_back(r);
|
||||||
}
|
}
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
@@ -161,14 +161,14 @@ int main(int argc, char *argv[]) {
|
|||||||
vector<InventoryEntry> sb;
|
vector<InventoryEntry> sb;
|
||||||
while((row = mysql_fetch_row(res))) {
|
while((row = mysql_fetch_row(res))) {
|
||||||
InventoryEntry r;
|
InventoryEntry r;
|
||||||
r.slotid = atoi(row[0]);
|
r.slotid = Strings::ToInt(row[0]);
|
||||||
r.itemid = atoi(row[1]);
|
r.itemid = Strings::ToInt(row[1]);
|
||||||
r.charges = atoi(row[2]);
|
r.charges = Strings::ToInt(row[2]);
|
||||||
r.augs[0] = atoi(row[3]);
|
r.augs[0] = Strings::ToInt(row[3]);
|
||||||
r.augs[1] = atoi(row[4]);
|
r.augs[1] = Strings::ToInt(row[4]);
|
||||||
r.augs[2] = atoi(row[5]);
|
r.augs[2] = Strings::ToInt(row[5]);
|
||||||
r.augs[3] = atoi(row[6]);
|
r.augs[3] = Strings::ToInt(row[6]);
|
||||||
r.augs[4] = atoi(row[7]);
|
r.augs[4] = Strings::ToInt(row[7]);
|
||||||
sb.push_back(r);
|
sb.push_back(r);
|
||||||
}
|
}
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
@@ -187,11 +187,11 @@ int main(int argc, char *argv[]) {
|
|||||||
vector<QuestGlobalEntry> qg;
|
vector<QuestGlobalEntry> qg;
|
||||||
while((row = mysql_fetch_row(res))) {
|
while((row = mysql_fetch_row(res))) {
|
||||||
QuestGlobalEntry r;
|
QuestGlobalEntry r;
|
||||||
r.npcid = atoi(row[0]);
|
r.npcid = Strings::ToInt(row[0]);
|
||||||
r.zoneid = atoi(row[1]);
|
r.zoneid = Strings::ToInt(row[1]);
|
||||||
strcpy(r.name, row[2]);
|
strcpy(r.name, row[2]);
|
||||||
strcpy(r.value, row[3]);
|
strcpy(r.value, row[3]);
|
||||||
r.expdate = atoi(row[4]);
|
r.expdate = Strings::ToInt(row[4]);
|
||||||
qg.push_back(r);
|
qg.push_back(r);
|
||||||
}
|
}
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
if(argc != 3)
|
if(argc != 3)
|
||||||
usage();
|
usage();
|
||||||
int accountid = atoi(argv[1]);
|
int accountid = Strings::ToInt(argv[1]);
|
||||||
if(accountid == 0)
|
if(accountid == 0)
|
||||||
usage();
|
usage();
|
||||||
infile = argv[2];
|
infile = argv[2];
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ bool atobool(char* iBool) {
|
|||||||
return true;
|
return true;
|
||||||
if (!strcasecmp(iBool, "n"))
|
if (!strcasecmp(iBool, "n"))
|
||||||
return false;
|
return false;
|
||||||
if (atoi(iBool))
|
if (Strings::ToInt(iBool))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ void EQEmuDatabase::GetPlayer(std::string name)
|
|||||||
while ((row = mysql_fetch_row(res)) != NULL)
|
while ((row = mysql_fetch_row(res)) != NULL)
|
||||||
{
|
{
|
||||||
player_entry pe;
|
player_entry pe;
|
||||||
pe.id = atoi(row[1]);
|
pe.id = Strings::ToInt(row[1]);
|
||||||
pe.data = new char[sizeof(PlayerProfile_Struct)];
|
pe.data = new char[sizeof(PlayerProfile_Struct)];
|
||||||
memcpy(pe.data, row[0], sizeof(PlayerProfile_Struct));
|
memcpy(pe.data, row[0], sizeof(PlayerProfile_Struct));
|
||||||
player_list.push_back(pe);
|
player_list.push_back(pe);
|
||||||
@@ -97,7 +97,7 @@ void EQEmuDatabase::GetPlayers()
|
|||||||
while ((row = mysql_fetch_row(res)) != NULL)
|
while ((row = mysql_fetch_row(res)) != NULL)
|
||||||
{
|
{
|
||||||
player_entry pe;
|
player_entry pe;
|
||||||
pe.id = atoi(row[1]);
|
pe.id = Strings::ToInt(row[1]);
|
||||||
pe.data = new char[sizeof(PlayerProfile_Struct)];
|
pe.data = new char[sizeof(PlayerProfile_Struct)];
|
||||||
memcpy(pe.data, row[0], sizeof(PlayerProfile_Struct));
|
memcpy(pe.data, row[0], sizeof(PlayerProfile_Struct));
|
||||||
player_list.push_back(pe);
|
player_list.push_back(pe);
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ int main() {
|
|||||||
|
|
||||||
while((row = mysql_fetch_row(res))) {
|
while((row = mysql_fetch_row(res))) {
|
||||||
lengths = mysql_fetch_lengths(res);
|
lengths = mysql_fetch_lengths(res);
|
||||||
unsigned long id = atoi(row[0]);
|
unsigned long id = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
int curlen = lengths[2];
|
int curlen = lengths[2];
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ int main() {
|
|||||||
|
|
||||||
while((row = mysql_fetch_row(res))) {
|
while((row = mysql_fetch_row(res))) {
|
||||||
lengths = mysql_fetch_lengths(res);
|
lengths = mysql_fetch_lengths(res);
|
||||||
unsigned long id = atoi(row[0]);
|
unsigned long id = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
int curlen = lengths[2];
|
int curlen = lengths[2];
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ int main(int argc, char** argv) {
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
spid = atoi(argv[1]);
|
spid = Strings::ToInt(argv[1]);
|
||||||
|
|
||||||
|
|
||||||
int tempid=0;
|
int tempid=0;
|
||||||
@@ -35,7 +35,7 @@ int main(int argc, char** argv) {
|
|||||||
if(spell_line[0]=='\0')
|
if(spell_line[0]=='\0')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
tempid = atoi(sep.arg[0]);
|
tempid = Strings::ToInt(sep.arg[0]);
|
||||||
if(tempid != spid)
|
if(tempid != spid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -55,75 +55,75 @@ int main(int argc, char** argv) {
|
|||||||
sp.aoerange=atof(sep.arg[10]);
|
sp.aoerange=atof(sep.arg[10]);
|
||||||
sp.pushback=atof(sep.arg[11]);
|
sp.pushback=atof(sep.arg[11]);
|
||||||
sp.pushup=atof(sep.arg[12]);
|
sp.pushup=atof(sep.arg[12]);
|
||||||
sp.cast_time=atoi(sep.arg[13]);
|
sp.cast_time=Strings::ToInt(sep.arg[13]);
|
||||||
sp.recovery_time=atoi(sep.arg[14]);
|
sp.recovery_time=Strings::ToInt(sep.arg[14]);
|
||||||
sp.recast_time=atoi(sep.arg[15]);
|
sp.recast_time=Strings::ToInt(sep.arg[15]);
|
||||||
sp.buffdurationformula=atoi(sep.arg[16]);
|
sp.buffdurationformula=Strings::ToInt(sep.arg[16]);
|
||||||
sp.buffduration=atoi(sep.arg[17]);
|
sp.buffduration=Strings::ToInt(sep.arg[17]);
|
||||||
sp.AEDuration=atoi(sep.arg[18]);
|
sp.AEDuration=Strings::ToInt(sep.arg[18]);
|
||||||
sp.mana=atoi(sep.arg[19]);
|
sp.mana=Strings::ToInt(sep.arg[19]);
|
||||||
|
|
||||||
int y=0;
|
int y=0;
|
||||||
for(y=0; y < EFFECT_COUNT;y++)
|
for(y=0; y < EFFECT_COUNT;y++)
|
||||||
sp.base[y]=atoi(sep.arg[20+y]);
|
sp.base[y]=Strings::ToInt(sep.arg[20+y]);
|
||||||
for(y=0;y<11;y++)
|
for(y=0;y<11;y++)
|
||||||
sp.base2[y]=atoi(sep.arg[33+y]);
|
sp.base2[y]=Strings::ToInt(sep.arg[33+y]);
|
||||||
for(y=0; y < EFFECT_COUNT;y++)
|
for(y=0; y < EFFECT_COUNT;y++)
|
||||||
sp.max[y]=atoi(sep.arg[44+y]);
|
sp.max[y]=Strings::ToInt(sep.arg[44+y]);
|
||||||
|
|
||||||
sp.icon=atoi(sep.arg[56]);
|
sp.icon=Strings::ToInt(sep.arg[56]);
|
||||||
sp.memicon=atoi(sep.arg[57]);
|
sp.memicon=Strings::ToInt(sep.arg[57]);
|
||||||
|
|
||||||
for(y=0; y< 4;y++)
|
for(y=0; y< 4;y++)
|
||||||
sp.components[y]=atoi(sep.arg[58+y]);
|
sp.components[y]=Strings::ToInt(sep.arg[58+y]);
|
||||||
|
|
||||||
for(y=0; y< 4;y++)
|
for(y=0; y< 4;y++)
|
||||||
sp.component_counts[y]=atoi(sep.arg[62+y]);
|
sp.component_counts[y]=Strings::ToInt(sep.arg[62+y]);
|
||||||
|
|
||||||
for(y=0; y< 4;y++)
|
for(y=0; y< 4;y++)
|
||||||
sp.NoexpendReagent[y]=atoi(sep.arg[66+y]);
|
sp.NoexpendReagent[y]=Strings::ToInt(sep.arg[66+y]);
|
||||||
|
|
||||||
for(y=0; y< 12;y++)
|
for(y=0; y< 12;y++)
|
||||||
sp.formula[y]=atoi(sep.arg[70+y]);
|
sp.formula[y]=Strings::ToInt(sep.arg[70+y]);
|
||||||
|
|
||||||
sp.LightType=atoi(sep.arg[82]);
|
sp.LightType=Strings::ToInt(sep.arg[82]);
|
||||||
sp.goodEffect=atoi(sep.arg[83]);
|
sp.goodEffect=Strings::ToInt(sep.arg[83]);
|
||||||
sp.Activated=atoi(sep.arg[84]);
|
sp.Activated=Strings::ToInt(sep.arg[84]);
|
||||||
sp.resisttype=atoi(sep.arg[85]);
|
sp.resisttype=Strings::ToInt(sep.arg[85]);
|
||||||
|
|
||||||
for(y=0; y< 12;y++)
|
for(y=0; y< 12;y++)
|
||||||
sp.effectid[y]=atoi(sep.arg[86+y]);
|
sp.effectid[y]=Strings::ToInt(sep.arg[86+y]);
|
||||||
|
|
||||||
sp.targettype=(SpellTargetType)atoi(sep.arg[98]);
|
sp.targettype=(SpellTargetType)Strings::ToInt(sep.arg[98]);
|
||||||
sp.basediff=atoi(sep.arg[99]);
|
sp.basediff=Strings::ToInt(sep.arg[99]);
|
||||||
sp.skill=(SkillType)atoi(sep.arg[100]);
|
sp.skill=(SkillType)Strings::ToInt(sep.arg[100]);
|
||||||
sp.zonetype=atoi(sep.arg[101]);
|
sp.zonetype=Strings::ToInt(sep.arg[101]);
|
||||||
sp.EnvironmentType=atoi(sep.arg[102]);
|
sp.EnvironmentType=Strings::ToInt(sep.arg[102]);
|
||||||
sp.TimeOfDay=atoi(sep.arg[103]);
|
sp.TimeOfDay=Strings::ToInt(sep.arg[103]);
|
||||||
|
|
||||||
for(y=0; y< 16;y++)
|
for(y=0; y< 16;y++)
|
||||||
sp.classes[y]=atoi(sep.arg[104+y]);
|
sp.classes[y]=Strings::ToInt(sep.arg[104+y]);
|
||||||
|
|
||||||
sp.CastingAnim=atoi(sep.arg[120]);
|
sp.CastingAnim=Strings::ToInt(sep.arg[120]);
|
||||||
sp.TargetAnim=atoi(sep.arg[121]);
|
sp.TargetAnim=Strings::ToInt(sep.arg[121]);
|
||||||
sp.TravelType=atoi(sep.arg[122]);
|
sp.TravelType=Strings::ToInt(sep.arg[122]);
|
||||||
sp.SpellAffectIndex=atoi(sep.arg[123]);
|
sp.SpellAffectIndex=Strings::ToInt(sep.arg[123]);
|
||||||
|
|
||||||
for(y=0; y< 23;y++) {
|
for(y=0; y< 23;y++) {
|
||||||
sp.spacing124[y]=atoi(sep.arg[124+y]);
|
sp.spacing124[y]=Strings::ToInt(sep.arg[124+y]);
|
||||||
}
|
}
|
||||||
|
|
||||||
sp.ResistDiff=atoi(sep.arg[147]);
|
sp.ResistDiff=Strings::ToInt(sep.arg[147]);
|
||||||
sp.dot_stacking_exempt=atoi(sep.arg[148]);
|
sp.dot_stacking_exempt=Strings::ToInt(sep.arg[148]);
|
||||||
sp.deletable=atoi(sep.arg[149]);
|
sp.deletable=Strings::ToInt(sep.arg[149]);
|
||||||
|
|
||||||
sp.RecourseLink = atoi(sep.arg[150]);
|
sp.RecourseLink = Strings::ToInt(sep.arg[150]);
|
||||||
sp.descnum = atoi(sep.arg[155]);
|
sp.descnum = Strings::ToInt(sep.arg[155]);
|
||||||
sp.typedescnum = atoi(sep.arg[156]);
|
sp.typedescnum = Strings::ToInt(sep.arg[156]);
|
||||||
sp.effectdescnum = atoi(sep.arg[157]);
|
sp.effectdescnum = Strings::ToInt(sep.arg[157]);
|
||||||
|
|
||||||
// for(y=0; y< 17;y++)
|
// for(y=0; y< 17;y++)
|
||||||
// sp.Spacing4[y] = atoi(sep.arg[158+y]);
|
// sp.Spacing4[y] = Strings::ToInt(sep.arg[158+y]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ require (
|
|||||||
require (
|
require (
|
||||||
github.com/golang/protobuf v1.3.2 // indirect
|
github.com/golang/protobuf v1.3.2 // indirect
|
||||||
github.com/google/go-querystring v1.1.0 // indirect
|
github.com/google/go-querystring v1.1.0 // indirect
|
||||||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
|
golang.org/x/crypto v0.1.0 // indirect
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect
|
golang.org/x/net v0.7.0 // indirect
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.7 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,11 +9,13 @@ github.com/google/go-github/v41 v41.0.0/go.mod h1:XgmCA5H323A9rtgExdTcnDkcqp6S30
|
|||||||
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
|
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
|
||||||
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
|
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=
|
|
||||||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
|
golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU=
|
||||||
|
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
|
||||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
|
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
|
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
|
||||||
|
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
|||||||
@@ -474,6 +474,8 @@
|
|||||||
9218|2023_01_24_item_recast.sql|show columns from character_item_recast like '%recast_type%'|contains|smallint
|
9218|2023_01_24_item_recast.sql|show columns from character_item_recast like '%recast_type%'|contains|smallint
|
||||||
9219|2023_01_29_merchant_status_requirements.sql|SHOW COLUMNS FROM merchantlist LIKE 'min_status'|empty|
|
9219|2023_01_29_merchant_status_requirements.sql|SHOW COLUMNS FROM merchantlist LIKE 'min_status'|empty|
|
||||||
9220|2022_12_19_player_events_tables.sql|SHOW TABLES LIKE 'player_event_logs'|empty|
|
9220|2022_12_19_player_events_tables.sql|SHOW TABLES LIKE 'player_event_logs'|empty|
|
||||||
|
9221|2023_02_24_npc_scaling_zone_id_instance_version.sql|SHOW COLUMNS FROM `npc_scale_global_base` LIKE 'zone_id'|empty|
|
||||||
|
9222|2023_02_28_npc_scaling_zone_list_version_list.sql|SHOW COLUMNS FROM `npc_scale_global_base` LIKE 'zone_id_list'|empty|
|
||||||
|
|
||||||
# Upgrade conditions:
|
# Upgrade conditions:
|
||||||
# This won't be needed after this system is implemented, but it is used database that are not
|
# This won't be needed after this system is implemented, but it is used database that are not
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
9035|2022_12_04_bot_archery.sql|SHOW COLUMNS FROM `bot_data` LIKE 'archery_setting'|empty|
|
9035|2022_12_04_bot_archery.sql|SHOW COLUMNS FROM `bot_data` LIKE 'archery_setting'|empty|
|
||||||
9036|2023_01_19_drop_bot_views.sql|SHOW TABLES LIKE 'vw_groups'|not_empty|
|
9036|2023_01_19_drop_bot_views.sql|SHOW TABLES LIKE 'vw_groups'|not_empty|
|
||||||
9037|2023_01_22_add_name_index.sql||show index from bot_data WHERE key_name = 'name`|empty|
|
9037|2023_01_22_add_name_index.sql||show index from bot_data WHERE key_name = 'name`|empty|
|
||||||
|
9038|2023_02_16_add_caster_range.sql|SHOW COLUMNS FROM `bot_data` LIKE 'caster_range'|empty|
|
||||||
|
|
||||||
# Upgrade conditions:
|
# Upgrade conditions:
|
||||||
# This won't be needed after this system is implemented, but it is used database that are not
|
# This won't be needed after this system is implemented, but it is used database that are not
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE `bot_data`
|
||||||
|
ADD COLUMN `caster_range` INT(11) UNSIGNED NOT NULL DEFAULT '300' AFTER `archery_setting`;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE `npc_scale_global_base`
|
||||||
|
ADD COLUMN `zone_id` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `level`,
|
||||||
|
ADD COLUMN `instance_version` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `zone_id`,
|
||||||
|
DROP PRIMARY KEY,
|
||||||
|
ADD PRIMARY KEY (`type`, `level`, `zone_id`, `instance_version`) USING BTREE;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE `npc_scale_global_base`
|
||||||
|
CHANGE COLUMN `zone_id` `zone_id_list` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 0 AFTER `level`,
|
||||||
|
CHANGE COLUMN `instance_version` `instance_version_list` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 0 AFTER `zone_id_list`,
|
||||||
|
DROP PRIMARY KEY,
|
||||||
|
ADD PRIMARY KEY (`type`, `level`, `zone_id_list`(255), `instance_version_list`(255)) USING BTREE;
|
||||||
+2
-2
@@ -383,8 +383,8 @@ void Adventure::MoveCorpsesToGraveyard()
|
|||||||
if(!results.Success())
|
if(!results.Success())
|
||||||
|
|
||||||
for(auto row = results.begin(); row != results.end(); ++row) {
|
for(auto row = results.begin(); row != results.end(); ++row) {
|
||||||
dbid_list.push_back(atoi(row[0]));
|
dbid_list.push_back(Strings::ToInt(row[0]));
|
||||||
charid_list.push_back(atoi(row[1]));
|
charid_list.push_back(Strings::ToInt(row[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &elem : dbid_list) {
|
for (auto &elem : dbid_list) {
|
||||||
|
|||||||
+52
-52
@@ -679,41 +679,41 @@ bool AdventureManager::LoadAdventureTemplates()
|
|||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
auto adventure_template = new AdventureTemplate;
|
auto adventure_template = new AdventureTemplate;
|
||||||
adventure_template->id = atoi(row[0]);
|
adventure_template->id = Strings::ToInt(row[0]);
|
||||||
strcpy(adventure_template->zone, row[1]);
|
strcpy(adventure_template->zone, row[1]);
|
||||||
|
|
||||||
adventure_template->zone_version = atoi(row[2]);
|
adventure_template->zone_version = Strings::ToInt(row[2]);
|
||||||
adventure_template->is_hard = atoi(row[3]);
|
adventure_template->is_hard = Strings::ToInt(row[3]);
|
||||||
adventure_template->min_level = atoi(row[4]);
|
adventure_template->min_level = Strings::ToInt(row[4]);
|
||||||
adventure_template->max_level = atoi(row[5]);
|
adventure_template->max_level = Strings::ToInt(row[5]);
|
||||||
adventure_template->type = atoi(row[6]);
|
adventure_template->type = Strings::ToInt(row[6]);
|
||||||
adventure_template->type_data = atoi(row[7]);
|
adventure_template->type_data = Strings::ToInt(row[7]);
|
||||||
adventure_template->type_count = atoi(row[8]);
|
adventure_template->type_count = Strings::ToInt(row[8]);
|
||||||
adventure_template->assa_x = atof(row[9]);
|
adventure_template->assa_x = Strings::ToFloat(row[9]);
|
||||||
adventure_template->assa_y = atof(row[10]);
|
adventure_template->assa_y = Strings::ToFloat(row[10]);
|
||||||
adventure_template->assa_z = atof(row[11]);
|
adventure_template->assa_z = Strings::ToFloat(row[11]);
|
||||||
adventure_template->assa_h = atof(row[12]);
|
adventure_template->assa_h = Strings::ToFloat(row[12]);
|
||||||
|
|
||||||
strn0cpy(adventure_template->text, row[13], sizeof(adventure_template->text));
|
strn0cpy(adventure_template->text, row[13], sizeof(adventure_template->text));
|
||||||
|
|
||||||
adventure_template->duration = atoi(row[14]);
|
adventure_template->duration = Strings::ToInt(row[14]);
|
||||||
adventure_template->zone_in_time = atoi(row[15]);
|
adventure_template->zone_in_time = Strings::ToInt(row[15]);
|
||||||
adventure_template->win_points = atoi(row[16]);
|
adventure_template->win_points = Strings::ToInt(row[16]);
|
||||||
adventure_template->lose_points = atoi(row[17]);
|
adventure_template->lose_points = Strings::ToInt(row[17]);
|
||||||
adventure_template->theme = atoi(row[18]);
|
adventure_template->theme = Strings::ToInt(row[18]);
|
||||||
adventure_template->zone_in_zone_id = atoi(row[19]);
|
adventure_template->zone_in_zone_id = Strings::ToInt(row[19]);
|
||||||
adventure_template->zone_in_x = atof(row[20]);
|
adventure_template->zone_in_x = Strings::ToFloat(row[20]);
|
||||||
adventure_template->zone_in_y = atof(row[21]);
|
adventure_template->zone_in_y = Strings::ToFloat(row[21]);
|
||||||
adventure_template->zone_in_object_id = atoi(row[22]);
|
adventure_template->zone_in_object_id = Strings::ToInt(row[22]);
|
||||||
adventure_template->dest_x = atof(row[23]);
|
adventure_template->dest_x = Strings::ToFloat(row[23]);
|
||||||
adventure_template->dest_y = atof(row[24]);
|
adventure_template->dest_y = Strings::ToFloat(row[24]);
|
||||||
adventure_template->dest_z = atof(row[25]);
|
adventure_template->dest_z = Strings::ToFloat(row[25]);
|
||||||
adventure_template->dest_h = atof(row[26]);
|
adventure_template->dest_h = Strings::ToFloat(row[26]);
|
||||||
adventure_template->graveyard_zone_id = atoi(row[27]);
|
adventure_template->graveyard_zone_id = Strings::ToInt(row[27]);
|
||||||
adventure_template->graveyard_x = atof(row[28]);
|
adventure_template->graveyard_x = Strings::ToFloat(row[28]);
|
||||||
adventure_template->graveyard_y = atof(row[29]);
|
adventure_template->graveyard_y = Strings::ToFloat(row[29]);
|
||||||
adventure_template->graveyard_z = atof(row[30]);
|
adventure_template->graveyard_z = Strings::ToFloat(row[30]);
|
||||||
adventure_template->graveyard_radius = atof(row[31]);
|
adventure_template->graveyard_radius = Strings::ToFloat(row[31]);
|
||||||
|
|
||||||
adventure_templates[adventure_template->id] = adventure_template;
|
adventure_templates[adventure_template->id] = adventure_template;
|
||||||
}
|
}
|
||||||
@@ -732,8 +732,8 @@ bool AdventureManager::LoadAdventureEntries()
|
|||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row)
|
for (auto row = results.begin(); row != results.end(); ++row)
|
||||||
{
|
{
|
||||||
int id = atoi(row[0]);
|
int id = Strings::ToInt(row[0]);
|
||||||
int template_id = atoi(row[1]);
|
int template_id = Strings::ToInt(row[1]);
|
||||||
AdventureTemplate* tid = nullptr;
|
AdventureTemplate* tid = nullptr;
|
||||||
|
|
||||||
auto t_iter = adventure_templates.find(template_id);
|
auto t_iter = adventure_templates.find(template_id);
|
||||||
@@ -1108,26 +1108,26 @@ void AdventureManager::LoadLeaderboardInfo()
|
|||||||
|
|
||||||
LeaderboardInfo lbi;
|
LeaderboardInfo lbi;
|
||||||
lbi.name = row[0];
|
lbi.name = row[0];
|
||||||
lbi.wins = atoi(row[3]);
|
lbi.wins = Strings::ToInt(row[3]);
|
||||||
lbi.guk_wins = atoi(row[3]);
|
lbi.guk_wins = Strings::ToInt(row[3]);
|
||||||
lbi.wins += atoi(row[4]);
|
lbi.wins += Strings::ToInt(row[4]);
|
||||||
lbi.mir_wins = atoi(row[4]);
|
lbi.mir_wins = Strings::ToInt(row[4]);
|
||||||
lbi.wins += atoi(row[5]);
|
lbi.wins += Strings::ToInt(row[5]);
|
||||||
lbi.mmc_wins = atoi(row[5]);
|
lbi.mmc_wins = Strings::ToInt(row[5]);
|
||||||
lbi.wins += atoi(row[6]);
|
lbi.wins += Strings::ToInt(row[6]);
|
||||||
lbi.ruj_wins = atoi(row[6]);
|
lbi.ruj_wins = Strings::ToInt(row[6]);
|
||||||
lbi.wins += atoi(row[7]);
|
lbi.wins += Strings::ToInt(row[7]);
|
||||||
lbi.tak_wins = atoi(row[7]);
|
lbi.tak_wins = Strings::ToInt(row[7]);
|
||||||
lbi.losses = atoi(row[8]);
|
lbi.losses = Strings::ToInt(row[8]);
|
||||||
lbi.guk_losses = atoi(row[8]);
|
lbi.guk_losses = Strings::ToInt(row[8]);
|
||||||
lbi.losses += atoi(row[9]);
|
lbi.losses += Strings::ToInt(row[9]);
|
||||||
lbi.mir_losses = atoi(row[9]);
|
lbi.mir_losses = Strings::ToInt(row[9]);
|
||||||
lbi.losses += atoi(row[10]);
|
lbi.losses += Strings::ToInt(row[10]);
|
||||||
lbi.mmc_losses = atoi(row[10]);
|
lbi.mmc_losses = Strings::ToInt(row[10]);
|
||||||
lbi.losses += atoi(row[11]);
|
lbi.losses += Strings::ToInt(row[11]);
|
||||||
lbi.ruj_losses = atoi(row[11]);
|
lbi.ruj_losses = Strings::ToInt(row[11]);
|
||||||
lbi.losses += atoi(row[12]);
|
lbi.losses += Strings::ToInt(row[12]);
|
||||||
lbi.tak_losses = atoi(row[12]);
|
lbi.tak_losses = Strings::ToInt(row[12]);
|
||||||
|
|
||||||
leaderboard_info_wins.push_back(lbi);
|
leaderboard_info_wins.push_back(lbi);
|
||||||
leaderboard_info_percentage.push_back(lbi);
|
leaderboard_info_percentage.push_back(lbi);
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
#include <thread>
|
||||||
|
#include "../../common/repositories/zone_repository.h"
|
||||||
|
#include "../../common/eqemu_config.h"
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
Database db;
|
||||||
|
Database db2;
|
||||||
|
|
||||||
|
volatile sig_atomic_t stop;
|
||||||
|
void inthand(int signum) {
|
||||||
|
stop = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[noreturn]] void DatabaseTest()
|
||||||
|
{
|
||||||
|
while (true) {
|
||||||
|
LogInfo("DatabaseTest Query");
|
||||||
|
db.QueryDatabase("SELECT 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[[noreturn]] void DatabaseTestSecondConnection()
|
||||||
|
{
|
||||||
|
while (true) {
|
||||||
|
LogInfo("DatabaseTest Query");
|
||||||
|
db2.QueryDatabase("SELECT 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WorldserverCLI::TestDatabaseConcurrency(int argc, char **argv, argh::parser &cmd, std::string &description)
|
||||||
|
{
|
||||||
|
description = "Test command to test database concurrency";
|
||||||
|
|
||||||
|
if (cmd[{"-h", "--help"}]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
signal(SIGINT, inthand);
|
||||||
|
|
||||||
|
LogInfo("Database test");
|
||||||
|
|
||||||
|
auto mutex = new Mutex;
|
||||||
|
|
||||||
|
auto c = EQEmuConfig::get();
|
||||||
|
LogInfo("Connecting to MySQL");
|
||||||
|
if (!db.Connect(
|
||||||
|
c->DatabaseHost.c_str(),
|
||||||
|
c->DatabaseUsername.c_str(),
|
||||||
|
c->DatabasePassword.c_str(),
|
||||||
|
c->DatabaseDB.c_str(),
|
||||||
|
c->DatabasePort
|
||||||
|
)) {
|
||||||
|
LogError("Cannot continue without a database connection");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
db.SetMutex(mutex);
|
||||||
|
|
||||||
|
db2.SetMySQL(db);
|
||||||
|
|
||||||
|
db2.SetMutex(mutex);
|
||||||
|
|
||||||
|
std::thread(DatabaseTest).detach();
|
||||||
|
std::thread(DatabaseTest).detach();
|
||||||
|
std::thread(DatabaseTestSecondConnection).detach();
|
||||||
|
|
||||||
|
while (!stop) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
safe_delete(mutex);
|
||||||
|
}
|
||||||
@@ -19,6 +19,6 @@ void WorldserverCLI::DatabaseSetAccountStatus(int argc, char **argv, argh::parse
|
|||||||
|
|
||||||
database.SetAccountStatus(
|
database.SetAccountStatus(
|
||||||
cmd(2).str(),
|
cmd(2).str(),
|
||||||
std::stoi(cmd(3).str())
|
Strings::ToInt(cmd(3).str())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
#include <cereal/archives/json.hpp>
|
||||||
|
#include <cereal/types/vector.hpp>
|
||||||
|
#include "../../common/events/player_events.h"
|
||||||
|
#include "../../common/timer.h"
|
||||||
|
|
||||||
|
void WorldserverCLI::TestStringBenchmarkCommand(int argc, char **argv, argh::parser &cmd, std::string &description)
|
||||||
|
{
|
||||||
|
description = "Test command";
|
||||||
|
|
||||||
|
if (cmd[{"-h", "--help"}]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Type {
|
||||||
|
StringsToInt = 0,
|
||||||
|
StringsToBigInt,
|
||||||
|
StringsToUnsignedInt,
|
||||||
|
StringsToUnsignedBigInt,
|
||||||
|
StringsToFloat,
|
||||||
|
StringsIsNumber,
|
||||||
|
StringsIsFloat,
|
||||||
|
StdStoi,
|
||||||
|
StdAtoi,
|
||||||
|
StdStoll,
|
||||||
|
StdAtoll,
|
||||||
|
StdStoul,
|
||||||
|
StdStoull,
|
||||||
|
StdStof,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Benchmark {
|
||||||
|
std::string name;
|
||||||
|
Type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<Benchmark> benches = {
|
||||||
|
Benchmark{.name = "Strings::ToInt", .type = StringsToInt},
|
||||||
|
Benchmark{.name = "std::stoi", .type = StdStoi},
|
||||||
|
Benchmark{.name = "std::atoi", .type = StdAtoi},
|
||||||
|
Benchmark{.name = "Strings::ToBigInt", .type = StringsToBigInt},
|
||||||
|
Benchmark{.name = "std::stoll", .type = StdStoll},
|
||||||
|
Benchmark{.name = "std::atoll", .type = StdAtoll},
|
||||||
|
Benchmark{.name = "Strings::ToUnsignedInt", .type = StringsToUnsignedInt},
|
||||||
|
Benchmark{.name = "std::stoul", .type = StdStoul},
|
||||||
|
Benchmark{.name = "Strings::ToUnsignedBigInt", .type = StringsToUnsignedBigInt},
|
||||||
|
Benchmark{.name = "std::stoull", .type = StdStoull},
|
||||||
|
Benchmark{.name = "Strings::ToFloat", .type = StringsToFloat},
|
||||||
|
Benchmark{.name = "std::stof", .type = StdStof},
|
||||||
|
Benchmark{.name = "Strings::IsNumber", .type = StringsIsNumber},
|
||||||
|
Benchmark{.name = "Strings::IsFloat", .type = StringsIsFloat},
|
||||||
|
};
|
||||||
|
|
||||||
|
BenchTimer benchmark;
|
||||||
|
|
||||||
|
for (auto &b: benches) {
|
||||||
|
int iterations = 10000000;
|
||||||
|
std::string number = "1111753784";
|
||||||
|
std::string float_number = "1111753784.2345623456345";
|
||||||
|
int64 convert = 0;
|
||||||
|
uint64_t uconvert = 0;
|
||||||
|
float fconvert = 0;
|
||||||
|
bool check = false;
|
||||||
|
|
||||||
|
for (int i = 0; i < iterations; i++) {
|
||||||
|
switch (b.type) {
|
||||||
|
case StringsToInt:
|
||||||
|
convert = Strings::ToInt(number, 0);
|
||||||
|
break;
|
||||||
|
case StdStoi:
|
||||||
|
convert = std::stoi(number);
|
||||||
|
break;
|
||||||
|
case StdAtoi:
|
||||||
|
convert = std::atoi(number.c_str());
|
||||||
|
break;
|
||||||
|
case StringsToBigInt:
|
||||||
|
convert = Strings::ToBigInt(number, 0);
|
||||||
|
break;
|
||||||
|
case StdStoll:
|
||||||
|
convert = std::stoll(number);
|
||||||
|
break;
|
||||||
|
case StdAtoll:
|
||||||
|
convert = std::atoll(number.c_str());
|
||||||
|
break;
|
||||||
|
case StringsToUnsignedInt:
|
||||||
|
uconvert = Strings::ToUnsignedInt(number, 0);
|
||||||
|
break;
|
||||||
|
case StringsToUnsignedBigInt:
|
||||||
|
uconvert = Strings::ToUnsignedBigInt(number, 0);
|
||||||
|
break;
|
||||||
|
case StringsToFloat:
|
||||||
|
fconvert = Strings::ToFloat(number, 0);
|
||||||
|
break;
|
||||||
|
case StringsIsNumber:
|
||||||
|
check = Strings::IsNumber(number);
|
||||||
|
break;
|
||||||
|
case StringsIsFloat:
|
||||||
|
check = Strings::IsFloat(float_number);
|
||||||
|
break;
|
||||||
|
case StdStoul:
|
||||||
|
uconvert = std::stoul(number);
|
||||||
|
break;
|
||||||
|
case StdStoull:
|
||||||
|
uconvert = std::stoull(number);
|
||||||
|
break;
|
||||||
|
case StdStof:
|
||||||
|
fconvert = std::stof(number);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LogInfo("{:<30} | [{}] time [{}]", b.name, Strings::Commify(iterations), benchmark.elapsed());
|
||||||
|
benchmark.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-6
@@ -453,7 +453,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
is_player_zoning = (login_info->zoning == 1);
|
is_player_zoning = (login_info->zoning == 1);
|
||||||
|
|
||||||
uint32 id = std::stoi(name);
|
uint32 id = Strings::ToInt(name);
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
LogWarning("Receiving Login Info Packet from Client | account_id is 0 - disconnecting");
|
LogWarning("Receiving Login Info Packet from Client | account_id is 0 - disconnecting");
|
||||||
return false;
|
return false;
|
||||||
@@ -808,7 +808,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
|||||||
if (!strcasecmp(row[1], char_name)) {
|
if (!strcasecmp(row[1], char_name)) {
|
||||||
if (RuleB(World, EnableReturnHomeButton)) {
|
if (RuleB(World, EnableReturnHomeButton)) {
|
||||||
int now = time(nullptr);
|
int now = time(nullptr);
|
||||||
if ((now - atoi(row[3])) >= RuleI(World, MinOfflineTimeToReturnHome)) {
|
if ((now - Strings::ToInt(row[3])) >= RuleI(World, MinOfflineTimeToReturnHome)) {
|
||||||
home_enabled = true;
|
home_enabled = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -834,7 +834,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
|||||||
if (!strcasecmp(row[1], char_name)) {
|
if (!strcasecmp(row[1], char_name)) {
|
||||||
if (
|
if (
|
||||||
RuleB(World, EnableTutorialButton) &&
|
RuleB(World, EnableTutorialButton) &&
|
||||||
std::stoi(row[2]) <= RuleI(World, MaxLevelForTutorial)
|
Strings::ToInt(row[2]) <= RuleI(World, MaxLevelForTutorial)
|
||||||
) {
|
) {
|
||||||
tutorial_enabled = true;
|
tutorial_enabled = true;
|
||||||
break;
|
break;
|
||||||
@@ -1258,7 +1258,7 @@ bool Client::ChecksumVerificationCRCEQGame(uint64 checksum)
|
|||||||
std::string checksumvar;
|
std::string checksumvar;
|
||||||
uint64_t checksumint;
|
uint64_t checksumint;
|
||||||
if (database.GetVariable("crc_eqgame", checksumvar)) {
|
if (database.GetVariable("crc_eqgame", checksumvar)) {
|
||||||
checksumint = atoll(checksumvar.c_str());
|
checksumint = Strings::ToBigInt(checksumvar.c_str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LogChecksumVerification("variable not set in variables table.");
|
LogChecksumVerification("variable not set in variables table.");
|
||||||
@@ -1281,7 +1281,7 @@ bool Client::ChecksumVerificationCRCSkillCaps(uint64 checksum)
|
|||||||
std::string checksumvar;
|
std::string checksumvar;
|
||||||
uint64_t checksumint;
|
uint64_t checksumint;
|
||||||
if (database.GetVariable("crc_skillcaps", checksumvar)) {
|
if (database.GetVariable("crc_skillcaps", checksumvar)) {
|
||||||
checksumint = atoll(checksumvar.c_str());
|
checksumint = Strings::ToBigInt(checksumvar.c_str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LogChecksumVerification("[checksum_crc2_skillcaps] variable not set in variables table.");
|
LogChecksumVerification("[checksum_crc2_skillcaps] variable not set in variables table.");
|
||||||
@@ -1304,7 +1304,7 @@ bool Client::ChecksumVerificationCRCBaseData(uint64 checksum)
|
|||||||
std::string checksumvar;
|
std::string checksumvar;
|
||||||
uint64_t checksumint;
|
uint64_t checksumint;
|
||||||
if (database.GetVariable("crc_basedata", checksumvar)) {
|
if (database.GetVariable("crc_basedata", checksumvar)) {
|
||||||
checksumint = atoll(checksumvar.c_str());
|
checksumint = Strings::ToBigInt(checksumvar.c_str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LogChecksumVerification("variable not set in variables table.");
|
LogChecksumVerification("variable not set in variables table.");
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ bool ClientListEntry::CheckAuth(uint32 loginserver_account_id, const char *key_p
|
|||||||
}
|
}
|
||||||
std::string lsworldadmin;
|
std::string lsworldadmin;
|
||||||
if (database.GetVariable("honorlsworldadmin", lsworldadmin)) {
|
if (database.GetVariable("honorlsworldadmin", lsworldadmin)) {
|
||||||
if (atoi(lsworldadmin.c_str()) == 1 && pworldadmin != 0 && (padmin < pworldadmin || padmin == AccountStatus::Player)) {
|
if (Strings::ToInt(lsworldadmin.c_str()) == 1 && pworldadmin != 0 && (padmin < pworldadmin || padmin == AccountStatus::Player)) {
|
||||||
padmin = pworldadmin;
|
padmin = pworldadmin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-19
@@ -166,14 +166,14 @@ void ConsoleWho(
|
|||||||
}
|
}
|
||||||
else if (Strings::IsNumber(arg)) {
|
else if (Strings::IsNumber(arg)) {
|
||||||
if (whom.lvllow == 0xFFFF) {
|
if (whom.lvllow == 0xFFFF) {
|
||||||
whom.lvllow = atoi(arg.c_str());
|
whom.lvllow = Strings::ToInt(arg.c_str());
|
||||||
whom.lvlhigh = whom.lvllow;
|
whom.lvlhigh = whom.lvllow;
|
||||||
}
|
}
|
||||||
else if (atoi(arg.c_str()) > int(whom.lvllow)) {
|
else if (Strings::ToInt(arg.c_str()) > int(whom.lvllow)) {
|
||||||
whom.lvlhigh = atoi(arg.c_str());
|
whom.lvlhigh = Strings::ToInt(arg.c_str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
whom.lvllow = atoi(arg.c_str());
|
whom.lvllow = Strings::ToInt(arg.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -200,11 +200,11 @@ void ConsoleUptime(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Strings::IsNumber(args[0]) && atoi(args[0].c_str()) > 0) {
|
if (Strings::IsNumber(args[0]) && Strings::ToInt(args[0].c_str()) > 0) {
|
||||||
auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct));
|
auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct));
|
||||||
ServerUptime_Struct *sus = (ServerUptime_Struct *) pack->pBuffer;
|
ServerUptime_Struct *sus = (ServerUptime_Struct *) pack->pBuffer;
|
||||||
snprintf(sus->adminname, sizeof(sus->adminname), "*%s", connection->UserName().c_str());
|
snprintf(sus->adminname, sizeof(sus->adminname), "*%s", connection->UserName().c_str());
|
||||||
sus->zoneserverid = atoi(args[0].c_str());
|
sus->zoneserverid = Strings::ToInt(args[0].c_str());
|
||||||
ZoneServer *zs = zoneserver_list.FindByID(sus->zoneserverid);
|
ZoneServer *zs = zoneserver_list.FindByID(sus->zoneserverid);
|
||||||
if (zs) {
|
if (zs) {
|
||||||
zs->SendPacket(pack);
|
zs->SendPacket(pack);
|
||||||
@@ -284,7 +284,7 @@ void ConsoleEmote(
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccountStatus::Player,
|
AccountStatus::Player,
|
||||||
atoi(args[1].c_str()),
|
Strings::ToInt(args[1].c_str()),
|
||||||
Strings::Join(join_args, " ").c_str()
|
Strings::Join(join_args, " ").c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -295,7 +295,7 @@ void ConsoleEmote(
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccountStatus::Player,
|
AccountStatus::Player,
|
||||||
atoi(args[1].c_str()),
|
Strings::ToInt(args[1].c_str()),
|
||||||
Strings::Join(join_args, " ").c_str()
|
Strings::Join(join_args, " ").c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -304,7 +304,7 @@ void ConsoleEmote(
|
|||||||
args[0].c_str(),
|
args[0].c_str(),
|
||||||
0,
|
0,
|
||||||
AccountStatus::Player,
|
AccountStatus::Player,
|
||||||
atoi(args[1].c_str()),
|
Strings::ToInt(args[1].c_str()),
|
||||||
Strings::Join(join_args, " ").c_str()
|
Strings::Join(join_args, " ").c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -422,7 +422,7 @@ void ConsoleGuildSay(
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto from = args[0];
|
auto from = args[0];
|
||||||
auto guild_id = Strings::IsNumber(args[1]) ? std::stoul(args[1]) : 0;
|
auto guild_id = Strings::IsNumber(args[1]) ? Strings::ToUnsignedInt(args[1]) : 0;
|
||||||
if (!guild_id) {
|
if (!guild_id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -585,7 +585,7 @@ void ConsoleZoneShutdown(
|
|||||||
pack->opcode = ServerOP_ZoneShutdown;
|
pack->opcode = ServerOP_ZoneShutdown;
|
||||||
strcpy(s->adminname, tmpname);
|
strcpy(s->adminname, tmpname);
|
||||||
if (Strings::IsNumber(args[0])) {
|
if (Strings::IsNumber(args[0])) {
|
||||||
s->ZoneServerID = atoi(args[0].c_str());
|
s->ZoneServerID = Strings::ToInt(args[0].c_str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
s->zoneid = ZoneID(args[0].c_str());
|
s->zoneid = ZoneID(args[0].c_str());
|
||||||
@@ -639,12 +639,12 @@ void ConsoleZoneBootup(
|
|||||||
if (args.size() > 2) {
|
if (args.size() > 2) {
|
||||||
zoneserver_list.SOPZoneBootup(
|
zoneserver_list.SOPZoneBootup(
|
||||||
tmpname,
|
tmpname,
|
||||||
atoi(args[0].c_str()),
|
Strings::ToInt(args[0].c_str()),
|
||||||
args[1].c_str(),
|
args[1].c_str(),
|
||||||
(bool) (strcasecmp(args[1].c_str(), "static") == 0));
|
(bool) (strcasecmp(args[1].c_str(), "static") == 0));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
zoneserver_list.SOPZoneBootup(tmpname, atoi(args[0].c_str()), args[1].c_str(), false);
|
zoneserver_list.SOPZoneBootup(tmpname, Strings::ToInt(args[0].c_str()), args[1].c_str(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -751,10 +751,10 @@ void ConsoleFlag(
|
|||||||
connection->SendLine("Usage: flag [status] [accountname]");
|
connection->SendLine("Usage: flag [status] [accountname]");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (atoi(args[0].c_str()) > connection->Admin()) {
|
if (Strings::ToInt(args[0].c_str()) > connection->Admin()) {
|
||||||
connection->SendLine("You cannot set people's status to higher than your own");
|
connection->SendLine("You cannot set people's status to higher than your own");
|
||||||
}
|
}
|
||||||
else if (!database.SetAccountStatus(args[1].c_str(), atoi(args[0].c_str()))) {
|
else if (!database.SetAccountStatus(args[1].c_str(), Strings::ToInt(args[0].c_str()))) {
|
||||||
connection->SendLine("Unable to flag account!");
|
connection->SendLine("Unable to flag account!");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -821,8 +821,8 @@ void ConsoleWorldShutdown(
|
|||||||
{
|
{
|
||||||
if (args.size() == 2) {
|
if (args.size() == 2) {
|
||||||
int32 time, interval;
|
int32 time, interval;
|
||||||
if (Strings::IsNumber(args[0]) && Strings::IsNumber(args[1]) && ((time = atoi(args[0].c_str())) > 0) &&
|
if (Strings::IsNumber(args[0]) && Strings::IsNumber(args[1]) && ((time = Strings::ToInt(args[0].c_str())) > 0) &&
|
||||||
((interval = atoi(args[1].c_str())) > 0)) {
|
((interval = Strings::ToInt(args[1].c_str())) > 0)) {
|
||||||
zoneserver_list.WorldShutDown(time, interval);
|
zoneserver_list.WorldShutDown(time, interval);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -886,7 +886,7 @@ void ConsoleSignalCharByName(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
connection->SendLine(StringFormat("Signal Sent to %s with ID %i", (char *) args[0].c_str(), atoi(args[1].c_str())));
|
connection->SendLine(StringFormat("Signal Sent to %s with ID %i", (char *) args[0].c_str(), Strings::ToInt(args[1].c_str())));
|
||||||
uint32 message_len = strlen((char *) args[0].c_str()) + 1;
|
uint32 message_len = strlen((char *) args[0].c_str()) + 1;
|
||||||
auto pack = new ServerPacket(ServerOP_CZSignal, sizeof(CZSignal_Struct) + message_len);
|
auto pack = new ServerPacket(ServerOP_CZSignal, sizeof(CZSignal_Struct) + message_len);
|
||||||
CZSignal_Struct* CZS = (CZSignal_Struct*) pack->pBuffer;
|
CZSignal_Struct* CZS = (CZSignal_Struct*) pack->pBuffer;
|
||||||
@@ -894,7 +894,7 @@ void ConsoleSignalCharByName(
|
|||||||
int update_identifier = 0;
|
int update_identifier = 0;
|
||||||
CZS->update_type = update_type;
|
CZS->update_type = update_type;
|
||||||
CZS->update_identifier = update_identifier;
|
CZS->update_identifier = update_identifier;
|
||||||
CZS->signal_id = atoi(args[1].c_str());
|
CZS->signal_id = Strings::ToInt(args[1].c_str());
|
||||||
strn0cpy(CZS->client_name, (char *) args[0].c_str(), 64);
|
strn0cpy(CZS->client_name, (char *) args[0].c_str(), 64);
|
||||||
zoneserver_list.SendPacket(pack);
|
zoneserver_list.SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
|
|||||||
+17
-17
@@ -494,13 +494,13 @@ void Console::ProcessCommand(const char* command) {
|
|||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
else if (strcasecmp(sep.arg[0], "signalcharbyname") == 0) {
|
else if (strcasecmp(sep.arg[0], "signalcharbyname") == 0) {
|
||||||
SendMessage(1, "Signal Sent to %s with ID %i", (char*) sep.arg[1], atoi(sep.arg[2]));
|
SendMessage(1, "Signal Sent to %s with ID %i", (char*) sep.arg[1], Strings::ToInt(sep.arg[2]));
|
||||||
uint32 message_len = strlen((char*) sep.arg[1]) + 1;
|
uint32 message_len = strlen((char*) sep.arg[1]) + 1;
|
||||||
auto pack = new ServerPacket(ServerOP_CZSignalClientByName,
|
auto pack = new ServerPacket(ServerOP_CZSignalClientByName,
|
||||||
sizeof(CZClientSignalByName_Struct) + message_len);
|
sizeof(CZClientSignalByName_Struct) + message_len);
|
||||||
CZClientSignalByName_Struct* CZSC = (CZClientSignalByName_Struct*) pack->pBuffer;
|
CZClientSignalByName_Struct* CZSC = (CZClientSignalByName_Struct*) pack->pBuffer;
|
||||||
strn0cpy(CZSC->Name, (char*) sep.arg[1], 64);
|
strn0cpy(CZSC->Name, (char*) sep.arg[1], 64);
|
||||||
CZSC->data = atoi(sep.arg[2]);
|
CZSC->data = Strings::ToInt(sep.arg[2]);
|
||||||
zoneserver_list.SendPacket(pack);
|
zoneserver_list.SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
}
|
}
|
||||||
@@ -522,11 +522,11 @@ void Console::ProcessCommand(const char* command) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcasecmp(sep.arg[0], "uptime") == 0) {
|
else if (strcasecmp(sep.arg[0], "uptime") == 0) {
|
||||||
if (sep.IsNumber(1) && atoi(sep.arg[1]) > 0) {
|
if (sep.IsNumber(1) && Strings::ToInt(sep.arg[1]) > 0) {
|
||||||
auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct));
|
auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct));
|
||||||
ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer;
|
ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer;
|
||||||
snprintf(sus->adminname, sizeof(sus->adminname), "*%s", GetName());
|
snprintf(sus->adminname, sizeof(sus->adminname), "*%s", GetName());
|
||||||
sus->zoneserverid = atoi(sep.arg[1]);
|
sus->zoneserverid = Strings::ToInt(sep.arg[1]);
|
||||||
ZoneServer* zs = zoneserver_list.FindByID(sus->zoneserverid);
|
ZoneServer* zs = zoneserver_list.FindByID(sus->zoneserverid);
|
||||||
if (zs)
|
if (zs)
|
||||||
zs->SendPacket(pack);
|
zs->SendPacket(pack);
|
||||||
@@ -603,13 +603,13 @@ void Console::ProcessCommand(const char* command) {
|
|||||||
}
|
}
|
||||||
else if (strcasecmp(sep.arg[0], "emote") == 0) {
|
else if (strcasecmp(sep.arg[0], "emote") == 0) {
|
||||||
if (strcasecmp(sep.arg[1], "world") == 0)
|
if (strcasecmp(sep.arg[1], "world") == 0)
|
||||||
zoneserver_list.SendEmoteMessageRaw(0, 0, 0, atoi(sep.arg[2]), sep.argplus[3]);
|
zoneserver_list.SendEmoteMessageRaw(0, 0, 0, Strings::ToInt(sep.arg[2]), sep.argplus[3]);
|
||||||
else {
|
else {
|
||||||
ZoneServer* zs = zoneserver_list.FindByName(sep.arg[1]);
|
ZoneServer* zs = zoneserver_list.FindByName(sep.arg[1]);
|
||||||
if (zs != 0)
|
if (zs != 0)
|
||||||
zs->SendEmoteMessageRaw(0, 0, 0, atoi(sep.arg[2]), sep.argplus[3]);
|
zs->SendEmoteMessageRaw(0, 0, 0, Strings::ToInt(sep.arg[2]), sep.argplus[3]);
|
||||||
else
|
else
|
||||||
zoneserver_list.SendEmoteMessageRaw(sep.arg[1], 0, 0, atoi(sep.arg[2]), sep.argplus[3]);
|
zoneserver_list.SendEmoteMessageRaw(sep.arg[1], 0, 0, Strings::ToInt(sep.arg[2]), sep.argplus[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcasecmp(sep.arg[0], "movechar") == 0) {
|
else if (strcasecmp(sep.arg[0], "movechar") == 0) {
|
||||||
@@ -634,11 +634,11 @@ void Console::ProcessCommand(const char* command) {
|
|||||||
SendMessage(1, "Usage: flag [status] [accountname]");
|
SendMessage(1, "Usage: flag [status] [accountname]");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (atoi(sep.arg[1]) > Admin())
|
if (Strings::ToInt(sep.arg[1]) > Admin())
|
||||||
SendMessage(1, "You cannot set people's status to higher than your own");
|
SendMessage(1, "You cannot set people's status to higher than your own");
|
||||||
else if (atoi(sep.arg[1]) < 0 && Admin() < consoleFlagStatus)
|
else if (Strings::ToInt(sep.arg[1]) < 0 && Admin() < consoleFlagStatus)
|
||||||
SendMessage(1, "You have too low of status to change flags");
|
SendMessage(1, "You have too low of status to change flags");
|
||||||
else if (!database.SetAccountStatus(sep.arg[2], atoi(sep.arg[1])))
|
else if (!database.SetAccountStatus(sep.arg[2], Strings::ToInt(sep.arg[1])))
|
||||||
SendMessage(1, "Unable to flag account!");
|
SendMessage(1, "Unable to flag account!");
|
||||||
else
|
else
|
||||||
SendMessage(1, "Account Flaged");
|
SendMessage(1, "Account Flaged");
|
||||||
@@ -672,13 +672,13 @@ void Console::ProcessCommand(const char* command) {
|
|||||||
whom->gmlookup = 1;
|
whom->gmlookup = 1;
|
||||||
else if (sep.IsNumber(i)) {
|
else if (sep.IsNumber(i)) {
|
||||||
if (whom->lvllow == 0xFFFF) {
|
if (whom->lvllow == 0xFFFF) {
|
||||||
whom->lvllow = atoi(sep.arg[i]);
|
whom->lvllow = Strings::ToInt(sep.arg[i]);
|
||||||
whom->lvlhigh = whom->lvllow;
|
whom->lvlhigh = whom->lvllow;
|
||||||
}
|
}
|
||||||
else if (atoi(sep.arg[i]) > int(whom->lvllow))
|
else if (Strings::ToInt(sep.arg[i]) > int(whom->lvllow))
|
||||||
whom->lvlhigh = atoi(sep.arg[i]);
|
whom->lvlhigh = Strings::ToInt(sep.arg[i]);
|
||||||
else
|
else
|
||||||
whom->lvllow = atoi(sep.arg[i]);
|
whom->lvllow = Strings::ToInt(sep.arg[i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strn0cpy(whom->whom, sep.arg[i], sizeof(whom->whom));
|
strn0cpy(whom->whom, sep.arg[i], sizeof(whom->whom));
|
||||||
@@ -709,7 +709,7 @@ void Console::ProcessCommand(const char* command) {
|
|||||||
pack->opcode = ServerOP_ZoneShutdown;
|
pack->opcode = ServerOP_ZoneShutdown;
|
||||||
strcpy(s->adminname, tmpname);
|
strcpy(s->adminname, tmpname);
|
||||||
if (sep.arg[1][0] >= '0' && sep.arg[1][0] <= '9')
|
if (sep.arg[1][0] >= '0' && sep.arg[1][0] <= '9')
|
||||||
s->ZoneServerID = atoi(sep.arg[1]);
|
s->ZoneServerID = Strings::ToInt(sep.arg[1]);
|
||||||
else
|
else
|
||||||
s->zoneid = ZoneID(sep.arg[1]);
|
s->zoneid = ZoneID(sep.arg[1]);
|
||||||
|
|
||||||
@@ -738,12 +738,12 @@ void Console::ProcessCommand(const char* command) {
|
|||||||
strcpy(&tmpname[1], paccountname);
|
strcpy(&tmpname[1], paccountname);
|
||||||
|
|
||||||
LogInfo("Console ZoneBootup: [{}], [{}], [{}]",tmpname,sep.arg[2],sep.arg[1]);
|
LogInfo("Console ZoneBootup: [{}], [{}], [{}]",tmpname,sep.arg[2],sep.arg[1]);
|
||||||
zoneserver_list.SOPZoneBootup(tmpname, atoi(sep.arg[1]), sep.arg[2], (bool) (strcasecmp(sep.arg[3], "static") == 0));
|
zoneserver_list.SOPZoneBootup(tmpname, Strings::ToInt(sep.arg[1]), sep.arg[2], (bool) (strcasecmp(sep.arg[3], "static") == 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcasecmp(sep.arg[0], "worldshutdown") == 0 && admin >= consoleWorldStatus) {
|
else if (strcasecmp(sep.arg[0], "worldshutdown") == 0 && admin >= consoleWorldStatus) {
|
||||||
int32 time, interval;
|
int32 time, interval;
|
||||||
if(sep.IsNumber(1) && sep.IsNumber(2) && ((time=atoi(sep.arg[1]))>0) && ((interval=atoi(sep.arg[2]))>0)) {
|
if(sep.IsNumber(1) && sep.IsNumber(2) && ((time=Strings::ToInt(sep.arg[1]))>0) && ((interval=Strings::ToInt(sep.arg[2]))>0)) {
|
||||||
zoneserver_list.WorldShutDown(time, interval);
|
zoneserver_list.WorldShutDown(time, interval);
|
||||||
}
|
}
|
||||||
else if(strcasecmp(sep.arg[1], "now") == 0) {
|
else if(strcasecmp(sep.arg[1], "now") == 0) {
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ void EQEmuApiWorldDataService::reload(Json::Value &r, const std::vector<std::str
|
|||||||
uint8 global_repop = ReloadWorld::NoRepop;
|
uint8 global_repop = ReloadWorld::NoRepop;
|
||||||
|
|
||||||
if (Strings::IsNumber(args[2])) {
|
if (Strings::IsNumber(args[2])) {
|
||||||
global_repop = static_cast<uint8>(std::stoul(args[2]));
|
global_repop = static_cast<uint8>(Strings::ToUnsignedInt(args[2]));
|
||||||
|
|
||||||
if (global_repop > ReloadWorld::ForceRepop) {
|
if (global_repop > ReloadWorld::ForceRepop) {
|
||||||
global_repop = ReloadWorld::ForceRepop;
|
global_repop = ReloadWorld::ForceRepop;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ void EQLConfig::LoadSettings() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
m_dynamics = atoi(row[0]);
|
m_dynamics = Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf);
|
query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf);
|
||||||
@@ -60,7 +60,7 @@ void EQLConfig::LoadSettings() {
|
|||||||
LauncherZone zs;
|
LauncherZone zs;
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
zs.name = row[0];
|
zs.name = row[0];
|
||||||
zs.port = atoi(row[1]);
|
zs.port = Strings::ToInt(row[1]);
|
||||||
m_zones[zs.name] = zs;
|
m_zones[zs.name] = zs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -131,7 +131,7 @@ std::vector<std::string> EQW::ListBootedZones() {
|
|||||||
std::map<std::string,std::string> EQW::GetZoneDetails(Const_char *zone_ref) {
|
std::map<std::string,std::string> EQW::GetZoneDetails(Const_char *zone_ref) {
|
||||||
std::map<std::string,std::string> res;
|
std::map<std::string,std::string> res;
|
||||||
|
|
||||||
ZoneServer *zs = zoneserver_list.FindByID(atoi(zone_ref));
|
ZoneServer *zs = zoneserver_list.FindByID(Strings::ToInt(zone_ref));
|
||||||
if(zs == nullptr) {
|
if(zs == nullptr) {
|
||||||
res["error"] = "Invalid zone.";
|
res["error"] = "Invalid zone.";
|
||||||
return(res);
|
return(res);
|
||||||
@@ -316,7 +316,7 @@ int EQW::CountBugs() {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
return atoi(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> EQW::ListBugs(uint32 offset) {
|
std::vector<std::string> EQW::ListBugs(uint32 offset) {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ int HTTPRequest::getInt(const char *name, int default_value) const {
|
|||||||
res = m_values.find(name);
|
res = m_values.find(name);
|
||||||
if(res == m_values.end())
|
if(res == m_values.end())
|
||||||
return(default_value);
|
return(default_value);
|
||||||
return(atoi(res->second.c_str()));
|
return(Strings::ToInt(res->second.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
float HTTPRequest::getFloat(const char *name, float default_value) const {
|
float HTTPRequest::getFloat(const char *name, float default_value) const {
|
||||||
@@ -62,7 +62,7 @@ float HTTPRequest::getFloat(const char *name, float default_value) const {
|
|||||||
res = m_values.find(name);
|
res = m_values.find(name);
|
||||||
if(res == m_values.end())
|
if(res == m_values.end())
|
||||||
return(default_value);
|
return(default_value);
|
||||||
return(atof(res->second.c_str()));
|
return(Strings::ToFloat(res->second.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTTPRequest::header(Const_char *name, Const_char *value) {
|
void HTTPRequest::header(Const_char *name, Const_char *value) {
|
||||||
|
|||||||
+7
-11
@@ -131,12 +131,6 @@ inline void UpdateWindowTitle(std::string new_title)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerEventQueueListener() {
|
|
||||||
while (RunLoops) {
|
|
||||||
player_event_logs.Process();
|
|
||||||
Sleep(1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* World process entrypoint
|
* World process entrypoint
|
||||||
@@ -381,13 +375,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Timer player_event_process_timer(1000);
|
||||||
player_event_logs.SetDatabase(&database)->Init();
|
player_event_logs.SetDatabase(&database)->Init();
|
||||||
|
|
||||||
if (!RuleB(Logging, PlayerEventsQSProcess)) {
|
|
||||||
LogInfo("[PlayerEventQueueListener] Booting queue processor");
|
|
||||||
std::thread(PlayerEventQueueListener).detach();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto loop_fn = [&](EQ::Timer* t) {
|
auto loop_fn = [&](EQ::Timer* t) {
|
||||||
Timer::SetCurrentTime();
|
Timer::SetCurrentTime();
|
||||||
|
|
||||||
@@ -435,6 +425,10 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
client_list.Process();
|
client_list.Process();
|
||||||
|
|
||||||
|
if (player_event_process_timer.Check()) {
|
||||||
|
player_event_logs.Process();
|
||||||
|
}
|
||||||
|
|
||||||
if (PurgeInstanceTimer.Check()) {
|
if (PurgeInstanceTimer.Check()) {
|
||||||
database.PurgeExpiredInstances();
|
database.PurgeExpiredInstances();
|
||||||
database.PurgeAllDeletedDataBuckets();
|
database.PurgeAllDeletedDataBuckets();
|
||||||
@@ -484,6 +478,8 @@ int main(int argc, char **argv)
|
|||||||
LogInfo("Signaling HTTP service to stop");
|
LogInfo("Signaling HTTP service to stop");
|
||||||
LogSys.CloseFileLogs();
|
LogSys.CloseFileLogs();
|
||||||
|
|
||||||
|
WorldBoot::Shutdown();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+14
-4
@@ -30,6 +30,8 @@
|
|||||||
extern ZSList zoneserver_list;
|
extern ZSList zoneserver_list;
|
||||||
extern WorldConfig Config;
|
extern WorldConfig Config;
|
||||||
|
|
||||||
|
auto mutex = new Mutex;
|
||||||
|
|
||||||
void WorldBoot::GMSayHookCallBackProcessWorld(uint16 log_category, const char *func, std::string message)
|
void WorldBoot::GMSayHookCallBackProcessWorld(uint16 log_category, const char *func, std::string message)
|
||||||
{
|
{
|
||||||
// we don't want to loop up with chat messages
|
// we don't want to loop up with chat messages
|
||||||
@@ -136,9 +138,7 @@ bool WorldBoot::LoadDatabaseConnections()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Multi-tenancy - content database
|
||||||
* Multi-tenancy: Content database
|
|
||||||
*/
|
|
||||||
if (!c->ContentDbHost.empty()) {
|
if (!c->ContentDbHost.empty()) {
|
||||||
if (!content_db.Connect(
|
if (!content_db.Connect(
|
||||||
c->ContentDbHost.c_str(),
|
c->ContentDbHost.c_str(),
|
||||||
@@ -153,7 +153,12 @@ bool WorldBoot::LoadDatabaseConnections()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
content_db.SetMysql(database.getMySQL());
|
content_db.SetMySQL(database);
|
||||||
|
// when database and content_db share the same underlying mysql connection
|
||||||
|
// it needs to be protected by a shared mutex otherwise we produce concurrency issues
|
||||||
|
// when database actions are occurring in different threads
|
||||||
|
database.SetMutex(mutex);
|
||||||
|
content_db.SetMutex(mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -652,3 +657,8 @@ void WorldBoot::CheckForPossibleConfigurationIssues()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldBoot::Shutdown()
|
||||||
|
{
|
||||||
|
safe_delete(mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public:
|
|||||||
static void RegisterLoginservers();
|
static void RegisterLoginservers();
|
||||||
static bool DatabaseLoadRoutines(int argc, char **argv);
|
static bool DatabaseLoadRoutines(int argc, char **argv);
|
||||||
static void CheckForPossibleConfigurationIssues();
|
static void CheckForPossibleConfigurationIssues();
|
||||||
|
static void Shutdown();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,10 +31,13 @@ void WorldserverCLI::CommandHandler(int argc, char **argv)
|
|||||||
function_map["test:expansion"] = &WorldserverCLI::ExpansionTestCommand;
|
function_map["test:expansion"] = &WorldserverCLI::ExpansionTestCommand;
|
||||||
function_map["test:repository"] = &WorldserverCLI::TestRepository;
|
function_map["test:repository"] = &WorldserverCLI::TestRepository;
|
||||||
function_map["test:repository2"] = &WorldserverCLI::TestRepository2;
|
function_map["test:repository2"] = &WorldserverCLI::TestRepository2;
|
||||||
|
function_map["test:db-concurrency"] = &WorldserverCLI::TestDatabaseConcurrency;
|
||||||
|
function_map["test:string-benchmark"] = &WorldserverCLI::TestStringBenchmarkCommand;
|
||||||
|
|
||||||
EQEmuCommand::HandleMenu(function_map, cmd, argc, argv);
|
EQEmuCommand::HandleMenu(function_map, cmd, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "cli/database_concurrency.cpp"
|
||||||
#include "cli/copy_character.cpp"
|
#include "cli/copy_character.cpp"
|
||||||
#include "cli/database_dump.cpp"
|
#include "cli/database_dump.cpp"
|
||||||
#include "cli/database_get_schema.cpp"
|
#include "cli/database_get_schema.cpp"
|
||||||
@@ -45,4 +48,5 @@ void WorldserverCLI::CommandHandler(int argc, char **argv)
|
|||||||
#include "cli/test_expansion.cpp"
|
#include "cli/test_expansion.cpp"
|
||||||
#include "cli/test_repository.cpp"
|
#include "cli/test_repository.cpp"
|
||||||
#include "cli/test_repository_2.cpp"
|
#include "cli/test_repository_2.cpp"
|
||||||
|
#include "cli/test_string_benchmark.cpp"
|
||||||
#include "cli/version.cpp"
|
#include "cli/version.cpp"
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ public:
|
|||||||
static void ExpansionTestCommand(int argc, char **argv, argh::parser &cmd, std::string &description);
|
static void ExpansionTestCommand(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||||
static void TestRepository(int argc, char **argv, argh::parser &cmd, std::string &description);
|
static void TestRepository(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||||
static void TestRepository2(int argc, char **argv, argh::parser &cmd, std::string &description);
|
static void TestRepository2(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||||
|
static void TestDatabaseConcurrency(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||||
|
static void TestStringBenchmarkCommand(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+96
-94
@@ -120,22 +120,22 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
|||||||
inventory_profile.SetInventoryVersion(client_version);
|
inventory_profile.SetInventoryVersion(client_version);
|
||||||
inventory_profile.SetGMInventory(true); // charsel can not interact with items..but, no harm in setting to full expansion support
|
inventory_profile.SetGMInventory(true); // charsel can not interact with items..but, no harm in setting to full expansion support
|
||||||
|
|
||||||
uint32 character_id = (uint32) atoi(row[0]);
|
uint32 character_id = (uint32) Strings::ToInt(row[0]);
|
||||||
uint8 has_home = 0;
|
uint8 has_home = 0;
|
||||||
uint8 has_bind = 0;
|
uint8 has_bind = 0;
|
||||||
|
|
||||||
memset(&pp, 0, sizeof(PlayerProfile_Struct));
|
memset(&pp, 0, sizeof(PlayerProfile_Struct));
|
||||||
memset(p_character_select_entry_struct->Name, 0, sizeof(p_character_select_entry_struct->Name));
|
memset(p_character_select_entry_struct->Name, 0, sizeof(p_character_select_entry_struct->Name));
|
||||||
strcpy(p_character_select_entry_struct->Name, row[1]);
|
strcpy(p_character_select_entry_struct->Name, row[1]);
|
||||||
p_character_select_entry_struct->Class = (uint8) atoi(row[4]);
|
p_character_select_entry_struct->Class = (uint8) Strings::ToInt(row[4]);
|
||||||
p_character_select_entry_struct->Race = (uint32) atoi(row[3]);
|
p_character_select_entry_struct->Race = (uint32) Strings::ToInt(row[3]);
|
||||||
p_character_select_entry_struct->Level = (uint8) atoi(row[5]);
|
p_character_select_entry_struct->Level = (uint8) Strings::ToInt(row[5]);
|
||||||
p_character_select_entry_struct->ShroudClass = p_character_select_entry_struct->Class;
|
p_character_select_entry_struct->ShroudClass = p_character_select_entry_struct->Class;
|
||||||
p_character_select_entry_struct->ShroudRace = p_character_select_entry_struct->Race;
|
p_character_select_entry_struct->ShroudRace = p_character_select_entry_struct->Race;
|
||||||
p_character_select_entry_struct->Zone = (uint16) atoi(row[19]);
|
p_character_select_entry_struct->Zone = (uint16) Strings::ToInt(row[19]);
|
||||||
p_character_select_entry_struct->Instance = 0;
|
p_character_select_entry_struct->Instance = 0;
|
||||||
p_character_select_entry_struct->Gender = (uint8) atoi(row[2]);
|
p_character_select_entry_struct->Gender = (uint8) Strings::ToInt(row[2]);
|
||||||
p_character_select_entry_struct->Face = (uint8) atoi(row[15]);
|
p_character_select_entry_struct->Face = (uint8) Strings::ToInt(row[15]);
|
||||||
|
|
||||||
for (uint32 material_slot = 0; material_slot < EQ::textures::materialCount; material_slot++) {
|
for (uint32 material_slot = 0; material_slot < EQ::textures::materialCount; material_slot++) {
|
||||||
p_character_select_entry_struct->Equip[material_slot].Material = 0;
|
p_character_select_entry_struct->Equip[material_slot].Material = 0;
|
||||||
@@ -148,28 +148,28 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
|||||||
|
|
||||||
p_character_select_entry_struct->Unknown15 = 0xFF;
|
p_character_select_entry_struct->Unknown15 = 0xFF;
|
||||||
p_character_select_entry_struct->Unknown19 = 0xFF;
|
p_character_select_entry_struct->Unknown19 = 0xFF;
|
||||||
p_character_select_entry_struct->DrakkinTattoo = (uint32) atoi(row[17]);
|
p_character_select_entry_struct->DrakkinTattoo = (uint32) Strings::ToInt(row[17]);
|
||||||
p_character_select_entry_struct->DrakkinDetails = (uint32) atoi(row[18]);
|
p_character_select_entry_struct->DrakkinDetails = (uint32) Strings::ToInt(row[18]);
|
||||||
p_character_select_entry_struct->Deity = (uint32) atoi(row[6]);
|
p_character_select_entry_struct->Deity = (uint32) Strings::ToInt(row[6]);
|
||||||
p_character_select_entry_struct->PrimaryIDFile = 0; // Processed Below
|
p_character_select_entry_struct->PrimaryIDFile = 0; // Processed Below
|
||||||
p_character_select_entry_struct->SecondaryIDFile = 0; // Processed Below
|
p_character_select_entry_struct->SecondaryIDFile = 0; // Processed Below
|
||||||
p_character_select_entry_struct->HairColor = (uint8) atoi(row[9]);
|
p_character_select_entry_struct->HairColor = (uint8) Strings::ToInt(row[9]);
|
||||||
p_character_select_entry_struct->BeardColor = (uint8) atoi(row[10]);
|
p_character_select_entry_struct->BeardColor = (uint8) Strings::ToInt(row[10]);
|
||||||
p_character_select_entry_struct->EyeColor1 = (uint8) atoi(row[11]);
|
p_character_select_entry_struct->EyeColor1 = (uint8) Strings::ToInt(row[11]);
|
||||||
p_character_select_entry_struct->EyeColor2 = (uint8) atoi(row[12]);
|
p_character_select_entry_struct->EyeColor2 = (uint8) Strings::ToInt(row[12]);
|
||||||
p_character_select_entry_struct->HairStyle = (uint8) atoi(row[13]);
|
p_character_select_entry_struct->HairStyle = (uint8) Strings::ToInt(row[13]);
|
||||||
p_character_select_entry_struct->Beard = (uint8) atoi(row[14]);
|
p_character_select_entry_struct->Beard = (uint8) Strings::ToInt(row[14]);
|
||||||
p_character_select_entry_struct->GoHome = 0; // Processed Below
|
p_character_select_entry_struct->GoHome = 0; // Processed Below
|
||||||
p_character_select_entry_struct->Tutorial = 0; // Processed Below
|
p_character_select_entry_struct->Tutorial = 0; // Processed Below
|
||||||
p_character_select_entry_struct->DrakkinHeritage = (uint32) atoi(row[16]);
|
p_character_select_entry_struct->DrakkinHeritage = (uint32) Strings::ToInt(row[16]);
|
||||||
p_character_select_entry_struct->Unknown1 = 0;
|
p_character_select_entry_struct->Unknown1 = 0;
|
||||||
p_character_select_entry_struct->Enabled = 1;
|
p_character_select_entry_struct->Enabled = 1;
|
||||||
p_character_select_entry_struct->LastLogin = (uint32) atoi(row[7]); // RoF2 value: 1212696584
|
p_character_select_entry_struct->LastLogin = (uint32) Strings::ToInt(row[7]); // RoF2 value: 1212696584
|
||||||
p_character_select_entry_struct->Unknown2 = 0;
|
p_character_select_entry_struct->Unknown2 = 0;
|
||||||
|
|
||||||
if (RuleB(World, EnableReturnHomeButton)) {
|
if (RuleB(World, EnableReturnHomeButton)) {
|
||||||
int now = time(nullptr);
|
int now = time(nullptr);
|
||||||
if ((now - atoi(row[7])) >= RuleI(World, MinOfflineTimeToReturnHome))
|
if ((now - Strings::ToInt(row[7])) >= RuleI(World, MinOfflineTimeToReturnHome))
|
||||||
p_character_select_entry_struct->GoHome = 1;
|
p_character_select_entry_struct->GoHome = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,20 +194,20 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
|||||||
auto results_bind = database.QueryDatabase(character_list_query);
|
auto results_bind = database.QueryDatabase(character_list_query);
|
||||||
auto bind_count = results_bind.RowCount();
|
auto bind_count = results_bind.RowCount();
|
||||||
for (auto row_b = results_bind.begin(); row_b != results_bind.end(); ++row_b) {
|
for (auto row_b = results_bind.begin(); row_b != results_bind.end(); ++row_b) {
|
||||||
if (row_b[6] && atoi(row_b[6]) == 4) {
|
if (row_b[6] && Strings::ToInt(row_b[6]) == 4) {
|
||||||
has_home = 1;
|
has_home = 1;
|
||||||
// If our bind count is less than 5, we need to actually make use of this data so lets parse it
|
// If our bind count is less than 5, we need to actually make use of this data so lets parse it
|
||||||
if (bind_count < 5) {
|
if (bind_count < 5) {
|
||||||
pp.binds[4].zone_id = atoi(row_b[0]);
|
pp.binds[4].zone_id = Strings::ToInt(row_b[0]);
|
||||||
pp.binds[4].instance_id = atoi(row_b[1]);
|
pp.binds[4].instance_id = Strings::ToInt(row_b[1]);
|
||||||
pp.binds[4].x = atof(row_b[2]);
|
pp.binds[4].x = Strings::ToFloat(row_b[2]);
|
||||||
pp.binds[4].y = atof(row_b[3]);
|
pp.binds[4].y = Strings::ToFloat(row_b[3]);
|
||||||
pp.binds[4].z = atof(row_b[4]);
|
pp.binds[4].z = Strings::ToFloat(row_b[4]);
|
||||||
pp.binds[4].heading = atof(row_b[5]);
|
pp.binds[4].heading = Strings::ToFloat(row_b[5]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (row_b[6] && atoi(row_b[6]) == 0)
|
if (row_b[6] && Strings::ToInt(row_b[6]) == 0)
|
||||||
has_bind = 1;
|
has_bind = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,8 +233,8 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
|||||||
auto results_bind = content_db.QueryDatabase(character_list_query);
|
auto results_bind = content_db.QueryDatabase(character_list_query);
|
||||||
for (auto row_d = results_bind.begin(); row_d != results_bind.end(); ++row_d) {
|
for (auto row_d = results_bind.begin(); row_d != results_bind.end(); ++row_d) {
|
||||||
/* If a bind_id is specified, make them start there */
|
/* If a bind_id is specified, make them start there */
|
||||||
if (atoi(row_d[1]) != 0) {
|
if (Strings::ToInt(row_d[1]) != 0) {
|
||||||
pp.binds[4].zone_id = (uint32) atoi(row_d[1]);
|
pp.binds[4].zone_id = (uint32) Strings::ToInt(row_d[1]);
|
||||||
|
|
||||||
auto z = GetZone(pp.binds[4].zone_id);
|
auto z = GetZone(pp.binds[4].zone_id);
|
||||||
if (z) {
|
if (z) {
|
||||||
@@ -246,11 +246,11 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
|||||||
}
|
}
|
||||||
/* Otherwise, use the zone and coordinates given */
|
/* Otherwise, use the zone and coordinates given */
|
||||||
else {
|
else {
|
||||||
pp.binds[4].zone_id = (uint32) atoi(row_d[0]);
|
pp.binds[4].zone_id = (uint32) Strings::ToInt(row_d[0]);
|
||||||
float x = atof(row_d[2]);
|
float x = Strings::ToFloat(row_d[2]);
|
||||||
float y = atof(row_d[3]);
|
float y = Strings::ToFloat(row_d[3]);
|
||||||
float z = atof(row_d[4]);
|
float z = Strings::ToFloat(row_d[4]);
|
||||||
float heading = atof(row_d[5]);
|
float heading = Strings::ToFloat(row_d[5]);
|
||||||
if (x == 0 && y == 0 && z == 0 && heading == 0) {
|
if (x == 0 && y == 0 && z == 0 && heading == 0) {
|
||||||
auto zone = GetZone(pp.binds[4].zone_id);
|
auto zone = GetZone(pp.binds[4].zone_id);
|
||||||
if (zone) {
|
if (zone) {
|
||||||
@@ -350,11 +350,11 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
|||||||
auto results_b = database.QueryDatabase(character_list_query);
|
auto results_b = database.QueryDatabase(character_list_query);
|
||||||
uint8 slot = 0;
|
uint8 slot = 0;
|
||||||
for (auto row_b = results_b.begin(); row_b != results_b.end(); ++row_b) {
|
for (auto row_b = results_b.begin(); row_b != results_b.end(); ++row_b) {
|
||||||
slot = atoi(row_b[0]);
|
slot = Strings::ToInt(row_b[0]);
|
||||||
pp.item_tint.Slot[slot].Red = atoi(row_b[1]);
|
pp.item_tint.Slot[slot].Red = Strings::ToInt(row_b[1]);
|
||||||
pp.item_tint.Slot[slot].Green = atoi(row_b[2]);
|
pp.item_tint.Slot[slot].Green = Strings::ToInt(row_b[2]);
|
||||||
pp.item_tint.Slot[slot].Blue = atoi(row_b[3]);
|
pp.item_tint.Slot[slot].Blue = Strings::ToInt(row_b[3]);
|
||||||
pp.item_tint.Slot[slot].UseTint = atoi(row_b[4]);
|
pp.item_tint.Slot[slot].UseTint = Strings::ToInt(row_b[4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetCharSelInventory(account_id, p_character_select_entry_struct->Name, &inventory_profile)) {
|
if (GetCharSelInventory(account_id, p_character_select_entry_struct->Name, &inventory_profile)) {
|
||||||
@@ -380,7 +380,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
|||||||
p_character_select_entry_struct->Equip[matslot].Material = item_id_file;
|
p_character_select_entry_struct->Equip[matslot].Material = item_id_file;
|
||||||
} else {
|
} else {
|
||||||
if (strlen(item->IDFile) > 2) {
|
if (strlen(item->IDFile) > 2) {
|
||||||
item_id_file = atoi(&item->IDFile[2]);
|
item_id_file = Strings::ToInt(&item->IDFile[2]);
|
||||||
p_character_select_entry_struct->Equip[matslot].Material = item_id_file;
|
p_character_select_entry_struct->Equip[matslot].Material = item_id_file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -439,12 +439,12 @@ int WorldDatabase::MoveCharacterToBind(int character_id, uint8 bind_number)
|
|||||||
int zone_id, instance_id;
|
int zone_id, instance_id;
|
||||||
double x, y, z, heading;
|
double x, y, z, heading;
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
zone_id = atoi(row[0]);
|
zone_id = Strings::ToInt(row[0]);
|
||||||
instance_id = atoi(row[1]);
|
instance_id = Strings::ToInt(row[1]);
|
||||||
x = atof(row[2]);
|
x = Strings::ToFloat(row[2]);
|
||||||
y = atof(row[3]);
|
y = Strings::ToFloat(row[3]);
|
||||||
z = atof(row[4]);
|
z = Strings::ToFloat(row[4]);
|
||||||
heading = atof(row[5]);
|
heading = Strings::ToFloat(row[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
query = fmt::format(
|
query = fmt::format(
|
||||||
@@ -596,16 +596,16 @@ bool WorldDatabase::GetStartZone(
|
|||||||
else {
|
else {
|
||||||
LogInfo("Found starting location in start_zones");
|
LogInfo("Found starting location in start_zones");
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
pp->x = atof(row[0]);
|
pp->x = Strings::ToFloat(row[0]);
|
||||||
pp->y = atof(row[1]);
|
pp->y = Strings::ToFloat(row[1]);
|
||||||
pp->z = atof(row[2]);
|
pp->z = Strings::ToFloat(row[2]);
|
||||||
pp->heading = atof(row[3]);
|
pp->heading = Strings::ToFloat(row[3]);
|
||||||
pp->zone_id = atoi(row[4]);
|
pp->zone_id = Strings::ToInt(row[4]);
|
||||||
pp->binds[0].zone_id = atoi(row[5]);
|
pp->binds[0].zone_id = Strings::ToInt(row[5]);
|
||||||
pp->binds[0].x = atof(row[6]);
|
pp->binds[0].x = Strings::ToFloat(row[6]);
|
||||||
pp->binds[0].y = atof(row[7]);
|
pp->binds[0].y = Strings::ToFloat(row[7]);
|
||||||
pp->binds[0].z = atof(row[8]);
|
pp->binds[0].z = Strings::ToFloat(row[8]);
|
||||||
pp->binds[0].heading = atof(row[3]);
|
pp->binds[0].heading = Strings::ToFloat(row[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -792,7 +792,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
level = atoi(row[0]);
|
level = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -808,21 +808,21 @@ bool WorldDatabase::LoadCharacterCreateAllocations()
|
|||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
RaceClassAllocation allocate;
|
RaceClassAllocation allocate;
|
||||||
allocate.Index = atoi(row[0]);
|
allocate.Index = Strings::ToInt(row[0]);
|
||||||
allocate.BaseStats[0] = atoi(row[1]);
|
allocate.BaseStats[0] = Strings::ToInt(row[1]);
|
||||||
allocate.BaseStats[3] = atoi(row[2]);
|
allocate.BaseStats[3] = Strings::ToInt(row[2]);
|
||||||
allocate.BaseStats[1] = atoi(row[3]);
|
allocate.BaseStats[1] = Strings::ToInt(row[3]);
|
||||||
allocate.BaseStats[2] = atoi(row[4]);
|
allocate.BaseStats[2] = Strings::ToInt(row[4]);
|
||||||
allocate.BaseStats[4] = atoi(row[5]);
|
allocate.BaseStats[4] = Strings::ToInt(row[5]);
|
||||||
allocate.BaseStats[5] = atoi(row[6]);
|
allocate.BaseStats[5] = Strings::ToInt(row[6]);
|
||||||
allocate.BaseStats[6] = atoi(row[7]);
|
allocate.BaseStats[6] = Strings::ToInt(row[7]);
|
||||||
allocate.DefaultPointAllocation[0] = atoi(row[8]);
|
allocate.DefaultPointAllocation[0] = Strings::ToInt(row[8]);
|
||||||
allocate.DefaultPointAllocation[3] = atoi(row[9]);
|
allocate.DefaultPointAllocation[3] = Strings::ToInt(row[9]);
|
||||||
allocate.DefaultPointAllocation[1] = atoi(row[10]);
|
allocate.DefaultPointAllocation[1] = Strings::ToInt(row[10]);
|
||||||
allocate.DefaultPointAllocation[2] = atoi(row[11]);
|
allocate.DefaultPointAllocation[2] = Strings::ToInt(row[11]);
|
||||||
allocate.DefaultPointAllocation[4] = atoi(row[12]);
|
allocate.DefaultPointAllocation[4] = Strings::ToInt(row[12]);
|
||||||
allocate.DefaultPointAllocation[5] = atoi(row[13]);
|
allocate.DefaultPointAllocation[5] = Strings::ToInt(row[13]);
|
||||||
allocate.DefaultPointAllocation[6] = atoi(row[14]);
|
allocate.DefaultPointAllocation[6] = Strings::ToInt(row[14]);
|
||||||
|
|
||||||
character_create_allocations.push_back(allocate);
|
character_create_allocations.push_back(allocate);
|
||||||
}
|
}
|
||||||
@@ -841,12 +841,12 @@ bool WorldDatabase::LoadCharacterCreateCombos()
|
|||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
RaceClassCombos combo;
|
RaceClassCombos combo;
|
||||||
combo.AllocationIndex = atoi(row[0]);
|
combo.AllocationIndex = Strings::ToInt(row[0]);
|
||||||
combo.Race = atoi(row[1]);
|
combo.Race = Strings::ToInt(row[1]);
|
||||||
combo.Class = atoi(row[2]);
|
combo.Class = Strings::ToInt(row[2]);
|
||||||
combo.Deity = atoi(row[3]);
|
combo.Deity = Strings::ToInt(row[3]);
|
||||||
combo.Zone = atoi(row[4]);
|
combo.Zone = Strings::ToInt(row[4]);
|
||||||
combo.ExpansionRequired = atoi(row[5]);
|
combo.ExpansionRequired = Strings::ToInt(row[5]);
|
||||||
|
|
||||||
character_create_race_class_combos.push_back(combo);
|
character_create_race_class_combos.push_back(combo);
|
||||||
}
|
}
|
||||||
@@ -876,7 +876,8 @@ bool WorldDatabase::GetCharSelInventory(uint32 account_id, char *name, EQ::Inven
|
|||||||
" custom_data,"
|
" custom_data,"
|
||||||
" ornamenticon,"
|
" ornamenticon,"
|
||||||
" ornamentidfile,"
|
" ornamentidfile,"
|
||||||
" ornament_hero_model "
|
" ornament_hero_model, ",
|
||||||
|
" guid "
|
||||||
"FROM"
|
"FROM"
|
||||||
" inventory "
|
" inventory "
|
||||||
"INNER JOIN"
|
"INNER JOIN"
|
||||||
@@ -901,7 +902,7 @@ bool WorldDatabase::GetCharSelInventory(uint32 account_id, char *name, EQ::Inven
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
int16 slot_id = atoi(row[0]);
|
int16 slot_id = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
switch (slot_id) {
|
switch (slot_id) {
|
||||||
case EQ::invslot::slotFace:
|
case EQ::invslot::slotFace:
|
||||||
@@ -916,28 +917,29 @@ bool WorldDatabase::GetCharSelInventory(uint32 account_id, char *name, EQ::Inven
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 item_id = atoi(row[1]);
|
uint32 item_id = Strings::ToInt(row[1]);
|
||||||
int8 charges = atoi(row[2]);
|
int8 charges = Strings::ToInt(row[2]);
|
||||||
uint32 color = atoul(row[3]);
|
uint32 color = Strings::ToUnsignedInt(row[3]);
|
||||||
|
|
||||||
uint32 aug[EQ::invaug::SOCKET_COUNT];
|
uint32 aug[EQ::invaug::SOCKET_COUNT];
|
||||||
aug[0] = (uint32)atoi(row[4]);
|
aug[0] = (uint32)Strings::ToInt(row[4]);
|
||||||
aug[1] = (uint32)atoi(row[5]);
|
aug[1] = (uint32)Strings::ToInt(row[5]);
|
||||||
aug[2] = (uint32)atoi(row[6]);
|
aug[2] = (uint32)Strings::ToInt(row[6]);
|
||||||
aug[3] = (uint32)atoi(row[7]);
|
aug[3] = (uint32)Strings::ToInt(row[7]);
|
||||||
aug[4] = (uint32)atoi(row[8]);
|
aug[4] = (uint32)Strings::ToInt(row[8]);
|
||||||
aug[5] = (uint32)atoi(row[9]);
|
aug[5] = (uint32)Strings::ToInt(row[9]);
|
||||||
|
|
||||||
bool instnodrop = ((row[10] && (uint16)atoi(row[10])) ? true : false);
|
bool instnodrop = ((row[10] && (uint16)Strings::ToInt(row[10])) ? true : false);
|
||||||
uint32 ornament_icon = (uint32)atoul(row[12]);
|
uint32 ornament_icon = (uint32)Strings::ToUnsignedInt(row[12]);
|
||||||
uint32 ornament_idfile = (uint32)atoul(row[13]);
|
uint32 ornament_idfile = (uint32)Strings::ToUnsignedInt(row[13]);
|
||||||
uint32 ornament_hero_model = (uint32)atoul(row[14]);
|
uint32 ornament_hero_model = (uint32)Strings::ToUnsignedInt(row[14]);
|
||||||
|
std::string guid = row[15];
|
||||||
|
|
||||||
const EQ::ItemData *item = content_db.GetItem(item_id);
|
const EQ::ItemData *item = content_db.GetItem(item_id);
|
||||||
if (!item)
|
if (!item)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
EQ::ItemInstance *inst = content_db.CreateBaseItem(item, charges);
|
EQ::ItemInstance *inst = content_db.CreateBaseItem(item, guid, charges);
|
||||||
|
|
||||||
if (inst == nullptr)
|
if (inst == nullptr)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -255,7 +255,6 @@ SET(zone_headers
|
|||||||
quest_parser_collection.h
|
quest_parser_collection.h
|
||||||
raids.h
|
raids.h
|
||||||
raycast_mesh.h
|
raycast_mesh.h
|
||||||
skills.h
|
|
||||||
shared_task_zone_messaging.h
|
shared_task_zone_messaging.h
|
||||||
spawn2.cpp
|
spawn2.cpp
|
||||||
spawn2.h
|
spawn2.h
|
||||||
|
|||||||
+35
-35
@@ -1448,9 +1448,9 @@ bool ZoneDatabase::LoadAlternateAdvancement(Client *c) {
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(auto row = results.begin(); row != results.end(); ++row) {
|
for(auto row = results.begin(); row != results.end(); ++row) {
|
||||||
uint32 aa = atoi(row[0]);
|
uint32 aa = Strings::ToInt(row[0]);
|
||||||
uint32 value = atoi(row[1]);
|
uint32 value = Strings::ToInt(row[1]);
|
||||||
uint32 charges = atoi(row[2]);
|
uint32 charges = Strings::ToInt(row[2]);
|
||||||
|
|
||||||
auto rank = zone->GetAlternateAdvancementRank(aa);
|
auto rank = zone->GetAlternateAdvancementRank(aa);
|
||||||
if(!rank) {
|
if(!rank) {
|
||||||
@@ -1775,20 +1775,20 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
|
|||||||
if(results.Success()) {
|
if(results.Success()) {
|
||||||
for(auto row = results.begin(); row != results.end(); ++row) {
|
for(auto row = results.begin(); row != results.end(); ++row) {
|
||||||
auto ability = new AA::Ability;
|
auto ability = new AA::Ability;
|
||||||
ability->id = atoi(row[0]);
|
ability->id = Strings::ToInt(row[0]);
|
||||||
ability->name = row[1];
|
ability->name = row[1];
|
||||||
ability->category = atoi(row[2]);
|
ability->category = Strings::ToInt(row[2]);
|
||||||
//EQ client has classes left shifted by one bit for some odd reason
|
//EQ client has classes left shifted by one bit for some odd reason
|
||||||
ability->classes = atoi(row[3]) << 1;
|
ability->classes = Strings::ToInt(row[3]) << 1;
|
||||||
ability->races = atoi(row[4]);
|
ability->races = Strings::ToInt(row[4]);
|
||||||
ability->deities = atoi(row[5]);
|
ability->deities = Strings::ToInt(row[5]);
|
||||||
ability->drakkin_heritage = atoi(row[6]);
|
ability->drakkin_heritage = Strings::ToInt(row[6]);
|
||||||
ability->status = atoi(row[7]);
|
ability->status = Strings::ToInt(row[7]);
|
||||||
ability->type = atoi(row[8]);
|
ability->type = Strings::ToInt(row[8]);
|
||||||
ability->charges = atoi(row[9]);
|
ability->charges = Strings::ToInt(row[9]);
|
||||||
ability->grant_only = atoi(row[10]) != 0 ? true : false;
|
ability->grant_only = Strings::ToInt(row[10]) != 0 ? true : false;
|
||||||
ability->reset_on_death = atoi(row[11]) != 0 ? true : false;
|
ability->reset_on_death = Strings::ToInt(row[11]) != 0 ? true : false;
|
||||||
ability->first_rank_id = atoi(row[12]);
|
ability->first_rank_id = Strings::ToInt(row[12]);
|
||||||
ability->first = nullptr;
|
ability->first = nullptr;
|
||||||
|
|
||||||
abilities[ability->id] = std::unique_ptr<AA::Ability>(ability);
|
abilities[ability->id] = std::unique_ptr<AA::Ability>(ability);
|
||||||
@@ -1814,18 +1814,18 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
|
|||||||
if(results.Success()) {
|
if(results.Success()) {
|
||||||
for(auto row = results.begin(); row != results.end(); ++row) {
|
for(auto row = results.begin(); row != results.end(); ++row) {
|
||||||
auto rank = new AA::Rank;
|
auto rank = new AA::Rank;
|
||||||
rank->id = atoi(row[0]);
|
rank->id = Strings::ToInt(row[0]);
|
||||||
rank->upper_hotkey_sid = atoi(row[1]);
|
rank->upper_hotkey_sid = Strings::ToInt(row[1]);
|
||||||
rank->lower_hotkey_sid = atoi(row[2]);
|
rank->lower_hotkey_sid = Strings::ToInt(row[2]);
|
||||||
rank->title_sid = atoi(row[3]);
|
rank->title_sid = Strings::ToInt(row[3]);
|
||||||
rank->desc_sid = atoi(row[4]);
|
rank->desc_sid = Strings::ToInt(row[4]);
|
||||||
rank->cost = atoi(row[5]);
|
rank->cost = Strings::ToInt(row[5]);
|
||||||
rank->level_req = atoi(row[6]);
|
rank->level_req = Strings::ToInt(row[6]);
|
||||||
rank->spell = atoi(row[7]);
|
rank->spell = Strings::ToInt(row[7]);
|
||||||
rank->spell_type = atoi(row[8]);
|
rank->spell_type = Strings::ToInt(row[8]);
|
||||||
rank->recast_time = atoi(row[9]);
|
rank->recast_time = Strings::ToInt(row[9]);
|
||||||
rank->next_id = atoi(row[10]);
|
rank->next_id = Strings::ToInt(row[10]);
|
||||||
rank->expansion = atoi(row[11]);
|
rank->expansion = Strings::ToInt(row[11]);
|
||||||
rank->base_ability = nullptr;
|
rank->base_ability = nullptr;
|
||||||
rank->total_cost = 0;
|
rank->total_cost = 0;
|
||||||
rank->prev_id = -1;
|
rank->prev_id = -1;
|
||||||
@@ -1846,11 +1846,11 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
|
|||||||
if(results.Success()) {
|
if(results.Success()) {
|
||||||
for(auto row = results.begin(); row != results.end(); ++row) {
|
for(auto row = results.begin(); row != results.end(); ++row) {
|
||||||
AA::RankEffect effect;
|
AA::RankEffect effect;
|
||||||
int rank_id = atoi(row[0]);
|
int rank_id = Strings::ToInt(row[0]);
|
||||||
effect.slot = atoi(row[1]);
|
effect.slot = Strings::ToInt(row[1]);
|
||||||
effect.effect_id = atoi(row[2]);
|
effect.effect_id = Strings::ToInt(row[2]);
|
||||||
effect.base_value = atoi(row[3]);
|
effect.base_value = Strings::ToInt(row[3]);
|
||||||
effect.limit_value = atoi(row[4]);
|
effect.limit_value = Strings::ToInt(row[4]);
|
||||||
|
|
||||||
if(effect.slot < 1)
|
if(effect.slot < 1)
|
||||||
continue;
|
continue;
|
||||||
@@ -1871,9 +1871,9 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
|
|||||||
results = QueryDatabase(query);
|
results = QueryDatabase(query);
|
||||||
if(results.Success()) {
|
if(results.Success()) {
|
||||||
for(auto row = results.begin(); row != results.end(); ++row) {
|
for(auto row = results.begin(); row != results.end(); ++row) {
|
||||||
int rank_id = atoi(row[0]);
|
int rank_id = Strings::ToInt(row[0]);
|
||||||
int aa_id = atoi(row[1]);
|
int aa_id = Strings::ToInt(row[1]);
|
||||||
int points = atoi(row[2]);
|
int points = Strings::ToInt(row[2]);
|
||||||
|
|
||||||
if(aa_id <= 0 || points <= 0) {
|
if(aa_id <= 0 || points <= 0) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
+7
-7
@@ -250,7 +250,7 @@ int Mob::compute_defense()
|
|||||||
int defense = GetSkill(EQ::skills::SkillDefense) * 400 / 225;
|
int defense = GetSkill(EQ::skills::SkillDefense) * 400 / 225;
|
||||||
defense += (8000 * (GetAGI() - 40)) / 36000;
|
defense += (8000 * (GetAGI() - 40)) / 36000;
|
||||||
if (IsOfClientBot()) {
|
if (IsOfClientBot()) {
|
||||||
defense += GetHeroicAGI() / 10;
|
defense += GetHeroicAGI() * RuleR(Character, HeroicAgilityMultiplier) / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
//516 SE_AC_Mitigation_Max_Percent
|
//516 SE_AC_Mitigation_Max_Percent
|
||||||
@@ -883,7 +883,7 @@ int Mob::ACSum(bool skip_caps)
|
|||||||
shield_ac = CalcRecommendedLevelBonus(GetLevel(), inst->GetItemRecommendedLevel(true), inst->GetItemArmorClass(true));
|
shield_ac = CalcRecommendedLevelBonus(GetLevel(), inst->GetItemRecommendedLevel(true), inst->GetItemArmorClass(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shield_ac += GetHeroicSTR() / 10;
|
shield_ac += GetHeroicSTR() * RuleR(Character, HeroicStrengthMultiplier) / 10;
|
||||||
}
|
}
|
||||||
// EQ math
|
// EQ math
|
||||||
ac = (ac * 4) / 3;
|
ac = (ac * 4) / 3;
|
||||||
@@ -1979,10 +1979,10 @@ bool Client::Death(Mob* killerMob, int64 damage, uint16 spell, EQ::skills::Skill
|
|||||||
database.GetVariable("ServerType", tmp);
|
database.GetVariable("ServerType", tmp);
|
||||||
if (tmp[0] == '1' && tmp[1] == '\0' && killerMob && killerMob->IsClient()) {
|
if (tmp[0] == '1' && tmp[1] == '\0' && killerMob && killerMob->IsClient()) {
|
||||||
database.GetVariable("PvPreward", tmp);
|
database.GetVariable("PvPreward", tmp);
|
||||||
auto reward = atoi(tmp.c_str());
|
auto reward = Strings::ToInt(tmp.c_str());
|
||||||
if (reward == 3) {
|
if (reward == 3) {
|
||||||
database.GetVariable("PvPitem", tmp);
|
database.GetVariable("PvPitem", tmp);
|
||||||
auto pvp_item_id = atoi(tmp.c_str());
|
auto pvp_item_id = Strings::ToInt(tmp.c_str());
|
||||||
const auto* item = database.GetItem(pvp_item_id);
|
const auto* item = database.GetItem(pvp_item_id);
|
||||||
if (item) {
|
if (item) {
|
||||||
new_corpse->SetPlayerKillItemID(pvp_item_id);
|
new_corpse->SetPlayerKillItemID(pvp_item_id);
|
||||||
@@ -2218,7 +2218,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
|||||||
|
|
||||||
//do attack animation regardless of whether or not we can hit below
|
//do attack animation regardless of whether or not we can hit below
|
||||||
int16 charges = 0;
|
int16 charges = 0;
|
||||||
EQ::ItemInstance weapon_inst(weapon, charges);
|
EQ::ItemInstance weapon_inst(weapon, "", charges);
|
||||||
my_hit.skill = AttackAnimation(Hand, &weapon_inst, my_hit.skill);
|
my_hit.skill = AttackAnimation(Hand, &weapon_inst, my_hit.skill);
|
||||||
|
|
||||||
//basically "if not immune" then do the attack
|
//basically "if not immune" then do the attack
|
||||||
@@ -5897,10 +5897,10 @@ void Mob::CommonOutgoingHitSuccess(Mob* defender, DamageHitInfo &hit, ExtraAttac
|
|||||||
switch (hit.skill) {
|
switch (hit.skill) {
|
||||||
case EQ::skills::SkillThrowing:
|
case EQ::skills::SkillThrowing:
|
||||||
case EQ::skills::SkillArchery:
|
case EQ::skills::SkillArchery:
|
||||||
extra = GetHeroicDEX() / 10;
|
extra = GetHeroicDEX() * RuleR(Character, HeroicDexterityMultiplier) / 10;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
extra = GetHeroicSTR() / 10;
|
extra = GetHeroicSTR() * RuleR(Character, HeroicStrengthMultiplier) / 10;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
hit.damage_done += extra;
|
hit.damage_done += extra;
|
||||||
|
|||||||
+9
-9
@@ -946,17 +946,17 @@ bool ZoneDatabase::GetAuraEntry(uint16 spell_id, AuraRecord &record)
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
record.npc_type = atoi(row[0]);
|
record.npc_type = Strings::ToInt(row[0]);
|
||||||
strn0cpy(record.name, row[1], 64);
|
strn0cpy(record.name, row[1], 64);
|
||||||
record.spell_id = atoi(row[2]);
|
record.spell_id = Strings::ToInt(row[2]);
|
||||||
record.distance = atoi(row[3]);
|
record.distance = Strings::ToInt(row[3]);
|
||||||
record.distance *= record.distance; // so we can avoid sqrt
|
record.distance *= record.distance; // so we can avoid sqrt
|
||||||
record.aura_type = atoi(row[4]);
|
record.aura_type = Strings::ToInt(row[4]);
|
||||||
record.spawn_type = atoi(row[5]);
|
record.spawn_type = Strings::ToInt(row[5]);
|
||||||
record.movement = atoi(row[6]);
|
record.movement = Strings::ToInt(row[6]);
|
||||||
record.duration = atoi(row[7]) * 1000; // DB is in seconds
|
record.duration = Strings::ToInt(row[7]) * 1000; // DB is in seconds
|
||||||
record.icon = atoi(row[8]);
|
record.icon = Strings::ToInt(row[8]);
|
||||||
record.cast_time = atoi(row[9]) * 1000; // DB is in seconds
|
record.cast_time = Strings::ToInt(row[9]) * 1000; // DB is in seconds
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+76
-61
@@ -71,6 +71,7 @@ Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm
|
|||||||
m_enforce_spell_settings = 0;
|
m_enforce_spell_settings = 0;
|
||||||
m_bot_archery_setting = 0;
|
m_bot_archery_setting = 0;
|
||||||
m_expansion_bitmask = -1;
|
m_expansion_bitmask = -1;
|
||||||
|
m_bot_caster_range = 0;
|
||||||
SetBotID(0);
|
SetBotID(0);
|
||||||
SetBotSpellID(0);
|
SetBotSpellID(0);
|
||||||
SetSpawnStatus(false);
|
SetSpawnStatus(false);
|
||||||
@@ -2240,16 +2241,16 @@ void Bot::AI_Bot_Init()
|
|||||||
AIautocastspell_timer.reset(nullptr);
|
AIautocastspell_timer.reset(nullptr);
|
||||||
casting_spell_AIindex = static_cast<uint8>(AIBot_spells.size());
|
casting_spell_AIindex = static_cast<uint8>(AIBot_spells.size());
|
||||||
|
|
||||||
roambox_max_x = 0;
|
m_roambox.max_x = 0;
|
||||||
roambox_max_y = 0;
|
m_roambox.max_y = 0;
|
||||||
roambox_min_x = 0;
|
m_roambox.min_x = 0;
|
||||||
roambox_min_y = 0;
|
m_roambox.min_y = 0;
|
||||||
roambox_distance = 0;
|
m_roambox.distance = 0;
|
||||||
roambox_destination_x = 0;
|
m_roambox.dest_x = 0;
|
||||||
roambox_destination_y = 0;
|
m_roambox.dest_y = 0;
|
||||||
roambox_destination_z = 0;
|
m_roambox.dest_z = 0;
|
||||||
roambox_min_delay = 2500;
|
m_roambox.delay = 2500;
|
||||||
roambox_delay = 2500;
|
m_roambox.min_delay = 2500;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bot::SpellProcess() {
|
void Bot::SpellProcess() {
|
||||||
@@ -2469,6 +2470,7 @@ void Bot::AI_Process()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We also need a leash owner and follow mob (subset of primary AI criteria)
|
// We also need a leash owner and follow mob (subset of primary AI criteria)
|
||||||
|
bot_group->VerifyGroup();
|
||||||
Client* leash_owner = (bot_group->GetLeader() && bot_group->GetLeader()->IsClient() ? bot_group->GetLeader()->CastToClient() : bot_owner);
|
Client* leash_owner = (bot_group->GetLeader() && bot_group->GetLeader()->IsClient() ? bot_group->GetLeader()->CastToClient() : bot_owner);
|
||||||
if (!leash_owner) {
|
if (!leash_owner) {
|
||||||
return;
|
return;
|
||||||
@@ -3115,26 +3117,7 @@ void Bot::AI_Process()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
float melee_distance_min = melee_distance / 2.0f;
|
float melee_distance_min = melee_distance / 2.0f;
|
||||||
|
float caster_distance_max = GetBotCasterMaxRange(melee_distance_max);
|
||||||
// Calculate caster distances
|
|
||||||
float caster_distance_max = 0.0f;
|
|
||||||
float caster_distance_min = 0.0f;
|
|
||||||
float caster_distance = 0.0f;
|
|
||||||
{
|
|
||||||
if (GetLevel() >= GetStopMeleeLevel() && GetClass() >= WARRIOR && GetClass() <= BERSERKER) {
|
|
||||||
caster_distance_max = MAX_CASTER_DISTANCE[(GetClass() - 1)];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (caster_distance_max) {
|
|
||||||
|
|
||||||
caster_distance_min = melee_distance_max;
|
|
||||||
if (caster_distance_max <= caster_distance_min) {
|
|
||||||
caster_distance_max = caster_distance_min * 1.25f;
|
|
||||||
}
|
|
||||||
|
|
||||||
caster_distance = ((caster_distance_max + caster_distance_min) / 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool atArcheryRange = IsArcheryRange(tar);
|
bool atArcheryRange = IsArcheryRange(tar);
|
||||||
|
|
||||||
@@ -3157,11 +3140,11 @@ void Bot::AI_Process()
|
|||||||
ChangeBotArcherWeapons(IsBotArcher());
|
ChangeBotArcherWeapons(IsBotArcher());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bool stop_melee_level = GetLevel() >= GetStopMeleeLevel();
|
||||||
if (IsBotArcher() && atArcheryRange) {
|
if (IsBotArcher() && atArcheryRange) {
|
||||||
atCombatRange = true;
|
atCombatRange = true;
|
||||||
}
|
}
|
||||||
else if (caster_distance_max && tar_distance <= caster_distance_max) {
|
else if (caster_distance_max && tar_distance <= caster_distance_max && stop_melee_level) {
|
||||||
atCombatRange = true;
|
atCombatRange = true;
|
||||||
}
|
}
|
||||||
else if (tar_distance <= melee_distance) {
|
else if (tar_distance <= melee_distance) {
|
||||||
@@ -4156,7 +4139,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
|
|||||||
item = inst->GetItem();
|
item = inst->GetItem();
|
||||||
if(item) {
|
if(item) {
|
||||||
if(strlen(item->IDFile) > 2)
|
if(strlen(item->IDFile) > 2)
|
||||||
ns->spawn.equipment.Primary.Material = atoi(&item->IDFile[2]);
|
ns->spawn.equipment.Primary.Material = Strings::ToInt(&item->IDFile[2]);
|
||||||
|
|
||||||
ns->spawn.equipment_tint.Primary.Color = GetEquipmentColor(EQ::textures::weaponPrimary);
|
ns->spawn.equipment_tint.Primary.Color = GetEquipmentColor(EQ::textures::weaponPrimary);
|
||||||
}
|
}
|
||||||
@@ -4167,7 +4150,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
|
|||||||
item = inst->GetItem();
|
item = inst->GetItem();
|
||||||
if(item) {
|
if(item) {
|
||||||
if(strlen(item->IDFile) > 2)
|
if(strlen(item->IDFile) > 2)
|
||||||
ns->spawn.equipment.Secondary.Material = atoi(&item->IDFile[2]);
|
ns->spawn.equipment.Secondary.Material = Strings::ToInt(&item->IDFile[2]);
|
||||||
|
|
||||||
ns->spawn.equipment_tint.Secondary.Color = GetEquipmentColor(EQ::textures::weaponSecondary);
|
ns->spawn.equipment_tint.Secondary.Color = GetEquipmentColor(EQ::textures::weaponSecondary);
|
||||||
}
|
}
|
||||||
@@ -4565,6 +4548,7 @@ bool Bot::AddBotToGroup(Bot* bot, Group* group) {
|
|||||||
group->SendUpdate(groupActUpdate, TempLeader);
|
group->SendUpdate(groupActUpdate, TempLeader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
group->VerifyGroup();
|
||||||
Result = true;
|
Result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6150,8 +6134,11 @@ void Bot::ProcessBotOwnerRefDelete(Mob* botOwner) {
|
|||||||
int64 Bot::CalcMaxMana() {
|
int64 Bot::CalcMaxMana() {
|
||||||
switch(GetCasterClass()) {
|
switch(GetCasterClass()) {
|
||||||
case 'I':
|
case 'I':
|
||||||
|
max_mana = (GenerateBaseManaPoints() + itembonuses.Mana + spellbonuses.Mana + GroupLeadershipAAManaEnhancement());
|
||||||
|
max_mana += (GetHeroicINT() * 10);
|
||||||
case 'W': {
|
case 'W': {
|
||||||
max_mana = (GenerateBaseManaPoints() + itembonuses.Mana + spellbonuses.Mana + GroupLeadershipAAManaEnhancement());
|
max_mana = (GenerateBaseManaPoints() + itembonuses.Mana + spellbonuses.Mana + GroupLeadershipAAManaEnhancement());
|
||||||
|
max_mana += (GetHeroicWIS() * 10);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'N': {
|
case 'N': {
|
||||||
@@ -6706,10 +6693,10 @@ int64 Bot::CalcManaRegenCap() {
|
|||||||
int64 cap = RuleI(Character, ItemManaRegenCap) + aabonuses.ItemManaRegenCap;
|
int64 cap = RuleI(Character, ItemManaRegenCap) + aabonuses.ItemManaRegenCap;
|
||||||
switch(GetCasterClass()) {
|
switch(GetCasterClass()) {
|
||||||
case 'I':
|
case 'I':
|
||||||
cap += (itembonuses.HeroicINT / 25);
|
cap += itembonuses.HeroicINT * RuleR(Character, HeroicIntelligenceMultiplier) / 25;
|
||||||
break;
|
break;
|
||||||
case 'W':
|
case 'W':
|
||||||
cap += (itembonuses.HeroicWIS / 25);
|
cap += itembonuses.HeroicWIS * RuleR(Character, HeroicWisdomMultiplier) / 25;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return (cap * RuleI(Character, ManaRegenMultiplier) / 100);
|
return (cap * RuleI(Character, ManaRegenMultiplier) / 100);
|
||||||
@@ -7101,7 +7088,9 @@ int32 Bot::LevelRegen() {
|
|||||||
|
|
||||||
int64 Bot::CalcHPRegen() {
|
int64 Bot::CalcHPRegen() {
|
||||||
int32 regen = (LevelRegen() + itembonuses.HPRegen + spellbonuses.HPRegen);
|
int32 regen = (LevelRegen() + itembonuses.HPRegen + spellbonuses.HPRegen);
|
||||||
|
regen += GetHeroicSTA() * RuleR(Character, HeroicStaminaMultiplier) / 20;
|
||||||
regen += (aabonuses.HPRegen + GroupLeadershipAAHealthRegeneration());
|
regen += (aabonuses.HPRegen + GroupLeadershipAAHealthRegeneration());
|
||||||
|
|
||||||
regen = ((regen * RuleI(Character, HPRegenMultiplier)) / 100);
|
regen = ((regen * RuleI(Character, HPRegenMultiplier)) / 100);
|
||||||
return regen;
|
return regen;
|
||||||
}
|
}
|
||||||
@@ -7121,9 +7110,9 @@ int64 Bot::CalcManaRegen() {
|
|||||||
regen = (2 + spellbonuses.ManaRegen + itembonuses.ManaRegen);
|
regen = (2 + spellbonuses.ManaRegen + itembonuses.ManaRegen);
|
||||||
|
|
||||||
if(GetCasterClass() == 'I')
|
if(GetCasterClass() == 'I')
|
||||||
regen += (itembonuses.HeroicINT / 25);
|
regen += itembonuses.HeroicINT * RuleR(Character, HeroicIntelligenceMultiplier) / 25;
|
||||||
else if(GetCasterClass() == 'W')
|
else if(GetCasterClass() == 'W')
|
||||||
regen += (itembonuses.HeroicWIS / 25);
|
regen += itembonuses.HeroicWIS * RuleR(Character, HeroicWisdomMultiplier) / 25;
|
||||||
else
|
else
|
||||||
regen = 0;
|
regen = 0;
|
||||||
|
|
||||||
@@ -7172,6 +7161,7 @@ int64 Bot::CalcMaxHP() {
|
|||||||
int32 bot_hp = 0;
|
int32 bot_hp = 0;
|
||||||
uint32 nd = 10000;
|
uint32 nd = 10000;
|
||||||
bot_hp += (GenerateBaseHitPoints() + itembonuses.HP);
|
bot_hp += (GenerateBaseHitPoints() + itembonuses.HP);
|
||||||
|
bot_hp += GetHeroicSTA() * RuleR(Character, HeroicStaminaMultiplier) * 10;
|
||||||
nd += aabonuses.MaxHP;
|
nd += aabonuses.MaxHP;
|
||||||
bot_hp = ((float)bot_hp * (float)nd / (float)10000);
|
bot_hp = ((float)bot_hp * (float)nd / (float)10000);
|
||||||
bot_hp += (spellbonuses.HP + aabonuses.HP);
|
bot_hp += (spellbonuses.HP + aabonuses.HP);
|
||||||
@@ -7211,35 +7201,42 @@ int64 Bot::CalcMaxEndurance() {
|
|||||||
int64 Bot::CalcBaseEndurance() {
|
int64 Bot::CalcBaseEndurance() {
|
||||||
int32 base_end = 0;
|
int32 base_end = 0;
|
||||||
int32 base_endurance = 0;
|
int32 base_endurance = 0;
|
||||||
int32 ConvertedStats = 0;
|
int32 converted_stats = 0;
|
||||||
int32 sta_end = 0;
|
int32 sta_end = 0;
|
||||||
int Stats = 0;
|
int stats = 0;
|
||||||
if (GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->ClientVersion() >= EQ::versions::ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
|
if (GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->ClientVersion() >= EQ::versions::ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
|
||||||
int HeroicStats = 0;
|
double heroic_stats = 0;
|
||||||
Stats = ((GetSTR() + GetSTA() + GetDEX() + GetAGI()) / 4);
|
stats = ((GetSTR() + GetSTA() + GetDEX() + GetAGI()) / 4);
|
||||||
HeroicStats = ((GetHeroicSTR() + GetHeroicSTA() + GetHeroicDEX() + GetHeroicAGI()) / 4);
|
double heroic_str = GetHeroicSTR() * RuleR(Character, HeroicStrengthMultiplier);
|
||||||
if (Stats > 100) {
|
double heroic_sta = GetHeroicSTA() * RuleR(Character, HeroicStaminaMultiplier);
|
||||||
ConvertedStats = (((Stats - 100) * 5 / 2) + 100);
|
double heroic_dex = GetHeroicDEX() * RuleR(Character, HeroicDexterityMultiplier);
|
||||||
if (Stats > 201)
|
double heroic_agi = GetHeroicAGI() * RuleR(Character, HeroicAgilityMultiplier);
|
||||||
ConvertedStats -= ((Stats - 201) * 5 / 4);
|
heroic_stats = (heroic_str + heroic_sta + heroic_dex + heroic_agi) / 4;
|
||||||
} else
|
|
||||||
ConvertedStats = Stats;
|
if (stats > 100) {
|
||||||
|
converted_stats = (((stats - 100) * 5 / 2) + 100);
|
||||||
|
if (stats > 201) {
|
||||||
|
converted_stats -= ((stats - 201) * 5 / 4);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
converted_stats = stats;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetLevel() < 41) {
|
if (GetLevel() < 41) {
|
||||||
sta_end = (GetLevel() * 75 * ConvertedStats / 1000);
|
sta_end = (GetLevel() * 75 * converted_stats / 1000);
|
||||||
base_endurance = (GetLevel() * 15);
|
base_endurance = (GetLevel() * 15);
|
||||||
} else if (GetLevel() < 81) {
|
} else if (GetLevel() < 81) {
|
||||||
sta_end = ((3 * ConvertedStats) + ((GetLevel() - 40) * 15 * ConvertedStats / 100));
|
sta_end = ((3 * converted_stats) + ((GetLevel() - 40) * 15 * converted_stats / 100));
|
||||||
base_endurance = (600 + ((GetLevel() - 40) * 30));
|
base_endurance = (600 + ((GetLevel() - 40) * 30));
|
||||||
} else {
|
} else {
|
||||||
sta_end = (9 * ConvertedStats);
|
sta_end = (9 * converted_stats);
|
||||||
base_endurance = (1800 + ((GetLevel() - 80) * 18));
|
base_endurance = (1800 + ((GetLevel() - 80) * 18));
|
||||||
}
|
}
|
||||||
base_end = (base_endurance + sta_end + (HeroicStats * 10));
|
base_end = (base_endurance + sta_end + (heroic_stats * 10));
|
||||||
} else {
|
} else {
|
||||||
Stats = (GetSTR()+GetSTA()+GetDEX()+GetAGI());
|
stats = (GetSTR() + GetSTA() + GetDEX() + GetAGI());
|
||||||
int LevelBase = (GetLevel() * 15);
|
int level_base = (GetLevel() * 15);
|
||||||
int at_most_800 = Stats;
|
int at_most_800 = stats;
|
||||||
if(at_most_800 > 800)
|
if(at_most_800 > 800)
|
||||||
at_most_800 = 800;
|
at_most_800 = 800;
|
||||||
|
|
||||||
@@ -7248,16 +7245,16 @@ int64 Bot::CalcBaseEndurance() {
|
|||||||
int Bonus800plus = 0;
|
int Bonus800plus = 0;
|
||||||
int HalfBonus800plus = 0;
|
int HalfBonus800plus = 0;
|
||||||
int BonusUpto800 = int(at_most_800 / 4) ;
|
int BonusUpto800 = int(at_most_800 / 4) ;
|
||||||
if(Stats > 400) {
|
if(stats > 400) {
|
||||||
Bonus400to800 = int((at_most_800 - 400) / 4);
|
Bonus400to800 = int((at_most_800 - 400) / 4);
|
||||||
HalfBonus400to800 = int(std::max((at_most_800 - 400), 0) / 8);
|
HalfBonus400to800 = int(std::max((at_most_800 - 400), 0) / 8);
|
||||||
if(Stats > 800) {
|
if(stats > 800) {
|
||||||
Bonus800plus = (int((Stats - 800) / 8) * 2);
|
Bonus800plus = (int((stats - 800) / 8) * 2);
|
||||||
HalfBonus800plus = int((Stats - 800) / 16);
|
HalfBonus800plus = int((stats - 800) / 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int bonus_sum = (BonusUpto800 + Bonus400to800 + HalfBonus400to800 + Bonus800plus + HalfBonus800plus);
|
int bonus_sum = (BonusUpto800 + Bonus400to800 + HalfBonus400to800 + Bonus800plus + HalfBonus800plus);
|
||||||
base_end = LevelBase;
|
base_end = level_base;
|
||||||
base_end += ((bonus_sum * 3 * GetLevel()) / 40);
|
base_end += ((bonus_sum * 3 * GetLevel()) / 40);
|
||||||
}
|
}
|
||||||
return base_end;
|
return base_end;
|
||||||
@@ -9825,4 +9822,22 @@ void Bot::SendSpellAnim(uint16 target_id, uint16 spell_id)
|
|||||||
entity_list.QueueCloseClients(this, &app, false, RuleI(Range, SpellParticles));
|
entity_list.QueueCloseClients(this, &app, false, RuleI(Range, SpellParticles));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Bot::GetBotCasterMaxRange(float melee_distance_max) {// Calculate caster distances
|
||||||
|
float caster_distance_max = 0.0f;
|
||||||
|
float caster_distance_min = 0.0f;
|
||||||
|
float caster_distance = 0.0f;
|
||||||
|
|
||||||
|
caster_distance_max = GetBotCasterRange() * GetBotCasterRange();
|
||||||
|
if (!GetBotCasterRange() && GetLevel() >= GetStopMeleeLevel() && GetClass() >= WARRIOR && GetClass() <= BERSERKER) {
|
||||||
|
caster_distance_max = MAX_CASTER_DISTANCE[GetClass() - 1];
|
||||||
|
}
|
||||||
|
if (caster_distance_max) {
|
||||||
|
caster_distance_min = melee_distance_max;
|
||||||
|
if (caster_distance_max <= caster_distance_min) {
|
||||||
|
caster_distance_max = caster_distance_min * 1.25f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return caster_distance_max;
|
||||||
|
}
|
||||||
|
|
||||||
uint8 Bot::spell_casting_chances[SPELL_TYPE_COUNT][PLAYER_CLASS_COUNT][EQ::constants::STANCE_TYPE_COUNT][cntHSND] = { 0 };
|
uint8 Bot::spell_casting_chances[SPELL_TYPE_COUNT][PLAYER_CLASS_COUNT][EQ::constants::STANCE_TYPE_COUNT][cntHSND] = { 0 };
|
||||||
|
|||||||
+5
-3
@@ -348,6 +348,8 @@ public:
|
|||||||
void SetStopMeleeLevel(uint8 level);
|
void SetStopMeleeLevel(uint8 level);
|
||||||
void SetGuardMode();
|
void SetGuardMode();
|
||||||
void SetHoldMode();
|
void SetHoldMode();
|
||||||
|
uint32 GetBotCasterRange() { return m_bot_caster_range; }
|
||||||
|
bool IsValidSpellRange(uint16 spell_id, Mob const* tar);
|
||||||
|
|
||||||
// Bot AI Methods
|
// Bot AI Methods
|
||||||
void AI_Bot_Init();
|
void AI_Bot_Init();
|
||||||
@@ -490,7 +492,7 @@ public:
|
|||||||
EQ::constants::StanceType GetBotStance() { return _botStance; }
|
EQ::constants::StanceType GetBotStance() { return _botStance; }
|
||||||
uint8 GetChanceToCastBySpellType(uint32 spellType);
|
uint8 GetChanceToCastBySpellType(uint32 spellType);
|
||||||
bool GetBotEnforceSpellSetting() { return m_enforce_spell_settings; }
|
bool GetBotEnforceSpellSetting() { return m_enforce_spell_settings; }
|
||||||
|
float GetBotCasterMaxRange(float melee_distance_max);
|
||||||
bool IsGroupHealer() { return m_CastingRoles.GroupHealer; }
|
bool IsGroupHealer() { return m_CastingRoles.GroupHealer; }
|
||||||
bool IsGroupSlower() { return m_CastingRoles.GroupSlower; }
|
bool IsGroupSlower() { return m_CastingRoles.GroupSlower; }
|
||||||
bool IsGroupNuker() { return m_CastingRoles.GroupNuker; }
|
bool IsGroupNuker() { return m_CastingRoles.GroupNuker; }
|
||||||
@@ -623,6 +625,7 @@ public:
|
|||||||
else
|
else
|
||||||
_botStance = EQ::constants::stancePassive;
|
_botStance = EQ::constants::stancePassive;
|
||||||
}
|
}
|
||||||
|
void SetBotCasterRange(uint32 bot_caster_range) { m_bot_caster_range = bot_caster_range; }
|
||||||
void SetSpellRecastTimer(int timer_index, int32 recast_delay);
|
void SetSpellRecastTimer(int timer_index, int32 recast_delay);
|
||||||
void SetDisciplineRecastTimer(int timer_index, int32 recast_delay);
|
void SetDisciplineRecastTimer(int timer_index, int32 recast_delay);
|
||||||
void SetAltOutOfCombatBehavior(bool behavior_flag) { _altoutofcombatbehavior = behavior_flag;}
|
void SetAltOutOfCombatBehavior(bool behavior_flag) { _altoutofcombatbehavior = behavior_flag;}
|
||||||
@@ -820,7 +823,7 @@ private:
|
|||||||
bool m_pulling_flag;
|
bool m_pulling_flag;
|
||||||
bool m_returning_flag;
|
bool m_returning_flag;
|
||||||
eStandingPetOrder m_previous_pet_order;
|
eStandingPetOrder m_previous_pet_order;
|
||||||
|
uint32 m_bot_caster_range;
|
||||||
BotCastingRoles m_CastingRoles;
|
BotCastingRoles m_CastingRoles;
|
||||||
std::map<std::string,std::string> bot_data_buckets;
|
std::map<std::string,std::string> bot_data_buckets;
|
||||||
std::map<std::string,std::string> bot_owner_data_buckets;
|
std::map<std::string,std::string> bot_owner_data_buckets;
|
||||||
@@ -829,7 +832,6 @@ private:
|
|||||||
|
|
||||||
std::shared_ptr<HealRotation> m_member_of_heal_rotation;
|
std::shared_ptr<HealRotation> m_member_of_heal_rotation;
|
||||||
|
|
||||||
std::map<uint32, BotAA> botAAs;
|
|
||||||
InspectMessage_Struct _botInspectMessage;
|
InspectMessage_Struct _botInspectMessage;
|
||||||
bool _altoutofcombatbehavior;
|
bool _altoutofcombatbehavior;
|
||||||
bool _showhelm;
|
bool _showhelm;
|
||||||
|
|||||||
+131
-53
@@ -1366,6 +1366,7 @@ int bot_command_init(void)
|
|||||||
bot_command_add("bottitle", "Sets a bots title", AccountStatus::Player, bot_subcommand_bot_title) ||
|
bot_command_add("bottitle", "Sets a bots title", AccountStatus::Player, bot_subcommand_bot_title) ||
|
||||||
bot_command_add("botupdate", "Updates a bot to reflect any level changes that you have experienced", AccountStatus::Player, bot_subcommand_bot_update) ||
|
bot_command_add("botupdate", "Updates a bot to reflect any level changes that you have experienced", AccountStatus::Player, bot_subcommand_bot_update) ||
|
||||||
bot_command_add("botwoad", "Changes the Barbarian woad of a bot", AccountStatus::Player, bot_subcommand_bot_woad) ||
|
bot_command_add("botwoad", "Changes the Barbarian woad of a bot", AccountStatus::Player, bot_subcommand_bot_woad) ||
|
||||||
|
bot_command_add("casterrange", "Controls the range casters will try to stay away from a mob (if too far, they will skip spells that are out-of-range)", AccountStatus::Player, bot_command_caster_range) ||
|
||||||
bot_command_add("charm", "Attempts to have a bot charm your target", AccountStatus::Player, bot_command_charm) ||
|
bot_command_add("charm", "Attempts to have a bot charm your target", AccountStatus::Player, bot_command_charm) ||
|
||||||
bot_command_add("circle", "Orders a Druid bot to open a magical doorway to a specified destination", AccountStatus::Player, bot_subcommand_circle) ||
|
bot_command_add("circle", "Orders a Druid bot to open a magical doorway to a specified destination", AccountStatus::Player, bot_subcommand_circle) ||
|
||||||
bot_command_add("cure", "Orders a bot to remove any ailments", AccountStatus::Player, bot_command_cure) ||
|
bot_command_add("cure", "Orders a bot to remove any ailments", AccountStatus::Player, bot_command_cure) ||
|
||||||
@@ -3178,7 +3179,14 @@ void bot_command_find_aliases(Client *c, const Seperator *sep)
|
|||||||
if (strcasecmp(find_iter->second.c_str(), alias_iter.second.c_str()) || c->Admin() < command_iter->second->access)
|
if (strcasecmp(find_iter->second.c_str(), alias_iter.second.c_str()) || c->Admin() < command_iter->second->access)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
c->Message(Chat::White, "%c%s", BOT_COMMAND_CHAR, alias_iter.first.c_str());
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"^{}",
|
||||||
|
alias_iter.first
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
++bot_command_aliases_shown;
|
++bot_command_aliases_shown;
|
||||||
}
|
}
|
||||||
c->Message(Chat::White, "%d bot command alias%s listed.", bot_command_aliases_shown, bot_command_aliases_shown != 1 ? "es" : "");
|
c->Message(Chat::White, "%d bot command alias%s listed.", bot_command_aliases_shown, bot_command_aliases_shown != 1 ? "es" : "");
|
||||||
@@ -3412,7 +3420,15 @@ void bot_command_help(Client *c, const Seperator *sep)
|
|||||||
if (c->Admin() < command_iter.second->access)
|
if (c->Admin() < command_iter.second->access)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
c->Message(Chat::White, "%c%s - %s", BOT_COMMAND_CHAR, command_iter.first.c_str(), command_iter.second->desc == nullptr ? "[no description]" : command_iter.second->desc);
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"^{} - {}",
|
||||||
|
command_iter.first,
|
||||||
|
command_iter.second->desc ? command_iter.second->desc : "No Description"
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
++bot_commands_shown;
|
++bot_commands_shown;
|
||||||
}
|
}
|
||||||
if (parse->PlayerHasQuestSub(EVENT_BOT_COMMAND)) {
|
if (parse->PlayerHasQuestSub(EVENT_BOT_COMMAND)) {
|
||||||
@@ -3653,8 +3669,14 @@ void bot_command_item_use(Client* c, const Seperator* sep)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = StringFormat("%cinventorygive byname %s", BOT_COMMAND_CHAR, bot_iter->GetCleanName());
|
text_link = bot_iter->CreateSayLink(
|
||||||
text_link = bot_iter->CreateSayLink(c, msg.c_str(), bot_iter->GetCleanName());
|
c,
|
||||||
|
fmt::format(
|
||||||
|
"^inventorygive byname {}",
|
||||||
|
bot_iter->GetCleanName()
|
||||||
|
).c_str(),
|
||||||
|
bot_iter->GetCleanName()
|
||||||
|
);
|
||||||
|
|
||||||
for (auto slot_iter : equipable_slot_list) {
|
for (auto slot_iter : equipable_slot_list) {
|
||||||
// needs more failure criteria - this should cover the bulk for now
|
// needs more failure criteria - this should cover the bulk for now
|
||||||
@@ -5040,7 +5062,7 @@ void bot_subcommand_bot_beard_color(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 uvalue = atoi(sep->arg[1]);
|
uint8 uvalue = Strings::ToInt(sep->arg[1]);
|
||||||
|
|
||||||
auto fail_type = BCEnum::AFT_None;
|
auto fail_type = BCEnum::AFT_None;
|
||||||
if (my_bot->GetGender() != MALE && my_bot->GetRace() != DWARF)
|
if (my_bot->GetGender() != MALE && my_bot->GetRace() != DWARF)
|
||||||
@@ -5077,7 +5099,7 @@ void bot_subcommand_bot_beard_style(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 uvalue = atoi(sep->arg[1]);
|
uint8 uvalue = Strings::ToInt(sep->arg[1]);
|
||||||
|
|
||||||
auto fail_type = BCEnum::AFT_None;
|
auto fail_type = BCEnum::AFT_None;
|
||||||
if (my_bot->GetGender() != MALE && my_bot->GetRace() != DWARF)
|
if (my_bot->GetGender() != MALE && my_bot->GetRace() != DWARF)
|
||||||
@@ -5357,7 +5379,7 @@ void bot_command_view_combos(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint16 bot_race = static_cast<uint16>(std::stoul(sep->arg[1]));
|
const uint16 bot_race = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||||
const std::string race_name = GetRaceIDName(bot_race);
|
const std::string race_name = GetRaceIDName(bot_race);
|
||||||
|
|
||||||
if (!Mob::IsPlayerRace(bot_race)) {
|
if (!Mob::IsPlayerRace(bot_race)) {
|
||||||
@@ -5561,14 +5583,14 @@ void bot_subcommand_bot_create(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bot_class = static_cast<uint8>(std::stoul(sep->arg[2]));
|
auto bot_class = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||||
|
|
||||||
if (arguments < 3 || !sep->IsNumber(3)) {
|
if (arguments < 3 || !sep->IsNumber(3)) {
|
||||||
c->Message(Chat::White, "Invalid race!");
|
c->Message(Chat::White, "Invalid race!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bot_race = static_cast<uint16>(std::stoul(sep->arg[3]));
|
auto bot_race = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[3]));
|
||||||
|
|
||||||
if (arguments < 4) {
|
if (arguments < 4) {
|
||||||
c->Message(Chat::White, "Invalid gender!");
|
c->Message(Chat::White, "Invalid gender!");
|
||||||
@@ -5578,7 +5600,7 @@ void bot_subcommand_bot_create(Client *c, const Seperator *sep)
|
|||||||
auto bot_gender = MALE;
|
auto bot_gender = MALE;
|
||||||
|
|
||||||
if (sep->IsNumber(4)) {
|
if (sep->IsNumber(4)) {
|
||||||
bot_gender = static_cast<uint8>(std::stoul(sep->arg[4]));
|
bot_gender = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[4]));
|
||||||
if (bot_gender == NEUTER) {
|
if (bot_gender == NEUTER) {
|
||||||
bot_gender = MALE;
|
bot_gender = MALE;
|
||||||
}
|
}
|
||||||
@@ -5646,7 +5668,7 @@ void bot_subcommand_bot_details(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 uvalue = atoi(sep->arg[1]);
|
uint32 uvalue = Strings::ToInt(sep->arg[1]);
|
||||||
|
|
||||||
auto fail_type = BCEnum::AFT_None;
|
auto fail_type = BCEnum::AFT_None;
|
||||||
if (my_bot->GetRace() != DRAKKIN)
|
if (my_bot->GetRace() != DRAKKIN)
|
||||||
@@ -5699,7 +5721,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
bool dye_all = (sep->arg[1][0] == '*');
|
bool dye_all = (sep->arg[1][0] == '*');
|
||||||
if (!dye_all) {
|
if (!dye_all) {
|
||||||
material_slot = std::stoi(sep->arg[1]);
|
material_slot = Strings::ToInt(sep->arg[1]);
|
||||||
slot_id = EQ::InventoryProfile::CalcSlotFromMaterial(material_slot);
|
slot_id = EQ::InventoryProfile::CalcSlotFromMaterial(material_slot);
|
||||||
|
|
||||||
if (!sep->IsNumber(1) || slot_id == INVALID_INDEX || material_slot > EQ::textures::LastTintableTexture) {
|
if (!sep->IsNumber(1) || slot_id == INVALID_INDEX || material_slot > EQ::textures::LastTintableTexture) {
|
||||||
@@ -5714,7 +5736,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 red_value = std::stoul(sep->arg[2]);
|
uint32 red_value = Strings::ToUnsignedInt(sep->arg[2]);
|
||||||
if (red_value > 255) {
|
if (red_value > 255) {
|
||||||
red_value = 255;
|
red_value = 255;
|
||||||
}
|
}
|
||||||
@@ -5724,7 +5746,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 green_value = std::stoul(sep->arg[3]);
|
uint32 green_value = Strings::ToUnsignedInt(sep->arg[3]);
|
||||||
if (green_value > 255) {
|
if (green_value > 255) {
|
||||||
green_value = 255;
|
green_value = 255;
|
||||||
}
|
}
|
||||||
@@ -5734,7 +5756,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 blue_value = std::stoul(sep->arg[4]);
|
uint32 blue_value = Strings::ToUnsignedInt(sep->arg[4]);
|
||||||
if (blue_value > 255) {
|
if (blue_value > 255) {
|
||||||
blue_value = 255;
|
blue_value = 255;
|
||||||
}
|
}
|
||||||
@@ -5814,7 +5836,7 @@ void bot_subcommand_bot_eyes(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 uvalue = atoi(sep->arg[1]);
|
uint8 uvalue = Strings::ToInt(sep->arg[1]);
|
||||||
|
|
||||||
//uint8 eye_bias = 0;
|
//uint8 eye_bias = 0;
|
||||||
//std::string arg2 = sep->arg[2];
|
//std::string arg2 = sep->arg[2];
|
||||||
@@ -5868,7 +5890,7 @@ void bot_subcommand_bot_face(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 uvalue = atoi(sep->arg[1]);
|
uint8 uvalue = Strings::ToInt(sep->arg[1]);
|
||||||
|
|
||||||
auto fail_type = BCEnum::AFT_None;
|
auto fail_type = BCEnum::AFT_None;
|
||||||
if (!PlayerAppearance::IsValidFace(my_bot->GetRace(), my_bot->GetGender(), uvalue)) {
|
if (!PlayerAppearance::IsValidFace(my_bot->GetRace(), my_bot->GetGender(), uvalue)) {
|
||||||
@@ -5908,7 +5930,7 @@ void bot_subcommand_bot_follow_distance(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bfd = atoi(sep->arg[2]);
|
bfd = Strings::ToInt(sep->arg[2]);
|
||||||
if (bfd < 1)
|
if (bfd < 1)
|
||||||
bfd = 1;
|
bfd = 1;
|
||||||
if (bfd > BOT_FOLLOW_DISTANCE_DEFAULT_MAX)
|
if (bfd > BOT_FOLLOW_DISTANCE_DEFAULT_MAX)
|
||||||
@@ -5974,7 +5996,7 @@ void bot_subcommand_bot_hair_color(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 uvalue = atoi(sep->arg[1]);
|
uint8 uvalue = Strings::ToInt(sep->arg[1]);
|
||||||
|
|
||||||
auto fail_type = BCEnum::AFT_None;
|
auto fail_type = BCEnum::AFT_None;
|
||||||
if (!PlayerAppearance::IsValidHairColor(my_bot->GetRace(), my_bot->GetGender(), uvalue))
|
if (!PlayerAppearance::IsValidHairColor(my_bot->GetRace(), my_bot->GetGender(), uvalue))
|
||||||
@@ -6009,7 +6031,7 @@ void bot_subcommand_bot_hairstyle(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 uvalue = atoi(sep->arg[1]);
|
uint8 uvalue = Strings::ToInt(sep->arg[1]);
|
||||||
|
|
||||||
auto fail_type = BCEnum::AFT_None;
|
auto fail_type = BCEnum::AFT_None;
|
||||||
if (!PlayerAppearance::IsValidHair(my_bot->GetRace(), my_bot->GetGender(), uvalue))
|
if (!PlayerAppearance::IsValidHair(my_bot->GetRace(), my_bot->GetGender(), uvalue))
|
||||||
@@ -6046,7 +6068,7 @@ void bot_subcommand_bot_heritage(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 uvalue = atoi(sep->arg[1]);
|
uint32 uvalue = Strings::ToInt(sep->arg[1]);
|
||||||
|
|
||||||
auto fail_type = BCEnum::AFT_None;
|
auto fail_type = BCEnum::AFT_None;
|
||||||
if (my_bot->GetRace() != DRAKKIN)
|
if (my_bot->GetRace() != DRAKKIN)
|
||||||
@@ -6183,13 +6205,13 @@ void bot_subcommand_bot_list(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
if (!strcasecmp(sep->arg[i], "class")) {
|
if (!strcasecmp(sep->arg[i], "class")) {
|
||||||
filter_mask |= MaskClass;
|
filter_mask |= MaskClass;
|
||||||
filter_value[FilterClass] = atoi(sep->arg[i + 1]);
|
filter_value[FilterClass] = Strings::ToInt(sep->arg[i + 1]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcasecmp(sep->arg[i], "race")) {
|
if (!strcasecmp(sep->arg[i], "race")) {
|
||||||
filter_mask |= MaskRace;
|
filter_mask |= MaskRace;
|
||||||
filter_value[FilterRace] = atoi(sep->arg[i + 1]);
|
filter_value[FilterRace] = Strings::ToInt(sep->arg[i + 1]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6750,7 +6772,7 @@ void bot_subcommand_bot_stance(Client *c, const Seperator *sep)
|
|||||||
if (!strcasecmp(sep->arg[1], "current"))
|
if (!strcasecmp(sep->arg[1], "current"))
|
||||||
current_flag = true;
|
current_flag = true;
|
||||||
else if (sep->IsNumber(1)) {
|
else if (sep->IsNumber(1)) {
|
||||||
bst = (EQ::constants::StanceType)atoi(sep->arg[1]);
|
bst = (EQ::constants::StanceType)Strings::ToInt(sep->arg[1]);
|
||||||
if (bst < EQ::constants::stanceUnknown || bst > EQ::constants::stanceBurnAE)
|
if (bst < EQ::constants::stanceUnknown || bst > EQ::constants::stanceBurnAE)
|
||||||
bst = EQ::constants::stanceUnknown;
|
bst = EQ::constants::stanceUnknown;
|
||||||
}
|
}
|
||||||
@@ -6809,7 +6831,7 @@ void bot_subcommand_bot_stop_melee_level(Client *c, const Seperator *sep)
|
|||||||
uint8 sml = RuleI(Bots, CasterStopMeleeLevel);
|
uint8 sml = RuleI(Bots, CasterStopMeleeLevel);
|
||||||
|
|
||||||
if (sep->IsNumber(1)) {
|
if (sep->IsNumber(1)) {
|
||||||
sml = atoi(sep->arg[1]);
|
sml = Strings::ToInt(sep->arg[1]);
|
||||||
}
|
}
|
||||||
else if (!strcasecmp(sep->arg[1], "sync")) {
|
else if (!strcasecmp(sep->arg[1], "sync")) {
|
||||||
sml = my_bot->GetLevel();
|
sml = my_bot->GetLevel();
|
||||||
@@ -6915,7 +6937,7 @@ void bot_subcommand_bot_tattoo(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 uvalue = atoi(sep->arg[1]);
|
uint32 uvalue = Strings::ToInt(sep->arg[1]);
|
||||||
|
|
||||||
auto fail_type = BCEnum::AFT_None;
|
auto fail_type = BCEnum::AFT_None;
|
||||||
if (my_bot->GetRace() != DRAKKIN)
|
if (my_bot->GetRace() != DRAKKIN)
|
||||||
@@ -7159,7 +7181,7 @@ void bot_subcommand_bot_woad(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 uvalue = atoi(sep->arg[1]);
|
uint8 uvalue = Strings::ToInt(sep->arg[1]);
|
||||||
|
|
||||||
auto fail_type = BCEnum::AFT_None;
|
auto fail_type = BCEnum::AFT_None;
|
||||||
if (my_bot->GetRace() != BARBARIAN) {
|
if (my_bot->GetRace() != BARBARIAN) {
|
||||||
@@ -8227,7 +8249,7 @@ void bot_subcommand_heal_rotation_adjust_critical(Client *c, const Seperator *se
|
|||||||
|
|
||||||
uint8 armor_type_value = 255;
|
uint8 armor_type_value = 255;
|
||||||
if (sep->IsNumber(1))
|
if (sep->IsNumber(1))
|
||||||
armor_type_value = atoi(armor_type_arg.c_str());
|
armor_type_value = Strings::ToInt(armor_type_arg.c_str());
|
||||||
|
|
||||||
if (armor_type_value > ARMOR_TYPE_LAST) {
|
if (armor_type_value > ARMOR_TYPE_LAST) {
|
||||||
c->Message(Chat::White, "You must specify a valid [armor_type: %u-%u] to use this command", ARMOR_TYPE_FIRST, ARMOR_TYPE_LAST);
|
c->Message(Chat::White, "You must specify a valid [armor_type: %u-%u] to use this command", ARMOR_TYPE_FIRST, ARMOR_TYPE_LAST);
|
||||||
@@ -8256,7 +8278,7 @@ void bot_subcommand_heal_rotation_adjust_critical(Client *c, const Seperator *se
|
|||||||
|
|
||||||
float critical_ratio = CRITICAL_HP_RATIO_BASE;
|
float critical_ratio = CRITICAL_HP_RATIO_BASE;
|
||||||
if (sep->IsNumber(2))
|
if (sep->IsNumber(2))
|
||||||
critical_ratio = atof(critical_arg.c_str());
|
critical_ratio = Strings::ToFloat(critical_arg.c_str());
|
||||||
else if (!critical_arg.compare("+"))
|
else if (!critical_arg.compare("+"))
|
||||||
critical_ratio = (*current_member->MemberOfHealRotation())->ArmorTypeCriticalHPRatio(armor_type_value) + HP_RATIO_DELTA;
|
critical_ratio = (*current_member->MemberOfHealRotation())->ArmorTypeCriticalHPRatio(armor_type_value) + HP_RATIO_DELTA;
|
||||||
else if (!critical_arg.compare("-"))
|
else if (!critical_arg.compare("-"))
|
||||||
@@ -8293,7 +8315,7 @@ void bot_subcommand_heal_rotation_adjust_safe(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
uint8 armor_type_value = 255;
|
uint8 armor_type_value = 255;
|
||||||
if (sep->IsNumber(1))
|
if (sep->IsNumber(1))
|
||||||
armor_type_value = atoi(armor_type_arg.c_str());
|
armor_type_value = Strings::ToInt(armor_type_arg.c_str());
|
||||||
|
|
||||||
if (armor_type_value > ARMOR_TYPE_LAST) {
|
if (armor_type_value > ARMOR_TYPE_LAST) {
|
||||||
c->Message(Chat::White, "You must specify a valid [armor_type: %u-%u] to use this command", ARMOR_TYPE_FIRST, ARMOR_TYPE_LAST);
|
c->Message(Chat::White, "You must specify a valid [armor_type: %u-%u] to use this command", ARMOR_TYPE_FIRST, ARMOR_TYPE_LAST);
|
||||||
@@ -8322,7 +8344,7 @@ void bot_subcommand_heal_rotation_adjust_safe(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
float safe_ratio = SAFE_HP_RATIO_BASE;
|
float safe_ratio = SAFE_HP_RATIO_BASE;
|
||||||
if (sep->IsNumber(2))
|
if (sep->IsNumber(2))
|
||||||
safe_ratio = atof(safe_arg.c_str());
|
safe_ratio = Strings::ToFloat(safe_arg.c_str());
|
||||||
else if (!safe_arg.compare("+"))
|
else if (!safe_arg.compare("+"))
|
||||||
safe_ratio = (*current_member->MemberOfHealRotation())->ArmorTypeSafeHPRatio(armor_type_value) + HP_RATIO_DELTA;
|
safe_ratio = (*current_member->MemberOfHealRotation())->ArmorTypeSafeHPRatio(armor_type_value) + HP_RATIO_DELTA;
|
||||||
else if (!safe_arg.compare("-"))
|
else if (!safe_arg.compare("-"))
|
||||||
@@ -8436,7 +8458,7 @@ void bot_subcommand_heal_rotation_change_interval(Client *c, const Seperator *se
|
|||||||
uint32 hr_change_interval_s = CASTING_CYCLE_DEFAULT_INTERVAL_S;
|
uint32 hr_change_interval_s = CASTING_CYCLE_DEFAULT_INTERVAL_S;
|
||||||
|
|
||||||
if (!change_interval_arg.empty()) {
|
if (!change_interval_arg.empty()) {
|
||||||
hr_change_interval_s = atoi(change_interval_arg.c_str());
|
hr_change_interval_s = Strings::ToInt(change_interval_arg.c_str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
hr_change_interval_s = (*current_member->MemberOfHealRotation())->IntervalS();
|
hr_change_interval_s = (*current_member->MemberOfHealRotation())->IntervalS();
|
||||||
@@ -8584,14 +8606,14 @@ void bot_subcommand_heal_rotation_create(Client *c, const Seperator *sep)
|
|||||||
hr_adaptive_targeting = true;
|
hr_adaptive_targeting = true;
|
||||||
if (!fast_heals_arg.compare("on"))
|
if (!fast_heals_arg.compare("on"))
|
||||||
hr_fast_heals = true;
|
hr_fast_heals = true;
|
||||||
hr_interval_s = atoi(interval_arg.c_str());
|
hr_interval_s = Strings::ToInt(interval_arg.c_str());
|
||||||
}
|
}
|
||||||
else if (!casting_override_arg.compare("off")) {
|
else if (!casting_override_arg.compare("off")) {
|
||||||
if (!adaptive_targeting_arg.compare("on"))
|
if (!adaptive_targeting_arg.compare("on"))
|
||||||
hr_adaptive_targeting = true;
|
hr_adaptive_targeting = true;
|
||||||
if (!fast_heals_arg.compare("on"))
|
if (!fast_heals_arg.compare("on"))
|
||||||
hr_fast_heals = true;
|
hr_fast_heals = true;
|
||||||
hr_interval_s = atoi(interval_arg.c_str());
|
hr_interval_s = Strings::ToInt(interval_arg.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hr_interval_s < CASTING_CYCLE_MINIMUM_INTERVAL_S || hr_interval_s > CASTING_CYCLE_MAXIMUM_INTERVAL_S)
|
if (hr_interval_s < CASTING_CYCLE_MINIMUM_INTERVAL_S || hr_interval_s > CASTING_CYCLE_MAXIMUM_INTERVAL_S)
|
||||||
@@ -9314,7 +9336,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto slot_id = static_cast<uint16>(std::stoul(sep->arg[1]));
|
auto slot_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||||
if (slot_id > EQ::invslot::EQUIPMENT_END || slot_id < EQ::invslot::EQUIPMENT_BEGIN) {
|
if (slot_id > EQ::invslot::EQUIPMENT_END || slot_id < EQ::invslot::EQUIPMENT_BEGIN) {
|
||||||
c->Message(Chat::White, "Valid slots are 0 to 22.");
|
c->Message(Chat::White, "Valid slots are 0 to 22.");
|
||||||
return;
|
return;
|
||||||
@@ -10142,8 +10164,7 @@ void helper_command_depart_list(Client* bot_owner, Bot* druid_bot, Bot* wizard_b
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg = fmt::format(
|
msg = fmt::format(
|
||||||
"{}circle {}{}",
|
"^circle {}{}",
|
||||||
std::to_string(BOT_COMMAND_CHAR),
|
|
||||||
spells[local_entry->spell_id].teleport_zone,
|
spells[local_entry->spell_id].teleport_zone,
|
||||||
single_flag ? " single" : ""
|
single_flag ? " single" : ""
|
||||||
);
|
);
|
||||||
@@ -10178,8 +10199,7 @@ void helper_command_depart_list(Client* bot_owner, Bot* druid_bot, Bot* wizard_b
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg = fmt::format(
|
msg = fmt::format(
|
||||||
"{}portal {}{}",
|
"^portal {}{}",
|
||||||
std::to_string(BOT_COMMAND_CHAR),
|
|
||||||
spells[local_entry->spell_id].teleport_zone,
|
spells[local_entry->spell_id].teleport_zone,
|
||||||
single_flag ? " single" : ""
|
single_flag ? " single" : ""
|
||||||
);
|
);
|
||||||
@@ -10244,7 +10264,15 @@ void helper_send_available_subcommands(Client *bot_owner, const char* command_si
|
|||||||
if (bot_owner->Admin() < find_iter->second->access)
|
if (bot_owner->Admin() < find_iter->second->access)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bot_owner->Message(Chat::White, "%c%s - %s", BOT_COMMAND_CHAR, subcommand_iter, ((find_iter != bot_command_list.end()) ? (find_iter->second->desc) : ("[no description]")));
|
bot_owner->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"^{} - {}",
|
||||||
|
subcommand_iter,
|
||||||
|
find_iter != bot_command_list.end() ? find_iter->second->desc : "No Description"
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
++bot_subcommands_shown;
|
++bot_subcommands_shown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10306,7 +10334,7 @@ void bot_command_spell_list(Client* c, const Seperator *sep)
|
|||||||
uint8 min_level = 0;
|
uint8 min_level = 0;
|
||||||
|
|
||||||
if (sep->IsNumber(1)) {
|
if (sep->IsNumber(1)) {
|
||||||
min_level = static_cast<uint8>(std::stoul(sep->arg[1]));
|
min_level = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
my_bot->ListBotSpells(min_level);
|
my_bot->ListBotSpells(min_level);
|
||||||
@@ -10353,7 +10381,7 @@ void bot_command_spell_settings_add(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto spell_id = static_cast<uint16>(std::stoul(sep->arg[1]));
|
auto spell_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||||
|
|
||||||
if (!IsValidSpell(spell_id)) {
|
if (!IsValidSpell(spell_id)) {
|
||||||
c->Message(
|
c->Message(
|
||||||
@@ -10380,9 +10408,9 @@ void bot_command_spell_settings_add(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto priority = static_cast<int16>(std::stoi(sep->arg[2]));
|
auto priority = static_cast<int16>(Strings::ToInt(sep->arg[2]));
|
||||||
auto min_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[3]), -1, 99));
|
auto min_hp = static_cast<int8>(EQ::Clamp(Strings::ToInt(sep->arg[3]), -1, 99));
|
||||||
auto max_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[4]), -1, 100));
|
auto max_hp = static_cast<int8>(EQ::Clamp(Strings::ToInt(sep->arg[4]), -1, 100));
|
||||||
|
|
||||||
BotSpellSetting bs;
|
BotSpellSetting bs;
|
||||||
|
|
||||||
@@ -10468,7 +10496,7 @@ void bot_command_spell_settings_delete(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto spell_id = static_cast<uint16>(std::stoul(sep->arg[1]));
|
auto spell_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||||
|
|
||||||
if (!IsValidSpell(spell_id)) {
|
if (!IsValidSpell(spell_id)) {
|
||||||
c->Message(
|
c->Message(
|
||||||
@@ -10576,7 +10604,7 @@ void bot_command_spell_settings_toggle(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto spell_id = static_cast<uint16>(std::stoul(sep->arg[1]));
|
auto spell_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||||
if (!IsValidSpell(spell_id)) {
|
if (!IsValidSpell(spell_id)) {
|
||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
@@ -10590,7 +10618,7 @@ void bot_command_spell_settings_toggle(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
bool toggle = (
|
bool toggle = (
|
||||||
sep->IsNumber(2) ?
|
sep->IsNumber(2) ?
|
||||||
(std::stoi(sep->arg[2]) ? true : false) :
|
(Strings::ToInt(sep->arg[2]) ? true : false) :
|
||||||
atobool(sep->arg[2])
|
atobool(sep->arg[2])
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -10681,7 +10709,7 @@ void bot_command_spell_settings_update(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto spell_id = static_cast<uint16>(std::stoul(sep->arg[1]));
|
auto spell_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||||
|
|
||||||
if (!IsValidSpell(spell_id)) {
|
if (!IsValidSpell(spell_id)) {
|
||||||
c->Message(
|
c->Message(
|
||||||
@@ -10694,9 +10722,9 @@ void bot_command_spell_settings_update(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto priority = static_cast<int16>(std::stoi(sep->arg[2]));
|
auto priority = static_cast<int16>(Strings::ToInt(sep->arg[2]));
|
||||||
auto min_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[3]), -1, 99));
|
auto min_hp = static_cast<int8>(EQ::Clamp(Strings::ToInt(sep->arg[3]), -1, 99));
|
||||||
auto max_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[4]), -1, 100));
|
auto max_hp = static_cast<int8>(EQ::Clamp(Strings::ToInt(sep->arg[4]), -1, 100));
|
||||||
|
|
||||||
BotSpellSetting bs;
|
BotSpellSetting bs;
|
||||||
|
|
||||||
@@ -10771,7 +10799,7 @@ void bot_spell_info_dialogue_window(Client* c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto spell_id = static_cast<uint16>(std::stoul(sep->arg[1]));
|
auto spell_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||||
auto min_level = spells[spell_id].classes;
|
auto min_level = spells[spell_id].classes;
|
||||||
auto class_level = min_level[my_bot->GetBotClass() - 1];
|
auto class_level = min_level[my_bot->GetBotClass() - 1];
|
||||||
|
|
||||||
@@ -10848,3 +10876,53 @@ void bot_command_enforce_spell_list(Client* c, const Seperator *sep)
|
|||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bot_command_caster_range(Client* c, const Seperator* sep)
|
||||||
|
{
|
||||||
|
if (helper_command_alias_fail(c, "bot_command_caster_range", sep->arg[0], "casterrange")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (helper_is_help_or_usage(sep->arg[1])) {
|
||||||
|
c->Message(Chat::White, "usage: <target_bot> %s [current | value: 0 - 300].", sep->arg[0]);
|
||||||
|
c->Message(Chat::White, "note: Can only be used for Casters or Hybrids.");
|
||||||
|
c->Message(Chat::White, "note: Use [current] to check the current setting.");
|
||||||
|
c->Message(Chat::White, "note: Set the value to the minimum distance you want your bot to try to remain from its target.");
|
||||||
|
c->Message(Chat::White, "note: If they are too far for a spell, it will be skipped.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto my_bot = ActionableBots::AsTarget_ByBot(c);
|
||||||
|
if (!my_bot) {
|
||||||
|
c->Message(Chat::White, "You must <target> a bot that you own to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!IsCasterClass(my_bot->GetClass()) && !IsHybridClass(my_bot->GetClass())) {
|
||||||
|
c->Message(Chat::White, "You must <target> a caster or hybrid class to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 crange = 0;
|
||||||
|
if (sep->IsNumber(1)) {
|
||||||
|
crange = atoi(sep->arg[1]);
|
||||||
|
if (crange >= 0 && crange <= 300) {
|
||||||
|
my_bot->SetBotCasterRange(crange);
|
||||||
|
if (!database.botdb.SaveBotCasterRange(c->CharacterID(), my_bot->GetBotID(), crange)) {
|
||||||
|
c->Message(Chat::White, "%s for '%s'", BotDatabase::fail::SaveBotCasterRange(), my_bot->GetCleanName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
c->Message(Chat::White, "Successfully set Caster Range for %s to %u.", my_bot->GetCleanName(), crange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
c->Message(Chat::White, "You must enter a value within the range of 0 - 300.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!strcasecmp(sep->arg[1], "current")) {
|
||||||
|
c->Message(Chat::White, "My current range is %u.", my_bot->GetBotCasterRange());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
c->Message(Chat::White, "Incorrect argument, use help for a list of options.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+1
-2
@@ -553,6 +553,7 @@ void bot_command_attack(Client *c, const Seperator *sep);
|
|||||||
void bot_command_bind_affinity(Client *c, const Seperator *sep);
|
void bot_command_bind_affinity(Client *c, const Seperator *sep);
|
||||||
void bot_command_bot(Client *c, const Seperator *sep);
|
void bot_command_bot(Client *c, const Seperator *sep);
|
||||||
void bot_command_botgroup(Client *c, const Seperator *sep);
|
void bot_command_botgroup(Client *c, const Seperator *sep);
|
||||||
|
void bot_command_caster_range(Client* c, const Seperator* sep);
|
||||||
void bot_command_charm(Client *c, const Seperator *sep);
|
void bot_command_charm(Client *c, const Seperator *sep);
|
||||||
void bot_command_cure(Client *c, const Seperator *sep);
|
void bot_command_cure(Client *c, const Seperator *sep);
|
||||||
void bot_command_defensive(Client *c, const Seperator *sep);
|
void bot_command_defensive(Client *c, const Seperator *sep);
|
||||||
@@ -638,7 +639,6 @@ void bot_subcommand_botgroup_list(Client *c, const Seperator *sep);
|
|||||||
void bot_subcommand_botgroup_load(Client *c, const Seperator *sep);
|
void bot_subcommand_botgroup_load(Client *c, const Seperator *sep);
|
||||||
void bot_subcommand_botgroup_remove_member(Client *c, const Seperator *sep);
|
void bot_subcommand_botgroup_remove_member(Client *c, const Seperator *sep);
|
||||||
void bot_subcommand_circle(Client *c, const Seperator *sep);
|
void bot_subcommand_circle(Client *c, const Seperator *sep);
|
||||||
void bot_subcommand_evacuate(Client *c, const Seperator *sep);
|
|
||||||
void bot_subcommand_heal_rotation_adaptive_targeting(Client *c, const Seperator *sep);
|
void bot_subcommand_heal_rotation_adaptive_targeting(Client *c, const Seperator *sep);
|
||||||
void bot_subcommand_heal_rotation_add_member(Client *c, const Seperator *sep);
|
void bot_subcommand_heal_rotation_add_member(Client *c, const Seperator *sep);
|
||||||
void bot_subcommand_heal_rotation_add_target(Client *c, const Seperator *sep);
|
void bot_subcommand_heal_rotation_add_target(Client *c, const Seperator *sep);
|
||||||
@@ -667,7 +667,6 @@ void bot_subcommand_pet_get_lost(Client *c, const Seperator *sep);
|
|||||||
void bot_subcommand_pet_remove(Client *c, const Seperator *sep);
|
void bot_subcommand_pet_remove(Client *c, const Seperator *sep);
|
||||||
void bot_subcommand_pet_set_type(Client *c, const Seperator *sep);
|
void bot_subcommand_pet_set_type(Client *c, const Seperator *sep);
|
||||||
void bot_subcommand_portal(Client *c, const Seperator *sep);
|
void bot_subcommand_portal(Client *c, const Seperator *sep);
|
||||||
void bot_subcommand_succor(Client *c, const Seperator *sep);
|
|
||||||
|
|
||||||
|
|
||||||
// bot command helpers
|
// bot command helpers
|
||||||
|
|||||||
+147
-105
@@ -43,7 +43,7 @@ bool BotDatabase::LoadBotCommandSettings(std::map<std::string, std::pair<uint8,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
bot_command_settings[row[0]].first = atoi(row[1]);
|
bot_command_settings[row[0]].first = Strings::ToInt(row[1]);
|
||||||
if (row[2][0] == 0)
|
if (row[2][0] == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -138,19 +138,19 @@ bool BotDatabase::LoadBotSpellCastingChances()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
uint8 spell_type_index = atoi(row[0]);
|
uint8 spell_type_index = Strings::ToInt(row[0]);
|
||||||
if (spell_type_index >= Bot::SPELL_TYPE_COUNT)
|
if (spell_type_index >= Bot::SPELL_TYPE_COUNT)
|
||||||
continue;
|
continue;
|
||||||
uint8 class_index = atoi(row[1]);
|
uint8 class_index = Strings::ToInt(row[1]);
|
||||||
if (class_index < WARRIOR || class_index > BERSERKER)
|
if (class_index < WARRIOR || class_index > BERSERKER)
|
||||||
continue;
|
continue;
|
||||||
--class_index;
|
--class_index;
|
||||||
uint8 stance_index = atoi(row[2]);
|
uint8 stance_index = Strings::ToInt(row[2]);
|
||||||
if (stance_index >= EQ::constants::STANCE_TYPE_COUNT)
|
if (stance_index >= EQ::constants::STANCE_TYPE_COUNT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (uint8 conditional_index = nHSND; conditional_index < cntHSND; ++conditional_index) {
|
for (uint8 conditional_index = nHSND; conditional_index < cntHSND; ++conditional_index) {
|
||||||
uint8 value = atoi(row[3 + conditional_index]);
|
uint8 value = Strings::ToInt(row[3 + conditional_index]);
|
||||||
if (!value)
|
if (!value)
|
||||||
continue;
|
continue;
|
||||||
if (value > 100)
|
if (value > 100)
|
||||||
@@ -223,7 +223,7 @@ bool BotDatabase::QueryBotCount(const uint32 owner_id, int class_id, uint32& bot
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
bot_count = std::stoul(row[0]);
|
bot_count = Strings::ToUnsignedInt(row[0]);
|
||||||
|
|
||||||
if (EQ::ValueWithin(class_id, WARRIOR, BERSERKER)) {
|
if (EQ::ValueWithin(class_id, WARRIOR, BERSERKER)) {
|
||||||
query = fmt::format(
|
query = fmt::format(
|
||||||
@@ -241,7 +241,7 @@ bool BotDatabase::QueryBotCount(const uint32 owner_id, int class_id, uint32& bot
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
bot_class_count = std::stoul(row[0]);
|
bot_class_count = Strings::ToUnsignedInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -269,7 +269,7 @@ bool BotDatabase::LoadBotsList(const uint32 owner_id, std::list<BotsAvailableLis
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
BotsAvailableList bot_entry;
|
BotsAvailableList bot_entry;
|
||||||
|
|
||||||
bot_entry.ID = atoi(row[0]);
|
bot_entry.ID = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
memset(&bot_entry.Name, 0, sizeof(bot_entry.Name));
|
memset(&bot_entry.Name, 0, sizeof(bot_entry.Name));
|
||||||
std::string bot_name = row[1];
|
std::string bot_name = row[1];
|
||||||
@@ -283,11 +283,11 @@ bool BotDatabase::LoadBotsList(const uint32 owner_id, std::list<BotsAvailableLis
|
|||||||
bot_owner = bot_owner.substr(0, 63);
|
bot_owner = bot_owner.substr(0, 63);
|
||||||
if (!bot_owner.empty())
|
if (!bot_owner.empty())
|
||||||
strcpy(bot_entry.Owner, bot_owner.c_str());
|
strcpy(bot_entry.Owner, bot_owner.c_str());
|
||||||
bot_entry.Class = atoi(row[2]);
|
bot_entry.Class = Strings::ToInt(row[2]);
|
||||||
bot_entry.Level = atoi(row[3]);
|
bot_entry.Level = Strings::ToInt(row[3]);
|
||||||
bot_entry.Race = atoi(row[4]);
|
bot_entry.Race = Strings::ToInt(row[4]);
|
||||||
bot_entry.Gender = atoi(row[5]);
|
bot_entry.Gender = Strings::ToInt(row[5]);
|
||||||
bot_entry.Owner_ID = atoi(row[7]);
|
bot_entry.Owner_ID = Strings::ToInt(row[7]);
|
||||||
bots_list.push_back(bot_entry);
|
bots_list.push_back(bot_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ bool BotDatabase::LoadOwnerID(const std::string& bot_name, uint32& owner_id)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
owner_id = atoi(row[0]);
|
owner_id = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -325,7 +325,7 @@ bool BotDatabase::LoadOwnerID(const uint32 bot_id, uint32& owner_id)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
owner_id = atoi(row[0]);
|
owner_id = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -366,7 +366,7 @@ bool BotDatabase::LoadBotID(const uint32 owner_id, const std::string& bot_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
bot_id = std::stoul(row[0]);
|
bot_id = Strings::ToUnsignedInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -393,8 +393,8 @@ bool BotDatabase::LoadBotID(const uint32 owner_id, const std::string& bot_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
bot_id = std::stoul(row[0]);
|
bot_id = Strings::ToUnsignedInt(row[0]);
|
||||||
bot_class_id = static_cast<uint8>(std::stoul(row[1]));
|
bot_class_id = static_cast<uint8>(Strings::ToUnsignedInt(row[1]));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -485,6 +485,8 @@ bool BotDatabase::LoadBot(const uint32 bot_id, Bot*& loaded_bot)
|
|||||||
loaded_bot->SetBotEnforceSpellSetting((l.enforce_spell_settings ? true : false));
|
loaded_bot->SetBotEnforceSpellSetting((l.enforce_spell_settings ? true : false));
|
||||||
|
|
||||||
loaded_bot->SetBotArcherySetting((l.archery_setting ? true : false));
|
loaded_bot->SetBotArcherySetting((l.archery_setting ? true : false));
|
||||||
|
|
||||||
|
loaded_bot->SetBotCasterRange(l.caster_range);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -545,6 +547,7 @@ bool BotDatabase::SaveNewBot(Bot* bot_inst, uint32& bot_id)
|
|||||||
e.expansion_bitmask = bot_inst->GetExpansionBitmask();
|
e.expansion_bitmask = bot_inst->GetExpansionBitmask();
|
||||||
e.enforce_spell_settings = bot_inst->GetBotEnforceSpellSetting();
|
e.enforce_spell_settings = bot_inst->GetBotEnforceSpellSetting();
|
||||||
e.archery_setting = bot_inst->IsBotArcher() ? 1 : 0;
|
e.archery_setting = bot_inst->IsBotArcher() ? 1 : 0;
|
||||||
|
e.caster_range = bot_inst->GetBotCasterRange();
|
||||||
|
|
||||||
auto b = BotDataRepository::InsertOne(database, e);
|
auto b = BotDataRepository::InsertOne(database, e);
|
||||||
if (!b.bot_id) {
|
if (!b.bot_id) {
|
||||||
@@ -639,10 +642,11 @@ bool BotDatabase::DeleteBot(const uint32 bot_id)
|
|||||||
|
|
||||||
bool BotDatabase::LoadBuffs(Bot* bot_inst)
|
bool BotDatabase::LoadBuffs(Bot* bot_inst)
|
||||||
{
|
{
|
||||||
if (!bot_inst)
|
if (!bot_inst) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
query = StringFormat(
|
query = fmt::format(
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" `spell_id`,"
|
" `spell_id`,"
|
||||||
" `caster_level`,"
|
" `caster_level`,"
|
||||||
@@ -663,45 +667,58 @@ bool BotDatabase::LoadBuffs(Bot* bot_inst)
|
|||||||
" `extra_di_chance`,"
|
" `extra_di_chance`,"
|
||||||
" `instrument_mod`"
|
" `instrument_mod`"
|
||||||
" FROM `bot_buffs`"
|
" FROM `bot_buffs`"
|
||||||
" WHERE `bot_id` = '%u'",
|
" WHERE `bot_id` = {}",
|
||||||
bot_inst->GetBotID()
|
bot_inst->GetBotID()
|
||||||
);
|
);
|
||||||
auto results = database.QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
|
||||||
|
if (!results.Success()) {
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
}
|
||||||
|
|
||||||
|
if (!results.RowCount()) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Buffs_Struct* bot_buffs = bot_inst->GetBuffs();
|
Buffs_Struct* bot_buffs = bot_inst->GetBuffs();
|
||||||
if (!bot_buffs)
|
|
||||||
|
if (!bot_buffs) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 max_slots = bot_inst->GetMaxBuffSlots();
|
||||||
|
for (int index = 0; index < max_slots; index++) {
|
||||||
|
bot_buffs[index].spellid = SPELL_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
int buff_count = 0;
|
int buff_count = 0;
|
||||||
for (auto row = results.begin(); row != results.end() && buff_count < BUFF_COUNT; ++row) {
|
for (auto row = results.begin(); row != results.end() && buff_count < BUFF_COUNT; ++row) {
|
||||||
bot_buffs[buff_count].spellid = atoi(row[0]);
|
bot_buffs[buff_count].spellid = Strings::ToUnsignedInt(row[0]);
|
||||||
bot_buffs[buff_count].casterlevel = atoi(row[1]);
|
bot_buffs[buff_count].casterlevel = Strings::ToUnsignedInt(row[1]);
|
||||||
//row[2] (duration_formula) can probably be removed
|
//row[2] (duration_formula) can probably be removed
|
||||||
bot_buffs[buff_count].ticsremaining = atoi(row[3]);
|
bot_buffs[buff_count].ticsremaining = Strings::ToInt(row[3]);
|
||||||
|
|
||||||
if (CalculatePoisonCounters(bot_buffs[buff_count].spellid) > 0)
|
bot_buffs[buff_count].counters = 0;
|
||||||
bot_buffs[buff_count].counters = atoi(row[4]);
|
if (CalculatePoisonCounters(bot_buffs[buff_count].spellid) > 0) {
|
||||||
else if (CalculateDiseaseCounters(bot_buffs[buff_count].spellid) > 0)
|
bot_buffs[buff_count].counters = Strings::ToUnsignedInt(row[4]);
|
||||||
bot_buffs[buff_count].counters = atoi(row[5]);
|
} else if (CalculateDiseaseCounters(bot_buffs[buff_count].spellid) > 0) {
|
||||||
else if (CalculateCurseCounters(bot_buffs[buff_count].spellid) > 0)
|
bot_buffs[buff_count].counters = Strings::ToUnsignedInt(row[5]);
|
||||||
bot_buffs[buff_count].counters = atoi(row[6]);
|
} else if (CalculateCurseCounters(bot_buffs[buff_count].spellid) > 0) {
|
||||||
else if (CalculateCorruptionCounters(bot_buffs[buff_count].spellid) > 0)
|
bot_buffs[buff_count].counters = Strings::ToUnsignedInt(row[6]);
|
||||||
bot_buffs[buff_count].counters = atoi(row[7]);
|
} else if (CalculateCorruptionCounters(bot_buffs[buff_count].spellid) > 0) {
|
||||||
|
bot_buffs[buff_count].counters = Strings::ToUnsignedInt(row[7]);
|
||||||
|
}
|
||||||
|
|
||||||
bot_buffs[buff_count].hit_number = atoi(row[8]);
|
bot_buffs[buff_count].hit_number = Strings::ToUnsignedInt(row[8]);
|
||||||
bot_buffs[buff_count].melee_rune = atoi(row[9]);
|
bot_buffs[buff_count].melee_rune = Strings::ToUnsignedInt(row[9]);
|
||||||
bot_buffs[buff_count].magic_rune = atoi(row[10]);
|
bot_buffs[buff_count].magic_rune = Strings::ToUnsignedInt(row[10]);
|
||||||
bot_buffs[buff_count].dot_rune = atoi(row[11]);
|
bot_buffs[buff_count].dot_rune = Strings::ToUnsignedInt(row[11]);
|
||||||
bot_buffs[buff_count].persistant_buff = ((atoi(row[12])) ? (true) : (false));
|
bot_buffs[buff_count].persistant_buff = (Strings::ToBool(row[12])) != 0;
|
||||||
bot_buffs[buff_count].caston_x = atoi(row[13]);
|
bot_buffs[buff_count].caston_x = Strings::ToInt(row[13]);
|
||||||
bot_buffs[buff_count].caston_y = atoi(row[14]);
|
bot_buffs[buff_count].caston_y = Strings::ToInt(row[14]);
|
||||||
bot_buffs[buff_count].caston_z = atoi(row[15]);
|
bot_buffs[buff_count].caston_z = Strings::ToInt(row[15]);
|
||||||
bot_buffs[buff_count].ExtraDIChance = atoi(row[16]);
|
bot_buffs[buff_count].ExtraDIChance = Strings::ToInt(row[16]);
|
||||||
bot_buffs[buff_count].instrument_mod = atoi(row[17]);
|
bot_buffs[buff_count].instrument_mod = Strings::ToUnsignedInt(row[17]);
|
||||||
bot_buffs[buff_count].casterid = 0;
|
bot_buffs[buff_count].casterid = 0;
|
||||||
++buff_count;
|
++buff_count;
|
||||||
}
|
}
|
||||||
@@ -822,7 +839,7 @@ bool BotDatabase::LoadStance(const uint32 bot_id, int& bot_stance)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
bot_stance = atoi(row[0]);
|
bot_stance = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -842,7 +859,7 @@ bool BotDatabase::LoadStance(Bot* bot_inst, bool& stance_flag)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
bot_inst->SetBotStance((EQ::constants::StanceType)atoi(row[0]));
|
bot_inst->SetBotStance((EQ::constants::StanceType)Strings::ToInt(row[0]));
|
||||||
stance_flag = true;
|
stance_flag = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -935,9 +952,9 @@ bool BotDatabase::LoadTimers(Bot* bot_inst)
|
|||||||
uint32 timer_value = 0;
|
uint32 timer_value = 0;
|
||||||
uint32 max_value = 0;
|
uint32 max_value = 0;
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
timer_id = atoi(row[0]) - 1;
|
timer_id = Strings::ToInt(row[0]) - 1;
|
||||||
timer_value = atoi(row[1]);
|
timer_value = Strings::ToInt(row[1]);
|
||||||
max_value = atoi(row[2]);
|
max_value = Strings::ToInt(row[2]);
|
||||||
|
|
||||||
if (timer_id >= 0 && timer_id < MaxTimer && timer_value < (Timer::GetCurrentTime() + max_value))
|
if (timer_id >= 0 && timer_id < MaxTimer && timer_value < (Timer::GetCurrentTime() + max_value))
|
||||||
bot_timers[timer_id] = timer_value;
|
bot_timers[timer_id] = timer_value;
|
||||||
@@ -1003,7 +1020,7 @@ bool BotDatabase::QueryInventoryCount(const uint32 bot_id, uint32& item_count)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
item_count = atoi(row[0]);
|
item_count = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1042,22 +1059,22 @@ bool BotDatabase::LoadItems(const uint32 bot_id, EQ::InventoryProfile& inventory
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
int16 slot_id = atoi(row[0]);
|
int16 slot_id = Strings::ToInt(row[0]);
|
||||||
if (slot_id < EQ::invslot::EQUIPMENT_BEGIN || slot_id > EQ::invslot::EQUIPMENT_END)
|
if (slot_id < EQ::invslot::EQUIPMENT_BEGIN || slot_id > EQ::invslot::EQUIPMENT_END)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint32 item_id = atoi(row[1]);
|
uint32 item_id = Strings::ToInt(row[1]);
|
||||||
uint16 item_charges = (uint16)atoi(row[2]);
|
uint16 item_charges = (uint16)Strings::ToInt(row[2]);
|
||||||
|
|
||||||
EQ::ItemInstance* item_inst = database.CreateItem(
|
EQ::ItemInstance* item_inst = database.CreateItem(
|
||||||
item_id,
|
item_id,
|
||||||
item_charges,
|
item_charges,
|
||||||
(uint32)atoul(row[9]),
|
(uint32)Strings::ToUnsignedInt(row[9]),
|
||||||
(uint32)atoul(row[10]),
|
(uint32)Strings::ToUnsignedInt(row[10]),
|
||||||
(uint32)atoul(row[11]),
|
(uint32)Strings::ToUnsignedInt(row[11]),
|
||||||
(uint32)atoul(row[12]),
|
(uint32)Strings::ToUnsignedInt(row[12]),
|
||||||
(uint32)atoul(row[13]),
|
(uint32)Strings::ToUnsignedInt(row[13]),
|
||||||
(uint32)atoul(row[14])
|
(uint32)Strings::ToUnsignedInt(row[14])
|
||||||
);
|
);
|
||||||
if (!item_inst) {
|
if (!item_inst) {
|
||||||
LogError("Warning: bot_id [{}] has an invalid item_id [{}] in inventory slot [{}]", bot_id, item_id, slot_id);
|
LogError("Warning: bot_id [{}] has an invalid item_id [{}] in inventory slot [{}]", bot_id, item_id, slot_id);
|
||||||
@@ -1071,12 +1088,12 @@ bool BotDatabase::LoadItems(const uint32 bot_id, EQ::InventoryProfile& inventory
|
|||||||
else
|
else
|
||||||
item_inst->SetCharges(item_charges);
|
item_inst->SetCharges(item_charges);
|
||||||
|
|
||||||
uint32 item_color = atoul(row[3]);
|
uint32 item_color = Strings::ToUnsignedInt(row[3]);
|
||||||
if (item_color > 0)
|
if (item_color > 0)
|
||||||
item_inst->SetColor(item_color);
|
item_inst->SetColor(item_color);
|
||||||
|
|
||||||
if (item_inst->GetItem()->Attuneable) {
|
if (item_inst->GetItem()->Attuneable) {
|
||||||
if (atoi(row[4]))
|
if (Strings::ToInt(row[4]))
|
||||||
item_inst->SetAttuned(true);
|
item_inst->SetAttuned(true);
|
||||||
else if (slot_id >= EQ::invslot::EQUIPMENT_BEGIN && slot_id <= EQ::invslot::EQUIPMENT_END)
|
else if (slot_id >= EQ::invslot::EQUIPMENT_BEGIN && slot_id <= EQ::invslot::EQUIPMENT_END)
|
||||||
item_inst->SetAttuned(true);
|
item_inst->SetAttuned(true);
|
||||||
@@ -1108,9 +1125,9 @@ bool BotDatabase::LoadItems(const uint32 bot_id, EQ::InventoryProfile& inventory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
item_inst->SetOrnamentIcon((uint32)atoul(row[6]));
|
item_inst->SetOrnamentIcon((uint32)Strings::ToUnsignedInt(row[6]));
|
||||||
item_inst->SetOrnamentationIDFile((uint32)atoul(row[7]));
|
item_inst->SetOrnamentationIDFile((uint32)Strings::ToUnsignedInt(row[7]));
|
||||||
item_inst->SetOrnamentHeroModel((uint32)atoul(row[8]));
|
item_inst->SetOrnamentHeroModel((uint32)Strings::ToUnsignedInt(row[8]));
|
||||||
|
|
||||||
if (inventory_inst.PutItem(slot_id, *item_inst) == INVALID_INDEX)
|
if (inventory_inst.PutItem(slot_id, *item_inst) == INVALID_INDEX)
|
||||||
LogError("Warning: Invalid slot_id for item in inventory: bot_id = [{}], item_id = [{}], slot_id = [{}]", bot_id, item_id, slot_id);
|
LogError("Warning: Invalid slot_id for item in inventory: bot_id = [{}], item_id = [{}], slot_id = [{}]", bot_id, item_id, slot_id);
|
||||||
@@ -1157,7 +1174,7 @@ bool BotDatabase::LoadItemBySlot(const uint32 bot_id, const uint32 slot_id, uint
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
item_id = atoi(row[0]);
|
item_id = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1298,7 +1315,7 @@ bool BotDatabase::LoadEquipmentColor(const uint32 bot_id, const uint8 material_s
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
rgb = atoul(row[0]);
|
rgb = Strings::ToUnsignedInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1349,7 +1366,7 @@ bool BotDatabase::LoadPetIndex(const uint32 bot_id, uint32& pet_index)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
pet_index = atoi(row[0]);
|
pet_index = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1367,7 +1384,7 @@ bool BotDatabase::LoadPetSpellID(const uint32 bot_id, uint32& pet_spell_id)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
pet_spell_id = atoi(row[0]);
|
pet_spell_id = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1391,10 +1408,10 @@ bool BotDatabase::LoadPetStats(const uint32 bot_id, std::string& pet_name, uint3
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
pet_spell_id = atoi(row[0]);
|
pet_spell_id = Strings::ToInt(row[0]);
|
||||||
pet_name = row[1];
|
pet_name = row[1];
|
||||||
pet_mana = atoi(row[2]);
|
pet_mana = Strings::ToInt(row[2]);
|
||||||
pet_hp = atoi(row[3]);
|
pet_hp = Strings::ToInt(row[3]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1480,9 +1497,9 @@ bool BotDatabase::LoadPetBuffs(const uint32 bot_id, SpellBuff_Struct* pet_buffs)
|
|||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
for (auto row = results.begin(); row != results.end() && buff_index < PET_BUFF_COUNT; ++row) {
|
for (auto row = results.begin(); row != results.end() && buff_index < PET_BUFF_COUNT; ++row) {
|
||||||
pet_buffs[buff_index].spellid = atoi(row[0]);
|
pet_buffs[buff_index].spellid = Strings::ToInt(row[0]);
|
||||||
pet_buffs[buff_index].level = atoi(row[1]);
|
pet_buffs[buff_index].level = Strings::ToInt(row[1]);
|
||||||
pet_buffs[buff_index].duration = atoi(row[2]);
|
pet_buffs[buff_index].duration = Strings::ToInt(row[2]);
|
||||||
|
|
||||||
// Work around for loading the counters and setting them back to max. Need entry in DB for saved counters
|
// Work around for loading the counters and setting them back to max. Need entry in DB for saved counters
|
||||||
if (CalculatePoisonCounters(pet_buffs[buff_index].spellid) > 0)
|
if (CalculatePoisonCounters(pet_buffs[buff_index].spellid) > 0)
|
||||||
@@ -1588,7 +1605,7 @@ bool BotDatabase::LoadPetItems(const uint32 bot_id, uint32* pet_items)
|
|||||||
|
|
||||||
int item_index = EQ::invslot::EQUIPMENT_BEGIN;
|
int item_index = EQ::invslot::EQUIPMENT_BEGIN;
|
||||||
for (auto row = results.begin(); row != results.end() && (item_index >= EQ::invslot::EQUIPMENT_BEGIN && item_index <= EQ::invslot::EQUIPMENT_END); ++row) {
|
for (auto row = results.begin(); row != results.end() && (item_index >= EQ::invslot::EQUIPMENT_BEGIN && item_index <= EQ::invslot::EQUIPMENT_END); ++row) {
|
||||||
pet_items[item_index] = atoi(row[0]);
|
pet_items[item_index] = Strings::ToInt(row[0]);
|
||||||
++item_index;
|
++item_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2128,7 +2145,7 @@ bool BotDatabase::LoadOwnerOptions(Client *owner)
|
|||||||
|
|
||||||
for (auto row : results) {
|
for (auto row : results) {
|
||||||
|
|
||||||
owner->SetBotOption(static_cast<Client::BotOwnerOption>(atoul(row[0])), (atoul(row[1]) != 0));
|
owner->SetBotOption(static_cast<Client::BotOwnerOption>(Strings::ToUnsignedInt(row[0])), (Strings::ToUnsignedInt(row[1]) != 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -2250,7 +2267,7 @@ bool BotDatabase::LoadBotGroupIDByBotGroupName(const std::string& group_name, ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
botgroup_id = std::stoul(row[0]);
|
botgroup_id = Strings::ToUnsignedInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2276,7 +2293,7 @@ bool BotDatabase::LoadBotGroupIDByLeaderID(const uint32 leader_id, uint32& botgr
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
botgroup_id = std::stoul(row[0]);
|
botgroup_id = Strings::ToUnsignedInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2302,7 +2319,7 @@ bool BotDatabase::LoadBotGroupIDByMemberID(const uint32 member_id, uint32& botgr
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
botgroup_id = std::stoul(row[0]);
|
botgroup_id = Strings::ToUnsignedInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2328,7 +2345,7 @@ bool BotDatabase::LoadLeaderIDByBotGroupName(const std::string& group_name, uint
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
leader_id = std::stoul(row[0]);
|
leader_id = Strings::ToUnsignedInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2354,7 +2371,7 @@ bool BotDatabase::LoadLeaderIDByBotGroupID(const uint32 group_id, uint32& leader
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
leader_id = std::stoul(row[0]);
|
leader_id = Strings::ToUnsignedInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2576,7 +2593,7 @@ bool BotDatabase::LoadBotGroupIDForLoadBotGroup(const uint32 owner_id, std::stri
|
|||||||
|
|
||||||
for (auto row : results) {
|
for (auto row : results) {
|
||||||
if (!group_name.compare(row[1])) {
|
if (!group_name.compare(row[1])) {
|
||||||
botgroup_id = std::stoul(row[0]);
|
botgroup_id = Strings::ToUnsignedInt(row[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2614,7 +2631,7 @@ bool BotDatabase::LoadBotGroup(const std::string& group_name, std::map<uint32, s
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto row : results) {
|
for (auto row : results) {
|
||||||
member_list[botgroup_id].push_back(std::stoul(row[0]));
|
member_list[botgroup_id].push_back(Strings::ToUnsignedInt(row[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -2646,7 +2663,7 @@ bool BotDatabase::LoadBotGroupsListByOwnerID(const uint32 owner_id, std::list<st
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto row : results) {
|
for (auto row : results) {
|
||||||
botgroups_list.push_back(std::pair<std::string, uint32>(row[0], atoul(row[1])));
|
botgroups_list.push_back(std::pair<std::string, uint32>(row[0], Strings::ToUnsignedInt(row[1])));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -2718,7 +2735,7 @@ bool BotDatabase::LoadAutoSpawnBotGroupsByOwnerID(const uint32 owner_id, std::li
|
|||||||
|
|
||||||
for (auto row : results) {
|
for (auto row : results) {
|
||||||
group_list.push_back(
|
group_list.push_back(
|
||||||
std::pair<uint32,std::string>(std::stoul(row[0]), row[1])
|
std::pair<uint32,std::string>(Strings::ToUnsignedInt(row[0]), row[1])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2750,7 +2767,7 @@ bool BotDatabase::LoadGroupedBotsByGroupID(const uint32 owner_id, const uint32 g
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto row : results) {
|
for (auto row : results) {
|
||||||
group_list.push_back(std::stoul(row[0]));
|
group_list.push_back(Strings::ToUnsignedInt(row[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -2771,7 +2788,7 @@ bool BotDatabase::LoadHealRotationIDByBotID(const uint32 bot_id, uint32& hr_inde
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
hr_index = atoi(row[0]);
|
hr_index = Strings::ToInt(row[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2818,20 +2835,20 @@ bool BotDatabase::LoadHealRotation(Bot* hr_member, std::list<uint32>& member_lis
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
(*hr_member->MemberOfHealRotation())->SetIntervalS((uint32)atoi(row[0]));
|
(*hr_member->MemberOfHealRotation())->SetIntervalS((uint32)Strings::ToInt(row[0]));
|
||||||
(*hr_member->MemberOfHealRotation())->SetFastHeals((bool)atoi(row[1]));
|
(*hr_member->MemberOfHealRotation())->SetFastHeals((bool)Strings::ToInt(row[1]));
|
||||||
(*hr_member->MemberOfHealRotation())->SetAdaptiveTargeting((bool)atoi(row[2]));
|
(*hr_member->MemberOfHealRotation())->SetAdaptiveTargeting((bool)Strings::ToInt(row[2]));
|
||||||
(*hr_member->MemberOfHealRotation())->SetCastingOverride((bool)atoi(row[3]));
|
(*hr_member->MemberOfHealRotation())->SetCastingOverride((bool)Strings::ToInt(row[3]));
|
||||||
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_UNKNOWN, atof(row[4]));
|
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_UNKNOWN, Strings::ToFloat(row[4]));
|
||||||
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_CLOTH, atof(row[5]));
|
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_CLOTH, Strings::ToFloat(row[5]));
|
||||||
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_LEATHER, atof(row[6]));
|
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_LEATHER, Strings::ToFloat(row[6]));
|
||||||
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_CHAIN, atof(row[7]));
|
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_CHAIN, Strings::ToFloat(row[7]));
|
||||||
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_PLATE, atof(row[8]));
|
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_PLATE, Strings::ToFloat(row[8]));
|
||||||
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_UNKNOWN, atof(row[9]));
|
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_UNKNOWN, Strings::ToFloat(row[9]));
|
||||||
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_CLOTH, atof(row[10]));
|
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_CLOTH, Strings::ToFloat(row[10]));
|
||||||
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_LEATHER, atof(row[11]));
|
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_LEATHER, Strings::ToFloat(row[11]));
|
||||||
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_CHAIN, atof(row[12]));
|
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_CHAIN, Strings::ToFloat(row[12]));
|
||||||
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_PLATE, atof(row[13]));
|
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_PLATE, Strings::ToFloat(row[13]));
|
||||||
|
|
||||||
load_flag = true;
|
load_flag = true;
|
||||||
|
|
||||||
@@ -2858,7 +2875,7 @@ bool BotDatabase::LoadHealRotationMembers(const uint32 hr_index, std::list<uint3
|
|||||||
|
|
||||||
for (auto row : results) {
|
for (auto row : results) {
|
||||||
if (row[0])
|
if (row[0])
|
||||||
member_list.push_back(atoi(row[0]));
|
member_list.push_back(Strings::ToInt(row[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -3028,7 +3045,7 @@ bool BotDatabase::DeleteAllHealRotations(const uint32 owner_id)
|
|||||||
if (!row[0])
|
if (!row[0])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DeleteHealRotation(atoi(row[0]));
|
DeleteHealRotation(Strings::ToInt(row[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -3060,7 +3077,7 @@ uint16 BotDatabase::GetRaceClassBitmask(uint16 bot_race)
|
|||||||
uint16 classes = 0;
|
uint16 classes = 0;
|
||||||
if (results.RowCount() == 1) {
|
if (results.RowCount() == 1) {
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
classes = atoi(row[0]);
|
classes = Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
return classes;
|
return classes;
|
||||||
}
|
}
|
||||||
@@ -3151,6 +3168,30 @@ std::string BotDatabase::GetBotNameByID(const uint32 bot_id)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BotDatabase::SaveBotCasterRange(const uint32 owner_id, const uint32 bot_id, const uint32 bot_caster_range_value)
|
||||||
|
{
|
||||||
|
if (!owner_id || !bot_id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
query = fmt::format(
|
||||||
|
"UPDATE `bot_data`"
|
||||||
|
" SET `caster_range` = '{}'"
|
||||||
|
" WHERE `owner_id` = '{}'"
|
||||||
|
" AND `bot_id` = '{}'",
|
||||||
|
bot_caster_range_value,
|
||||||
|
owner_id,
|
||||||
|
bot_id
|
||||||
|
);
|
||||||
|
auto results = database.QueryDatabase(query);
|
||||||
|
|
||||||
|
if (!results.Success()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/* fail::Bot functions */
|
/* fail::Bot functions */
|
||||||
const char* BotDatabase::fail::LoadBotsList() { return "Failed to bots list"; }
|
const char* BotDatabase::fail::LoadBotsList() { return "Failed to bots list"; }
|
||||||
const char* BotDatabase::fail::LoadOwnerID() { return "Failed to load owner ID"; }
|
const char* BotDatabase::fail::LoadOwnerID() { return "Failed to load owner ID"; }
|
||||||
@@ -3205,6 +3246,7 @@ const char* BotDatabase::fail::ToggleAllHelmAppearances() { return "Failed to sa
|
|||||||
const char* BotDatabase::fail::SaveFollowDistance() { return "Failed to save follow distance"; }
|
const char* BotDatabase::fail::SaveFollowDistance() { return "Failed to save follow distance"; }
|
||||||
const char* BotDatabase::fail::SaveAllFollowDistances() { return "Failed to save all follow distances"; }
|
const char* BotDatabase::fail::SaveAllFollowDistances() { return "Failed to save all follow distances"; }
|
||||||
const char* BotDatabase::fail::SaveStopMeleeLevel() { return "Failed to save stop melee level"; }
|
const char* BotDatabase::fail::SaveStopMeleeLevel() { return "Failed to save stop melee level"; }
|
||||||
|
const char* BotDatabase::fail::SaveBotCasterRange() { return "Failed to save caster range"; }
|
||||||
|
|
||||||
/* fail::Bot heal rotation functions */
|
/* fail::Bot heal rotation functions */
|
||||||
const char* BotDatabase::fail::LoadHealRotationIDByBotID() { return "Failed to load heal rotation ID by bot ID"; }
|
const char* BotDatabase::fail::LoadHealRotationIDByBotID() { return "Failed to load heal rotation ID by bot ID"; }
|
||||||
|
|||||||
@@ -146,6 +146,8 @@ public:
|
|||||||
bool SaveOwnerOption(const uint32 owner_id, size_t type, const bool flag);
|
bool SaveOwnerOption(const uint32 owner_id, size_t type, const bool flag);
|
||||||
bool SaveOwnerOption(const uint32 owner_id, const std::pair<size_t, size_t> type, const std::pair<bool, bool> flag);
|
bool SaveOwnerOption(const uint32 owner_id, const std::pair<size_t, size_t> type, const std::pair<bool, bool> flag);
|
||||||
|
|
||||||
|
bool SaveBotCasterRange(const uint32 owner_id, const uint32 bot_id, const uint32 bot_caster_range_value);
|
||||||
|
|
||||||
/* Bot bot-group functions */
|
/* Bot bot-group functions */
|
||||||
bool QueryBotGroupExistence(const std::string& botgroup_name);
|
bool QueryBotGroupExistence(const std::string& botgroup_name);
|
||||||
|
|
||||||
@@ -250,6 +252,7 @@ public:
|
|||||||
static const char* SaveFollowDistance();
|
static const char* SaveFollowDistance();
|
||||||
static const char* SaveAllFollowDistances();
|
static const char* SaveAllFollowDistances();
|
||||||
static const char* SaveStopMeleeLevel();
|
static const char* SaveStopMeleeLevel();
|
||||||
|
static const char* SaveBotCasterRange();
|
||||||
|
|
||||||
/* fail::Bot bot-group functions */
|
/* fail::Bot bot-group functions */
|
||||||
static const char* QueryBotGroupExistence();
|
static const char* QueryBotGroupExistence();
|
||||||
|
|||||||
@@ -34,22 +34,6 @@ struct BotsAvailableList {
|
|||||||
uint32 Owner_ID;
|
uint32 Owner_ID;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BotGroup {
|
|
||||||
uint32 BotGroupID;
|
|
||||||
uint32 BotID;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BotGroupList {
|
|
||||||
std::string BotGroupName;
|
|
||||||
std::string BotGroupLeaderName;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SpawnedBotsList {
|
|
||||||
char BotName[64];
|
|
||||||
char ZoneName[64];
|
|
||||||
uint32 BotLeaderCharID;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BotSpell {
|
struct BotSpell {
|
||||||
uint16 SpellId;
|
uint16 SpellId;
|
||||||
int SpellIndex;
|
int SpellIndex;
|
||||||
@@ -71,12 +55,6 @@ struct BotCastingRoles {
|
|||||||
//bool RaidDoter;
|
//bool RaidDoter;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BotAA {
|
|
||||||
uint32 aa_id;
|
|
||||||
uint8 req_level;
|
|
||||||
uint8 total_levels;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BotSpellSetting {
|
struct BotSpellSetting {
|
||||||
int16 priority;
|
int16 priority;
|
||||||
uint8 min_level;
|
uint8 min_level;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user