Merge of a monster

This commit is contained in:
KimLS
2017-04-02 20:03:51 -07:00
146 changed files with 10532 additions and 7432 deletions
+44 -44
View File
@@ -430,12 +430,12 @@ int command_init(void)
auto iter_cs = command_settings.find(iter_cl->first);
if (iter_cs == command_settings.end()) {
if (iter_cl->second->access == 0)
Log.Out(Logs::General, Logs::Commands, "command_init(): Warning: Command '%s' defaulting to access level 0!", iter_cl->first.c_str());
Log(Logs::General, Logs::Commands, "command_init(): Warning: Command '%s' defaulting to access level 0!", iter_cl->first.c_str());
continue;
}
iter_cl->second->access = iter_cs->second.first;
Log.Out(Logs::General, Logs::Commands, "command_init(): - Command '%s' set to access level %d.", iter_cl->first.c_str(), iter_cs->second.first);
Log(Logs::General, Logs::Commands, "command_init(): - Command '%s' set to access level %d.", iter_cl->first.c_str(), iter_cs->second.first);
if (iter_cs->second.second.empty())
continue;
@@ -444,14 +444,14 @@ int command_init(void)
if (iter_aka->empty())
continue;
if (commandlist.find(*iter_aka) != commandlist.end()) {
Log.Out(Logs::General, Logs::Commands, "command_init(): Warning: Alias '%s' already exists as a command - skipping!", iter_aka->c_str());
Log(Logs::General, Logs::Commands, "command_init(): Warning: Alias '%s' already exists as a command - skipping!", iter_aka->c_str());
continue;
}
commandlist[*iter_aka] = iter_cl->second;
commandaliases[*iter_aka] = iter_cl->first;
Log.Out(Logs::General, Logs::Commands, "command_init(): - Alias '%s' added to command '%s'.", iter_aka->c_str(), commandaliases[*iter_aka].c_str());
Log(Logs::General, Logs::Commands, "command_init(): - Alias '%s' added to command '%s'.", iter_aka->c_str(), commandaliases[*iter_aka].c_str());
}
}
@@ -491,21 +491,21 @@ void command_deinit(void)
int command_add(std::string command_name, const char *desc, int access, CmdFuncPtr function)
{
if (command_name.empty()) {
Log.Out(Logs::General, Logs::Error, "command_add() - Command added with empty name string - check command.cpp.");
Log(Logs::General, Logs::Error, "command_add() - Command added with empty name string - check command.cpp.");
return -1;
}
if (function == nullptr) {
Log.Out(Logs::General, Logs::Error, "command_add() - Command '%s' added without a valid function pointer - check command.cpp.", command_name.c_str());
Log(Logs::General, Logs::Error, "command_add() - Command '%s' added without a valid function pointer - check command.cpp.", command_name.c_str());
return -1;
}
if (commandlist.count(command_name) != 0) {
Log.Out(Logs::General, Logs::Error, "command_add() - Command '%s' is a duplicate command name - check command.cpp.", command_name.c_str());
Log(Logs::General, Logs::Error, "command_add() - Command '%s' is a duplicate command name - check command.cpp.", command_name.c_str());
return -1;
}
for (auto iter = commandlist.begin(); iter != commandlist.end(); ++iter) {
if (iter->second->function != function)
continue;
Log.Out(Logs::General, Logs::Error, "command_add() - Command '%s' equates to an alias of '%s' - check command.cpp.", command_name.c_str(), iter->first.c_str());
Log(Logs::General, Logs::Error, "command_add() - Command '%s' equates to an alias of '%s' - check command.cpp.", command_name.c_str(), iter->first.c_str());
return -1;
}
@@ -559,11 +559,11 @@ int command_realdispatch(Client *c, const char *message)
}
if(cur->access >= COMMANDS_LOGGING_MIN_STATUS) {
Log.Out(Logs::General, Logs::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE");
Log(Logs::General, Logs::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE");
}
if(cur->function == nullptr) {
Log.Out(Logs::General, Logs::Error, "Command '%s' has a null function\n", cstr.c_str());
Log(Logs::General, Logs::Error, "Command '%s' has a null function\n", cstr.c_str());
return(-1);
} else {
//dispatch C++ command
@@ -1262,7 +1262,7 @@ void command_viewpetition(Client *c, const Seperator *sep)
if (!results.Success())
return;
Log.Out(Logs::General, Logs::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) );
Log(Logs::General, Logs::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) );
if (results.RowCount() == 0) {
c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again.");
@@ -1287,7 +1287,7 @@ void command_petitioninfo(Client *c, const Seperator *sep)
if (!results.Success())
return;
Log.Out(Logs::General, Logs::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) );
Log(Logs::General, Logs::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) );
if (results.RowCount() == 0) {
c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again.");
@@ -1313,7 +1313,7 @@ void command_delpetition(Client *c, const Seperator *sep)
if (!results.Success())
return;
Log.Out(Logs::General, Logs::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) );
Log(Logs::General, Logs::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) );
}
@@ -1549,7 +1549,7 @@ void command_permaclass(Client *c, const Seperator *sep)
c->Message(0,"Target is not a client.");
else {
c->Message(0, "Setting %s's class...Sending to char select.", t->GetName());
Log.Out(Logs::General, Logs::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
Log(Logs::General, Logs::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
t->SetBaseClass(atoi(sep->arg[1]));
t->Save();
t->Kick();
@@ -1571,7 +1571,7 @@ void command_permarace(Client *c, const Seperator *sep)
c->Message(0,"Target is not a client.");
else {
c->Message(0, "Setting %s's race - zone to take effect", t->GetName());
Log.Out(Logs::General, Logs::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
Log(Logs::General, Logs::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
uint32 tmp = Mob::GetDefaultGender(atoi(sep->arg[1]), t->GetBaseGender());
t->SetBaseRace(atoi(sep->arg[1]));
t->SetBaseGender(tmp);
@@ -1595,7 +1595,7 @@ void command_permagender(Client *c, const Seperator *sep)
c->Message(0,"Target is not a client.");
else {
c->Message(0, "Setting %s's gender - zone to take effect", t->GetName());
Log.Out(Logs::General, Logs::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
Log(Logs::General, Logs::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
t->SetBaseGender(atoi(sep->arg[1]));
t->Save();
t->SendIllusionPacket(atoi(sep->arg[1]));
@@ -1932,7 +1932,7 @@ void command_dbspawn2(Client *c, const Seperator *sep)
{
if (sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)) {
Log.Out(Logs::General, Logs::Normal, "Spawning database spawn");
Log(Logs::General, Logs::Normal, "Spawning database spawn");
uint16 cond = 0;
int16 cond_min = 0;
if(sep->IsNumber(4)) {
@@ -2255,7 +2255,7 @@ void command_setlanguage(Client *c, const Seperator *sep)
}
else
{
Log.Out(Logs::General, Logs::Normal, "Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) );
Log(Logs::General, Logs::Normal, "Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) );
uint8 langid = (uint8)atoi(sep->arg[1]);
uint8 value = (uint8)atoi(sep->arg[2]);
c->GetTarget()->CastToClient()->SetLanguageSkill( langid, value );
@@ -2280,7 +2280,7 @@ void command_setskill(Client *c, const Seperator *sep)
c->Message(0, " x = 0 to %d", HIGHEST_CAN_SET_SKILL);
}
else {
Log.Out(Logs::General, Logs::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) );
Log(Logs::General, Logs::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) );
int skill_num = atoi(sep->arg[1]);
uint16 skill_value = atoi(sep->arg[2]);
if (skill_num <= EQEmu::skills::HIGHEST_SKILL)
@@ -2300,7 +2300,7 @@ void command_setskillall(Client *c, const Seperator *sep)
}
else {
if (c->Admin() >= commandSetSkillsOther || c->GetTarget()==c || c->GetTarget()==0) {
Log.Out(Logs::General, Logs::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName());
Log(Logs::General, Logs::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName());
uint16 level = atoi(sep->arg[1]);
for (EQEmu::skills::SkillType skill_num = EQEmu::skills::Skill1HBlunt; skill_num <= EQEmu::skills::HIGHEST_SKILL; skill_num = (EQEmu::skills::SkillType)(skill_num + 1)) {
c->GetTarget()->CastToClient()->SetSkill(skill_num, level);
@@ -3123,7 +3123,7 @@ void command_listpetition(Client *c, const Seperator *sep)
if (!results.Success())
return;
Log.Out(Logs::General, Logs::Normal, "Petition list requested by %s", c->GetName());
Log(Logs::General, Logs::Normal, "Petition list requested by %s", c->GetName());
if (results.RowCount() == 0)
return;
@@ -3781,7 +3781,7 @@ void command_lastname(Client *c, const Seperator *sep)
if(c->GetTarget() && c->GetTarget()->IsClient())
t=c->GetTarget()->CastToClient();
Log.Out(Logs::General, Logs::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName());
Log(Logs::General, Logs::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName());
if(strlen(sep->arg[1]) <= 70)
t->ChangeLastName(sep->arg[1]);
@@ -4338,7 +4338,7 @@ void command_iteminfo(Client *c, const Seperator *sep)
}
auto item = inst->GetItem();
if (!item) {
Log.Out(Logs::General, Logs::Inventory, "(%s) Command #iteminfo processed an item with no data pointer");
Log(Logs::General, Logs::Inventory, "(%s) Command #iteminfo processed an item with no data pointer");
c->Message(13, "Error: This item has no data reference");
return;
}
@@ -4445,7 +4445,7 @@ void command_time(Client *c, const Seperator *sep)
}
c->Message(13, "Setting world time to %s:%i (Timezone: 0)...", sep->arg[1], minutes);
zone->SetTime(atoi(sep->arg[1])+1, minutes);
Log.Out(Logs::General, Logs::Zone_Server, "%s :: Setting world time to %s:%i (Timezone: 0)...", c->GetCleanName(), sep->arg[1], minutes);
Log(Logs::General, Logs::Zone_Server, "%s :: Setting world time to %s:%i (Timezone: 0)...", c->GetCleanName(), sep->arg[1], minutes);
}
else {
c->Message(13, "To set the Time: #time HH [MM]");
@@ -4460,7 +4460,7 @@ void command_time(Client *c, const Seperator *sep)
zone->zone_time.getEQTimeZoneMin()
);
c->Message(13, "It is now %s.", timeMessage);
Log.Out(Logs::General, Logs::Zone_Server, "Current Time is: %s", timeMessage);
Log(Logs::General, Logs::Zone_Server, "Current Time is: %s", timeMessage);
}
}
@@ -4594,10 +4594,10 @@ void command_guild(Client *c, const Seperator *sep)
}
if(guild_id == GUILD_NONE) {
Log.Out(Logs::Detail, Logs::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(),
Log(Logs::Detail, Logs::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(),
sep->arg[2], charid);
} else {
Log.Out(Logs::Detail, Logs::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(),
Log(Logs::Detail, Logs::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(),
sep->arg[2], charid,
guild_mgr.GetGuildName(guild_id), guild_id);
}
@@ -4646,7 +4646,7 @@ void command_guild(Client *c, const Seperator *sep)
return;
}
Log.Out(Logs::Detail, Logs::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(),
Log(Logs::Detail, Logs::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(),
sep->arg[2], charid, rank);
if(!guild_mgr.SetGuildRank(charid, rank))
@@ -4688,7 +4688,7 @@ void command_guild(Client *c, const Seperator *sep)
uint32 id = guild_mgr.CreateGuild(sep->argplus[3], leader);
Log.Out(Logs::Detail, Logs::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(),
Log(Logs::Detail, Logs::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(),
sep->argplus[3], leader, (unsigned long)id);
if (id == GUILD_NONE)
@@ -4727,7 +4727,7 @@ void command_guild(Client *c, const Seperator *sep)
}
}
Log.Out(Logs::Detail, Logs::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(),
Log(Logs::Detail, Logs::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(),
guild_mgr.GetGuildName(id), id);
if (!guild_mgr.DeleteGuild(id))
@@ -4761,7 +4761,7 @@ void command_guild(Client *c, const Seperator *sep)
}
}
Log.Out(Logs::Detail, Logs::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(),
Log(Logs::Detail, Logs::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(),
guild_mgr.GetGuildName(id), id, sep->argplus[3]);
if (!guild_mgr.RenameGuild(id, sep->argplus[3]))
@@ -4812,7 +4812,7 @@ void command_guild(Client *c, const Seperator *sep)
}
}
Log.Out(Logs::Detail, Logs::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(),
Log(Logs::Detail, Logs::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(),
guild_mgr.GetGuildName(id), id, leader);
if(!guild_mgr.SetGuildLeader(id, leader))
@@ -5272,7 +5272,7 @@ void command_scribespells(Client *c, const Seperator *sep)
t->Message(0, "Scribing spells to spellbook.");
if(t != c)
c->Message(0, "Scribing spells for %s.", t->GetName());
Log.Out(Logs::General, Logs::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level);
Log(Logs::General, Logs::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level);
for(curspell = 0, book_slot = t->GetNextAvailableSpellBookSlot(), count = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++, book_slot = t->GetNextAvailableSpellBookSlot(book_slot))
{
@@ -5329,7 +5329,7 @@ void command_scribespell(Client *c, const Seperator *sep) {
if(t != c)
c->Message(0, "Scribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName());
Log.Out(Logs::General, Logs::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName());
Log(Logs::General, Logs::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName());
if (spells[spell_id].classes[WARRIOR] != 0 && spells[spell_id].skill != 52 && spells[spell_id].classes[t->GetPP().class_ - 1] > 0 && !IsDiscipline(spell_id)) {
book_slot = t->GetNextAvailableSpellBookSlot();
@@ -5376,7 +5376,7 @@ void command_unscribespell(Client *c, const Seperator *sep) {
if(t != c)
c->Message(0, "Unscribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName());
Log.Out(Logs::General, Logs::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName());
Log(Logs::General, Logs::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName());
}
else {
t->Message(13, "Unable to unscribe spell: %s (%i) from your spellbook. This spell is not scribed.", spells[spell_id].name, spell_id);
@@ -7816,7 +7816,7 @@ void command_traindisc(Client *c, const Seperator *sep)
t->Message(0, "Training disciplines");
if(t != c)
c->Message(0, "Training disciplines for %s.", t->GetName());
Log.Out(Logs::General, Logs::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level);
Log(Logs::General, Logs::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level);
for(curspell = 0, count = 0; curspell < SPDAT_RECORDS; curspell++)
{
@@ -10613,7 +10613,7 @@ void command_logtest(Client *c, const Seperator *sep){
uint32 i = 0;
t = std::clock();
for (i = 0; i < atoi(sep->arg[1]); i++){
Log.Out(Logs::General, Logs::Debug, "[%u] Test #2... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
Log(Logs::General, Logs::Debug, "[%u] Test #2... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
}
}
@@ -10645,22 +10645,22 @@ void command_logs(Client *c, const Seperator *sep){
c->Message(0, "[Category ID | console | file | gmsay | Category Description]");
redisplay_columns = 0;
}
c->Message(0, StringFormat("--- %i | %u | %u | %u | %s", i, Log.log_settings[i].log_to_console, Log.log_settings[i].log_to_file, Log.log_settings[i].log_to_gmsay, Logs::LogCategoryName[i]).c_str());
c->Message(0, StringFormat("--- %i | %u | %u | %u | %s", i, LogSys.log_settings[i].log_to_console, LogSys.log_settings[i].log_to_file, LogSys.log_settings[i].log_to_gmsay, Logs::LogCategoryName[i]).c_str());
redisplay_columns++;
}
}
/* #logs set */
if (strcasecmp(sep->arg[1], "set") == 0){
if (strcasecmp(sep->arg[2], "console") == 0){
Log.log_settings[atoi(sep->arg[3])].log_to_console = atoi(sep->arg[4]);
LogSys.log_settings[atoi(sep->arg[3])].log_to_console = atoi(sep->arg[4]);
logs_set = 1;
}
else if (strcasecmp(sep->arg[2], "file") == 0){
Log.log_settings[atoi(sep->arg[3])].log_to_file = atoi(sep->arg[4]);
LogSys.log_settings[atoi(sep->arg[3])].log_to_file = atoi(sep->arg[4]);
logs_set = 1;
}
else if (strcasecmp(sep->arg[2], "gmsay") == 0){
Log.log_settings[atoi(sep->arg[3])].log_to_gmsay = atoi(sep->arg[4]);
LogSys.log_settings[atoi(sep->arg[3])].log_to_gmsay = atoi(sep->arg[4]);
logs_set = 1;
}
else{
@@ -10675,10 +10675,10 @@ void command_logs(Client *c, const Seperator *sep){
This is used in hot places of code to check if its enabled in any way before triggering logs
*/
if (atoi(sep->arg[4]) > 0){
Log.log_settings[atoi(sep->arg[3])].is_category_enabled = 1;
LogSys.log_settings[atoi(sep->arg[3])].is_category_enabled = 1;
}
else{
Log.log_settings[atoi(sep->arg[3])].is_category_enabled = 0;
LogSys.log_settings[atoi(sep->arg[3])].is_category_enabled = 0;
}
}
}
@@ -10701,7 +10701,7 @@ void command_mysqltest(Client *c, const Seperator *sep)
auto results = database.QueryDatabase(query);
}
}
Log.Out(Logs::General, Logs::Debug, "MySQL Test... Took %f seconds", ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
Log(Logs::General, Logs::Debug, "MySQL Test... Took %f seconds", ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
}
void command_resetaa_timer(Client *c, const Seperator *sep) {