mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 02:11:30 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
2865278987
@ -1,5 +1,32 @@
|
||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||
-------------------------------------------------------
|
||||
== 12/14/2015 ==
|
||||
Kinglykrab: Added IsBlind() and IsFeared() functionality to Perl and Lua.
|
||||
- Note: Both methods are Mob methods and may be used on NPCs or PCs.
|
||||
Natedog: Added Discipline functions, UpdateInstanceTimer function, and UnmemSpellBySpellID to lua and perl
|
||||
-Examples: http://wiki.eqemulator.org/i?M=Pastebin&Paste=BJ0ygmNM
|
||||
|
||||
== 12/07/2015 ==
|
||||
Uleat: Command aliases are no longer handled through the command_add() function.
|
||||
- To add a command alias, edit the database table `command_settings` - here, you will find three columns: `command`, `access` and `aliases`
|
||||
- Adding command aliases require that the command contain an entry in `command_settings`.`command`
|
||||
- Only 'real' commands go inside of the command_init() function in command.cpp .. if you wish to add aliases, you must enter them into the database
|
||||
- 'Real' commands are loaded first .. then any access/alias data is loaded and applied afterwards
|
||||
- Duplicate aliases will be ignored .. only the first encountered occurrence will be honored - if it does not conflict with an existing command name
|
||||
- Aliases should not contain whitespace and should be '|' (pipe) delimited
|
||||
- The restriction on the number of aliases has been removed .. though each alias will still be limited to the access level of the parent command
|
||||
- If you need need more name space for aliases, simply edit the `command_settings` table and increase the size of the `aliases` column
|
||||
- The old `commands` table has been renamed to `commands_old` for reference
|
||||
- All of the current 'standard' commands have been added to the new `command_settings` table
|
||||
|
||||
- YOU WILL NEED TO VERIFY/IMPORT OLD ACCESS VALUES AS THIS CHANGE REVERTS ALL COMMAND ACCESS VALUES TO THEIR PEQDB DEFAULTS
|
||||
|
||||
== 11/30/2015 ==
|
||||
Uleat: Changed criteria for a few bots scripts from count to null/not null in hopes of fixing special case failures
|
||||
|
||||
== 11/22/2015 ==
|
||||
Uleat: Fix for loginserver project compile failure
|
||||
|
||||
== 11/7/2015 ==
|
||||
Akkadius: Implemented #repopclose [distance in units] - Used for development purposes, defaults to 500 units
|
||||
- Real case use: Large zones with 700 NPC's and you are making fast quick tweaks to nearby NPC's you can refresh just the NPC's around you instead of all in the zone
|
||||
|
||||
@ -493,7 +493,7 @@ bool Database::CheckDatabaseConversions() {
|
||||
/* Check for a new version of this script, the arg passed
|
||||
would have to be higher than the copy they have downloaded
|
||||
locally and they will re fetch */
|
||||
system("perl eqemu_update.pl V 11");
|
||||
system("perl eqemu_update.pl V 13");
|
||||
|
||||
/* Run Automatic Database Upgrade Script */
|
||||
system("perl eqemu_update.pl ran_from_world");
|
||||
|
||||
@ -102,6 +102,7 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
log_settings[Logs::UCS_Server].log_to_console = Logs::General;
|
||||
log_settings[Logs::Crash].log_to_console = Logs::General;
|
||||
log_settings[Logs::MySQLError].log_to_console = Logs::General;
|
||||
log_settings[Logs::Login_Server].log_to_console = Logs::General;
|
||||
|
||||
/* Declare process file names for log writing
|
||||
If there is no process_file_name declared, no log file will be written, simply
|
||||
|
||||
@ -82,6 +82,7 @@ namespace Logs {
|
||||
Client_Server_Packet_Unhandled,
|
||||
Server_Client_Packet_With_Dump,
|
||||
Client_Server_Packet_With_Dump,
|
||||
Login_Server,
|
||||
MaxCategoryID /* Don't Remove this*/
|
||||
};
|
||||
|
||||
@ -130,6 +131,7 @@ namespace Logs {
|
||||
"Packet :: Client -> Server Unhandled",
|
||||
"Packet :: Server -> Client (Dump)",
|
||||
"Packet :: Client -> Server (Dump)",
|
||||
"Login Server"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -969,7 +969,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) {
|
||||
//load up the rank info for each guild.
|
||||
std::string query;
|
||||
#ifdef BOTS
|
||||
query = StringFormat(GuildMemberBaseQuery " WHERE c.id=%d AND c.mobtype = 'C'", char_id);
|
||||
query = StringFormat(GuildMemberBaseQuery " WHERE c.id=%d AND c.mob_type = 'C'", char_id);
|
||||
#else
|
||||
query = StringFormat(GuildMemberBaseQuery " WHERE c.id=%d", char_id);
|
||||
#endif
|
||||
|
||||
@ -17,43 +17,14 @@
|
||||
*/
|
||||
|
||||
#include "rulesys.h"
|
||||
|
||||
#include "database.h"
|
||||
#include "string_util.h"
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
/*
|
||||
|
||||
FatherNitwit: Added new rules subsystem to allow game rules to be changed
|
||||
at runtime. more about this will come as time goes on.
|
||||
FatherNitwit: Added #rules command to manage rules data from in game.
|
||||
FatherNitwit: Renamed old #rules to #serverrules
|
||||
FatherNitwit: Moved max level into the rules system (Character:MaxLevel)
|
||||
Requred SQL:
|
||||
|
||||
|
||||
|
||||
CREATE TABLE rule_sets (
|
||||
ruleset_id TINYINT UNSIGNED NOT NULL auto_increment,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
PRIMARY KEY(ruleset_id)
|
||||
);
|
||||
INSERT INTO rule_sets VALUES(0, "default");
|
||||
UPDATE rule_sets SET ruleset_id=0;
|
||||
|
||||
CREATE TABLE rule_values (
|
||||
ruleset_id TINYINT UNSIGNED NOT NULL,
|
||||
rule_name VARCHAR(64) NOT NULL,
|
||||
rule_value VARCHAR(10) NOT NULL,
|
||||
INDEX(ruleset_id),
|
||||
PRIMARY KEY(ruleset_id,rule_name)
|
||||
);
|
||||
|
||||
|
||||
|
||||
Commands:
|
||||
#rules:
|
||||
Commands:
|
||||
#rules:
|
||||
current -> lists current set name
|
||||
switch (set name) -> change set in the DB, but dont reload
|
||||
load (set name) -> load set into this zone without changing the world
|
||||
@ -94,28 +65,28 @@ RuleManager::RuleManager()
|
||||
}
|
||||
|
||||
RuleManager::CategoryType RuleManager::FindCategory(const char *catname) {
|
||||
int r;
|
||||
for(r = 0; r < _CatCount; r++) {
|
||||
if(strcasecmp(catname, s_categoryNames[r]) == 0)
|
||||
return((CategoryType) r);
|
||||
int i;
|
||||
for (i = 0; i < _CatCount; i++) {
|
||||
if (strcasecmp(catname, s_categoryNames[i]) == 0)
|
||||
return((CategoryType)i);
|
||||
}
|
||||
return(InvalidCategory);
|
||||
}
|
||||
|
||||
bool RuleManager::ListRules(const char *catname, std::vector<const char *> &into) {
|
||||
CategoryType cat = InvalidCategory;
|
||||
if(catname != nullptr) {
|
||||
if (catname != nullptr) {
|
||||
cat = FindCategory(catname);
|
||||
if(cat == InvalidCategory) {
|
||||
if (cat == InvalidCategory) {
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Unable to find category '%s'", catname);
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
int r;
|
||||
int rcount = CountRules();
|
||||
for(r = 0; r < rcount; r++) {
|
||||
const RuleInfo &rule = s_RuleInfo[r];
|
||||
if(catname == nullptr || cat == rule.category) {
|
||||
int i;
|
||||
int rule_count = CountRules();
|
||||
for (i = 0; i < rule_count; i++) {
|
||||
const RuleInfo &rule = s_RuleInfo[i];
|
||||
if (catname == nullptr || cat == rule.category) {
|
||||
into.push_back(rule.name);
|
||||
}
|
||||
}
|
||||
@ -123,15 +94,14 @@ bool RuleManager::ListRules(const char *catname, std::vector<const char *> &into
|
||||
}
|
||||
|
||||
bool RuleManager::ListCategories(std::vector<const char *> &into) {
|
||||
int r;
|
||||
for(r = 0; r < _CatCount; r++) {
|
||||
into.push_back(s_categoryNames[r]);
|
||||
int i;
|
||||
for (i = 0; i < _CatCount; i++) {
|
||||
into.push_back(s_categoryNames[i]);
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
bool RuleManager::GetRule(const char *rule_name, std::string &ret_val) {
|
||||
bool RuleManager::GetRule(const char *rule_name, std::string &return_value) {
|
||||
RuleType type;
|
||||
uint16 index;
|
||||
if (!_FindRule(rule_name, type, index))
|
||||
@ -151,12 +121,12 @@ bool RuleManager::GetRule(const char *rule_name, std::string &ret_val) {
|
||||
break;
|
||||
}
|
||||
|
||||
ret_val = tmp;
|
||||
return_value = tmp;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Database *db, bool db_save) {
|
||||
bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Database *database, bool db_save) {
|
||||
if(rule_name == nullptr || rule_value == nullptr)
|
||||
return(false);
|
||||
|
||||
@ -166,25 +136,26 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas
|
||||
return(false);
|
||||
|
||||
switch(type) {
|
||||
case IntRule:
|
||||
m_RuleIntValues [index] = atoi(rule_value);
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]);
|
||||
break;
|
||||
case RealRule:
|
||||
m_RuleRealValues[index] = atof(rule_value);
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]);
|
||||
break;
|
||||
case BoolRule:
|
||||
uint32 val = 0;
|
||||
if(!strcasecmp(rule_value, "on") || !strcasecmp(rule_value, "true") || !strcasecmp(rule_value, "yes") || !strcasecmp(rule_value, "enabled") || !strcmp(rule_value, "1"))
|
||||
val = 1;
|
||||
m_RuleBoolValues[index] = val;
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false");
|
||||
break;
|
||||
case IntRule:
|
||||
m_RuleIntValues[index] = atoi(rule_value);
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]);
|
||||
break;
|
||||
case RealRule:
|
||||
m_RuleRealValues[index] = atof(rule_value);
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]);
|
||||
break;
|
||||
case BoolRule:
|
||||
uint32 val = 0;
|
||||
if (!strcasecmp(rule_value, "on") || !strcasecmp(rule_value, "true") || !strcasecmp(rule_value, "yes") || !strcasecmp(rule_value, "enabled") || !strcmp(rule_value, "1"))
|
||||
val = 1;
|
||||
|
||||
m_RuleBoolValues[index] = val;
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ? "true" : "false");
|
||||
break;
|
||||
}
|
||||
|
||||
if(db_save)
|
||||
_SaveRule(db, type, index);
|
||||
_SaveRule(database, type, index);
|
||||
|
||||
return(true);
|
||||
}
|
||||
@ -201,14 +172,14 @@ void RuleManager::ResetRules() {
|
||||
}
|
||||
|
||||
bool RuleManager::_FindRule(const char *rule_name, RuleType &type_into, uint16 &index_into) {
|
||||
if(rule_name == nullptr)
|
||||
if (rule_name == nullptr)
|
||||
return(false);
|
||||
|
||||
int r;
|
||||
int rcount = CountRules();
|
||||
for(r = 0; r < rcount; r++) {
|
||||
const RuleInfo &rule = s_RuleInfo[r];
|
||||
if(strcmp(rule_name, rule.name) == 0) {
|
||||
int i;
|
||||
int rule_count = CountRules();
|
||||
for (i = 0; i < rule_count; i++) {
|
||||
const RuleInfo &rule = s_RuleInfo[i];
|
||||
if (strcmp(rule_name, rule.name) == 0) {
|
||||
type_into = rule.type;
|
||||
index_into = rule.rule_index;
|
||||
return(true);
|
||||
@ -220,191 +191,177 @@ bool RuleManager::_FindRule(const char *rule_name, RuleType &type_into, uint16 &
|
||||
|
||||
//assumes index is valid!
|
||||
const char *RuleManager::_GetRuleName(RuleType type, uint16 index) {
|
||||
switch(type) {
|
||||
case IntRule:
|
||||
return(s_RuleInfo[index].name);
|
||||
case RealRule:
|
||||
return(s_RuleInfo[index+_IntRuleCount].name);
|
||||
case BoolRule:
|
||||
return(s_RuleInfo[index+_IntRuleCount+_RealRuleCount].name);
|
||||
switch (type) {
|
||||
case IntRule:
|
||||
return(s_RuleInfo[index].name);
|
||||
case RealRule:
|
||||
return(s_RuleInfo[index + _IntRuleCount].name);
|
||||
case BoolRule:
|
||||
return(s_RuleInfo[index + _IntRuleCount + _RealRuleCount].name);
|
||||
}
|
||||
//should never happen
|
||||
return("InvalidRule??");
|
||||
}
|
||||
|
||||
void RuleManager::SaveRules(Database *db, const char *ruleset) {
|
||||
void RuleManager::SaveRules(Database *database, const char *ruleset_name) {
|
||||
|
||||
if(ruleset != nullptr) {
|
||||
if (ruleset_name != nullptr) {
|
||||
//saving to a specific name
|
||||
if(m_activeName != ruleset) {
|
||||
if (m_activeName != ruleset_name) {
|
||||
//a new name...
|
||||
|
||||
m_activeRuleset = _FindOrCreateRuleset(db, ruleset);
|
||||
if(m_activeRuleset == -1) {
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Unable to find or create rule set %s", ruleset);
|
||||
m_activeRuleset = _FindOrCreateRuleset(database, ruleset_name);
|
||||
if (m_activeRuleset == -1) {
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Unable to find or create rule set %s", ruleset_name);
|
||||
return;
|
||||
}
|
||||
m_activeName = ruleset;
|
||||
m_activeName = ruleset_name;
|
||||
}
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset);
|
||||
} else {
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Saving running rules into rule set %s (%d)", ruleset_name, m_activeRuleset);
|
||||
}
|
||||
else {
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset);
|
||||
}
|
||||
|
||||
int r;
|
||||
for(r = 0; r < _IntRuleCount; r++) {
|
||||
_SaveRule(db, IntRule, r);
|
||||
int i;
|
||||
for (i = 0; i < _IntRuleCount; i++) {
|
||||
_SaveRule(database, IntRule, i);
|
||||
}
|
||||
for(r = 0; r < _RealRuleCount; r++) {
|
||||
_SaveRule(db, RealRule, r);
|
||||
for (i = 0; i < _RealRuleCount; i++) {
|
||||
_SaveRule(database, RealRule, i);
|
||||
}
|
||||
for(r = 0; r < _BoolRuleCount; r++) {
|
||||
_SaveRule(db, BoolRule, r);
|
||||
for (i = 0; i < _BoolRuleCount; i++) {
|
||||
_SaveRule(database, BoolRule, i);
|
||||
}
|
||||
}
|
||||
|
||||
bool RuleManager::LoadRules(Database *database, const char *ruleset_name) {
|
||||
|
||||
|
||||
bool RuleManager::LoadRules(Database *db, const char *ruleset) {
|
||||
|
||||
int rsid = GetRulesetID(db, ruleset);
|
||||
if(rsid < 0) {
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset);
|
||||
int ruleset_id = GetRulesetID(database, ruleset_name);
|
||||
if (ruleset_id < 0) {
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset_name);
|
||||
return(false);
|
||||
}
|
||||
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Loading rule set '%s' (%d)", ruleset, rsid);
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Loading rule set '%s' (%d)", ruleset_name, ruleset_id);
|
||||
|
||||
m_activeRuleset = rsid;
|
||||
m_activeName = ruleset;
|
||||
m_activeRuleset = ruleset_id;
|
||||
m_activeName = ruleset_name;
|
||||
|
||||
std::string query = StringFormat("SELECT rule_name, rule_value FROM rule_values WHERE ruleset_id=%d", rsid);
|
||||
auto results = db->QueryDatabase(query);
|
||||
std::string query = StringFormat("SELECT rule_name, rule_value FROM rule_values WHERE ruleset_id=%d", ruleset_id);
|
||||
auto results = database->QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for(auto row = results.begin(); row != results.end(); ++row)
|
||||
if(!SetRule(row[0], row[1], nullptr, false))
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Unable to interpret rule record for %s", row[0]);
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
if (!SetRule(row[0], row[1], nullptr, false))
|
||||
Log.Out(Logs::Detail, Logs::Rules, "Unable to interpret rule record for %s", row[0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) {
|
||||
char vstr[100];
|
||||
void RuleManager::_SaveRule(Database *database, RuleType type, uint16 index) {
|
||||
char value_string[100];
|
||||
|
||||
switch(type) {
|
||||
case IntRule:
|
||||
sprintf(vstr, "%d", m_RuleIntValues[index]);
|
||||
break;
|
||||
case RealRule:
|
||||
sprintf(vstr, "%.13f", m_RuleRealValues[index]);
|
||||
break;
|
||||
case BoolRule:
|
||||
sprintf(vstr, "%s", m_RuleBoolValues[index]?"true":"false");
|
||||
break;
|
||||
case IntRule:
|
||||
sprintf(value_string, "%d", m_RuleIntValues[index]);
|
||||
break;
|
||||
case RealRule:
|
||||
sprintf(value_string, "%.13f", m_RuleRealValues[index]);
|
||||
break;
|
||||
case BoolRule:
|
||||
sprintf(value_string, "%s", m_RuleBoolValues[index]?"true":"false");
|
||||
break;
|
||||
}
|
||||
|
||||
std::string query = StringFormat("REPLACE INTO rule_values "
|
||||
"(ruleset_id, rule_name, rule_value) "
|
||||
" VALUES(%d, '%s', '%s')",
|
||||
m_activeRuleset, _GetRuleName(type, index), vstr);
|
||||
auto results = db->QueryDatabase(query);
|
||||
m_activeRuleset, _GetRuleName(type, index), value_string);
|
||||
auto results = database->QueryDatabase(query);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int RuleManager::GetRulesetID(Database *db, const char *rulesetname) {
|
||||
int RuleManager::GetRulesetID(Database *database, const char *ruleset_name) {
|
||||
|
||||
uint32 len = strlen(rulesetname);
|
||||
char* rst = new char[2*len+1];
|
||||
db->DoEscapeString(rst, rulesetname, len);
|
||||
uint32 len = strlen(ruleset_name);
|
||||
char* rst = new char[2 * len + 1];
|
||||
database->DoEscapeString(rst, ruleset_name, len);
|
||||
|
||||
std::string query = StringFormat("SELECT ruleset_id FROM rule_sets WHERE name='%s'", rst);
|
||||
safe_delete_array(rst);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return -1;
|
||||
}
|
||||
std::string query = StringFormat("SELECT ruleset_id FROM rule_sets WHERE name='%s'", rst);
|
||||
safe_delete_array(rst);
|
||||
auto results = database->QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return -1;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return -1;
|
||||
if (results.RowCount() == 0)
|
||||
return -1;
|
||||
|
||||
auto row = results.begin();
|
||||
auto row = results.begin();
|
||||
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
int RuleManager::_FindOrCreateRuleset(Database *db, const char *ruleset) {
|
||||
int RuleManager::_FindOrCreateRuleset(Database *database, const char *in_ruleset_name) {
|
||||
|
||||
int res = GetRulesetID(db, ruleset);
|
||||
if(res >= 0)
|
||||
return res; //found and existing one...
|
||||
int ruleset_id = GetRulesetID(database, in_ruleset_name);
|
||||
if (ruleset_id >= 0)
|
||||
return ruleset_id; //found and existing one...
|
||||
|
||||
uint32 len = strlen(ruleset);
|
||||
char* rst = new char[2*len+1];
|
||||
db->DoEscapeString(rst, ruleset, len);
|
||||
uint32 len = strlen(in_ruleset_name);
|
||||
char* ruleset_name = new char[2 * len + 1];
|
||||
database->DoEscapeString(ruleset_name, in_ruleset_name, len);
|
||||
|
||||
std::string query = StringFormat("INSERT INTO rule_sets (ruleset_id, name) VALUES(0, '%s')", rst);
|
||||
safe_delete_array(rst);
|
||||
auto results = db->QueryDatabase(query);
|
||||
std::string query = StringFormat("INSERT INTO rule_sets (ruleset_id, name) VALUES(0, '%s')", ruleset_name);
|
||||
safe_delete_array(ruleset_name);
|
||||
auto results = database->QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return results.LastInsertedID();
|
||||
return results.LastInsertedID();
|
||||
}
|
||||
|
||||
std::string RuleManager::GetRulesetName(Database *db, int id) {
|
||||
|
||||
std::string query = StringFormat("SELECT name FROM rule_sets WHERE ruleset_id=%d", id);
|
||||
auto results = db->QueryDatabase(query);
|
||||
std::string RuleManager::GetRulesetName(Database *database, int ruleset_id) {
|
||||
std::string query = StringFormat("SELECT name FROM rule_sets WHERE ruleset_id=%d", ruleset_id);
|
||||
auto results = database->QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return "";
|
||||
return "";
|
||||
|
||||
auto row = results.begin();
|
||||
auto row = results.begin();
|
||||
|
||||
return row[0];
|
||||
}
|
||||
|
||||
bool RuleManager::ListRulesets(Database *db, std::map<int, std::string> &into) {
|
||||
bool RuleManager::ListRulesets(Database *database, std::map<int, std::string> &into) {
|
||||
|
||||
//start out with the default set which is always present.
|
||||
into[0] = "default";
|
||||
|
||||
std::string query = "SELECT ruleset_id, name FROM rule_sets";
|
||||
auto results = db->QueryDatabase(query);
|
||||
std::string query = "SELECT ruleset_id, name FROM rule_sets";
|
||||
auto results = database->QueryDatabase(query);
|
||||
if (results.Success())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
into[ atoi(row[0]) ] = row[1];
|
||||
into[atoi(row[0])] = row[1];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int32 RuleManager::GetIntRule(RuleManager::IntType t) const
|
||||
{
|
||||
int32 RuleManager::GetIntRule(RuleManager::IntType t) const{
|
||||
return(m_RuleIntValues[t]);
|
||||
}
|
||||
|
||||
float RuleManager::GetRealRule(RuleManager::RealType t) const
|
||||
{
|
||||
float RuleManager::GetRealRule(RuleManager::RealType t) const{
|
||||
return(m_RuleRealValues[t]);
|
||||
}
|
||||
|
||||
bool RuleManager::GetBoolRule(RuleManager::BoolType t) const
|
||||
{
|
||||
bool RuleManager::GetBoolRule(RuleManager::BoolType t) const{
|
||||
return (m_RuleBoolValues[t] == 1);
|
||||
}
|
||||
|
||||
|
||||
@ -125,6 +125,7 @@ RULE_BOOL(Character, ActiveInvSnapshots, false) // Takes a periodic snapshot of
|
||||
RULE_INT(Character, InvSnapshotMinIntervalM, 180) // Minimum time (in minutes) between inventory snapshots
|
||||
RULE_INT(Character, InvSnapshotMinRetryM, 30) // Time (in minutes) to re-attempt an inventory snapshot after a failure
|
||||
RULE_INT(Character, InvSnapshotHistoryD, 30) // Time (in days) to keep snapshot entries
|
||||
RULE_BOOL(Character, RestrictSpellScribing, false) // Restricts spell scribing to allowable races/classes of spell scroll, if true
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Mercs)
|
||||
|
||||
@ -523,7 +523,7 @@ struct ServerLSPlayerZoneChange_Struct {
|
||||
uint32 from; // 0 = world
|
||||
uint32 to; // 0 = world
|
||||
};
|
||||
struct ServerLSClientAuth {
|
||||
struct ClientAuth_Struct {
|
||||
uint32 lsaccount_id; // ID# in login server's db
|
||||
char name[30]; // username in login server's db
|
||||
char key[30]; // the Key the client will present
|
||||
|
||||
@ -1325,19 +1325,28 @@ int32 SharedDatabase::DeleteStalePlayerCorpses() {
|
||||
return results.RowsAffected();
|
||||
}
|
||||
|
||||
bool SharedDatabase::GetCommandSettings(std::map<std::string,uint8> &commands) {
|
||||
bool SharedDatabase::GetCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &command_settings)
|
||||
{
|
||||
command_settings.clear();
|
||||
|
||||
const std::string query = "SELECT command, access FROM commands";
|
||||
std::string query = "SELECT `command`, `access`, `aliases` FROM `command_settings`";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
command_settings[row[0]].first = atoi(row[1]);
|
||||
if (row[2][0] == 0)
|
||||
continue;
|
||||
|
||||
std::vector<std::string> aliases = SplitString(row[2], '|');
|
||||
for (std::vector<std::string>::iterator iter = aliases.begin(); iter != aliases.end(); ++iter) {
|
||||
if (iter->empty())
|
||||
continue;
|
||||
command_settings[row[0]].second.push_back(*iter);
|
||||
}
|
||||
}
|
||||
|
||||
commands.clear();
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
commands[row[0]]=atoi(row[1]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ class SharedDatabase : public Database
|
||||
int32 DeleteStalePlayerCorpses();
|
||||
void LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message);
|
||||
void SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message);
|
||||
bool GetCommandSettings(std::map<std::string, uint8> &commands);
|
||||
bool GetCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &command_settings);
|
||||
uint32 GetTotalTimeEntitledOnAccount(uint32 AccountID);
|
||||
|
||||
/*
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||
*/
|
||||
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9089
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9091
|
||||
#ifdef BOTS
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9000
|
||||
#else
|
||||
|
||||
@ -6,7 +6,6 @@ SET(eqlogin_sources
|
||||
config.cpp
|
||||
database_mysql.cpp
|
||||
database_postgresql.cpp
|
||||
error_log.cpp
|
||||
main.cpp
|
||||
server_manager.cpp
|
||||
world_server.cpp
|
||||
@ -26,7 +25,6 @@ SET(eqlogin_headers
|
||||
database_postgresql.h
|
||||
encryption.h
|
||||
eq_crypto_api.h
|
||||
error_log.h
|
||||
login_server.h
|
||||
login_structures.h
|
||||
options.h
|
||||
@ -43,7 +41,7 @@ ADD_EXECUTABLE(loginserver ${eqlogin_sources} ${eqlogin_headers})
|
||||
|
||||
INSTALL(TARGETS loginserver RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES(loginserver common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE})
|
||||
TARGET_LINK_LIBRARIES(loginserver common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(loginserver PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
|
||||
@ -16,12 +16,12 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "client.h"
|
||||
#include "error_log.h"
|
||||
#include "login_server.h"
|
||||
#include "login_structures.h"
|
||||
#include "../common/misc_functions.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
extern EQEmuLogSys Log;
|
||||
extern LoginServer server;
|
||||
|
||||
Client::Client(std::shared_ptr<EQStream> c, LSClientVersion v)
|
||||
@ -41,7 +41,7 @@ bool Client::Process()
|
||||
{
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network, "Application packet received from client (size %u)", app->Size());
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Application packet received from client (size %u)", app->Size());
|
||||
}
|
||||
|
||||
if(server.options.IsDumpInPacketsOn())
|
||||
@ -55,7 +55,7 @@ bool Client::Process()
|
||||
{
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network, "Session ready received from client.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Session ready received from client.");
|
||||
}
|
||||
Handle_SessionReady((const char*)app->pBuffer, app->Size());
|
||||
break;
|
||||
@ -64,13 +64,13 @@ bool Client::Process()
|
||||
{
|
||||
if(app->Size() < 20)
|
||||
{
|
||||
server_log->Log(log_network_error, "Login received but it is too small, discarding.");
|
||||
Log.Out(Logs::General, Logs::Error, "Login received but it is too small, discarding.");
|
||||
break;
|
||||
}
|
||||
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network, "Login received from client.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Login received from client.");
|
||||
}
|
||||
|
||||
Handle_Login((const char*)app->pBuffer, app->Size());
|
||||
@ -80,7 +80,7 @@ bool Client::Process()
|
||||
{
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network, "Server list request received from client.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Server list request received from client.");
|
||||
}
|
||||
|
||||
SendServerListPacket();
|
||||
@ -90,7 +90,7 @@ bool Client::Process()
|
||||
{
|
||||
if(app->Size() < sizeof(PlayEverquestRequest_Struct))
|
||||
{
|
||||
server_log->Log(log_network_error, "Play received but it is too small, discarding.");
|
||||
Log.Out(Logs::General, Logs::Error, "Play received but it is too small, discarding.");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ bool Client::Process()
|
||||
{
|
||||
char dump[64];
|
||||
app->build_header_dump(dump);
|
||||
server_log->Log(log_network_error, "Recieved unhandled application packet from the client: %s.", dump);
|
||||
Log.Out(Logs::General, Logs::Error, "Recieved unhandled application packet from the client: %s.", dump);
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,20 +116,20 @@ void Client::Handle_SessionReady(const char* data, unsigned int size)
|
||||
{
|
||||
if(status != cs_not_sent_session_ready)
|
||||
{
|
||||
server_log->Log(log_network_error, "Session ready received again after already being received.");
|
||||
Log.Out(Logs::General, Logs::Error, "Session ready received again after already being received.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(size < sizeof(unsigned int))
|
||||
{
|
||||
server_log->Log(log_network_error, "Session ready was too small.");
|
||||
Log.Out(Logs::General, Logs::Error, "Session ready was too small.");
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int mode = *((unsigned int*)data);
|
||||
if(mode == (unsigned int)lm_from_world)
|
||||
{
|
||||
server_log->Log(log_network, "Session ready indicated logged in from world(unsupported feature), disconnecting.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Session ready indicated logged in from world(unsupported feature), disconnecting.");
|
||||
connection->Close();
|
||||
return;
|
||||
}
|
||||
@ -175,138 +175,144 @@ void Client::Handle_SessionReady(const char* data, unsigned int size)
|
||||
|
||||
void Client::Handle_Login(const char* data, unsigned int size)
|
||||
{
|
||||
if(status != cs_waiting_for_login)
|
||||
{
|
||||
server_log->Log(log_network_error, "Login received after already having logged in.");
|
||||
if(status != cs_waiting_for_login) {
|
||||
Log.Out(Logs::General, Logs::Error, "Login received after already having logged in.");
|
||||
return;
|
||||
}
|
||||
|
||||
if((size - 12) % 8 != 0)
|
||||
{
|
||||
server_log->Log(log_network_error, "Login received packet of size: %u, this would cause a block corruption, discarding.", size);
|
||||
if((size - 12) % 8 != 0) {
|
||||
Log.Out(Logs::General, Logs::Error, "Login received packet of size: %u, this would cause a block corruption, discarding.", size);
|
||||
return;
|
||||
}
|
||||
|
||||
status = cs_logged_in;
|
||||
|
||||
string e_user;
|
||||
string e_hash;
|
||||
char *e_buffer = nullptr;
|
||||
unsigned int d_account_id = 0;
|
||||
string d_pass_hash;
|
||||
string entered_username;
|
||||
string entered_password_hash_result;
|
||||
|
||||
char *login_packet_buffer = nullptr;
|
||||
|
||||
unsigned int db_account_id = 0;
|
||||
string db_account_password_hash;
|
||||
|
||||
#ifdef WIN32
|
||||
e_buffer = server.eq_crypto->DecryptUsernamePassword(data, size, server.options.GetEncryptionMode());
|
||||
login_packet_buffer = server.eq_crypto->DecryptUsernamePassword(data, size, server.options.GetEncryptionMode());
|
||||
|
||||
int buffer_len = strlen(e_buffer);
|
||||
e_hash.assign(e_buffer, buffer_len);
|
||||
e_user.assign((e_buffer + buffer_len + 1), strlen(e_buffer + buffer_len + 1));
|
||||
int login_packet_buffer_length = strlen(login_packet_buffer);
|
||||
entered_password_hash_result.assign(login_packet_buffer, login_packet_buffer_length);
|
||||
entered_username.assign((login_packet_buffer + login_packet_buffer_length + 1), strlen(login_packet_buffer + login_packet_buffer_length + 1));
|
||||
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_client, "User: %s", e_user.c_str());
|
||||
server_log->Log(log_client, "Hash: %s", e_hash.c_str());
|
||||
if(server.options.IsTraceOn()) {
|
||||
Log.Out(Logs::General, Logs::Debug, "User: %s", entered_username.c_str());
|
||||
Log.Out(Logs::General, Logs::Debug, "Hash: %s", entered_password_hash_result.c_str());
|
||||
}
|
||||
|
||||
server.eq_crypto->DeleteHeap(e_buffer);
|
||||
server.eq_crypto->DeleteHeap(login_packet_buffer);
|
||||
#else
|
||||
e_buffer = DecryptUsernamePassword(data, size, server.options.GetEncryptionMode());
|
||||
login_packet_buffer = DecryptUsernamePassword(data, size, server.options.GetEncryptionMode());
|
||||
|
||||
int buffer_len = strlen(e_buffer);
|
||||
e_hash.assign(e_buffer, buffer_len);
|
||||
e_user.assign((e_buffer + buffer_len + 1), strlen(e_buffer + buffer_len + 1));
|
||||
int login_packet_buffer_length = strlen(login_packet_buffer);
|
||||
entered_password_hash_result.assign(login_packet_buffer, login_packet_buffer_length);
|
||||
entered_username.assign((login_packet_buffer + login_packet_buffer_length + 1), strlen(login_packet_buffer + login_packet_buffer_length + 1));
|
||||
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_client, "User: %s", e_user.c_str());
|
||||
server_log->Log(log_client, "Hash: %s", e_hash.c_str());
|
||||
if(server.options.IsTraceOn()) {
|
||||
Log.Out(Logs::General, Logs::Debug, "User: %s", entered_username.c_str());
|
||||
Log.Out(Logs::General, Logs::Debug, "Hash: %s", entered_password_hash_result.c_str());
|
||||
}
|
||||
|
||||
_HeapDeleteCharBuffer(e_buffer);
|
||||
_HeapDeleteCharBuffer(login_packet_buffer);
|
||||
#endif
|
||||
|
||||
bool result;
|
||||
if(server.db->GetLoginDataFromAccountName(e_user, d_pass_hash, d_account_id) == false)
|
||||
{
|
||||
server_log->Log(log_client_error, "Error logging in, user %s does not exist in the database.", e_user.c_str());
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(d_pass_hash.compare(e_hash) == 0)
|
||||
{
|
||||
if(server.db->GetLoginDataFromAccountName(entered_username, db_account_password_hash, db_account_id) == false) {
|
||||
/* If we have auto_create_accounts enabled in the login.ini, we will process the creation of an account on our own*/
|
||||
if (
|
||||
server.config->GetVariable("options", "auto_create_accounts").compare("TRUE") == 0 &&
|
||||
server.db->CreateLoginData(entered_username, entered_password_hash_result, db_account_id) == true
|
||||
){
|
||||
Log.Out(Logs::General, Logs::Error, "User %s does not exist in the database, so we created it...", entered_username.c_str());
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
Log.Out(Logs::General, Logs::Error, "Error logging in, user %s does not exist in the database.", entered_username.c_str());
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(db_account_password_hash.compare(entered_password_hash_result) == 0) {
|
||||
result = true;
|
||||
}
|
||||
else {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(result)
|
||||
{
|
||||
server.CM->RemoveExistingClient(d_account_id);
|
||||
/* Login Accepted */
|
||||
if(result) {
|
||||
|
||||
server.client_manager->RemoveExistingClient(db_account_id);
|
||||
|
||||
in_addr in;
|
||||
in.s_addr = connection->GetRemoteIP();
|
||||
server.db->UpdateLSAccountData(d_account_id, string(inet_ntoa(in)));
|
||||
|
||||
server.db->UpdateLSAccountData(db_account_id, string(inet_ntoa(in)));
|
||||
GenerateKey();
|
||||
account_id = d_account_id;
|
||||
account_name = e_user;
|
||||
|
||||
account_id = db_account_id;
|
||||
account_name = entered_username;
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_LoginAccepted, 10 + 80);
|
||||
const LoginLoginRequest_Struct* llrs = (const LoginLoginRequest_Struct *)data;
|
||||
LoginLoginAccepted_Struct* llas = (LoginLoginAccepted_Struct *)outapp->pBuffer;
|
||||
llas->unknown1 = llrs->unknown1;
|
||||
llas->unknown2 = llrs->unknown2;
|
||||
llas->unknown3 = llrs->unknown3;
|
||||
llas->unknown4 = llrs->unknown4;
|
||||
llas->unknown5 = llrs->unknown5;
|
||||
LoginAccepted_Struct* login_accepted = (LoginAccepted_Struct *)outapp->pBuffer;
|
||||
login_accepted->unknown1 = llrs->unknown1;
|
||||
login_accepted->unknown2 = llrs->unknown2;
|
||||
login_accepted->unknown3 = llrs->unknown3;
|
||||
login_accepted->unknown4 = llrs->unknown4;
|
||||
login_accepted->unknown5 = llrs->unknown5;
|
||||
|
||||
Login_ReplyBlock_Struct * lrbs = new Login_ReplyBlock_Struct;
|
||||
memset(lrbs, 0, sizeof(Login_ReplyBlock_Struct));
|
||||
LoginFailedAttempts_Struct * login_failed_attempts = new LoginFailedAttempts_Struct;
|
||||
memset(login_failed_attempts, 0, sizeof(LoginFailedAttempts_Struct));
|
||||
|
||||
lrbs->failed_attempts = 0;
|
||||
lrbs->message = 0x01;
|
||||
lrbs->lsid = d_account_id;
|
||||
lrbs->unknown3[3] = 0x03;
|
||||
lrbs->unknown4[3] = 0x02;
|
||||
lrbs->unknown5[0] = 0xe7;
|
||||
lrbs->unknown5[1] = 0x03;
|
||||
lrbs->unknown6[0] = 0xff;
|
||||
lrbs->unknown6[1] = 0xff;
|
||||
lrbs->unknown6[2] = 0xff;
|
||||
lrbs->unknown6[3] = 0xff;
|
||||
lrbs->unknown7[0] = 0xa0;
|
||||
lrbs->unknown7[1] = 0x05;
|
||||
lrbs->unknown8[3] = 0x02;
|
||||
lrbs->unknown9[0] = 0xff;
|
||||
lrbs->unknown9[1] = 0x03;
|
||||
lrbs->unknown11[0] = 0x63;
|
||||
lrbs->unknown12[0] = 0x01;
|
||||
memcpy(lrbs->key, key.c_str(), key.size());
|
||||
login_failed_attempts->failed_attempts = 0;
|
||||
login_failed_attempts->message = 0x01;
|
||||
login_failed_attempts->lsid = db_account_id;
|
||||
login_failed_attempts->unknown3[3] = 0x03;
|
||||
login_failed_attempts->unknown4[3] = 0x02;
|
||||
login_failed_attempts->unknown5[0] = 0xe7;
|
||||
login_failed_attempts->unknown5[1] = 0x03;
|
||||
login_failed_attempts->unknown6[0] = 0xff;
|
||||
login_failed_attempts->unknown6[1] = 0xff;
|
||||
login_failed_attempts->unknown6[2] = 0xff;
|
||||
login_failed_attempts->unknown6[3] = 0xff;
|
||||
login_failed_attempts->unknown7[0] = 0xa0;
|
||||
login_failed_attempts->unknown7[1] = 0x05;
|
||||
login_failed_attempts->unknown8[3] = 0x02;
|
||||
login_failed_attempts->unknown9[0] = 0xff;
|
||||
login_failed_attempts->unknown9[1] = 0x03;
|
||||
login_failed_attempts->unknown11[0] = 0x63;
|
||||
login_failed_attempts->unknown12[0] = 0x01;
|
||||
memcpy(login_failed_attempts->key, key.c_str(), key.size());
|
||||
|
||||
#ifdef WIN32
|
||||
unsigned int e_size;
|
||||
char *encrypted_buffer = server.eq_crypto->Encrypt((const char*)lrbs, 75, e_size);
|
||||
memcpy(llas->encrypt, encrypted_buffer, 80);
|
||||
char *encrypted_buffer = server.eq_crypto->Encrypt((const char*)login_failed_attempts, 75, e_size);
|
||||
memcpy(login_accepted->encrypt, encrypted_buffer, 80);
|
||||
server.eq_crypto->DeleteHeap(encrypted_buffer);
|
||||
#else
|
||||
unsigned int e_size;
|
||||
char *encrypted_buffer = Encrypt((const char*)lrbs, 75, e_size);
|
||||
memcpy(llas->encrypt, encrypted_buffer, 80);
|
||||
char *encrypted_buffer = Encrypt((const char*)login_failed_attempts, 75, e_size);
|
||||
memcpy(login_accepted->encrypt, encrypted_buffer, 80);
|
||||
_HeapDeleteCharBuffer(encrypted_buffer);
|
||||
#endif
|
||||
|
||||
if(server.options.IsDumpOutPacketsOn())
|
||||
{
|
||||
if(server.options.IsDumpOutPacketsOn()) {
|
||||
DumpPacket(outapp);
|
||||
}
|
||||
|
||||
connection->QueuePacket(outapp);
|
||||
delete outapp;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_LoginAccepted, sizeof(LoginLoginFailed_Struct));
|
||||
const LoginLoginRequest_Struct* llrs = (const LoginLoginRequest_Struct *)data;
|
||||
LoginLoginFailed_Struct* llas = (LoginLoginFailed_Struct *)outapp->pBuffer;
|
||||
@ -317,8 +323,7 @@ void Client::Handle_Login(const char* data, unsigned int size)
|
||||
llas->unknown5 = llrs->unknown5;
|
||||
memcpy(llas->unknown6, FailedLoginResponseData, sizeof(FailedLoginResponseData));
|
||||
|
||||
if(server.options.IsDumpOutPacketsOn())
|
||||
{
|
||||
if(server.options.IsDumpOutPacketsOn()) {
|
||||
DumpPacket(outapp);
|
||||
}
|
||||
|
||||
@ -331,7 +336,7 @@ void Client::Handle_Play(const char* data)
|
||||
{
|
||||
if(status != cs_logged_in)
|
||||
{
|
||||
server_log->Log(log_client_error, "Client sent a play request when they either were not logged in, discarding.");
|
||||
Log.Out(Logs::General, Logs::Error, "Client sent a play request when they either were not logged in, discarding.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -341,18 +346,18 @@ void Client::Handle_Play(const char* data)
|
||||
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network, "Play received from client, server number %u sequence %u.", server_id_in, sequence_in);
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Play received from client, server number %u sequence %u.", server_id_in, sequence_in);
|
||||
}
|
||||
|
||||
this->play_server_id = (unsigned int)play->ServerNumber;
|
||||
play_sequence_id = sequence_in;
|
||||
play_server_id = server_id_in;
|
||||
server.SM->SendUserToWorldRequest(server_id_in, account_id);
|
||||
server.server_manager->SendUserToWorldRequest(server_id_in, account_id);
|
||||
}
|
||||
|
||||
void Client::SendServerListPacket()
|
||||
{
|
||||
EQApplicationPacket *outapp = server.SM->CreateServerListPacket(this);
|
||||
EQApplicationPacket *outapp = server.server_manager->CreateServerListPacket(this);
|
||||
|
||||
if(server.options.IsDumpOutPacketsOn())
|
||||
{
|
||||
@ -367,8 +372,8 @@ void Client::SendPlayResponse(EQApplicationPacket *outapp)
|
||||
{
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network_trace, "Sending play response for %s.", GetAccountName().c_str());
|
||||
server_log->LogPacket(log_network_trace, (const char*)outapp->pBuffer, outapp->size);
|
||||
Log.Out(Logs::General, Logs::Netcode, "Sending play response for %s.", GetAccountName().c_str());
|
||||
// server_log->LogPacket(log_network_trace, (const char*)outapp->pBuffer, outapp->size);
|
||||
}
|
||||
connection->QueuePacket(outapp);
|
||||
status = cs_logged_in;
|
||||
@ -378,7 +383,7 @@ void Client::GenerateKey()
|
||||
{
|
||||
key.clear();
|
||||
int count = 0;
|
||||
while(count < 10)
|
||||
while (count < 10)
|
||||
{
|
||||
static const char key_selection[] =
|
||||
{
|
||||
|
||||
@ -16,13 +16,14 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "client_manager.h"
|
||||
#include "error_log.h"
|
||||
#include "login_server.h"
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
extern LoginServer server;
|
||||
extern bool run_server;
|
||||
|
||||
#include "../common/eqemu_logsys.h"
|
||||
extern EQEmuLogSys Log;
|
||||
|
||||
ClientManager::ClientManager()
|
||||
{
|
||||
int titanium_port = atoi(server.config->GetVariable("Titanium", "port").c_str());
|
||||
@ -30,18 +31,18 @@ ClientManager::ClientManager()
|
||||
titanium_ops = new RegularOpcodeManager;
|
||||
if(!titanium_ops->LoadOpcodes(server.config->GetVariable("Titanium", "opcodes").c_str()))
|
||||
{
|
||||
server_log->Log(log_error, "ClientManager fatal error: couldn't load opcodes for Titanium file %s.",
|
||||
Log.Out(Logs::General, Logs::Error, "ClientManager fatal error: couldn't load opcodes for Titanium file %s.",
|
||||
server.config->GetVariable("Titanium", "opcodes").c_str());
|
||||
run_server = false;
|
||||
}
|
||||
|
||||
if(titanium_stream->Open())
|
||||
{
|
||||
server_log->Log(log_network, "ClientManager listening on Titanium stream.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "ClientManager listening on Titanium stream.");
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_error, "ClientManager fatal error: couldn't open Titanium stream.");
|
||||
Log.Out(Logs::General, Logs::Error, "ClientManager fatal error: couldn't open Titanium stream.");
|
||||
run_server = false;
|
||||
}
|
||||
|
||||
@ -50,18 +51,18 @@ ClientManager::ClientManager()
|
||||
sod_ops = new RegularOpcodeManager;
|
||||
if(!sod_ops->LoadOpcodes(server.config->GetVariable("SoD", "opcodes").c_str()))
|
||||
{
|
||||
server_log->Log(log_error, "ClientManager fatal error: couldn't load opcodes for SoD file %s.",
|
||||
Log.Out(Logs::General, Logs::Error, "ClientManager fatal error: couldn't load opcodes for SoD file %s.",
|
||||
server.config->GetVariable("SoD", "opcodes").c_str());
|
||||
run_server = false;
|
||||
}
|
||||
|
||||
if(sod_stream->Open())
|
||||
{
|
||||
server_log->Log(log_network, "ClientManager listening on SoD stream.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "ClientManager listening on SoD stream.");
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_error, "ClientManager fatal error: couldn't open SoD stream.");
|
||||
Log.Out(Logs::General, Logs::Error, "ClientManager fatal error: couldn't open SoD stream.");
|
||||
run_server = false;
|
||||
}
|
||||
}
|
||||
@ -99,7 +100,7 @@ void ClientManager::Process()
|
||||
{
|
||||
struct in_addr in;
|
||||
in.s_addr = cur->GetRemoteIP();
|
||||
server_log->Log(log_network, "New Titanium client connection from %s:%d", inet_ntoa(in), ntohs(cur->GetRemotePort()));
|
||||
Log.Out(Logs::General, Logs::Login_Server, "New Titanium client connection from %s:%d", inet_ntoa(in), ntohs(cur->GetRemotePort()));
|
||||
|
||||
cur->SetOpcodeManager(&titanium_ops);
|
||||
Client *c = new Client(cur, cv_titanium);
|
||||
@ -112,7 +113,7 @@ void ClientManager::Process()
|
||||
{
|
||||
struct in_addr in;
|
||||
in.s_addr = cur->GetRemoteIP();
|
||||
server_log->Log(log_network, "New SoD client connection from %s:%d", inet_ntoa(in), ntohs(cur->GetRemotePort()));
|
||||
Log.Out(Logs::General, Logs::Login_Server, "New SoD client connection from %s:%d", inet_ntoa(in), ntohs(cur->GetRemotePort()));
|
||||
|
||||
cur->SetOpcodeManager(&sod_ops);
|
||||
Client *c = new Client(cur, cv_sod);
|
||||
@ -125,7 +126,7 @@ void ClientManager::Process()
|
||||
{
|
||||
if((*iter)->Process() == false)
|
||||
{
|
||||
server_log->Log(log_client, "Client had a fatal error and had to be removed from the login.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Client had a fatal error and had to be removed from the login.");
|
||||
delete (*iter);
|
||||
iter = clients.erase(iter);
|
||||
}
|
||||
@ -144,7 +145,7 @@ void ClientManager::ProcessDisconnect()
|
||||
std::shared_ptr<EQStream> c = (*iter)->GetConnection();
|
||||
if(c->CheckClosed())
|
||||
{
|
||||
server_log->Log(log_network, "Client disconnected from the server, removing client.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Client disconnected from the server, removing client.");
|
||||
delete (*iter);
|
||||
iter = clients.erase(iter);
|
||||
}
|
||||
@ -172,7 +173,7 @@ void ClientManager::RemoveExistingClient(unsigned int account_id)
|
||||
{
|
||||
if((*iter)->GetAccountID() == account_id)
|
||||
{
|
||||
server_log->Log(log_network, "Client attempting to log in and existing client already logged in, removing existing client.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Client attempting to log in and existing client already logged in, removing existing client.");
|
||||
delete (*iter);
|
||||
iter = clients.erase(iter);
|
||||
}
|
||||
@ -200,7 +201,7 @@ Client *ClientManager::GetClient(unsigned int account_id)
|
||||
|
||||
if(count > 1)
|
||||
{
|
||||
server_log->Log(log_client_error, "More than one client with a given account_id existed in the client list.");
|
||||
Log.Out(Logs::General, Logs::Error, "More than one client with a given account_id existed in the client list.");
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
|
||||
@ -16,10 +16,10 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "config.h"
|
||||
#include "error_log.h"
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
extern EQEmuLogSys Log;
|
||||
/**
|
||||
* Retrieves the variable we want from our title or theme
|
||||
* First gets the map from the title
|
||||
@ -48,7 +48,7 @@ void Config::Parse(const char *file_name)
|
||||
{
|
||||
if(file_name == nullptr)
|
||||
{
|
||||
server_log->Log(log_error, "Config::Parse(), file_name passed was null.");
|
||||
Log.Out(Logs::General, Logs::Error, "Config::Parse(), file_name passed was null.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ void Config::Parse(const char *file_name)
|
||||
++iter;
|
||||
if(iter == tokens.end())
|
||||
{
|
||||
server_log->Log(log_error, "Config::Parse(), EOF before title done parsing.");
|
||||
Log.Out(Logs::General, Logs::Error, "Config::Parse(), EOF before title done parsing.");
|
||||
fclose(input);
|
||||
vars.clear();
|
||||
return;
|
||||
@ -104,7 +104,7 @@ void Config::Parse(const char *file_name)
|
||||
mode++;
|
||||
if((*iter).compare("=") != 0)
|
||||
{
|
||||
server_log->Log(log_error, "Config::Parse(), invalid parse token where = should be.");
|
||||
Log.Out(Logs::General, Logs::Error, "Config::Parse(), invalid parse token where = should be.");
|
||||
fclose(input);
|
||||
vars.clear();
|
||||
return;
|
||||
@ -133,7 +133,7 @@ void Config::Parse(const char *file_name)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_error, "Config::Parse(), file was unable to be opened for parsing.");
|
||||
Log.Out(Logs::General, Logs::Error, "Config::Parse(), file was unable to be opened for parsing.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -44,6 +44,8 @@ public:
|
||||
*/
|
||||
virtual bool GetLoginDataFromAccountName(std::string name, std::string &password, unsigned int &id) { return false; }
|
||||
|
||||
virtual bool CreateLoginData(std::string name, std::string &password, unsigned int &id) { return false; }
|
||||
|
||||
/**
|
||||
* Retrieves the world registration from the long and short names provided.
|
||||
* Needed for world login procedure.
|
||||
|
||||
@ -20,14 +20,12 @@
|
||||
|
||||
#ifdef EQEMU_MYSQL_ENABLED
|
||||
#include "database_mysql.h"
|
||||
#include "error_log.h"
|
||||
#include "login_server.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
extern EQEmuLogSys Log;
|
||||
extern LoginServer server;
|
||||
|
||||
#pragma comment(lib, "mysqlclient.lib")
|
||||
|
||||
DatabaseMySQL::DatabaseMySQL(string user, string pass, string host, string port, string name)
|
||||
{
|
||||
this->user = user;
|
||||
@ -35,35 +33,35 @@ DatabaseMySQL::DatabaseMySQL(string user, string pass, string host, string port,
|
||||
this->host = host;
|
||||
this->name = name;
|
||||
|
||||
db = mysql_init(nullptr);
|
||||
if(db)
|
||||
database = mysql_init(nullptr);
|
||||
if(database)
|
||||
{
|
||||
my_bool r = 1;
|
||||
mysql_options(db, MYSQL_OPT_RECONNECT, &r);
|
||||
if(!mysql_real_connect(db, host.c_str(), user.c_str(), pass.c_str(), name.c_str(), atoi(port.c_str()), nullptr, 0))
|
||||
mysql_options(database, MYSQL_OPT_RECONNECT, &r);
|
||||
if(!mysql_real_connect(database, host.c_str(), user.c_str(), pass.c_str(), name.c_str(), atoi(port.c_str()), nullptr, 0))
|
||||
{
|
||||
mysql_close(db);
|
||||
server_log->Log(log_database, "Failed to connect to MySQL database. Error: %s", mysql_error(db));
|
||||
mysql_close(database);
|
||||
Log.Out(Logs::General, Logs::Error, "Failed to connect to MySQL database. Error: %s", mysql_error(database));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_database, "Failed to create db object in MySQL database.");
|
||||
Log.Out(Logs::General, Logs::Error, "Failed to create db object in MySQL database.");
|
||||
}
|
||||
}
|
||||
|
||||
DatabaseMySQL::~DatabaseMySQL()
|
||||
{
|
||||
if(db)
|
||||
if(database)
|
||||
{
|
||||
mysql_close(db);
|
||||
mysql_close(database);
|
||||
}
|
||||
}
|
||||
|
||||
bool DatabaseMySQL::GetLoginDataFromAccountName(string name, string &password, unsigned int &id)
|
||||
{
|
||||
if(!db)
|
||||
if (!database)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -75,17 +73,17 @@ bool DatabaseMySQL::GetLoginDataFromAccountName(string name, string &password, u
|
||||
query << name;
|
||||
query << "'";
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
res = mysql_use_result(db);
|
||||
res = mysql_use_result(database);
|
||||
|
||||
if(res)
|
||||
if (res)
|
||||
{
|
||||
while((row = mysql_fetch_row(res)) != nullptr)
|
||||
while ((row = mysql_fetch_row(res)) != nullptr)
|
||||
{
|
||||
id = atoi(row[0]);
|
||||
password = row[1];
|
||||
@ -94,14 +92,41 @@ bool DatabaseMySQL::GetLoginDataFromAccountName(string name, string &password, u
|
||||
}
|
||||
}
|
||||
|
||||
server_log->Log(log_database, "Mysql query returned no result: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query returned no result: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool DatabaseMySQL::CreateLoginData(string name, string &password, unsigned int &id)
|
||||
{
|
||||
if (!database) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
stringstream query(stringstream::in | stringstream::out);
|
||||
|
||||
query << "INSERT INTO " << server.options.GetAccountTable() << " (AccountName, AccountPassword, AccountEmail, LastLoginDate, LastIPAddress) ";
|
||||
query << " VALUES('" << name << "', '" << password << "', 'local_creation', NOW(), '127.0.0.1'); ";
|
||||
|
||||
if (mysql_query(database, query.str().c_str()) != 0) {
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
id = mysql_insert_id(database);
|
||||
return true;
|
||||
}
|
||||
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query returned no result: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id,
|
||||
unsigned int &trusted, string &list_desc, string &account, string &password)
|
||||
unsigned int &trusted, string &list_desc, string &account, string &password)
|
||||
{
|
||||
if(!db)
|
||||
if (!database)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -110,8 +135,8 @@ bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, un
|
||||
MYSQL_ROW row;
|
||||
char escaped_short_name[101];
|
||||
unsigned long length;
|
||||
length = mysql_real_escape_string(db, escaped_short_name, short_name.substr(0, 100).c_str(), short_name.substr(0, 100).length());
|
||||
escaped_short_name[length+1] = 0;
|
||||
length = mysql_real_escape_string(database, escaped_short_name, short_name.substr(0, 100).c_str(), short_name.substr(0, 100).length());
|
||||
escaped_short_name[length + 1] = 0;
|
||||
stringstream query(stringstream::in | stringstream::out);
|
||||
query << "SELECT ifnull(WSR.ServerID,999999) AS ServerID, WSR.ServerTagDescription, ifnull(WSR.ServerTrusted,0) AS ServerTrusted, ifnull(SLT.ServerListTypeID,3) AS ServerListTypeID, ";
|
||||
query << "SLT.ServerListTypeDescription, ifnull(WSR.ServerAdminID,0) AS ServerAdminID FROM " << server.options.GetWorldRegistrationTable();
|
||||
@ -120,16 +145,16 @@ bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, un
|
||||
query << escaped_short_name;
|
||||
query << "'";
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
res = mysql_use_result(db);
|
||||
if(res)
|
||||
res = mysql_use_result(database);
|
||||
if (res)
|
||||
{
|
||||
if((row = mysql_fetch_row(res)) != nullptr)
|
||||
if ((row = mysql_fetch_row(res)) != nullptr)
|
||||
{
|
||||
id = atoi(row[0]);
|
||||
desc = row[1];
|
||||
@ -139,22 +164,22 @@ bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, un
|
||||
int db_account_id = atoi(row[5]);
|
||||
mysql_free_result(res);
|
||||
|
||||
if(db_account_id > 0)
|
||||
if (db_account_id > 0)
|
||||
{
|
||||
stringstream query(stringstream::in | stringstream::out);
|
||||
query << "SELECT AccountName, AccountPassword FROM " << server.options.GetWorldAdminRegistrationTable();
|
||||
query << " WHERE ServerAdminID = " << db_account_id;
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
res = mysql_use_result(db);
|
||||
if(res)
|
||||
res = mysql_use_result(database);
|
||||
if (res)
|
||||
{
|
||||
if((row = mysql_fetch_row(res)) != nullptr)
|
||||
if ((row = mysql_fetch_row(res)) != nullptr)
|
||||
{
|
||||
account = row[0];
|
||||
password = row[1];
|
||||
@ -163,20 +188,20 @@ bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, un
|
||||
}
|
||||
}
|
||||
|
||||
server_log->Log(log_database, "Mysql query returned no result: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query returned no result: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
server_log->Log(log_database, "Mysql query returned no result: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query returned no result: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
void DatabaseMySQL::UpdateLSAccountData(unsigned int id, string ip_address)
|
||||
{
|
||||
if(!db)
|
||||
if (!database)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -187,15 +212,15 @@ void DatabaseMySQL::UpdateLSAccountData(unsigned int id, string ip_address)
|
||||
query << "', LastLoginDate = now() where LoginServerID = ";
|
||||
query << id;
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseMySQL::UpdateLSAccountInfo(unsigned int id, string name, string password, string email)
|
||||
{
|
||||
if(!db)
|
||||
if (!database)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -206,23 +231,23 @@ void DatabaseMySQL::UpdateLSAccountInfo(unsigned int id, string name, string pas
|
||||
query << password << "'), AccountCreateDate = now(), AccountEmail = '" << email;
|
||||
query << "', LastIPAddress = '0.0.0.0', LastLoginDate = now()";
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseMySQL::UpdateWorldRegistration(unsigned int id, string long_name, string ip_address)
|
||||
{
|
||||
if(!db)
|
||||
if (!database)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char escaped_long_name[101];
|
||||
unsigned long length;
|
||||
length = mysql_real_escape_string(db, escaped_long_name, long_name.substr(0, 100).c_str(), long_name.substr(0, 100).length());
|
||||
escaped_long_name[length+1] = 0;
|
||||
length = mysql_real_escape_string(database, escaped_long_name, long_name.substr(0, 100).c_str(), long_name.substr(0, 100).length());
|
||||
escaped_long_name[length + 1] = 0;
|
||||
stringstream query(stringstream::in | stringstream::out);
|
||||
query << "UPDATE " << server.options.GetWorldRegistrationTable() << " SET ServerLastLoginDate = now(), ServerLastIPAddr = '";
|
||||
query << ip_address;
|
||||
@ -231,15 +256,15 @@ void DatabaseMySQL::UpdateWorldRegistration(unsigned int id, string long_name, s
|
||||
query << "' WHERE ServerID = ";
|
||||
query << id;
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
bool DatabaseMySQL::CreateWorldRegistration(string long_name, string short_name, unsigned int &id)
|
||||
{
|
||||
if(!db)
|
||||
if (!database)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -249,23 +274,23 @@ bool DatabaseMySQL::CreateWorldRegistration(string long_name, string short_name,
|
||||
char escaped_long_name[201];
|
||||
char escaped_short_name[101];
|
||||
unsigned long length;
|
||||
length = mysql_real_escape_string(db, escaped_long_name, long_name.substr(0, 100).c_str(), long_name.substr(0, 100).length());
|
||||
escaped_long_name[length+1] = 0;
|
||||
length = mysql_real_escape_string(db, escaped_short_name, short_name.substr(0, 100).c_str(), short_name.substr(0, 100).length());
|
||||
escaped_short_name[length+1] = 0;
|
||||
length = mysql_real_escape_string(database, escaped_long_name, long_name.substr(0, 100).c_str(), long_name.substr(0, 100).length());
|
||||
escaped_long_name[length + 1] = 0;
|
||||
length = mysql_real_escape_string(database, escaped_short_name, short_name.substr(0, 100).c_str(), short_name.substr(0, 100).length());
|
||||
escaped_short_name[length + 1] = 0;
|
||||
stringstream query(stringstream::in | stringstream::out);
|
||||
query << "SELECT ifnull(max(ServerID),0) FROM " << server.options.GetWorldRegistrationTable();
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
res = mysql_use_result(db);
|
||||
if(res)
|
||||
res = mysql_use_result(database);
|
||||
if (res)
|
||||
{
|
||||
if((row = mysql_fetch_row(res)) != nullptr)
|
||||
if ((row = mysql_fetch_row(res)) != nullptr)
|
||||
{
|
||||
id = atoi(row[0]) + 1;
|
||||
mysql_free_result(res);
|
||||
@ -275,15 +300,15 @@ bool DatabaseMySQL::CreateWorldRegistration(string long_name, string short_name,
|
||||
query << ", ServerLongName = '" << escaped_long_name << "', ServerShortName = '" << escaped_short_name;
|
||||
query << "', ServerListTypeID = 3, ServerAdminID = 0, ServerTrusted = 0, ServerTagDescription = ''";
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
server_log->Log(log_database, "World registration did not exist in the database for %s %s", long_name.c_str(), short_name.c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "World registration did not exist in the database for %s %s", long_name.c_str(), short_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ public:
|
||||
/**
|
||||
* Constructor, sets our database to null.
|
||||
*/
|
||||
DatabaseMySQL() { db = nullptr; }
|
||||
DatabaseMySQL() { database = nullptr; }
|
||||
|
||||
/**
|
||||
* Constructor, tries to set our database to connect to the supplied options.
|
||||
@ -50,7 +50,7 @@ public:
|
||||
/**
|
||||
* @return Returns true if the database successfully connected.
|
||||
*/
|
||||
virtual bool IsConnected() { return (db != nullptr); }
|
||||
virtual bool IsConnected() { return (database != nullptr); }
|
||||
|
||||
/**
|
||||
* Retrieves the login data (password hash and account id) from the account name provided
|
||||
@ -59,6 +59,8 @@ public:
|
||||
*/
|
||||
virtual bool GetLoginDataFromAccountName(std::string name, std::string &password, unsigned int &id);
|
||||
|
||||
virtual bool CreateLoginData(std::string name, std::string &password, unsigned int &id);
|
||||
|
||||
/**
|
||||
* Retrieves the world registration from the long and short names provided.
|
||||
* Needed for world login procedure.
|
||||
@ -88,7 +90,7 @@ public:
|
||||
virtual bool CreateWorldRegistration(std::string long_name, std::string short_name, unsigned int &id);
|
||||
protected:
|
||||
std::string user, pass, host, port, name;
|
||||
MYSQL *db;
|
||||
MYSQL *database;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#include "error_log.h"
|
||||
#include "login_server.h"
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
|
||||
extern LoginServer server;
|
||||
|
||||
#pragma comment(lib, "libpq.lib")
|
||||
@ -34,12 +34,12 @@ DatabasePostgreSQL::DatabasePostgreSQL(string user, string pass, string host, st
|
||||
db = PQsetdbLogin(host.c_str(), port.c_str(), nullptr, nullptr, name.c_str(), user.c_str(), pass.c_str());
|
||||
if(!db)
|
||||
{
|
||||
server_log->Log(log_database, "Failed to connect to PostgreSQL Database.");
|
||||
Log.Out(Logs::General, Logs::Error, "Failed to connect to PostgreSQL Database.");
|
||||
}
|
||||
|
||||
if(PQstatus(db) != CONNECTION_OK)
|
||||
{
|
||||
server_log->Log(log_database, "Failed to connect to PostgreSQL Database.");
|
||||
Log.Out(Logs::General, Logs::Error, "Failed to connect to PostgreSQL Database.");
|
||||
PQfinish(db);
|
||||
db = nullptr;
|
||||
}
|
||||
@ -83,7 +83,7 @@ bool DatabasePostgreSQL::GetLoginDataFromAccountName(string name, string &passwo
|
||||
char *error = PQresultErrorMessage(res);
|
||||
if(strlen(error) > 0)
|
||||
{
|
||||
server_log->Log(log_database, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
Log.Out(Logs::General, Logs::Error, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
PQclear(res);
|
||||
return false;
|
||||
}
|
||||
@ -135,7 +135,7 @@ bool DatabasePostgreSQL::GetWorldRegistration(string long_name, string short_nam
|
||||
char *error = PQresultErrorMessage(res);
|
||||
if(strlen(error) > 0)
|
||||
{
|
||||
server_log->Log(log_database, "Database error in DatabasePostgreSQL::GetWorldRegistration(): %s", error);
|
||||
Log.Out(Logs::General, Logs::Error, "Database error in DatabasePostgreSQL::GetWorldRegistration(): %s", error);
|
||||
PQclear(res);
|
||||
return false;
|
||||
}
|
||||
@ -188,7 +188,7 @@ void DatabasePostgreSQL::UpdateLSAccountData(unsigned int id, string ip_address)
|
||||
char *error = PQresultErrorMessage(res);
|
||||
if(strlen(error) > 0)
|
||||
{
|
||||
server_log->Log(log_database, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
Log.Out(Logs::General, Logs::Error, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
}
|
||||
PQclear(res);
|
||||
}
|
||||
@ -225,7 +225,7 @@ void DatabasePostgreSQL::UpdateWorldRegistration(unsigned int id, string long_na
|
||||
char *error = PQresultErrorMessage(res);
|
||||
if(strlen(error) > 0)
|
||||
{
|
||||
server_log->Log(log_database, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
Log.Out(Logs::General, Logs::Error, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
}
|
||||
PQclear(res);
|
||||
}
|
||||
|
||||
@ -17,16 +17,16 @@
|
||||
*/
|
||||
#include "../common/global_define.h"
|
||||
#include "encryption.h"
|
||||
#include "error_log.h"
|
||||
#include <string>
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
#include "../common/eqemu_logsys.h"
|
||||
extern EQEmuLogSys Log;
|
||||
|
||||
bool Encryption::LoadCrypto(std::string name)
|
||||
{
|
||||
if(!Load(name.c_str()))
|
||||
{
|
||||
server_log->Log(log_error, "Failed to load %s from the operating system.", name.c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Failed to load %s from the operating system.", name.c_str());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -34,21 +34,21 @@ bool Encryption::LoadCrypto(std::string name)
|
||||
encrypt_func = (DLLFUNC_Encrypt)GetSym("Encrypt");
|
||||
if(encrypt_func == NULL)
|
||||
{
|
||||
server_log->Log(log_error, "Failed to attach Encrypt.");
|
||||
Log.Out(Logs::General, Logs::Error, "Failed to attach Encrypt.");
|
||||
Unload();
|
||||
return false;
|
||||
}
|
||||
decrypt_func = (DLLFUNC_DecryptUsernamePassword)GetSym("DecryptUsernamePassword");
|
||||
if(decrypt_func == NULL)
|
||||
{
|
||||
server_log->Log(log_error, "Failed to attach DecryptUsernamePassword.");
|
||||
Log.Out(Logs::General, Logs::Error, "Failed to attach DecryptUsernamePassword.");
|
||||
Unload();
|
||||
return false;
|
||||
}
|
||||
delete_func = (DLLFUNC_HeapDelete)GetSym("_HeapDeleteCharBuffer");
|
||||
if(delete_func == NULL)
|
||||
{
|
||||
server_log->Log(log_error, "Failed to attach _HeapDeleteCharBuffer.");
|
||||
Log.Out(Logs::General, Logs::Error, "Failed to attach _HeapDeleteCharBuffer.");
|
||||
Unload();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1,210 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "error_log.h"
|
||||
|
||||
const char *eqLogTypes[_log_largest_type] =
|
||||
{
|
||||
"Debug",
|
||||
"Error",
|
||||
"Database",
|
||||
"Network",
|
||||
"Network Trace",
|
||||
"Network Error",
|
||||
"World",
|
||||
"World Error",
|
||||
"Client",
|
||||
"Client Error"
|
||||
};
|
||||
|
||||
ErrorLog::ErrorLog(const char* file_name)
|
||||
{
|
||||
log_mutex = new Mutex();
|
||||
error_log = fopen(file_name, "w");
|
||||
}
|
||||
|
||||
ErrorLog::~ErrorLog()
|
||||
{
|
||||
log_mutex->lock();
|
||||
if(error_log)
|
||||
{
|
||||
fclose(error_log);
|
||||
}
|
||||
log_mutex->unlock();
|
||||
delete log_mutex;
|
||||
}
|
||||
|
||||
void ErrorLog::Log(eqLogType type, const char *message, ...)
|
||||
{
|
||||
if(type >= _log_largest_type)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
va_list argptr;
|
||||
char *buffer = new char[4096];
|
||||
va_start(argptr, message);
|
||||
vsnprintf(buffer, 4096, message, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
time_t m_clock;
|
||||
struct tm *m_time;
|
||||
time(&m_clock);
|
||||
m_time = localtime(&m_clock);
|
||||
|
||||
log_mutex->lock();
|
||||
printf("[%s] [%02d.%02d.%02d - %02d:%02d:%02d] %s\n",
|
||||
eqLogTypes[type],
|
||||
m_time->tm_mon+1,
|
||||
m_time->tm_mday,
|
||||
m_time->tm_year%100,
|
||||
m_time->tm_hour,
|
||||
m_time->tm_min,
|
||||
m_time->tm_sec,
|
||||
buffer);
|
||||
|
||||
if(error_log)
|
||||
{
|
||||
fprintf(error_log, "[%s] [%02d.%02d.%02d - %02d:%02d:%02d] %s\n",
|
||||
eqLogTypes[type],
|
||||
m_time->tm_mon+1,
|
||||
m_time->tm_mday,
|
||||
m_time->tm_year%100,
|
||||
m_time->tm_hour,
|
||||
m_time->tm_min,
|
||||
m_time->tm_sec,
|
||||
buffer);
|
||||
fflush(error_log);
|
||||
}
|
||||
|
||||
log_mutex->unlock();
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
void ErrorLog::LogPacket(eqLogType type, const char *data, size_t size)
|
||||
{
|
||||
if(type >= _log_largest_type)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
log_mutex->lock();
|
||||
time_t m_clock;
|
||||
struct tm *m_time;
|
||||
time(&m_clock);
|
||||
m_time = localtime(&m_clock);
|
||||
|
||||
log_mutex->lock();
|
||||
printf("[%s] [%02d.%02d.%02d - %02d:%02d:%02d] dumping packet of size %u:\n",
|
||||
eqLogTypes[type],
|
||||
m_time->tm_mon+1,
|
||||
m_time->tm_mday,
|
||||
m_time->tm_year%100,
|
||||
m_time->tm_hour,
|
||||
m_time->tm_min,
|
||||
m_time->tm_sec,
|
||||
(unsigned int)size);
|
||||
|
||||
if(error_log)
|
||||
{
|
||||
fprintf(error_log, "[%s] [%02d.%02d.%02d - %02d:%02d:%02d] dumping packet of size %u\n",
|
||||
eqLogTypes[type],
|
||||
m_time->tm_mon+1,
|
||||
m_time->tm_mday,
|
||||
m_time->tm_year%100,
|
||||
m_time->tm_hour,
|
||||
m_time->tm_min,
|
||||
m_time->tm_sec,
|
||||
(unsigned int)size);
|
||||
}
|
||||
|
||||
char ascii[17]; //16 columns + 1 null term
|
||||
memset(ascii, 0, 17);
|
||||
|
||||
size_t j = 0;
|
||||
size_t i = 0;
|
||||
for(; i < size; ++i)
|
||||
{
|
||||
if(i % 16 == 0)
|
||||
{
|
||||
if(i != 0)
|
||||
{
|
||||
printf(" | %s\n", ascii);
|
||||
if(error_log)
|
||||
{
|
||||
fprintf(error_log, " | %s\n", ascii);
|
||||
}
|
||||
}
|
||||
printf("%.4u: ", (unsigned int)i);
|
||||
memset(ascii, 0, 17);
|
||||
j = 0;
|
||||
}
|
||||
else if(i % 8 == 0)
|
||||
{
|
||||
printf("- ");
|
||||
if(error_log)
|
||||
{
|
||||
fprintf(error_log, "- ");
|
||||
}
|
||||
}
|
||||
|
||||
printf("%02X ", (unsigned int)data[i]);
|
||||
if(error_log)
|
||||
{
|
||||
fprintf(error_log, "%02X ", (unsigned int)data[i]);
|
||||
}
|
||||
|
||||
if(data[i] >= 32 && data[i] < 127)
|
||||
{
|
||||
ascii[j++] = data[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
ascii[j++] = '.';
|
||||
}
|
||||
}
|
||||
|
||||
size_t k = (i - 1) % 16;
|
||||
if(k < 8)
|
||||
{
|
||||
printf(" ");
|
||||
if(error_log)
|
||||
{
|
||||
fprintf(error_log, " ");
|
||||
}
|
||||
}
|
||||
|
||||
for(size_t h = k + 1; h < 16; ++h)
|
||||
{
|
||||
printf(" ");
|
||||
if(error_log)
|
||||
{
|
||||
fprintf(error_log, " ");
|
||||
}
|
||||
}
|
||||
|
||||
printf(" | %s\n", ascii);
|
||||
if(error_log)
|
||||
{
|
||||
fprintf(error_log, " | %s\n", ascii);
|
||||
fflush(error_log);
|
||||
}
|
||||
|
||||
log_mutex->unlock();
|
||||
}
|
||||
|
||||
@ -1,79 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef EQEMU_ERROR_LOG_H
|
||||
#define EQEMU_ERROR_LOG_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <string>
|
||||
|
||||
#include "../common/mutex.h"
|
||||
|
||||
/**
|
||||
* Dictates the log type specified in ErrorLog for Log(...)
|
||||
*/
|
||||
enum eqLogType
|
||||
{
|
||||
log_debug,
|
||||
log_error,
|
||||
log_database,
|
||||
log_network,
|
||||
log_network_trace,
|
||||
log_network_error,
|
||||
log_world,
|
||||
log_world_error,
|
||||
log_client,
|
||||
log_client_error,
|
||||
_log_largest_type
|
||||
};
|
||||
|
||||
/**
|
||||
* Basic error logging class.
|
||||
* Thread safe logging class that records time and date to both a file and to console(if exists).
|
||||
*/
|
||||
class ErrorLog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor: opens the log file for writing and creates our mutex for writing to the log.
|
||||
*/
|
||||
ErrorLog(const char* file_name);
|
||||
|
||||
/**
|
||||
* Closes the file and destroys the mutex.
|
||||
*/
|
||||
~ErrorLog();
|
||||
|
||||
/**
|
||||
* Writes to the log system a variable message.
|
||||
*/
|
||||
void Log(eqLogType type, const char *message, ...);
|
||||
|
||||
/**
|
||||
* Writes to the log system a packet.
|
||||
*/
|
||||
void LogPacket(eqLogType type, const char *data, size_t size);
|
||||
|
||||
protected:
|
||||
Mutex *log_mutex;
|
||||
FILE* error_log;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
#ifndef EQEMU_LOGINSERVER_H
|
||||
#define EQEMU_LOGINSERVER_H
|
||||
|
||||
#include "error_log.h"
|
||||
#include "config.h"
|
||||
#include "database.h"
|
||||
#include "database_mysql.h"
|
||||
@ -40,7 +39,7 @@ public:
|
||||
* but it's the most trivial way to do this.
|
||||
*/
|
||||
#ifdef WIN32
|
||||
LoginServer() : config(nullptr), db(nullptr), eq_crypto(nullptr), SM(nullptr) { }
|
||||
LoginServer() : config(nullptr), db(nullptr), eq_crypto(nullptr), server_manager(nullptr) { }
|
||||
#else
|
||||
LoginServer() : config(nullptr), db(nullptr) { }
|
||||
#endif
|
||||
@ -48,8 +47,8 @@ public:
|
||||
Config *config;
|
||||
Database *db;
|
||||
Options options;
|
||||
ServerManager *SM;
|
||||
ClientManager *CM;
|
||||
ServerManager *server_manager;
|
||||
ClientManager *client_manager;
|
||||
|
||||
#ifdef WIN32
|
||||
Encryption *eq_crypto;
|
||||
|
||||
@ -38,7 +38,7 @@ struct LoginLoginRequest_Struct {
|
||||
char unknown6[16];
|
||||
};
|
||||
|
||||
struct LoginLoginAccepted_Struct {
|
||||
struct LoginAccepted_Struct {
|
||||
short unknown1;
|
||||
short unknown2;
|
||||
short unknown3;
|
||||
@ -47,7 +47,7 @@ struct LoginLoginAccepted_Struct {
|
||||
char encrypt[80];
|
||||
};
|
||||
|
||||
struct Login_ReplyBlock_Struct
|
||||
struct LoginFailedAttempts_Struct
|
||||
{
|
||||
char message; //0x01
|
||||
char unknown2[7]; //0x00
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
TimeoutManager timeout_manager;
|
||||
LoginServer server;
|
||||
EQEmuLogSys Log;
|
||||
ErrorLog *server_log;
|
||||
bool run_server = true;
|
||||
|
||||
void CatchSignal(int sig_num)
|
||||
@ -43,106 +42,63 @@ int main()
|
||||
{
|
||||
RegisterExecutablePlatform(ExePlatformLogin);
|
||||
set_exception_handler();
|
||||
Log.LoadLogSettingsDefaults();
|
||||
|
||||
//Create our error log, is of format login_<number>.log
|
||||
time_t current_time = time(nullptr);
|
||||
std::stringstream log_name(std::stringstream::in | std::stringstream::out);
|
||||
#ifdef WIN32
|
||||
log_name << ".\\logs\\login_" << (unsigned int)current_time << ".log";
|
||||
#else
|
||||
log_name << "./logs/login_" << (unsigned int)current_time << ".log";
|
||||
#endif
|
||||
server_log = new ErrorLog(log_name.str().c_str());
|
||||
server_log->Log(log_debug, "Logging System Init.");
|
||||
Log.log_settings[Logs::Error].log_to_console = Logs::General;
|
||||
|
||||
//Create our subsystem and parse the ini file.
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Logging System Init.");
|
||||
|
||||
/* Parse out login.ini */
|
||||
server.config = new Config();
|
||||
server_log->Log(log_debug, "Config System Init.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Config System Init.");
|
||||
server.config->Parse("login.ini");
|
||||
|
||||
//Parse unregistered allowed option.
|
||||
if(server.config->GetVariable("options", "unregistered_allowed").compare("FALSE") == 0)
|
||||
{
|
||||
if (server.config->GetVariable("options", "unregistered_allowed").compare("FALSE") == 0)
|
||||
server.options.AllowUnregistered(false);
|
||||
}
|
||||
|
||||
//Parse trace option.
|
||||
if(server.config->GetVariable("options", "trace").compare("TRUE") == 0)
|
||||
{
|
||||
if (server.config->GetVariable("options", "trace").compare("TRUE") == 0)
|
||||
server.options.Trace(true);
|
||||
}
|
||||
|
||||
//Parse trace option.
|
||||
if(server.config->GetVariable("options", "world_trace").compare("TRUE") == 0)
|
||||
{
|
||||
if (server.config->GetVariable("options", "world_trace").compare("TRUE") == 0)
|
||||
server.options.WorldTrace(true);
|
||||
}
|
||||
|
||||
//Parse packet inc dump option.
|
||||
if(server.config->GetVariable("options", "dump_packets_in").compare("TRUE") == 0)
|
||||
{
|
||||
if (server.config->GetVariable("options", "dump_packets_in").compare("TRUE") == 0)
|
||||
server.options.DumpInPackets(true);
|
||||
}
|
||||
|
||||
//Parse packet out dump option.
|
||||
if(server.config->GetVariable("options", "dump_packets_out").compare("TRUE") == 0)
|
||||
{
|
||||
if (server.config->GetVariable("options", "dump_packets_out").compare("TRUE") == 0)
|
||||
server.options.DumpOutPackets(true);
|
||||
}
|
||||
|
||||
//Parse encryption mode option.
|
||||
std::string mode = server.config->GetVariable("security", "mode");
|
||||
if(mode.size() > 0)
|
||||
{
|
||||
if (mode.size() > 0)
|
||||
server.options.EncryptionMode(atoi(mode.c_str()));
|
||||
}
|
||||
|
||||
//Parse local network option.
|
||||
std::string ln = server.config->GetVariable("options", "local_network");
|
||||
if(ln.size() > 0)
|
||||
{
|
||||
server.options.LocalNetwork(ln);
|
||||
}
|
||||
std::string local_network = server.config->GetVariable("options", "local_network");
|
||||
if (local_network.size() > 0)
|
||||
server.options.LocalNetwork(local_network);
|
||||
|
||||
//Parse reject duplicate servers option.
|
||||
if(server.config->GetVariable("options", "reject_duplicate_servers").compare("TRUE") == 0)
|
||||
{
|
||||
if (server.config->GetVariable("options", "reject_duplicate_servers").compare("TRUE") == 0)
|
||||
server.options.RejectDuplicateServers(true);
|
||||
}
|
||||
|
||||
//Parse account table option.
|
||||
ln = server.config->GetVariable("schema", "account_table");
|
||||
if(ln.size() > 0)
|
||||
{
|
||||
server.options.AccountTable(ln);
|
||||
}
|
||||
local_network = server.config->GetVariable("schema", "account_table");
|
||||
if (local_network.size() > 0)
|
||||
server.options.AccountTable(local_network);
|
||||
|
||||
//Parse world account table option.
|
||||
ln = server.config->GetVariable("schema", "world_registration_table");
|
||||
if(ln.size() > 0)
|
||||
{
|
||||
server.options.WorldRegistrationTable(ln);
|
||||
}
|
||||
local_network = server.config->GetVariable("schema", "world_registration_table");
|
||||
if (local_network.size() > 0)
|
||||
server.options.WorldRegistrationTable(local_network);
|
||||
|
||||
//Parse admin world account table option.
|
||||
ln = server.config->GetVariable("schema", "world_admin_registration_table");
|
||||
if(ln.size() > 0)
|
||||
{
|
||||
server.options.WorldAdminRegistrationTable(ln);
|
||||
}
|
||||
local_network = server.config->GetVariable("schema", "world_admin_registration_table");
|
||||
if (local_network.size() > 0)
|
||||
server.options.WorldAdminRegistrationTable(local_network);
|
||||
|
||||
//Parse world type table option.
|
||||
ln = server.config->GetVariable("schema", "world_server_type_table");
|
||||
if(ln.size() > 0)
|
||||
{
|
||||
server.options.WorldServerTypeTable(ln);
|
||||
}
|
||||
local_network = server.config->GetVariable("schema", "world_server_type_table");
|
||||
if (local_network.size() > 0)
|
||||
server.options.WorldServerTypeTable(local_network);
|
||||
|
||||
//Create our DB from options.
|
||||
if(server.config->GetVariable("database", "subsystem").compare("MySQL") == 0)
|
||||
{
|
||||
/* Create database connection */
|
||||
if (server.config->GetVariable("database", "subsystem").compare("MySQL") == 0) {
|
||||
#ifdef EQEMU_MYSQL_ENABLED
|
||||
server_log->Log(log_debug, "MySQL Database Init.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "MySQL Database Init.");
|
||||
server.db = (Database*)new DatabaseMySQL(
|
||||
server.config->GetVariable("database", "user"),
|
||||
server.config->GetVariable("database", "password"),
|
||||
@ -151,10 +107,9 @@ int main()
|
||||
server.config->GetVariable("database", "db"));
|
||||
#endif
|
||||
}
|
||||
else if(server.config->GetVariable("database", "subsystem").compare("PostgreSQL") == 0)
|
||||
{
|
||||
else if (server.config->GetVariable("database", "subsystem").compare("PostgreSQL") == 0) {
|
||||
#ifdef EQEMU_POSTGRESQL_ENABLED
|
||||
server_log->Log(log_debug, "PostgreSQL Database Init.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "PostgreSQL Database Init.");
|
||||
server.db = (Database*)new DatabasePostgreSQL(
|
||||
server.config->GetVariable("database", "user"),
|
||||
server.config->GetVariable("database", "password"),
|
||||
@ -164,78 +119,70 @@ int main()
|
||||
#endif
|
||||
}
|
||||
|
||||
//Make sure our database got created okay, otherwise cleanup and exit.
|
||||
if(!server.db)
|
||||
{
|
||||
server_log->Log(log_error, "Database Initialization Failure.");
|
||||
server_log->Log(log_debug, "Config System Shutdown.");
|
||||
/* Make sure our database got created okay, otherwise cleanup and exit. */
|
||||
if (!server.db) {
|
||||
Log.Out(Logs::General, Logs::Error, "Database Initialization Failure.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
server_log->Log(log_debug, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Log System Shutdown.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if WIN32
|
||||
//initialize our encryption.
|
||||
server_log->Log(log_debug, "Encryption Initialize.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Encryption Initialize.");
|
||||
server.eq_crypto = new Encryption();
|
||||
if(server.eq_crypto->LoadCrypto(server.config->GetVariable("security", "plugin")))
|
||||
{
|
||||
server_log->Log(log_debug, "Encryption Loaded Successfully.");
|
||||
if (server.eq_crypto->LoadCrypto(server.config->GetVariable("security", "plugin"))) {
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Encryption Loaded Successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
//We can't run without encryption, cleanup and exit.
|
||||
server_log->Log(log_error, "Encryption Failed to Load.");
|
||||
server_log->Log(log_debug, "Database System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Error, "Encryption Failed to Load.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Database System Shutdown.");
|
||||
delete server.db;
|
||||
server_log->Log(log_debug, "Config System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
server_log->Log(log_debug, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//create our server manager.
|
||||
server_log->Log(log_debug, "Server Manager Initialize.");
|
||||
server.SM = new ServerManager();
|
||||
if(!server.SM)
|
||||
{
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Server Manager Initialize.");
|
||||
server.server_manager = new ServerManager();
|
||||
if (!server.server_manager) {
|
||||
//We can't run without a server manager, cleanup and exit.
|
||||
server_log->Log(log_error, "Server Manager Failed to Start.");
|
||||
Log.Out(Logs::General, Logs::Error, "Server Manager Failed to Start.");
|
||||
|
||||
#ifdef WIN32
|
||||
server_log->Log(log_debug, "Encryption System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Encryption System Shutdown.");
|
||||
delete server.eq_crypto;
|
||||
#endif
|
||||
server_log->Log(log_debug, "Database System Shutdown.");
|
||||
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Database System Shutdown.");
|
||||
delete server.db;
|
||||
server_log->Log(log_debug, "Config System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
server_log->Log(log_debug, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//create our client manager.
|
||||
server_log->Log(log_debug, "Client Manager Initialize.");
|
||||
server.CM = new ClientManager();
|
||||
if(!server.CM)
|
||||
{
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Client Manager Initialize.");
|
||||
server.client_manager = new ClientManager();
|
||||
if (!server.client_manager) {
|
||||
//We can't run without a client manager, cleanup and exit.
|
||||
server_log->Log(log_error, "Client Manager Failed to Start.");
|
||||
server_log->Log(log_debug, "Server Manager Shutdown.");
|
||||
delete server.SM;
|
||||
Log.Out(Logs::General, Logs::Error, "Client Manager Failed to Start.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Server Manager Shutdown.");
|
||||
delete server.server_manager;
|
||||
|
||||
#ifdef WIN32
|
||||
server_log->Log(log_debug, "Encryption System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Encryption System Shutdown.");
|
||||
delete server.eq_crypto;
|
||||
#endif
|
||||
server_log->Log(log_debug, "Database System Shutdown.");
|
||||
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Database System Shutdown.");
|
||||
delete server.db;
|
||||
server_log->Log(log_debug, "Config System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
server_log->Log(log_debug, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -247,30 +194,29 @@ int main()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
server_log->Log(log_debug, "Server Started.");
|
||||
while(run_server)
|
||||
{
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Server Started.");
|
||||
while (run_server) {
|
||||
Timer::SetCurrentTime();
|
||||
server.CM->Process();
|
||||
server.SM->Process();
|
||||
server.client_manager->Process();
|
||||
server.server_manager->Process();
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
server_log->Log(log_debug, "Server Shutdown.");
|
||||
server_log->Log(log_debug, "Client Manager Shutdown.");
|
||||
delete server.CM;
|
||||
server_log->Log(log_debug, "Server Manager Shutdown.");
|
||||
delete server.SM;
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Server Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Client Manager Shutdown.");
|
||||
delete server.client_manager;
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Server Manager Shutdown.");
|
||||
delete server.server_manager;
|
||||
|
||||
#ifdef WIN32
|
||||
server_log->Log(log_debug, "Encryption System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Encryption System Shutdown.");
|
||||
delete server.eq_crypto;
|
||||
#endif
|
||||
server_log->Log(log_debug, "Database System Shutdown.");
|
||||
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Database System Shutdown.");
|
||||
delete server.db;
|
||||
server_log->Log(log_debug, "Config System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
server_log->Log(log_debug, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -17,11 +17,12 @@
|
||||
*/
|
||||
#include "server_manager.h"
|
||||
#include "login_server.h"
|
||||
#include "error_log.h"
|
||||
#include "login_structures.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
extern EQEmuLogSys Log;
|
||||
extern LoginServer server;
|
||||
extern bool run_server;
|
||||
|
||||
@ -31,21 +32,18 @@ ServerManager::ServerManager()
|
||||
|
||||
int listen_port = atoi(server.config->GetVariable("options", "listen_port").c_str());
|
||||
tcps = new EmuTCPServer(listen_port, true);
|
||||
if(tcps->Open(listen_port, error_buffer))
|
||||
{
|
||||
server_log->Log(log_network, "ServerManager listening on port %u", listen_port);
|
||||
if(tcps->Open(listen_port, error_buffer)) {
|
||||
Log.Out(Logs::General, Logs::Login_Server, "ServerManager listening on port %u", listen_port);
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_error, "ServerManager fatal error opening port on %u: %s", listen_port, error_buffer);
|
||||
else {
|
||||
Log.Out(Logs::General, Logs::Error, "ServerManager fatal error opening port on %u: %s", listen_port, error_buffer);
|
||||
run_server = false;
|
||||
}
|
||||
}
|
||||
|
||||
ServerManager::~ServerManager()
|
||||
{
|
||||
if(tcps)
|
||||
{
|
||||
if (tcps) {
|
||||
tcps->Close();
|
||||
delete tcps;
|
||||
}
|
||||
@ -55,38 +53,32 @@ void ServerManager::Process()
|
||||
{
|
||||
ProcessDisconnect();
|
||||
EmuTCPConnection *tcp_c = nullptr;
|
||||
while(tcp_c = tcps->NewQueuePop())
|
||||
{
|
||||
while (tcp_c = tcps->NewQueuePop()) {
|
||||
in_addr tmp;
|
||||
tmp.s_addr = tcp_c->GetrIP();
|
||||
server_log->Log(log_network, "New world server connection from %s:%d", inet_ntoa(tmp), tcp_c->GetrPort());
|
||||
Log.Out(Logs::General, Logs::Login_Server, "New world server connection from %s:%d", inet_ntoa(tmp), tcp_c->GetrPort());
|
||||
|
||||
WorldServer *cur = GetServerByAddress(tcp_c->GetrIP());
|
||||
if(cur)
|
||||
{
|
||||
server_log->Log(log_network, "World server already existed for %s, removing existing connection and updating current.", inet_ntoa(tmp));
|
||||
cur->GetConnection()->Free();
|
||||
cur->SetConnection(tcp_c);
|
||||
cur->Reset();
|
||||
WorldServer *server_entity = GetServerByAddress(tcp_c->GetrIP());
|
||||
if (server_entity) {
|
||||
Log.Out(Logs::General, Logs::Login_Server, "World server already existed for %s, removing existing connection and updating current.", inet_ntoa(tmp));
|
||||
server_entity->GetConnection()->Free();
|
||||
server_entity->SetConnection(tcp_c);
|
||||
server_entity->Reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
WorldServer *w = new WorldServer(tcp_c);
|
||||
world_servers.push_back(w);
|
||||
}
|
||||
}
|
||||
|
||||
list<WorldServer*>::iterator iter = world_servers.begin();
|
||||
while(iter != world_servers.end())
|
||||
{
|
||||
if((*iter)->Process() == false)
|
||||
{
|
||||
server_log->Log(log_world, "World server %s had a fatal error and had to be removed from the login.", (*iter)->GetLongName().c_str());
|
||||
while (iter != world_servers.end()) {
|
||||
if ((*iter)->Process() == false) {
|
||||
Log.Out(Logs::General, Logs::World_Server, "World server %s had a fatal error and had to be removed from the login.", (*iter)->GetLongName().c_str());
|
||||
delete (*iter);
|
||||
iter = world_servers.erase(iter);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
@ -95,20 +87,17 @@ void ServerManager::Process()
|
||||
void ServerManager::ProcessDisconnect()
|
||||
{
|
||||
list<WorldServer*>::iterator iter = world_servers.begin();
|
||||
while(iter != world_servers.end())
|
||||
{
|
||||
EmuTCPConnection *c = (*iter)->GetConnection();
|
||||
if(!c->Connected())
|
||||
{
|
||||
while (iter != world_servers.end()) {
|
||||
EmuTCPConnection *connection = (*iter)->GetConnection();
|
||||
if (!connection->Connected()) {
|
||||
in_addr tmp;
|
||||
tmp.s_addr = c->GetrIP();
|
||||
server_log->Log(log_network, "World server disconnected from the server, removing server and freeing connection.");
|
||||
c->Free();
|
||||
tmp.s_addr = connection->GetrIP();
|
||||
Log.Out(Logs::General, Logs::Login_Server, "World server disconnected from the server, removing server and freeing connection.");
|
||||
connection->Free();
|
||||
delete (*iter);
|
||||
iter = world_servers.erase(iter);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
@ -117,10 +106,8 @@ void ServerManager::ProcessDisconnect()
|
||||
WorldServer* ServerManager::GetServerByAddress(unsigned int address)
|
||||
{
|
||||
list<WorldServer*>::iterator iter = world_servers.begin();
|
||||
while(iter != world_servers.end())
|
||||
{
|
||||
if((*iter)->GetConnection()->GetrIP() == address)
|
||||
{
|
||||
while (iter != world_servers.end()) {
|
||||
if ((*iter)->GetConnection()->GetrIP() == address) {
|
||||
return (*iter);
|
||||
}
|
||||
++iter;
|
||||
@ -138,10 +125,8 @@ EQApplicationPacket *ServerManager::CreateServerListPacket(Client *c)
|
||||
string client_ip = inet_ntoa(in);
|
||||
|
||||
list<WorldServer*>::iterator iter = world_servers.begin();
|
||||
while(iter != world_servers.end())
|
||||
{
|
||||
if((*iter)->IsAuthorized() == false)
|
||||
{
|
||||
while (iter != world_servers.end()) {
|
||||
if ((*iter)->IsAuthorized() == false) {
|
||||
++iter;
|
||||
continue;
|
||||
}
|
||||
@ -149,16 +134,13 @@ EQApplicationPacket *ServerManager::CreateServerListPacket(Client *c)
|
||||
in.s_addr = (*iter)->GetConnection()->GetrIP();
|
||||
string world_ip = inet_ntoa(in);
|
||||
|
||||
if(world_ip.compare(client_ip) == 0)
|
||||
{
|
||||
if (world_ip.compare(client_ip) == 0) {
|
||||
packet_size += (*iter)->GetLongName().size() + (*iter)->GetLocalIP().size() + 24;
|
||||
}
|
||||
else if(client_ip.find(server.options.GetLocalNetwork()) != string::npos)
|
||||
{
|
||||
else if (client_ip.find(server.options.GetLocalNetwork()) != string::npos) {
|
||||
packet_size += (*iter)->GetLongName().size() + (*iter)->GetLocalIP().size() + 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
packet_size += (*iter)->GetLongName().size() + (*iter)->GetRemoteIP().size() + 24;
|
||||
}
|
||||
|
||||
@ -167,98 +149,87 @@ EQApplicationPacket *ServerManager::CreateServerListPacket(Client *c)
|
||||
}
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_ServerListResponse, packet_size);
|
||||
ServerListHeader_Struct *sl = (ServerListHeader_Struct*)outapp->pBuffer;
|
||||
sl->Unknown1 = 0x00000004;
|
||||
sl->Unknown2 = 0x00000000;
|
||||
sl->Unknown3 = 0x01650000;
|
||||
/**
|
||||
* Not sure what this is but it should be noted setting it to
|
||||
* 0xFFFFFFFF crashes the client so: don't do that.
|
||||
*/
|
||||
sl->Unknown4 = 0x00000000;
|
||||
sl->NumberOfServers = server_count;
|
||||
ServerListHeader_Struct *server_list = (ServerListHeader_Struct*)outapp->pBuffer;
|
||||
server_list->Unknown1 = 0x00000004;
|
||||
server_list->Unknown2 = 0x00000000;
|
||||
server_list->Unknown3 = 0x01650000;
|
||||
|
||||
unsigned char *data_ptr = outapp->pBuffer;
|
||||
data_ptr += sizeof(ServerListHeader_Struct);
|
||||
/**
|
||||
* Not sure what this is but it should be noted setting it to
|
||||
* 0xFFFFFFFF crashes the client so: don't do that.
|
||||
*/
|
||||
server_list->Unknown4 = 0x00000000;
|
||||
server_list->NumberOfServers = server_count;
|
||||
|
||||
unsigned char *data_pointer = outapp->pBuffer;
|
||||
data_pointer += sizeof(ServerListHeader_Struct);
|
||||
|
||||
iter = world_servers.begin();
|
||||
while(iter != world_servers.end())
|
||||
{
|
||||
if((*iter)->IsAuthorized() == false)
|
||||
{
|
||||
while (iter != world_servers.end()) {
|
||||
if ((*iter)->IsAuthorized() == false) {
|
||||
++iter;
|
||||
continue;
|
||||
}
|
||||
|
||||
in.s_addr = (*iter)->GetConnection()->GetrIP();
|
||||
string world_ip = inet_ntoa(in);
|
||||
if(world_ip.compare(client_ip) == 0)
|
||||
{
|
||||
memcpy(data_ptr, (*iter)->GetLocalIP().c_str(), (*iter)->GetLocalIP().size());
|
||||
data_ptr += ((*iter)->GetLocalIP().size() + 1);
|
||||
if (world_ip.compare(client_ip) == 0) {
|
||||
memcpy(data_pointer, (*iter)->GetLocalIP().c_str(), (*iter)->GetLocalIP().size());
|
||||
data_pointer += ((*iter)->GetLocalIP().size() + 1);
|
||||
}
|
||||
else if(client_ip.find(server.options.GetLocalNetwork()) != string::npos)
|
||||
{
|
||||
memcpy(data_ptr, (*iter)->GetLocalIP().c_str(), (*iter)->GetLocalIP().size());
|
||||
data_ptr += ((*iter)->GetLocalIP().size() + 1);
|
||||
else if (client_ip.find(server.options.GetLocalNetwork()) != string::npos) {
|
||||
memcpy(data_pointer, (*iter)->GetLocalIP().c_str(), (*iter)->GetLocalIP().size());
|
||||
data_pointer += ((*iter)->GetLocalIP().size() + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(data_ptr, (*iter)->GetRemoteIP().c_str(), (*iter)->GetRemoteIP().size());
|
||||
data_ptr += ((*iter)->GetRemoteIP().size() + 1);
|
||||
else {
|
||||
memcpy(data_pointer, (*iter)->GetRemoteIP().c_str(), (*iter)->GetRemoteIP().size());
|
||||
data_pointer += ((*iter)->GetRemoteIP().size() + 1);
|
||||
}
|
||||
|
||||
switch((*iter)->GetServerListID())
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
*(unsigned int*)data_ptr = 0x00000030;
|
||||
switch ((*iter)->GetServerListID()) {
|
||||
case 1: {
|
||||
*(unsigned int*)data_pointer = 0x00000030;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
*(unsigned int*)data_ptr = 0x00000009;
|
||||
case 2: {
|
||||
*(unsigned int*)data_pointer = 0x00000009;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
*(unsigned int*)data_ptr = 0x00000001;
|
||||
default: {
|
||||
*(unsigned int*)data_pointer = 0x00000001;
|
||||
}
|
||||
}
|
||||
data_ptr += 4;
|
||||
|
||||
*(unsigned int*)data_ptr = (*iter)->GetRuntimeID();
|
||||
data_ptr += 4;
|
||||
data_pointer += 4;
|
||||
|
||||
memcpy(data_ptr, (*iter)->GetLongName().c_str(), (*iter)->GetLongName().size());
|
||||
data_ptr += ((*iter)->GetLongName().size() + 1);
|
||||
*(unsigned int*)data_pointer = (*iter)->GetRuntimeID();
|
||||
data_pointer += 4;
|
||||
|
||||
memcpy(data_ptr, "EN", 2);
|
||||
data_ptr += 3;
|
||||
memcpy(data_pointer, (*iter)->GetLongName().c_str(), (*iter)->GetLongName().size());
|
||||
data_pointer += ((*iter)->GetLongName().size() + 1);
|
||||
|
||||
memcpy(data_ptr, "US", 2);
|
||||
data_ptr += 3;
|
||||
memcpy(data_pointer, "EN", 2);
|
||||
data_pointer += 3;
|
||||
|
||||
memcpy(data_pointer, "US", 2);
|
||||
data_pointer += 3;
|
||||
|
||||
// 0 = Up, 1 = Down, 2 = Up, 3 = down, 4 = locked, 5 = locked(down)
|
||||
if((*iter)->GetStatus() < 0)
|
||||
{
|
||||
if((*iter)->GetZonesBooted() == 0)
|
||||
{
|
||||
*(uint32*)data_ptr = 0x01;
|
||||
if ((*iter)->GetStatus() < 0) {
|
||||
if ((*iter)->GetZonesBooted() == 0) {
|
||||
*(uint32*)data_pointer = 0x01;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(uint32*)data_ptr = 0x04;
|
||||
else {
|
||||
*(uint32*)data_pointer = 0x04;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*(uint32*)data_ptr = 0x02;
|
||||
else {
|
||||
*(uint32*)data_pointer = 0x02;
|
||||
}
|
||||
data_ptr += 4;
|
||||
data_pointer += 4;
|
||||
|
||||
*(uint32*)data_ptr = (*iter)->GetPlayersOnline();
|
||||
data_ptr += 4;
|
||||
*(uint32*)data_pointer = (*iter)->GetPlayersOnline();
|
||||
data_pointer += 4;
|
||||
|
||||
++iter;
|
||||
}
|
||||
@ -270,10 +241,8 @@ void ServerManager::SendUserToWorldRequest(unsigned int server_id, unsigned int
|
||||
{
|
||||
list<WorldServer*>::iterator iter = world_servers.begin();
|
||||
bool found = false;
|
||||
while(iter != world_servers.end())
|
||||
{
|
||||
if((*iter)->GetRuntimeID() == server_id)
|
||||
{
|
||||
while (iter != world_servers.end()) {
|
||||
if ((*iter)->GetRuntimeID() == server_id) {
|
||||
ServerPacket *outapp = new ServerPacket(ServerOP_UsertoWorldReq, sizeof(UsertoWorldRequest_Struct));
|
||||
UsertoWorldRequest_Struct *utwr = (UsertoWorldRequest_Struct*)outapp->pBuffer;
|
||||
utwr->worldid = server_id;
|
||||
@ -281,8 +250,7 @@ void ServerManager::SendUserToWorldRequest(unsigned int server_id, unsigned int
|
||||
(*iter)->GetConnection()->SendPacket(outapp);
|
||||
found = true;
|
||||
|
||||
if(server.options.IsDumpInPacketsOn())
|
||||
{
|
||||
if (server.options.IsDumpInPacketsOn()) {
|
||||
DumpPacket(outapp);
|
||||
}
|
||||
delete outapp;
|
||||
@ -290,25 +258,21 @@ void ServerManager::SendUserToWorldRequest(unsigned int server_id, unsigned int
|
||||
++iter;
|
||||
}
|
||||
|
||||
if(!found && server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_client_error, "Client requested a user to world but supplied an invalid id of %u.", server_id);
|
||||
if (!found && server.options.IsTraceOn()) {
|
||||
Log.Out(Logs::General, Logs::Error, "Client requested a user to world but supplied an invalid id of %u.", server_id);
|
||||
}
|
||||
}
|
||||
|
||||
bool ServerManager::ServerExists(string l_name, string s_name, WorldServer *ignore)
|
||||
{
|
||||
list<WorldServer*>::iterator iter = world_servers.begin();
|
||||
while(iter != world_servers.end())
|
||||
{
|
||||
if((*iter) == ignore)
|
||||
{
|
||||
while (iter != world_servers.end()) {
|
||||
if ((*iter) == ignore) {
|
||||
++iter;
|
||||
continue;
|
||||
}
|
||||
|
||||
if((*iter)->GetLongName().compare(l_name) == 0 && (*iter)->GetShortName().compare(s_name) == 0)
|
||||
{
|
||||
if ((*iter)->GetLongName().compare(l_name) == 0 && (*iter)->GetShortName().compare(s_name) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -320,18 +284,14 @@ bool ServerManager::ServerExists(string l_name, string s_name, WorldServer *igno
|
||||
void ServerManager::DestroyServerByName(string l_name, string s_name, WorldServer *ignore)
|
||||
{
|
||||
list<WorldServer*>::iterator iter = world_servers.begin();
|
||||
while(iter != world_servers.end())
|
||||
{
|
||||
if((*iter) == ignore)
|
||||
{
|
||||
while (iter != world_servers.end()) {
|
||||
if ((*iter) == ignore) {
|
||||
++iter;
|
||||
}
|
||||
|
||||
if((*iter)->GetLongName().compare(l_name) == 0 && (*iter)->GetShortName().compare(s_name) == 0)
|
||||
{
|
||||
if ((*iter)->GetLongName().compare(l_name) == 0 && (*iter)->GetShortName().compare(s_name) == 0) {
|
||||
EmuTCPConnection *c = (*iter)->GetConnection();
|
||||
if(c->Connected())
|
||||
{
|
||||
if (c->Connected()) {
|
||||
c->Disconnect();
|
||||
}
|
||||
c->Free();
|
||||
@ -341,5 +301,4 @@ void ServerManager::DestroyServerByName(string l_name, string s_name, WorldServe
|
||||
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -16,11 +16,13 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "world_server.h"
|
||||
#include "error_log.h"
|
||||
#include "login_server.h"
|
||||
#include "login_structures.h"
|
||||
#include "config.h"
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
extern EQEmuLogSys Log;
|
||||
extern LoginServer server;
|
||||
|
||||
WorldServer::WorldServer(EmuTCPConnection *c)
|
||||
@ -28,19 +30,18 @@ WorldServer::WorldServer(EmuTCPConnection *c)
|
||||
connection = c;
|
||||
zones_booted = 0;
|
||||
players_online = 0;
|
||||
status = 0;
|
||||
server_status = 0;
|
||||
runtime_id = 0;
|
||||
server_list_id = 0;
|
||||
server_type = 0;
|
||||
authorized = false;
|
||||
trusted = false;
|
||||
logged_in = false;
|
||||
is_server_authorized = false;
|
||||
is_server_trusted = false;
|
||||
is_server_logged_in = false;
|
||||
}
|
||||
|
||||
WorldServer::~WorldServer()
|
||||
{
|
||||
if(connection)
|
||||
{
|
||||
if(connection) {
|
||||
connection->Free();
|
||||
}
|
||||
}
|
||||
@ -49,12 +50,12 @@ void WorldServer::Reset()
|
||||
{
|
||||
zones_booted = 0;
|
||||
players_online = 0;
|
||||
status = 0;
|
||||
server_status = 0;
|
||||
runtime_id;
|
||||
server_list_id = 0;
|
||||
server_type = 0;
|
||||
authorized = false;
|
||||
logged_in = false;
|
||||
is_server_authorized = false;
|
||||
is_server_logged_in = false;
|
||||
}
|
||||
|
||||
bool WorldServer::Process()
|
||||
@ -64,7 +65,7 @@ bool WorldServer::Process()
|
||||
{
|
||||
if(server.options.IsWorldTraceOn())
|
||||
{
|
||||
server_log->Log(log_network_trace, "Application packet received from server: 0x%.4X, (size %u)", app->opcode, app->size);
|
||||
Log.Out(Logs::General, Logs::Netcode, "Application packet received from server: 0x%.4X, (size %u)", app->opcode, app->size);
|
||||
}
|
||||
|
||||
if(server.options.IsDumpInPacketsOn())
|
||||
@ -78,14 +79,14 @@ bool WorldServer::Process()
|
||||
{
|
||||
if(app->size < sizeof(ServerNewLSInfo_Struct))
|
||||
{
|
||||
server_log->Log(log_network_error, "Received application packet from server that had opcode ServerOP_NewLSInfo, "
|
||||
Log.Out(Logs::General, Logs::Error, "Received application packet from server that had opcode ServerOP_NewLSInfo, "
|
||||
"but was too small. Discarded to avoid buffer overrun.");
|
||||
break;
|
||||
}
|
||||
|
||||
if(server.options.IsWorldTraceOn())
|
||||
{
|
||||
server_log->Log(log_network_trace, "New Login Info Recieved.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "New Login Info Recieved.");
|
||||
}
|
||||
|
||||
ServerNewLSInfo_Struct *info = (ServerNewLSInfo_Struct*)app->pBuffer;
|
||||
@ -96,14 +97,14 @@ bool WorldServer::Process()
|
||||
{
|
||||
if(app->size < sizeof(ServerLSStatus_Struct))
|
||||
{
|
||||
server_log->Log(log_network_error, "Recieved application packet from server that had opcode ServerOP_LSStatus, "
|
||||
Log.Out(Logs::General, Logs::Error, "Recieved application packet from server that had opcode ServerOP_LSStatus, "
|
||||
"but was too small. Discarded to avoid buffer overrun.");
|
||||
break;
|
||||
}
|
||||
|
||||
if(server.options.IsWorldTraceOn())
|
||||
{
|
||||
server_log->Log(log_network_trace, "World Server Status Recieved.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "World Server Status Recieved.");
|
||||
}
|
||||
|
||||
ServerLSStatus_Struct *ls_status = (ServerLSStatus_Struct*)app->pBuffer;
|
||||
@ -127,7 +128,7 @@ bool WorldServer::Process()
|
||||
{
|
||||
if(app->size < sizeof(UsertoWorldResponse_Struct))
|
||||
{
|
||||
server_log->Log(log_network_error, "Recieved application packet from server that had opcode ServerOP_UsertoWorldResp, "
|
||||
Log.Out(Logs::General, Logs::Error, "Recieved application packet from server that had opcode ServerOP_UsertoWorldResp, "
|
||||
"but was too small. Discarded to avoid buffer overrun.");
|
||||
break;
|
||||
}
|
||||
@ -137,21 +138,22 @@ bool WorldServer::Process()
|
||||
//While keeping world server spam with multiple servers connected almost impossible.
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network_trace, "User-To-World Response received.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "User-To-World Response received.");
|
||||
}
|
||||
|
||||
UsertoWorldResponse_Struct *utwr = (UsertoWorldResponse_Struct*)app->pBuffer;
|
||||
server_log->Log(log_client, "Trying to find client with user id of %u.", utwr->lsaccountid);
|
||||
Client *c = server.CM->GetClient(utwr->lsaccountid);
|
||||
Log.Out(Logs::General, Logs::Debug, "Trying to find client with user id of %u.", utwr->lsaccountid);
|
||||
Client *c = server.client_manager->GetClient(utwr->lsaccountid);
|
||||
if(c)
|
||||
{
|
||||
server_log->Log(log_client, "Found client with user id of %u and account name of %s.", utwr->lsaccountid, c->GetAccountName().c_str());
|
||||
Log.Out(Logs::General, Logs::Debug, "Found client with user id of %u and account name of %s.", utwr->lsaccountid, c->GetAccountName().c_str());
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_PlayEverquestResponse, sizeof(PlayEverquestResponse_Struct));
|
||||
PlayEverquestResponse_Struct *per = (PlayEverquestResponse_Struct*)outapp->pBuffer;
|
||||
per->Sequence = c->GetPlaySequence();
|
||||
per->ServerNumber = c->GetPlayServerID();
|
||||
server_log->Log(log_client, "Found sequence and play of %u %u", c->GetPlaySequence(), c->GetPlayServerID());
|
||||
server_log->LogPacket(log_network_trace, (const char*)outapp->pBuffer, outapp->size);
|
||||
Log.Out(Logs::General, Logs::Debug, "Found sequence and play of %u %u", c->GetPlaySequence(), c->GetPlayServerID());
|
||||
|
||||
Log.Out(Logs::General, Logs::Netcode, "[Size: %u] %s", outapp->size, DumpPacketToString(outapp).c_str());
|
||||
|
||||
if(utwr->response > 0)
|
||||
{
|
||||
@ -180,9 +182,9 @@ bool WorldServer::Process()
|
||||
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network_trace, "Sending play response with following data, allowed %u, sequence %u, server number %u, message %u",
|
||||
Log.Out(Logs::General, Logs::Netcode, "Sending play response with following data, allowed %u, sequence %u, server number %u, message %u",
|
||||
per->Allowed, per->Sequence, per->ServerNumber, per->Message);
|
||||
server_log->LogPacket(log_network_trace, (const char*)outapp->pBuffer, outapp->size);
|
||||
Log.Out(Logs::General, Logs::Netcode, "[Size: %u] %s", outapp->size, DumpPacketToString(outapp).c_str());
|
||||
}
|
||||
|
||||
if(server.options.IsDumpOutPacketsOn())
|
||||
@ -195,7 +197,7 @@ bool WorldServer::Process()
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_client_error, "Recieved User-To-World Response for %u but could not find the client referenced!.", utwr->lsaccountid);
|
||||
Log.Out(Logs::General, Logs::Error, "Recieved User-To-World Response for %u but could not find the client referenced!.", utwr->lsaccountid);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -203,16 +205,16 @@ bool WorldServer::Process()
|
||||
{
|
||||
if(app->size < sizeof(ServerLSAccountUpdate_Struct))
|
||||
{
|
||||
server_log->Log(log_network_error, "Recieved application packet from server that had opcode ServerLSAccountUpdate_Struct, "
|
||||
Log.Out(Logs::General, Logs::Error, "Recieved application packet from server that had opcode ServerLSAccountUpdate_Struct, "
|
||||
"but was too small. Discarded to avoid buffer overrun.");
|
||||
break;
|
||||
}
|
||||
|
||||
server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate packet received from: %s", short_name.c_str());
|
||||
Log.Out(Logs::General, Logs::Netcode, "ServerOP_LSAccountUpdate packet received from: %s", short_name.c_str());
|
||||
ServerLSAccountUpdate_Struct *lsau = (ServerLSAccountUpdate_Struct*)app->pBuffer;
|
||||
if(trusted)
|
||||
if(is_server_trusted)
|
||||
{
|
||||
server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate update processed for: %s", lsau->useraccount);
|
||||
Log.Out(Logs::General, Logs::Netcode, "ServerOP_LSAccountUpdate update processed for: %s", lsau->useraccount);
|
||||
string name;
|
||||
string password;
|
||||
string email;
|
||||
@ -225,7 +227,7 @@ bool WorldServer::Process()
|
||||
}
|
||||
default:
|
||||
{
|
||||
server_log->Log(log_network_error, "Recieved application packet from server that had an unknown operation code 0x%.4X.", app->opcode);
|
||||
Log.Out(Logs::General, Logs::Error, "Recieved application packet from server that had an unknown operation code 0x%.4X.", app->opcode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,9 +239,9 @@ bool WorldServer::Process()
|
||||
|
||||
void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
{
|
||||
if(logged_in)
|
||||
if(is_server_logged_in)
|
||||
{
|
||||
server_log->Log(log_network_error, "WorldServer::Handle_NewLSInfo called but the login server was already marked as logged in, aborting.");
|
||||
Log.Out(Logs::General, Logs::Error, "WorldServer::Handle_NewLSInfo called but the login server was already marked as logged in, aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -249,7 +251,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, account name was too long.");
|
||||
Log.Out(Logs::General, Logs::Error, "Handle_NewLSInfo error, account name was too long.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -259,7 +261,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, account password was too long.");
|
||||
Log.Out(Logs::General, Logs::Error, "Handle_NewLSInfo error, account password was too long.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -269,7 +271,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, long name was too long.");
|
||||
Log.Out(Logs::General, Logs::Error, "Handle_NewLSInfo error, long name was too long.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -279,7 +281,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, short name was too long.");
|
||||
Log.Out(Logs::General, Logs::Error, "Handle_NewLSInfo error, short name was too long.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -287,7 +289,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
{
|
||||
if(strlen(i->local_address) == 0)
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, local address was null, defaulting to localhost");
|
||||
Log.Out(Logs::General, Logs::Error, "Handle_NewLSInfo error, local address was null, defaulting to localhost");
|
||||
local_ip = "127.0.0.1";
|
||||
}
|
||||
else
|
||||
@ -297,7 +299,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, local address was too long.");
|
||||
Log.Out(Logs::General, Logs::Error, "Handle_NewLSInfo error, local address was too long.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -308,7 +310,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
in_addr in;
|
||||
in.s_addr = GetConnection()->GetrIP();
|
||||
remote_ip = inet_ntoa(in);
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, remote address was null, defaulting to stream address %s.", remote_ip.c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Handle_NewLSInfo error, remote address was null, defaulting to stream address %s.", remote_ip.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -320,7 +322,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
in_addr in;
|
||||
in.s_addr = GetConnection()->GetrIP();
|
||||
remote_ip = inet_ntoa(in);
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, remote address was too long, defaulting to stream address %s.", remote_ip.c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Handle_NewLSInfo error, remote address was too long, defaulting to stream address %s.", remote_ip.c_str());
|
||||
}
|
||||
|
||||
if(strlen(i->serverversion) <= 64)
|
||||
@ -329,7 +331,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, server version was too long.");
|
||||
Log.Out(Logs::General, Logs::Error, "Handle_NewLSInfo error, server version was too long.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -339,27 +341,27 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, protocol version was too long.");
|
||||
Log.Out(Logs::General, Logs::Error, "Handle_NewLSInfo error, protocol version was too long.");
|
||||
return;
|
||||
}
|
||||
|
||||
server_type = i->servertype;
|
||||
logged_in = true;
|
||||
is_server_logged_in = true;
|
||||
|
||||
if(server.options.IsRejectingDuplicateServers())
|
||||
{
|
||||
if(server.SM->ServerExists(long_name, short_name, this))
|
||||
if(server.server_manager->ServerExists(long_name, short_name, this))
|
||||
{
|
||||
server_log->Log(log_world_error, "World tried to login but there already exists a server that has that name.");
|
||||
Log.Out(Logs::General, Logs::Error, "World tried to login but there already exists a server that has that name.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(server.SM->ServerExists(long_name, short_name, this))
|
||||
if(server.server_manager->ServerExists(long_name, short_name, this))
|
||||
{
|
||||
server_log->Log(log_world_error, "World tried to login but there already exists a server that has that name.");
|
||||
server.SM->DestroyServerByName(long_name, short_name, this);
|
||||
Log.Out(Logs::General, Logs::Error, "World tried to login but there already exists a server that has that name.");
|
||||
server.server_manager->DestroyServerByName(long_name, short_name, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -378,112 +380,112 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
{
|
||||
if(s_acct_name.size() == 0 || s_acct_pass.size() == 0)
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) successfully logged into account that had no user/password requirement.",
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) successfully logged into account that had no user/password requirement.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
authorized = true;
|
||||
is_server_authorized = true;
|
||||
SetRuntimeID(s_id);
|
||||
server_list_id = s_list_type;
|
||||
desc = s_desc;
|
||||
}
|
||||
else if(s_acct_name.compare(account_name) == 0 && s_acct_pass.compare(account_password) == 0)
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) successfully logged in.",
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) successfully logged in.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
authorized = true;
|
||||
is_server_authorized = true;
|
||||
SetRuntimeID(s_id);
|
||||
server_list_id = s_list_type;
|
||||
desc = s_desc;
|
||||
if(s_trusted)
|
||||
{
|
||||
server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate sent to world");
|
||||
trusted = true;
|
||||
if(s_trusted) {
|
||||
Log.Out(Logs::General, Logs::Netcode, "ServerOP_LSAccountUpdate sent to world");
|
||||
is_server_trusted = true;
|
||||
ServerPacket *outapp = new ServerPacket(ServerOP_LSAccountUpdate, 0);
|
||||
connection->SendPacket(outapp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) attempted to log in but account and password did not match the entry in the database, and only"
|
||||
else {
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) attempted to log in but account and password did not match the entry in the database, and only"
|
||||
" registered servers are allowed.", long_name.c_str(), short_name.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry and only registered servers are allowed.",
|
||||
else {
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) attempted to log in but database couldn't find an entry and only registered servers are allowed.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) did not attempt to log in but only registered servers are allowed.",
|
||||
else {
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) did not attempt to log in but only registered servers are allowed.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int s_id = 0;
|
||||
unsigned int s_list_type = 0;
|
||||
unsigned int s_trusted = 0;
|
||||
string s_desc;
|
||||
string s_list_desc;
|
||||
string s_acct_name;
|
||||
string s_acct_pass;
|
||||
if(server.db->GetWorldRegistration(long_name, short_name, s_id, s_desc, s_list_type, s_trusted, s_list_desc, s_acct_name, s_acct_pass))
|
||||
else {
|
||||
unsigned int server_id = 0;
|
||||
unsigned int server_list_type = 0;
|
||||
unsigned int is_server_trusted = 0;
|
||||
string server_description;
|
||||
string server_list_description;
|
||||
string server_account_name;
|
||||
string server_account_password;
|
||||
|
||||
|
||||
if(server.db->GetWorldRegistration(
|
||||
long_name,
|
||||
short_name,
|
||||
server_id,
|
||||
server_description,
|
||||
server_list_type,
|
||||
is_server_trusted,
|
||||
server_list_description,
|
||||
server_account_name,
|
||||
server_account_password))
|
||||
{
|
||||
if(account_name.size() > 0 && account_password.size() > 0)
|
||||
{
|
||||
if(s_acct_name.compare(account_name) == 0 && s_acct_pass.compare(account_password) == 0)
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) successfully logged in.",
|
||||
|
||||
if(account_name.size() > 0 && account_password.size() > 0) {
|
||||
if(server_account_name.compare(account_name) == 0 && server_account_password.compare(account_password) == 0) {
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) successfully logged in.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
authorized = true;
|
||||
SetRuntimeID(s_id);
|
||||
server_list_id = s_list_type;
|
||||
desc = s_desc;
|
||||
if(s_trusted)
|
||||
{
|
||||
server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate sent to world");
|
||||
trusted = true;
|
||||
is_server_authorized = true;
|
||||
SetRuntimeID(server_id);
|
||||
server_list_id = server_list_type;
|
||||
desc = server_description;
|
||||
|
||||
if(is_server_trusted) {
|
||||
Log.Out(Logs::General, Logs::Netcode, "ServerOP_LSAccountUpdate sent to world");
|
||||
is_server_trusted = true;
|
||||
ServerPacket *outapp = new ServerPacket(ServerOP_LSAccountUpdate, 0);
|
||||
connection->SendPacket(outapp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// this is the first of two cases where we should deny access even if unregistered is allowed
|
||||
server_log->Log(log_world, "Server %s(%s) attempted to log in but account and password did not match the entry in the database.",
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) attempted to log in but account and password did not match the entry in the database.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(s_acct_name.size() > 0 || s_acct_pass.size() > 0)
|
||||
{
|
||||
else {
|
||||
if(server_account_name.size() > 0 || server_account_password.size() > 0) {
|
||||
// this is the second of two cases where we should deny access even if unregistered is allowed
|
||||
server_log->Log(log_world, "Server %s(%s) did not attempt to log in but this server requires a password.",
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) did not attempt to log in but this server requires a password.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) did not attempt to log in but unregistered servers are allowed.",
|
||||
else {
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) did not attempt to log in but unregistered servers are allowed.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
authorized = true;
|
||||
SetRuntimeID(s_id);
|
||||
is_server_authorized = true;
|
||||
SetRuntimeID(server_id);
|
||||
server_list_id = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry but unregistered servers are allowed.",
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) attempted to log in but database couldn't find an entry but unregistered servers are allowed.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
if(server.db->CreateWorldRegistration(long_name, short_name, s_id))
|
||||
{
|
||||
authorized = true;
|
||||
SetRuntimeID(s_id);
|
||||
if(server.db->CreateWorldRegistration(long_name, short_name, server_id)) {
|
||||
is_server_authorized = true;
|
||||
SetRuntimeID(server_id);
|
||||
server_list_id = 3;
|
||||
}
|
||||
}
|
||||
@ -493,9 +495,9 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
in.s_addr = connection->GetrIP();
|
||||
server.db->UpdateWorldRegistration(GetRuntimeID(), long_name, string(inet_ntoa(in)));
|
||||
|
||||
if(authorized)
|
||||
if(is_server_authorized)
|
||||
{
|
||||
server.CM->UpdateServerList();
|
||||
server.client_manager->UpdateServerList();
|
||||
}
|
||||
}
|
||||
|
||||
@ -503,43 +505,40 @@ void WorldServer::Handle_LSStatus(ServerLSStatus_Struct *s)
|
||||
{
|
||||
players_online = s->num_players;
|
||||
zones_booted = s->num_zones;
|
||||
status = s->status;
|
||||
server_status = s->status;
|
||||
}
|
||||
|
||||
void WorldServer::SendClientAuth(unsigned int ip, string account, string key, unsigned int account_id)
|
||||
{
|
||||
ServerPacket *outapp = new ServerPacket(ServerOP_LSClientAuth, sizeof(ServerLSClientAuth));
|
||||
ServerLSClientAuth* slsca = (ServerLSClientAuth*)outapp->pBuffer;
|
||||
ServerPacket *outapp = new ServerPacket(ServerOP_LSClientAuth, sizeof(ClientAuth_Struct));
|
||||
ClientAuth_Struct* client_auth = (ClientAuth_Struct*)outapp->pBuffer;
|
||||
|
||||
slsca->lsaccount_id = account_id;
|
||||
strncpy(slsca->name, account.c_str(), account.size() > 30 ? 30 : account.size());
|
||||
strncpy(slsca->key, key.c_str(), 10);
|
||||
slsca->lsadmin = 0;
|
||||
slsca->worldadmin = 0;
|
||||
slsca->ip = ip;
|
||||
client_auth->lsaccount_id = account_id;
|
||||
strncpy(client_auth->name, account.c_str(), account.size() > 30 ? 30 : account.size());
|
||||
strncpy(client_auth->key, key.c_str(), 10);
|
||||
client_auth->lsadmin = 0;
|
||||
client_auth->worldadmin = 0;
|
||||
client_auth->ip = ip;
|
||||
|
||||
in_addr in;
|
||||
in.s_addr = ip;connection->GetrIP();
|
||||
in.s_addr = ip; connection->GetrIP();
|
||||
string client_address(inet_ntoa(in));
|
||||
in.s_addr = connection->GetrIP();
|
||||
string world_address(inet_ntoa(in));
|
||||
|
||||
if(client_address.compare(world_address) == 0)
|
||||
{
|
||||
slsca->local = 1;
|
||||
if (client_address.compare(world_address) == 0) {
|
||||
client_auth->local = 1;
|
||||
}
|
||||
else if(client_address.find(server.options.GetLocalNetwork()) != string::npos)
|
||||
{
|
||||
slsca->local = 1;
|
||||
else if (client_address.find(server.options.GetLocalNetwork()) != string::npos) {
|
||||
client_auth->local = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
slsca->local = 0;
|
||||
else {
|
||||
client_auth->local = 0;
|
||||
}
|
||||
|
||||
connection->SendPacket(outapp);
|
||||
|
||||
if(server.options.IsDumpInPacketsOn())
|
||||
if (server.options.IsDumpInPacketsOn())
|
||||
{
|
||||
DumpPacket(outapp);
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ public:
|
||||
/**
|
||||
* Gets whether the server is authorized to show up on the server list or not.
|
||||
*/
|
||||
bool IsAuthorized() const { return authorized; }
|
||||
bool IsAuthorized() const { return is_server_authorized; }
|
||||
|
||||
/**
|
||||
* Gets the local ip of the server.
|
||||
@ -106,7 +106,7 @@ public:
|
||||
/**
|
||||
* Gets the status of the server.
|
||||
*/
|
||||
int GetStatus() const { return status; }
|
||||
int GetStatus() const { return server_status; }
|
||||
|
||||
/**
|
||||
* Gets the number of zones online on the server.
|
||||
@ -138,7 +138,7 @@ private:
|
||||
EmuTCPConnection *connection;
|
||||
unsigned int zones_booted;
|
||||
unsigned int players_online;
|
||||
int status;
|
||||
int server_status;
|
||||
unsigned int runtime_id;
|
||||
unsigned int server_list_id;
|
||||
unsigned int server_type;
|
||||
@ -151,9 +151,9 @@ private:
|
||||
std::string local_ip;
|
||||
std::string protocol;
|
||||
std::string version;
|
||||
bool authorized;
|
||||
bool logged_in;
|
||||
bool trusted;
|
||||
bool is_server_authorized;
|
||||
bool is_server_logged_in;
|
||||
bool is_server_trusted;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
135
utils/scripts/bot_command_spell_scripts/_blank_spells.sql
Normal file
135
utils/scripts/bot_command_spell_scripts/_blank_spells.sql
Normal file
@ -0,0 +1,135 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '1' AND `CastRestriction` = '0' THEN 'TargetOptional'
|
||||
WHEN `targettype` = '3' AND `CastRestriction` = '0' THEN 'GroupV1'
|
||||
WHEN `targettype` = '4' AND `CastRestriction` = '0' THEN 'AECaster'
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '0' THEN 'Single'
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '150' THEN 'Animal'
|
||||
WHEN `targettype` = '6' AND `CastRestriction` = '0' THEN 'Self'
|
||||
WHEN `targettype` = '8' AND `CastRestriction` = '0' THEN 'AETarget'
|
||||
WHEN `targettype` = '9' AND `CastRestriction` = '0' THEN 'Animal'
|
||||
WHEN `targettype` = '10' AND `CastRestriction` = '0' THEN 'Undead'
|
||||
WHEN `targettype` = '11' AND `CastRestriction` = '0' THEN 'Summoned'
|
||||
WHEN `targettype` = '13' AND `CastRestriction` = '0' THEN 'Tap'
|
||||
WHEN `targettype` = '14' AND `CastRestriction` = '0' THEN 'Pet'
|
||||
WHEN `targettype` = '15' AND `CastRestriction` = '0' THEN 'Corpse'
|
||||
WHEN `targettype` = '16' AND `CastRestriction` = '0' THEN 'Plant'
|
||||
WHEN `targettype` = '17' AND `CastRestriction` = '0' THEN 'Giant'
|
||||
WHEN `targettype` = '18' AND `CastRestriction` = '0' THEN 'Dragon'
|
||||
WHEN `targettype` = '34' AND `CastRestriction` = '0' THEN 'LDoNChest_Cursed'
|
||||
WHEN `targettype` = '38' AND `CastRestriction` = '0' THEN 'SummonedPet'
|
||||
WHEN `targettype` = '39' AND `CastRestriction` = '0' THEN 'GroupNoPets' -- V1 or V2?
|
||||
WHEN `targettype` = '40' AND `CastRestriction` = '0' THEN 'AEBard'
|
||||
WHEN `targettype` = '41' AND `CastRestriction` = '0' THEN 'GroupV2'
|
||||
WHEN `targettype` = '42' AND `CastRestriction` = '0' THEN 'Directional'
|
||||
WHEN `targettype` = '43' AND `CastRestriction` = '0' THEN 'GroupClientAndPet'
|
||||
WHEN `targettype` = '44' AND `CastRestriction` = '0' THEN 'Beam'
|
||||
WHEN `targettype` = '45' AND `CastRestriction` = '0' THEN 'Ring'
|
||||
WHEN `targettype` = '46' AND `CastRestriction` = '0' THEN 'TargetsTarget'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name
|
||||
-- base <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'WARRIOR' caster_class, `classes1` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes1` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'CLERIC' caster_class, `classes2` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes2` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'PALADIN' caster_class, `classes3` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes3` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'RANGER' caster_class, `classes4` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes4` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'SHADOWKNIGHT' caster_class, `classes5` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes5` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'DRUID' caster_class, `classes6` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes6` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'MONK' caster_class, `classes7` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes7` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'BARD' caster_class, `classes8` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes8` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'ROGUE' caster_class, `classes9` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes9` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'SHAMAN' caster_class, `classes10` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes10` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'NECROMANCER' caster_class, `classes11` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes11` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'WIZARD' caster_class, `classes12` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes12` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'MAGICIAN' caster_class, `classes13` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes13` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'ENCHANTER' caster_class, `classes14` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes14` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'BEASTLORD' caster_class, `classes15` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes15` NOT IN ('254', '255')
|
||||
UNION ALL
|
||||
SELECT 'BERSERKER' caster_class, `classes16` spell_level,
|
||||
`spells_new`.*
|
||||
FROM `spells_new`
|
||||
WHERE `classes16` NOT IN ('254', '255')
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY FIELD(target_type, 'Animal', 'Undead', 'Summoned', 'Pet', 'Plant', 'TargetsTarget', 'Single', 'Self', 'GroupV1', 'GroupV2', 'GroupNoPets', 'AECaster', 'AETarget', 'Corpse'),
|
||||
zone_type,
|
||||
FIELD(caster_class, 'WARRIOR', 'CLERIC', 'PALADIN', 'RANGER', 'SHADOWKNIGHT', 'DRUID', 'MONK', 'BARD', 'ROGUE', 'SHAMAN', 'NECROMANCER', 'WIZARD', 'MAGICIAN', 'ENCHANTER', 'BEASTLORD', 'BERSERKER'),
|
||||
spell_level,
|
||||
spell_id,
|
||||
spell_name
|
||||
@ -0,0 +1,78 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '0' THEN 'Single'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost
|
||||
-- base <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'CLERIC' caster_class, `classes2` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes2` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '14'
|
||||
AND '25' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'DRUID' caster_class, `classes6` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes6` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '14'
|
||||
AND '25' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'SHAMAN' caster_class, `classes10` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes10` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '14'
|
||||
AND '25' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'NECROMANCER' caster_class, `classes11` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes11` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '14'
|
||||
AND '25' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'WIZARD' caster_class, `classes12` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes12` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '14'
|
||||
AND '25' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'MAGICIAN' caster_class, `classes13` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes13` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '14'
|
||||
AND '25' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'ENCHANTER' caster_class, `classes14` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes14` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '14'
|
||||
AND '25' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY mana_cost DESC,
|
||||
FIELD(target_type, 'Single'),
|
||||
spell_level,
|
||||
FIELD(caster_class, 'CLERIC', 'DRUID', 'SHAMAN', 'NECROMANCER', 'WIZARD', 'MAGICIAN', 'ENCHANTER')
|
||||
73
utils/scripts/bot_command_spell_scripts/charm_spells.sql
Normal file
73
utils/scripts/bot_command_spell_scripts/charm_spells.sql
Normal file
@ -0,0 +1,73 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '0' THEN 'Single'
|
||||
WHEN `targettype` = '9' AND `CastRestriction` = '0' THEN 'Animal'
|
||||
WHEN `targettype` = '10' AND `CastRestriction` = '0' THEN 'Undead'
|
||||
WHEN `targettype` = '11' AND `CastRestriction` = '0' THEN 'Summoned'
|
||||
WHEN `targettype` = '16' AND `CastRestriction` = '0' THEN 'Plant'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost,
|
||||
-- base <end>
|
||||
-- extra <begin>
|
||||
`ResistDiff` resist_diff,
|
||||
`max1` max_target_level
|
||||
-- extra <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'DRUID' caster_class, `classes6` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `ResistDiff`, `max1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes6` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '12'
|
||||
AND '22' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'SHAMAN' caster_class, `classes10` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `ResistDiff`, `max1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes10` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '12'
|
||||
AND '22' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'NECROMANCER' caster_class, `classes11` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `ResistDiff`, `max1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes11` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '12'
|
||||
AND '22' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'MAGICIAN' caster_class, `classes13` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `ResistDiff`, `max1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes13` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '12'
|
||||
AND '22' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'ENCHANTER' caster_class, `classes14` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `ResistDiff`, `max1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes14` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '12'
|
||||
AND '22' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY resist_diff,
|
||||
FIELD(target_type, 'Animal', 'Undead', 'Summoned', 'Plant', 'Single'),
|
||||
max_target_level DESC,
|
||||
spell_level,
|
||||
FIELD(caster_class, 'DRUID', 'SHAMAN', 'NECROMANCER', 'MAGICIAN', 'ENCHANTER')
|
||||
193
utils/scripts/bot_command_spell_scripts/cure_spells.sql
Normal file
193
utils/scripts/bot_command_spell_scripts/cure_spells.sql
Normal file
@ -0,0 +1,193 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '3' AND `CastRestriction` = '0' THEN 'GroupV1'
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '0' THEN 'Single'
|
||||
WHEN `targettype` = '41' AND `CastRestriction` = '0' THEN 'GroupV2'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost,
|
||||
-- base <end>
|
||||
-- extra <begin>
|
||||
(
|
||||
(IF(('20' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)), '1', '0')) |
|
||||
(IF(('35' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)), '2', '0')) |
|
||||
(IF(('36' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)), '4', '0')) |
|
||||
(IF(('116' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)), '8', '0')) |
|
||||
(IF(('369' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)), '16', '0'))
|
||||
) cure_mask
|
||||
-- extra <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'CLERIC' caster_class, `classes2` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes2` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '1'
|
||||
-- 6-self, 10-undead, 14-pet, 45-ring
|
||||
AND `targettype` NOT IN ('6', '10', '14', '45')
|
||||
AND (
|
||||
-- 20-blindness, 35-disease, 36-poison, 116-curse, 369-corruption
|
||||
'20' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '35' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '36' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '116' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '369' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'PALADIN' caster_class, `classes3` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes3` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '1'
|
||||
-- 6-self, 10-undead, 14-pet, 45-ring
|
||||
AND `targettype` NOT IN ('6', '10', '14', '45')
|
||||
AND (
|
||||
-- 20-blindness, 35-disease, 36-poison, 116-curse, 369-corruption
|
||||
'20' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '35' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '36' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '116' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '369' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'RANGER' caster_class, `classes4` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes4` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '1'
|
||||
-- 6-self, 10-undead, 14-pet, 45-ring
|
||||
AND `targettype` NOT IN ('6', '10', '14', '45')
|
||||
AND (
|
||||
-- 20-blindness, 35-disease, 36-poison, 116-curse, 369-corruption
|
||||
'20' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '35' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '36' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '116' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '369' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'SHADOWKNIGHT' caster_class, `classes5` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes5` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '1'
|
||||
-- 6-self, 10-undead, 14-pet, 45-ring
|
||||
AND `targettype` NOT IN ('6', '10', '14', '45')
|
||||
AND (
|
||||
-- 20-blindness, 35-disease, 36-poison, 116-curse, 369-corruption
|
||||
'20' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '35' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '36' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '116' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '369' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'DRUID' caster_class, `classes6` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes6` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '1'
|
||||
-- 6-self, 10-undead, 14-pet, 45-ring
|
||||
AND `targettype` NOT IN ('6', '10', '14', '45')
|
||||
AND (
|
||||
-- 20-blindness, 35-disease, 36-poison, 116-curse, 369-corruption
|
||||
'20' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '35' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '36' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '116' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '369' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'BARD' caster_class, `classes8` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes8` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '1'
|
||||
-- 6-self, 10-undead, 14-pet, 45-ring
|
||||
AND `targettype` NOT IN ('6', '10', '14', '45')
|
||||
AND (
|
||||
-- 20-blindness, 35-disease, 36-poison, 116-curse, 369-corruption
|
||||
'20' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '35' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '36' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '116' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '369' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'SHAMAN' caster_class, `classes10` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes10` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '1'
|
||||
-- 6-self, 10-undead, 14-pet, 45-ring
|
||||
AND `targettype` NOT IN ('6', '10', '14', '45')
|
||||
AND (
|
||||
-- 20-blindness, 35-disease, 36-poison, 116-curse, 369-corruption
|
||||
'20' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '35' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '36' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '116' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '369' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'NECROMANCER' caster_class, `classes11` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes11` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '1'
|
||||
-- 6-self, 10-undead, 14-pet, 45-ring
|
||||
AND `targettype` NOT IN ('6', '10', '14', '45')
|
||||
AND (
|
||||
-- 20-blindness, 35-disease, 36-poison, 116-curse, 369-corruption
|
||||
'20' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '35' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '36' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '116' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '369' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'BEASTLORD' caster_class, `classes15` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes15` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '1'
|
||||
-- 6-self, 10-undead, 14-pet, 45-ring
|
||||
AND `targettype` NOT IN ('6', '10', '14', '45')
|
||||
AND (
|
||||
-- 20-blindness, 35-disease, 36-poison, 116-curse, 369-corruption
|
||||
'20' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '35' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '36' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '116' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '369' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY FIELD(target_type, 'Single', 'GroupV1', 'GroupV2'),
|
||||
spell_level DESC,
|
||||
cure_mask DESC,
|
||||
FIELD(caster_class, 'CLERIC', 'PALADIN', 'RANGER', 'SHADOWKNIGHT', 'DRUID', 'BARD', 'SHAMAN', 'NECROMANCER', 'BEASTLORD')
|
||||
61
utils/scripts/bot_command_spell_scripts/depart_spells.sql
Normal file
61
utils/scripts/bot_command_spell_scripts/depart_spells.sql
Normal file
@ -0,0 +1,61 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '3' AND `CastRestriction` = '0' THEN 'GroupV1'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost,
|
||||
-- base <end>
|
||||
-- extra <begin>
|
||||
CONCAT('"', `teleport_zone`, '"') short_name,
|
||||
CONCAT('"', IFNULL((SELECT `long_name` FROM `zone` WHERE `short_name` = `teleport_zone` LIMIT 1), 'Unreachable Destination'), '"') long_name
|
||||
-- extra <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'DRUID' caster_class, `classes6` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `teleport_zone`
|
||||
FROM `spells_new`
|
||||
WHERE `classes6` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '40'
|
||||
AND (
|
||||
'83' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '86' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR (
|
||||
'88' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
AND `teleport_zone` NOT LIKE 'same'
|
||||
)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'WIZARD' caster_class, `classes12` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `teleport_zone`
|
||||
FROM `spells_new`
|
||||
WHERE `classes12` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '40'
|
||||
AND (
|
||||
'83' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '86' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR (
|
||||
'88' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
AND `teleport_zone` NOT LIKE 'same'
|
||||
)
|
||||
)
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY FIELD(target_type, 'GroupV1'),
|
||||
FIELD(caster_class, 'DRUID', 'WIZARD'),
|
||||
spell_level,
|
||||
spell_name
|
||||
45
utils/scripts/bot_command_spell_scripts/escape_spells.sql
Normal file
45
utils/scripts/bot_command_spell_scripts/escape_spells.sql
Normal file
@ -0,0 +1,45 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '41' AND `CastRestriction` = '0' THEN 'GroupV2'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost
|
||||
-- base <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'DRUID' caster_class, `classes6` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes6` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '40'
|
||||
AND '88' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
AND `teleport_zone` LIKE 'same'
|
||||
UNION ALL
|
||||
SELECT 'WIZARD' caster_class, `classes12` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes12` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '40'
|
||||
AND '88' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
AND `teleport_zone` LIKE 'same'
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY FIELD(target_type, 'GroupV2'),
|
||||
FIELD(caster_class, 'DRUID', 'WIZARD'),
|
||||
spell_level,
|
||||
spell_name
|
||||
39
utils/scripts/bot_command_spell_scripts/grow_spells.sql
Normal file
39
utils/scripts/bot_command_spell_scripts/grow_spells.sql
Normal file
@ -0,0 +1,39 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '0' THEN 'Single'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost
|
||||
-- base <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'SHAMAN' caster_class, `classes10` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes10` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '10'
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
AND `effectid1` = '89' -- implementation restricted to `effectid1`
|
||||
AND `effect_base_value1` > 100 -- implementation restricted to `effect_base_value1`
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY FIELD(target_type, 'Single'),
|
||||
FIELD(caster_class, 'SHAMAN'),
|
||||
spell_level,
|
||||
spell_name
|
||||
151
utils/scripts/bot_command_spell_scripts/invisibility_spells.sql
Normal file
151
utils/scripts/bot_command_spell_scripts/invisibility_spells.sql
Normal file
@ -0,0 +1,151 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '0' THEN 'Single'
|
||||
WHEN `targettype` = '41' AND `CastRestriction` = '0' THEN 'GroupV2'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost,
|
||||
-- base <end>
|
||||
-- extra <begin>
|
||||
CASE
|
||||
WHEN `effectid1` = '12' THEN 'Living'
|
||||
WHEN `effectid1` = '13' THEN 'See'
|
||||
WHEN `effectid1` = '28' THEN 'Undead'
|
||||
WHEN `effectid1` = '29' THEN 'Animal'
|
||||
ELSE `effectid1` -- 'UNDEFINED'
|
||||
END invis_type
|
||||
-- extra <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'CLERIC' caster_class, `classes2` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effectid1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes2` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('5', '9')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
-- 12-living, 13-see, 28-undead, 29-animal
|
||||
AND `effectid1` IN ('12', '13', '28', '29') -- implementation restricted to `effectid1`
|
||||
UNION ALL
|
||||
SELECT 'PALADIN' caster_class, `classes3` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effectid1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes3` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('5', '9')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
-- 12-living, 13-see, 28-undead, 29-animal
|
||||
AND `effectid1` IN ('12', '13', '28', '29') -- implementation restricted to `effectid1`
|
||||
UNION ALL
|
||||
SELECT 'RANGER' caster_class, `classes4` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effectid1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes4` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('5', '9')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
-- 12-living, 13-see, 28-undead, 29-animal
|
||||
AND `effectid1` IN ('12', '13', '28', '29') -- implementation restricted to `effectid1`
|
||||
UNION ALL
|
||||
SELECT 'SHADOWKNIGHT' caster_class, `classes5` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effectid1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes5` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('5', '9')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
-- 12-living, 13-see, 28-undead, 29-animal
|
||||
AND `effectid1` IN ('12', '13', '28', '29') -- implementation restricted to `effectid1`
|
||||
UNION ALL
|
||||
SELECT 'DRUID' caster_class, `classes6` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effectid1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes6` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('5', '9')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
-- 12-living, 13-see, 28-undead, 29-animal
|
||||
AND `effectid1` IN ('12', '13', '28', '29') -- implementation restricted to `effectid1`
|
||||
UNION ALL
|
||||
SELECT 'SHAMAN' caster_class, `classes10` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effectid1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes10` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('5', '9')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
-- 12-living, 13-see, 28-undead, 29-animal
|
||||
AND `effectid1` IN ('12', '13', '28', '29') -- implementation restricted to `effectid1`
|
||||
UNION ALL
|
||||
SELECT 'NECROMANCER' caster_class, `classes11` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effectid1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes11` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('5', '9')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
-- 12-living, 13-see, 28-undead, 29-animal
|
||||
AND `effectid1` IN ('12', '13', '28', '29') -- implementation restricted to `effectid1`
|
||||
UNION ALL
|
||||
SELECT 'WIZARD' caster_class, `classes12` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effectid1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes12` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('5', '9')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
-- 12-living, 13-see, 28-undead, 29-animal
|
||||
AND `effectid1` IN ('12', '13', '28', '29') -- implementation restricted to `effectid1`
|
||||
UNION ALL
|
||||
SELECT 'MAGICIAN' caster_class, `classes13` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effectid1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes13` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('5', '9')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
-- 12-living, 13-see, 28-undead, 29-animal
|
||||
AND `effectid1` IN ('12', '13', '28', '29') -- implementation restricted to `effectid1`
|
||||
UNION ALL
|
||||
SELECT 'ENCHANTER' caster_class, `classes14` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effectid1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes14` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('5', '9')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
-- 12-living, 13-see, 28-undead, 29-animal
|
||||
AND `effectid1` IN ('12', '13', '28', '29') -- implementation restricted to `effectid1`
|
||||
UNION ALL
|
||||
SELECT 'BEASTLORD' caster_class, `classes15` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effectid1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes15` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('5', '9')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
-- 12-living, 13-see, 28-undead, 29-animal
|
||||
AND `effectid1` IN ('12', '13', '28', '29') -- implementation restricted to `effectid1`
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY FIELD(invis_type, 'Animal', 'Undead', 'Living', 'See'),
|
||||
FIELD(target_type, 'Single', 'GroupV2'),
|
||||
zone_type,
|
||||
spell_level DESC,
|
||||
spell_name,
|
||||
FIELD(caster_class, 'CLERIC', 'PALADIN', 'RANGER', 'SHADOWKNIGHT', 'DRUID', 'SHAMAN', 'NECROMANCER', 'WIZARD', 'MAGICIAN', 'ENCHANTER', 'BEASTLORD')
|
||||
@ -0,0 +1,94 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '0' THEN 'Single'
|
||||
WHEN `targettype` = '41' AND `CastRestriction` = '0' THEN 'GroupV2'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost
|
||||
-- base <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'RANGER' caster_class, `classes4` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes4` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('2', '28')
|
||||
-- 6-self, 43-groupclientandpet
|
||||
AND `targettype` NOT IN ('6', '43')
|
||||
AND '57' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'DRUID' caster_class, `classes6` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes6` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('2', '28')
|
||||
-- 6-self, 43-groupclientandpet
|
||||
AND `targettype` NOT IN ('6', '43')
|
||||
AND '57' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'SHAMAN' caster_class, `classes10` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes10` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('2', '28')
|
||||
-- 6-self, 43-groupclientandpet
|
||||
AND `targettype` NOT IN ('6', '43')
|
||||
AND '57' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'NECROMANCER' caster_class, `classes11` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes11` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('2', '28')
|
||||
-- 6-self, 43-groupclientandpet
|
||||
AND `targettype` NOT IN ('6', '43')
|
||||
AND '57' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'WIZARD' caster_class, `classes12` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes12` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('2', '28')
|
||||
-- 6-self, 43-groupclientandpet
|
||||
AND `targettype` NOT IN ('6', '43')
|
||||
AND '57' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'ENCHANTER' caster_class, `classes14` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes14` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('2', '28')
|
||||
-- 6-self, 43-groupclientandpet
|
||||
AND `targettype` NOT IN ('6', '43')
|
||||
AND '57' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'BEASTLORD' caster_class, `classes15` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes15` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('2', '28')
|
||||
-- 6-self, 43-groupclientandpet
|
||||
AND `targettype` NOT IN ('6', '43')
|
||||
AND '57' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY FIELD(target_type, 'Single', 'GroupV2'),
|
||||
zone_type,
|
||||
spell_level DESC,
|
||||
spell_name,
|
||||
FIELD(caster_class, 'RANGER', 'DRUID', 'SHAMAN', 'NECROMANCER', 'WIZARD', 'ENCHANTER', 'BEASTLORD')
|
||||
86
utils/scripts/bot_command_spell_scripts/lull_spells.sql
Normal file
86
utils/scripts/bot_command_spell_scripts/lull_spells.sql
Normal file
@ -0,0 +1,86 @@
|
||||
-- needs criteria refinement
|
||||
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '0' THEN 'Single'
|
||||
WHEN `targettype` = '8' AND `CastRestriction` = '0' THEN 'AETarget'
|
||||
WHEN `targettype` = '9' AND `CastRestriction` = '0' THEN 'Animal'
|
||||
WHEN `targettype` = '10' AND `CastRestriction` = '0' THEN 'Undead'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost
|
||||
-- base <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'CLERIC' caster_class, `classes2` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes2` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '12'
|
||||
AND '18' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'PALADIN' caster_class, `classes3` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes3` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '12'
|
||||
AND '18' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'RANGER' caster_class, `classes4` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes4` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '12'
|
||||
AND '18' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'SHADOWKNIGHT' caster_class, `classes5` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes5` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '12'
|
||||
AND '18' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'DRUID' caster_class, `classes6` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes6` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '12'
|
||||
AND '18' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'NECROMANCER' caster_class, `classes11` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes11` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '12'
|
||||
AND '18' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
UNION ALL
|
||||
SELECT 'ENCHANTER' caster_class, `classes14` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes14` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '12'
|
||||
AND '18' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY FIELD(target_type, 'Animal', 'Undead', 'Single', 'AETarget'),
|
||||
target_type,
|
||||
zone_type,
|
||||
FIELD(caster_class, 'CLERIC', 'PALADIN', 'RANGER', 'SHADOWKNIGHT', 'DRUID', 'NECROMANCER', 'ENCHANTER'),
|
||||
spell_level,
|
||||
spell_id,
|
||||
spell_name
|
||||
76
utils/scripts/bot_command_spell_scripts/mesmerize_spells.sql
Normal file
76
utils/scripts/bot_command_spell_scripts/mesmerize_spells.sql
Normal file
@ -0,0 +1,76 @@
|
||||
-- needs criteria refinement
|
||||
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '4' AND `CastRestriction` = '0' THEN 'AECaster'
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '0' THEN 'Single'
|
||||
WHEN `targettype` = '8' AND `CastRestriction` = '0' THEN 'AETarget'
|
||||
WHEN `targettype` = '10' AND `CastRestriction` = '0' THEN 'Undead'
|
||||
WHEN `targettype` = '11' AND `CastRestriction` = '0' THEN 'Summoned'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost,
|
||||
-- base <end>
|
||||
-- extra <begin>
|
||||
`ResistDiff` resist_diff,
|
||||
`max1` max_target_level
|
||||
-- extra <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'BARD' caster_class, `classes8` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `ResistDiff`, `max1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes8` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('12', '13', '25', '27', '41', '43')
|
||||
-- 45-ring
|
||||
AND `targettype` NOT IN ('45')
|
||||
AND `effectid1` = '31'
|
||||
UNION ALL
|
||||
SELECT 'NECROMANCER' caster_class, `classes11` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `ResistDiff`, `max1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes11` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('12', '13', '25', '27', '41', '43')
|
||||
-- 45-ring
|
||||
AND `targettype` NOT IN ('45')
|
||||
AND `effectid1` = '31'
|
||||
UNION ALL
|
||||
SELECT 'MAGICIAN' caster_class, `classes13` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `ResistDiff`, `max1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes13` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('12', '13', '25', '27', '41', '43')
|
||||
-- 45-ring
|
||||
AND `targettype` NOT IN ('45')
|
||||
AND `effectid1` = '31'
|
||||
UNION ALL
|
||||
SELECT 'ENCHANTER' caster_class, `classes14` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `ResistDiff`, `max1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes14` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('12', '13', '25', '27', '41', '43')
|
||||
-- 45-ring
|
||||
AND `targettype` NOT IN ('45')
|
||||
AND `effectid1` = '31'
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY resist_diff,
|
||||
FIELD(target_type, 'Undead', 'Summoned', 'Single', 'AECaster', 'AETarget'),
|
||||
max_target_level DESC,
|
||||
spell_level DESC,
|
||||
FIELD(caster_class, 'BARD', 'NECROMANCER', 'MAGICIAN', 'ENCHANTER')
|
||||
@ -0,0 +1,74 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '3' AND `CastRestriction` = '0' THEN 'GroupV1'
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '0' THEN 'Single'
|
||||
WHEN `targettype` = '41' AND `CastRestriction` = '0' THEN 'GroupV2'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost,
|
||||
-- base <end>
|
||||
-- extra <begin>
|
||||
`effect_base_value2` base_speed
|
||||
-- extra <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'RANGER' caster_class, `classes4` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effect_base_value2`
|
||||
FROM `spells_new`
|
||||
WHERE `classes4` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('7', '10')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
AND `CastRestriction` = '0'
|
||||
AND `effectdescnum` = '65'
|
||||
UNION ALL
|
||||
SELECT 'DRUID' caster_class, `classes6` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effect_base_value2`
|
||||
FROM `spells_new`
|
||||
WHERE `classes6` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('7', '10')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
AND `CastRestriction` = '0'
|
||||
AND `effectdescnum` = '65'
|
||||
UNION ALL
|
||||
SELECT 'SHAMAN' caster_class, `classes10` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effect_base_value2`
|
||||
FROM `spells_new`
|
||||
WHERE `classes10` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('7', '10')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
AND `CastRestriction` = '0'
|
||||
AND `effectdescnum` = '65'
|
||||
UNION ALL
|
||||
SELECT 'BEASTLORD' caster_class, `classes15` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effect_base_value2`
|
||||
FROM `spells_new`
|
||||
WHERE `classes15` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('7', '10')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
AND `CastRestriction` = '0'
|
||||
AND `effectdescnum` = '65'
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY FIELD(target_type, 'Single', 'GroupV1', 'GroupV2'),
|
||||
effect_base_value2 DESC,
|
||||
spell_level,
|
||||
FIELD(caster_class, 'RANGER', 'DRUID', 'SHAMAN', 'BEASTLORD')
|
||||
221
utils/scripts/bot_command_spell_scripts/resistance_spells.sql
Normal file
221
utils/scripts/bot_command_spell_scripts/resistance_spells.sql
Normal file
@ -0,0 +1,221 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '3' AND `CastRestriction` = '0' THEN 'GroupV1'
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '0' THEN 'Single'
|
||||
WHEN `targettype` = '41' AND `CastRestriction` = '0' THEN 'GroupV2'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost,
|
||||
-- base <end>
|
||||
-- extra <begin>
|
||||
(
|
||||
(IF(('46' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)), '1', '0')) |
|
||||
(IF(('47' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)), '2', '0')) |
|
||||
(IF(('48' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)), '4', '0')) |
|
||||
(IF(('49' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)), '8', '0')) |
|
||||
(IF(('50' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)), '16', '0')) |
|
||||
(IF(('370' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)), '32', '0'))
|
||||
) resist_type
|
||||
-- extra <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'CLERIC' caster_class, `classes2` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes2` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '2'
|
||||
-- 6-self, 14-pet, 39-groupnopets, 46-targetstarget
|
||||
AND `targettype` NOT IN ('6', '14', '39', '46')
|
||||
AND (
|
||||
|
||||
'46' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '47' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '48' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '49' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '50' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '370' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'PALADIN' caster_class, `classes3` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes3` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '2'
|
||||
-- 6-self, 14-pet, 39-groupnopets, 46-targetstarget
|
||||
AND `targettype` NOT IN ('6', '14', '39', '46')
|
||||
AND (
|
||||
|
||||
'46' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '47' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '48' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '49' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '50' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '370' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'RANGER' caster_class, `classes4` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes4` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '2'
|
||||
-- 6-self, 14-pet, 39-groupnopets, 46-targetstarget
|
||||
AND `targettype` NOT IN ('6', '14', '39', '46')
|
||||
AND (
|
||||
|
||||
'46' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '47' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '48' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '49' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '50' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '370' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'SHADOWKNIGHT' caster_class, `classes5` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes5` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '2'
|
||||
-- 6-self, 14-pet, 39-groupnopets, 46-targetstarget
|
||||
AND `targettype` NOT IN ('6', '14', '39', '46')
|
||||
AND (
|
||||
|
||||
'46' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '47' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '48' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '49' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '50' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '370' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'DRUID' caster_class, `classes6` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes6` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '2'
|
||||
-- 6-self, 14-pet, 39-groupnopets, 46-targetstarget
|
||||
AND `targettype` NOT IN ('6', '14', '39', '46')
|
||||
AND (
|
||||
|
||||
'46' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '47' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '48' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '49' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '50' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '370' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'SHAMAN' caster_class, `classes10` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes10` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '2'
|
||||
-- 6-self, 14-pet, 39-groupnopets, 46-targetstarget
|
||||
AND `targettype` NOT IN ('6', '14', '39', '46')
|
||||
AND (
|
||||
|
||||
'46' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '47' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '48' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '49' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '50' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '370' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'NECROMANCER' caster_class, `classes11` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes11` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '2'
|
||||
-- 6-self, 14-pet, 39-groupnopets, 46-targetstarget
|
||||
AND `targettype` NOT IN ('6', '14', '39', '46')
|
||||
AND (
|
||||
|
||||
'46' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '47' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '48' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '49' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '50' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '370' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'MAGICIAN' caster_class, `classes13` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes13` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '2'
|
||||
-- 6-self, 14-pet, 39-groupnopets, 46-targetstarget
|
||||
AND `targettype` NOT IN ('6', '14', '39', '46')
|
||||
AND (
|
||||
|
||||
'46' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '47' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '48' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '49' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '50' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '370' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'ENCHANTER' caster_class, `classes14` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes14` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '2'
|
||||
-- 6-self, 14-pet, 39-groupnopets, 46-targetstarget
|
||||
AND `targettype` NOT IN ('6', '14', '39', '46')
|
||||
AND (
|
||||
|
||||
'46' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '47' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '48' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '49' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '50' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '370' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'BEASTLORD' caster_class, `classes15` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`,
|
||||
`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`
|
||||
FROM `spells_new`
|
||||
WHERE `classes15` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '2'
|
||||
-- 6-self, 14-pet, 39-groupnopets, 46-targetstarget
|
||||
AND `targettype` NOT IN ('6', '14', '39', '46')
|
||||
AND (
|
||||
|
||||
'46' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '47' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '48' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '49' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '50' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
OR '370' IN (`effectid1`, `effectid2`, `effectid3`, `effectid4`, `effectid5`, `effectid6`, `effectid7`, `effectid8`, `effectid9`, `effectid10`, `effectid11`, `effectid12`)
|
||||
)
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY FIELD(target_type, 'Single', 'GroupV1', 'GroupV2'),
|
||||
spell_level DESC,
|
||||
resist_type DESC,
|
||||
FIELD(caster_class, 'CLERIC', 'PALADIN', 'RANGER', 'SHADOWKNIGHT', 'DRUID', 'SHAMAN', 'NECROMANCER', 'MAGICIAN', 'ENCHANTER', 'BEASTLORD')
|
||||
71
utils/scripts/bot_command_spell_scripts/resurrect_spells.sql
Normal file
71
utils/scripts/bot_command_spell_scripts/resurrect_spells.sql
Normal file
@ -0,0 +1,71 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '4' AND `CastRestriction` = '0' THEN 'AECaster'
|
||||
WHEN `targettype` = '15' AND `CastRestriction` = '0' THEN 'Corpse'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost,
|
||||
-- base <end>
|
||||
-- extra <begin>
|
||||
`effect_base_value1` percent
|
||||
-- extra <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'CLERIC' caster_class, `classes2` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effect_base_value1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes2` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('1', '13')
|
||||
AND `effectid1` = '81'
|
||||
UNION ALL
|
||||
SELECT 'PALADIN' caster_class, `classes3` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effect_base_value1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes3` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('1', '13')
|
||||
AND `effectid1` = '81'
|
||||
UNION ALL
|
||||
SELECT 'DRUID' caster_class, `classes6` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effect_base_value1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes6` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('1', '13')
|
||||
AND `effectid1` = '81'
|
||||
UNION ALL
|
||||
SELECT 'SHAMAN' caster_class, `classes10` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effect_base_value1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes10` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('1', '13')
|
||||
AND `effectid1` = '81'
|
||||
UNION ALL
|
||||
SELECT 'NECROMANCER' caster_class, `classes11` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `effect_base_value1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes11` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('1', '13')
|
||||
AND `effectid1` = '81'
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY percent DESC,
|
||||
FIELD(target_type, 'Corpse', 'AETarget'),
|
||||
zone_type,
|
||||
FIELD(caster_class, 'CLERIC', 'PALADIN', 'DRUID', 'SHAMAN', 'NECROMANCER'),
|
||||
spell_level,
|
||||
spell_id,
|
||||
spell_name
|
||||
40
utils/scripts/bot_command_spell_scripts/rune_spells.sql
Normal file
40
utils/scripts/bot_command_spell_scripts/rune_spells.sql
Normal file
@ -0,0 +1,40 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '3' AND `CastRestriction` = '0' THEN 'GroupV1'
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '0' THEN 'Single'
|
||||
WHEN `targettype` = '41' AND `CastRestriction` = '0' THEN 'GroupV2'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost,
|
||||
-- base <end>
|
||||
-- extra <begin>
|
||||
`max1` max_absorbtion
|
||||
-- extra <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'ENCHANTER' caster_class, `classes14` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`, `max1`
|
||||
FROM `spells_new`
|
||||
WHERE `classes14` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '2'
|
||||
AND `effectid1` = '55'
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY FIELD(target_type, 'Single', 'GroupV1', 'GroupV2'),
|
||||
spell_level DESC,
|
||||
max1 DESC
|
||||
49
utils/scripts/bot_command_spell_scripts/shrink_spells.sql
Normal file
49
utils/scripts/bot_command_spell_scripts/shrink_spells.sql
Normal file
@ -0,0 +1,49 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '0' THEN 'Single'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost
|
||||
-- base <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'SHAMAN' caster_class, `classes10` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes10` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '10'
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
AND `effectid1` = '89' -- implementation restricted to `effectid1`
|
||||
AND `effect_base_value1` < 100 -- implementation restricted to `effect_base_value1`
|
||||
UNION ALL
|
||||
SELECT 'BEASTLORD' caster_class, `classes15` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes15` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` = '10'
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
AND `effectid1` = '89' -- implementation restricted to `effectid1`
|
||||
AND `effect_base_value1` < 100 -- implementation restricted to `effect_base_value1`
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY FIELD(target_type, 'Single'),
|
||||
FIELD(caster_class, 'SHAMAN', 'BEASTLORD'),
|
||||
spell_level,
|
||||
spell_name
|
||||
@ -0,0 +1,84 @@
|
||||
SELECT
|
||||
-- base <begin>
|
||||
CASE
|
||||
WHEN `targettype` = '5' AND `CastRestriction` = '0' THEN 'Single'
|
||||
WHEN `targettype` = '41' AND `CastRestriction` = '0' THEN 'GroupV2'
|
||||
ELSE CONCAT(`targettype`, ', ', `CastRestriction`) -- 'UNDEFINED'
|
||||
END target_type,
|
||||
CASE
|
||||
WHEN `zonetype` NOT IN ('-1', '0') THEN `zonetype`
|
||||
ELSE '0'
|
||||
END zone_type,
|
||||
caster_class,
|
||||
spell_level,
|
||||
`id` spell_id,
|
||||
CONCAT('"', `name`, '"') spell_name,
|
||||
`mana` mana_cost
|
||||
-- base <end>
|
||||
|
||||
FROM (
|
||||
SELECT 'RANGER' caster_class, `classes4` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes4` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('2', '14')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
AND `effectid1` = '14'
|
||||
UNION ALL
|
||||
SELECT 'DRUID' caster_class, `classes6` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes6` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('2', '14')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
AND `effectid1` = '14'
|
||||
UNION ALL
|
||||
SELECT 'SHAMAN' caster_class, `classes10` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes10` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('2', '14')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
AND `effectid1` = '14'
|
||||
UNION ALL
|
||||
SELECT 'NECROMANCER' caster_class, `classes11` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes11` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('2', '14')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
AND `effectid1` = '14'
|
||||
UNION ALL
|
||||
SELECT 'ENCHANTER' caster_class, `classes14` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes14` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('2', '14')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
AND `effectid1` = '14'
|
||||
UNION ALL
|
||||
SELECT 'BEASTLORD' caster_class, `classes15` spell_level,
|
||||
`targettype`, `CastRestriction`, `zonetype`, `id`, `name`, `mana`
|
||||
FROM `spells_new`
|
||||
WHERE `classes15` NOT IN ('254', '255')
|
||||
AND `SpellAffectIndex` IN ('2', '14')
|
||||
-- 6-self
|
||||
AND `targettype` NOT IN ('6')
|
||||
AND `effectid1` = '14'
|
||||
) spells
|
||||
|
||||
-- WHERE `name` NOT LIKE '%II'
|
||||
-- ---
|
||||
-- WHERE `name` NOT LIKE '%Rk. II%'
|
||||
-- AND `name` NOT LIKE '%Rk.II%'
|
||||
-- AND `name` NOT LIKE '%Rk. III%'
|
||||
-- AND `name` NOT LIKE '%Rk.III%'
|
||||
ORDER BY FIELD(target_type, 'Single', 'GroupV2'),
|
||||
spell_level,
|
||||
spell_name,
|
||||
FIELD(caster_class, 'RANGER', 'DRUID', 'SHAMAN', 'NECROMANCER', 'ENCHANTER', 'BEASTLORD')
|
||||
@ -23,7 +23,7 @@ if($Config{osname}=~/linux/i){ $OS = "Linux"; }
|
||||
if($Config{osname}=~/Win|MS/i){ $OS = "Windows"; }
|
||||
|
||||
#::: If current version is less than what world is reporting, then download a new one...
|
||||
$current_version = 11;
|
||||
$current_version = 13;
|
||||
|
||||
if($ARGV[0] eq "V"){
|
||||
if($ARGV[1] > $current_version){
|
||||
@ -111,18 +111,33 @@ if($ARGV[0] eq "installer"){
|
||||
print "Running EQEmu Server installer routines...\n";
|
||||
mkdir('logs');
|
||||
mkdir('updates_staged');
|
||||
mkdir('shared');
|
||||
fetch_latest_windows_binaries();
|
||||
map_files_fetch_bulk();
|
||||
opcodes_fetch();
|
||||
plugins_fetch();
|
||||
quest_files_fetch();
|
||||
lua_modules_fetch();
|
||||
|
||||
#::: Binary dll's
|
||||
get_remote_file("https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/lua51.dll", "lua51.dll", 1);
|
||||
get_remote_file("https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/zlib1.dll", "zlib1.dll", 1);
|
||||
get_remote_file("https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/libmysql.dll", "libmysql.dll", 1);
|
||||
|
||||
#::: Server scripts
|
||||
get_remote_file("https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/t_database_backup.bat", "t_database_backup.bat", 1);
|
||||
get_remote_file("https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/t_server_crash_report.pl", "t_server_crash_report.pl", 1);
|
||||
get_remote_file("https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/t_start_server.bat", "t_start_server.bat", 1);
|
||||
get_remote_file("https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/t_start_server_with_login_server.bat", "t_start_server_with_login_server.bat", 1);
|
||||
get_remote_file("https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/t_stop_server.bat", "t_stop_server.bat", 1);
|
||||
get_remote_file("https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/win_server_launcher.pl", "win_server_launcher.pl", 1);
|
||||
|
||||
|
||||
#::: Database Routines
|
||||
print "MariaDB :: Creating Database 'peq'\n";
|
||||
print `"$path" --host $host --user $user --password="$pass" -N -B -e "DROP DATABASE peq;CREATE DATABASE peq"`;
|
||||
if($OS eq "Windows"){ @db_version = split(': ', `world db_version`); }
|
||||
print `"$path" --host $host --user $user --password="$pass" -N -B -e "DROP DATABASE IF EXISTS peq;"`;
|
||||
print `"$path" --host $host --user $user --password="$pass" -N -B -e "CREATE DATABASE peq"`;
|
||||
if($OS eq "Windows"){ @db_version = split(': ', `world db_version`); }
|
||||
if($OS eq "Linux"){ @db_version = split(': ', `./world db_version`); }
|
||||
$bin_db_ver = trim($db_version[1]);
|
||||
check_db_version_table();
|
||||
@ -132,6 +147,18 @@ if($ARGV[0] eq "installer"){
|
||||
main_db_management();
|
||||
print "\nApplying Latest Database Updates...\n";
|
||||
main_db_management();
|
||||
|
||||
print get_mysql_result("UPDATE `launcher` SET `dynamics` = 30 WHERE `name` = 'zone'");
|
||||
|
||||
if($OS eq "Windows"){
|
||||
check_windows_firewall_rules();
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
if($ARGV[0] eq "db_dump_compress"){ database_dump_compress(); exit; }
|
||||
if($ARGV[0] eq "login_server_setup"){
|
||||
do_windows_login_server_setup();
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -221,6 +248,10 @@ sub show_menu_prompt {
|
||||
8 => \&quest_files_fetch,
|
||||
9 => \&lua_modules_fetch,
|
||||
10 => \&aa_fetch,
|
||||
11 => \&fetch_latest_windows_binaries,
|
||||
12 => \&fetch_server_dlls,
|
||||
13 => \&do_windows_login_server_setup,
|
||||
19 => \&do_bots_db_schema_drop,
|
||||
20 => \&do_update_self,
|
||||
0 => \&script_exit,
|
||||
);
|
||||
@ -294,6 +325,10 @@ return <<EO_MENU;
|
||||
8) [Quests (Perl/LUA)] :: Download latest PEQ quests and stage updates
|
||||
9) [LUA Modules] :: Download latest LUA Modules (Required for Lua)
|
||||
10) [DB Data : Alternate Advancement] :: Download Latest AA's from PEQ (This overwrites existing data)
|
||||
11) [Windows Server Build] :: Download Latest and Stable Server Build (Overwrites existing .exe's, includes .dll's)
|
||||
12) [Windows Server .dll's] :: Download Pre-Requisite Server .dll's
|
||||
13) [Windows Server Loginserver Setup] :: Download and install Windows Loginserver
|
||||
19) [EQEmu DB Drop Bots Schema] :: Remove Bots schema and return database to normal state
|
||||
20) [Update the updater] Force update this script (Redownload)
|
||||
0) Exit
|
||||
|
||||
@ -533,6 +568,138 @@ sub fetch_latest_windows_binaries{
|
||||
rmtree('updates_staged');
|
||||
}
|
||||
|
||||
sub do_windows_login_server_setup{
|
||||
print "\n --- Fetching Loginserver... --- \n";
|
||||
get_remote_file("https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/login_server.zip", "updates_staged/login_server.zip", 1);
|
||||
print "\n --- Extracting... --- \n";
|
||||
unzip('updates_staged/login_server.zip', 'updates_staged/login_server/');
|
||||
my @files;
|
||||
my $start_dir = "updates_staged/login_server";
|
||||
find(
|
||||
sub { push @files, $File::Find::name unless -d; },
|
||||
$start_dir
|
||||
);
|
||||
for my $file (@files) {
|
||||
$dest_file = $file;
|
||||
$dest_file =~s/updates_staged\/login_server\///g;
|
||||
print "Installing :: " . $dest_file . "\n";
|
||||
copy_file($file, $dest_file);
|
||||
}
|
||||
print "\n Done... \n";
|
||||
|
||||
print "Pulling down Loginserver database tables...\n";
|
||||
get_remote_file("https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/login_server_tables.sql", "db_update/login_server_tables.sql");
|
||||
print "\n\nInstalling Loginserver tables...\n";
|
||||
print get_mysql_result_from_file("db_update/login_server_tables.sql");
|
||||
print "\nDone...\n\n";
|
||||
|
||||
add_login_server_firewall_rules();
|
||||
|
||||
rmtree('updates_staged');
|
||||
rmtree('db_update');
|
||||
|
||||
print "\nPress any key to continue...\n";
|
||||
|
||||
<>; #Read from STDIN
|
||||
|
||||
}
|
||||
|
||||
sub add_login_server_firewall_rules{
|
||||
#::: Check Loginserver Firewall install for Windows
|
||||
if($OS eq "Windows"){
|
||||
$output = `netsh advfirewall firewall show rule name=all`;
|
||||
@output_buffer = split("\n", $output);
|
||||
$has_loginserver_rules_titanium = 0;
|
||||
$has_loginserver_rules_sod = 0;
|
||||
foreach my $val (@output_buffer){
|
||||
if($val=~/Rule Name/i){
|
||||
$val=~s/Rule Name://g;
|
||||
if($val=~/EQEmu Loginserver/i && $val=~/Titanium/i){
|
||||
$has_loginserver_rules_titanium = 1;
|
||||
print "Found existing rule :: " . trim($val) . "\n";
|
||||
}
|
||||
if($val=~/EQEmu Loginserver/i && $val=~/SOD/i){
|
||||
$has_loginserver_rules_sod = 1;
|
||||
print "Found existing rule :: " . trim($val) . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($has_loginserver_rules_titanium == 0){
|
||||
print "Attempting to add EQEmu Loginserver Firewall Rules (Titanium) (TCP) port 5998 \n";
|
||||
print `netsh advfirewall firewall add rule name="EQEmu Loginserver (Titanium) (5998) TCP" dir=in action=allow protocol=TCP localport=5998`;
|
||||
print "Attempting to add EQEmu Loginserver Firewall Rules (Titanium) (UDP) port 5998 \n";
|
||||
print `netsh advfirewall firewall add rule name="EQEmu Loginserver (Titanium) (5998) UDP" dir=in action=allow protocol=UDP localport=5998`;
|
||||
}
|
||||
if($has_loginserver_rules_sod == 0){
|
||||
print "Attempting to add EQEmu Loginserver Firewall Rules (SOD+) (TCP) port 5999 \n";
|
||||
print `netsh advfirewall firewall add rule name="EQEmu Loginserver (SOD+) (5999) TCP" dir=in action=allow protocol=TCP localport=5999`;
|
||||
print "Attempting to add EQEmu Loginserver Firewall Rules (SOD+) (UDP) port 5999 \n";
|
||||
print `netsh advfirewall firewall add rule name="EQEmu Loginserver (SOD+) (5999) UDP" dir=in action=allow protocol=UDP localport=5999`;
|
||||
}
|
||||
|
||||
print "If firewall rules don't add you must run this script (eqemu_update.pl) as administrator\n";
|
||||
print "\n";
|
||||
print "#::: Instructions \n";
|
||||
print "In order to connect your server to the loginserver you must point your eqemu_config.xml to your local server similar to the following:\n";
|
||||
print "
|
||||
<loginserver1>
|
||||
<host>login.eqemulator.net</host>
|
||||
<port>5998</port>
|
||||
<account></account>
|
||||
<password></password>
|
||||
</loginserver1>
|
||||
<loginserver2>
|
||||
<host>127.0.0.1</host>
|
||||
<port>5998</port>
|
||||
<account></account>
|
||||
<password></password>
|
||||
</loginserver2>
|
||||
";
|
||||
print "\nWhen done, make sure your EverQuest client points to your loginserver's IP (In this case it would be 127.0.0.1) in the eqhosts.txt file\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub check_windows_firewall_rules{
|
||||
$output = `netsh advfirewall firewall show rule name=all`;
|
||||
@output_buffer = split("\n", $output);
|
||||
$has_world_rules = 0;
|
||||
$has_zone_rules = 0;
|
||||
foreach my $val (@output_buffer){
|
||||
if($val=~/Rule Name/i){
|
||||
$val=~s/Rule Name://g;
|
||||
if($val=~/EQEmu World/i){
|
||||
$has_world_rules = 1;
|
||||
print "Found existing rule :: " . trim($val) . "\n";
|
||||
}
|
||||
if($val=~/EQEmu Zone/i){
|
||||
$has_zone_rules = 1;
|
||||
print "Found existing rule :: " . trim($val) . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($has_world_rules == 0){
|
||||
print "Attempting to add EQEmu World Firewall Rules (TCP) port 9000 \n";
|
||||
print `netsh advfirewall firewall add rule name="EQEmu World (9000) TCP" dir=in action=allow protocol=TCP localport=9000`;
|
||||
print "Attempting to add EQEmu World Firewall Rules (UDP) port 9000 \n";
|
||||
print `netsh advfirewall firewall add rule name="EQEmu World (9000) UDP" dir=in action=allow protocol=UDP localport=9000`;
|
||||
}
|
||||
if($has_zone_rules == 0){
|
||||
print "Attempting to add EQEmu Zones (7000-7500) TCP \n";
|
||||
print `netsh advfirewall firewall add rule name="EQEmu Zones (7000-7500) TCP" dir=in action=allow protocol=TCP localport=7000-7500`;
|
||||
print "Attempting to add EQEmu Zones (7000-7500) UDP \n";
|
||||
print `netsh advfirewall firewall add rule name="EQEmu Zones (7000-7500) UDP" dir=in action=allow protocol=UDP localport=7000-7500`;
|
||||
}
|
||||
}
|
||||
|
||||
sub fetch_server_dlls{
|
||||
print "Fetching lua51.dll, zlib1.dll, libmysql.dll...\n";
|
||||
get_remote_file("https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/lua51.dll", "lua51.dll", 1);
|
||||
get_remote_file("https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/zlib1.dll", "zlib1.dll", 1);
|
||||
get_remote_file("https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/libmysql.dll", "libmysql.dll", 1);
|
||||
}
|
||||
|
||||
sub fetch_peq_db_full{
|
||||
print "Downloading latest PEQ Database... Please wait...\n";
|
||||
get_remote_file("http://edit.peqtgc.com/weekly/peq_beta.zip", "updates_staged/peq_beta.zip", 1);
|
||||
@ -830,6 +997,216 @@ sub are_file_sizes_different{
|
||||
return;
|
||||
}
|
||||
|
||||
sub do_bots_db_schema_drop{
|
||||
#"drop_bots.sql" is run before reverting database back to 'normal'
|
||||
print "Fetching drop_bots.sql...\n";
|
||||
get_remote_file("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/git/bots/drop_bots.sql", "db_update/drop_bots.sql");
|
||||
print get_mysql_result_from_file("db_update/drop_bots.sql");
|
||||
|
||||
print "Restoring normality...\n";
|
||||
print get_mysql_result("DELETE FROM `rule_values` WHERE `rule_name` LIKE 'Bots:%';");
|
||||
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'commands'") ne "" && $db){
|
||||
print get_mysql_result("DELETE FROM `commands` WHERE `command` LIKE 'bot';");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'command_settings'") ne "" && $db){
|
||||
print get_mysql_result("DELETE FROM `command_settings` WHERE `command` LIKE 'bot';");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW KEYS FROM `group_id` WHERE `Key_name` LIKE 'PRIMARY'") ne "" && $db){
|
||||
print get_mysql_result("ALTER TABLE `group_id` DROP PRIMARY KEY;");
|
||||
}
|
||||
print get_mysql_result("ALTER TABLE `group_id` ADD PRIMARY KEY (`groupid`, `charid`, `ismerc`);");
|
||||
|
||||
if(get_mysql_result("SHOW KEYS FROM `guild_members` WHERE `Key_name` LIKE 'PRIMARY'") ne "" && $db){
|
||||
print get_mysql_result("ALTER TABLE `guild_members` DROP PRIMARY KEY;");
|
||||
}
|
||||
print get_mysql_result("ALTER TABLE `guild_members` ADD PRIMARY KEY (`char_id`);");
|
||||
|
||||
print get_mysql_result("UPDATE `spawn2` SET `enabled` = 0 WHERE `id` IN (59297,59298);");
|
||||
|
||||
if(get_mysql_result("SHOW COLUMNS FROM `db_version` LIKE 'bots_version'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `db_version` SET `bots_version` = 0;");
|
||||
}
|
||||
}
|
||||
|
||||
sub modify_db_for_bots{
|
||||
#Called after the db bots schema (2015_09_30_bots.sql) has been loaded
|
||||
print "Modifying database for bots...\n";
|
||||
print get_mysql_result("UPDATE `spawn2` SET `enabled` = 1 WHERE `id` IN (59297,59298);");
|
||||
|
||||
if(get_mysql_result("SHOW KEYS FROM `guild_members` WHERE `Key_name` LIKE 'PRIMARY'") ne "" && $db){
|
||||
print get_mysql_result("ALTER TABLE `guild_members` DROP PRIMARY KEY;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW KEYS FROM `group_id` WHERE `Key_name` LIKE 'PRIMARY'") ne "" && $db){
|
||||
print get_mysql_result("ALTER TABLE `group_id` DROP PRIMARY KEY;");
|
||||
}
|
||||
print get_mysql_result("ALTER TABLE `group_id` ADD PRIMARY KEY USING BTREE(`groupid`, `charid`, `name`, `ismerc`);");
|
||||
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'command_settings'") ne "" && get_mysql_result("SELECT `command` FROM `command_settings` WHERE `command` LIKE 'bot'") eq "" && $db){
|
||||
print get_mysql_result("INSERT INTO `command_settings` VALUES ('bot', '0', '');");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'commands'") ne "" && get_mysql_result("SELECT `command` FROM `commands` WHERE `command` LIKE 'bot'") eq "" && $db){
|
||||
print get_mysql_result("INSERT INTO `commands` VALUES ('bot', '0');");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotAAExpansion'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:AAExpansion' WHERE `rule_name` LIKE 'Bots:BotAAExpansion';");
|
||||
}
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:AAExpansion'") eq "" && $db){
|
||||
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:AAExpansion', '8', 'The expansion through which bots will obtain AAs');");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:CreateBotCount'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:CreationLimit' WHERE `rule_name` LIKE 'Bots:CreateBotCount';");
|
||||
}
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:CreationLimit'") eq "" && $db){
|
||||
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:CreationLimit', '150', 'Number of bots that each account can create');");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotFinishBuffing'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:FinishBuffing' WHERE `rule_name` LIKE 'Bots:BotFinishBuffing';");
|
||||
}
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:FinishBuffing'") eq "" && $db){
|
||||
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:FinishBuffing', 'false', 'Allow for buffs to complete even if the bot caster is out of mana. Only affects buffing out of combat.');");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotGroupBuffing'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:GroupBuffing' WHERE `rule_name` LIKE 'Bots:BotGroupBuffing';");
|
||||
}
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:GroupBuffing'") eq "" && $db){
|
||||
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:GroupBuffing', 'false', 'Bots will cast single target buffs as group buffs, default is false for single. Does not make single target buffs work for MGB.');");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotManaRegen'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:ManaRegen' WHERE `rule_name` LIKE 'Bots:BotManaRegen';");
|
||||
}
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:ManaRegen'") eq "" && $db){
|
||||
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:ManaRegen', '3.0', 'Adjust mana regen for bots, 1 is fast and higher numbers slow it down 3 is about the same as players.');");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotQuest'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:QuestableSpawnLimit' WHERE `rule_name` LIKE 'Bots:BotQuest';");
|
||||
}
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:QuestableSpawnLimit'") eq "" && $db){
|
||||
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:QuestableSpawnLimit', 'false', 'Optional quest method to manage bot spawn limits using the quest_globals name bot_spawn_limit, see: /bazaar/Aediles_Thrall.pl');");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotSpellQuest'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:QuestableSpells' WHERE `rule_name` LIKE 'Bots:BotSpellQuest';");
|
||||
}
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:QuestableSpells'") eq "" && $db){
|
||||
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:QuestableSpells', 'false', 'Anita Thrall\\\'s (Anita_Thrall.pl) Bot Spell Scriber quests.');");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:SpawnBotCount'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:SpawnLimit' WHERE `rule_name` LIKE 'Bots:SpawnBotCount';");
|
||||
}
|
||||
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:SpawnLimit'") eq "" && $db){
|
||||
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:SpawnLimit', '71', 'Number of bots a character can have spawned at one time, You + 71 bots is a 12 group raid');");
|
||||
}
|
||||
|
||||
convert_existing_bot_data();
|
||||
}
|
||||
|
||||
sub convert_existing_bot_data{
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'bots'") ne "" && $db){
|
||||
print "Converting existing bot data...\n";
|
||||
print get_mysql_result("INSERT INTO `bot_data` (`bot_id`, `owner_id`, `spells_id`, `name`, `last_name`, `zone_id`, `gender`, `race`, `class`, `level`, `creation_day`, `last_spawn`, `time_spawned`, `size`, `face`, `hair_color`, `hair_style`, `beard`, `beard_color`, `eye_color_1`, `eye_color_2`, `drakkin_heritage`, `drakkin_tattoo`, `drakkin_details`, `ac`, `atk`, `hp`, `mana`, `str`, `sta`, `cha`, `dex`, `int`, `agi`, `wis`, `fire`, `cold`, `magic`, `poison`, `disease`, `corruption`) SELECT `BotID`, `BotOwnerCharacterID`, `BotSpellsID`, `Name`, `LastName`, `LastZoneId`, `Gender`, `Race`, `Class`, `BotLevel`, UNIX_TIMESTAMP(`BotCreateDate`), UNIX_TIMESTAMP(`LastSpawnDate`), `TotalPlayTime`, `Size`, `Face`, `LuclinHairColor`, `LuclinHairStyle`, `LuclinBeard`, `LuclinBeardColor`, `LuclinEyeColor`, `LuclinEyeColor2`, `DrakkinHeritage`, `DrakkinTattoo`, `DrakkinDetails`, `AC`, `ATK`, `HP`, `Mana`, `STR`, `STA`, `CHA`, `DEX`, `_INT`, `AGI`, `WIS`, `FR`, `CR`, `MR`, `PR`, `DR`, `Corrup` FROM `bots`;");
|
||||
|
||||
print get_mysql_result("INSERT INTO `bot_inspect_messages` (`bot_id`, `inspect_message`) SELECT `BotID`, `BotInspectMessage` FROM `bots`;");
|
||||
|
||||
print get_mysql_result("RENAME TABLE `bots` TO `bots_old`;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'botstances'") ne "" && $db){
|
||||
print get_mysql_result("INSERT INTO `bot_stances` (`bot_id`, `stance_id`) SELECT bs.`BotID`, bs.`StanceID` FROM `botstances` bs INNER JOIN `bot_data` bd ON bs.`BotID` = bd.`bot_id`;");
|
||||
|
||||
print get_mysql_result("RENAME TABLE `botstances` TO `botstances_old`;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'bottimers'") ne "" && $db){
|
||||
print get_mysql_result("INSERT INTO `bot_timers` (`bot_id`, `timer_id`, `timer_value`) SELECT bt.`BotID`, bt.`TimerID`, bt.`Value` FROM `bottimers` bt INNER JOIN `bot_data` bd ON bt.`BotID` = bd.`bot_id`;");
|
||||
|
||||
print get_mysql_result("RENAME TABLE `bottimers` TO `bottimers_old`;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'botbuffs'") ne "" && $db){
|
||||
print get_mysql_result("INSERT INTO `bot_buffs` (`buffs_index`, `bot_id`, `spell_id`, `caster_level`, `duration_formula`, `tics_remaining`, `poison_counters`, `disease_counters`, `curse_counters`, `corruption_counters`, `numhits`, `melee_rune`, `magic_rune`, `persistent`) SELECT bb.`BotBuffId`, bb.`BotId`, bb.`SpellId`, bb.`CasterLevel`, bb.`DurationFormula`, bb.`TicsRemaining`, bb.`PoisonCounters`, bb.`DiseaseCounters`, bb.`CurseCounters`, bb.`CorruptionCounters`, bb.`HitCount`, bb.`MeleeRune`, bb.`MagicRune`, bb.`Persistent` FROM `botbuffs` bb INNER JOIN `bot_data` bd ON bb.`BotId` = bd.`bot_id`;");
|
||||
|
||||
if(get_mysql_result("SHOW COLUMNS FROM `botbuffs` LIKE 'dot_rune'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `bot_buffs` bb INNER JOIN `botbuffs` bbo ON bb.`buffs_index` = bbo.`BotBuffId` SET bb.`dot_rune` = bbo.`dot_rune` WHERE bb.`bot_id` = bbo.`BotID`;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW COLUMNS FROM `botbuffs` LIKE 'caston_x'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `bot_buffs` bb INNER JOIN `botbuffs` bbo ON bb.`buffs_index` = bbo.`BotBuffId` SET bb.`caston_x` = bbo.`caston_x` WHERE bb.`bot_id` = bbo.`BotID`;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW COLUMNS FROM `botbuffs` LIKE 'caston_y'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `bot_buffs` bb INNER JOIN `botbuffs` bbo ON bb.`buffs_index` = bbo.`BotBuffId` SET bb.`caston_y` = bbo.`caston_y` WHERE bb.`bot_id` = bbo.`BotID`;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW COLUMNS FROM `botbuffs` LIKE 'caston_z'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `bot_buffs` bb INNER JOIN `botbuffs` bbo ON bb.`buffs_index` = bbo.`BotBuffId` SET bb.`caston_z` = bbo.`caston_z` WHERE bb.`bot_id` = bbo.`BotID`;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW COLUMNS FROM `botbuffs` LIKE 'ExtraDIChance'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `bot_buffs` bb INNER JOIN `botbuffs` bbo ON bb.`buffs_index` = bbo.`BotBuffId` SET bb.`extra_di_chance` = bbo.`ExtraDIChance` WHERE bb.`bot_id` = bbo.`BotID`;");
|
||||
}
|
||||
|
||||
print get_mysql_result("RENAME TABLE `botbuffs` TO `botbuffs_old`;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'botinventory'") ne "" && $db){
|
||||
print get_mysql_result("INSERT INTO `bot_inventories` (`inventories_index`, `bot_id`, `slot_id`, `item_id`, `inst_charges`, `inst_color`, `inst_no_drop`, `augment_1`, `augment_2`, `augment_3`, `augment_4`, `augment_5`) SELECT bi.`BotInventoryID`, bi.`BotID`, bi.`SlotID`, bi.`ItemID`, bi.`charges`, bi.`color`, bi.`instnodrop`, bi.`augslot1`, bi.`augslot2`, bi.`augslot3`, bi.`augslot4`, bi.`augslot5` FROM `botinventory` bi INNER JOIN `bot_data` bd ON bi.`BotID` = bd.`bot_id`;");
|
||||
|
||||
if(get_mysql_result("SHOW COLUMNS FROM `botinventory` LIKE 'augslot6'") ne "" && $db){
|
||||
print get_mysql_result("UPDATE `bot_inventories` bi INNER JOIN `botinventory` bio ON bi.`inventories_index` = bio.`BotInventoryID` SET bi.`augment_6` = bio.`augslot6` WHERE bi.`bot_id` = bio.`BotID`;");
|
||||
}
|
||||
|
||||
print get_mysql_result("RENAME TABLE `botinventory` TO `botinventory_old`;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'botpets'") ne "" && $db){
|
||||
print get_mysql_result("INSERT INTO `bot_pets` (`pets_index`, `pet_id`, `bot_id`, `name`, `mana`, `hp`) SELECT bp.`BotPetsId`, bp.`PetId`, bp.`BotId`, bp.`Name`, bp.`Mana`, bp.`HitPoints` FROM `botpets` bp INNER JOIN `bot_data` bd ON bp.`BotId` = bd.`bot_id`;");
|
||||
|
||||
print get_mysql_result("RENAME TABLE `botpets` TO `botpets_old`;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'botpetbuffs'") ne "" && $db){
|
||||
print get_mysql_result("INSERT INTO `bot_pet_buffs` (`pet_buffs_index`, `pets_index`, `spell_id`, `caster_level`, `duration`) SELECT bpb.`BotPetBuffId`, bpb.`BotPetsId`, bpb.`SpellId`, bpb.`CasterLevel`, bpb.`Duration` FROM `botpetbuffs` bpb INNER JOIN `bot_pets` bp ON bpb.`BotPetsId` = bp.`pets_index`;");
|
||||
|
||||
print get_mysql_result("RENAME TABLE `botpetbuffs` TO `botpetbuffs_old`;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'botpetinventory'") ne "" && $db){
|
||||
print get_mysql_result("INSERT INTO `bot_pet_inventories` (`pet_inventories_index`, `pets_index`, `item_id`) SELECT bpi.`BotPetInventoryId`, bpi.`BotPetsId`, bpi.`ItemId` FROM `botpetinventory` bpi INNER JOIN `bot_pets` bp ON bpi.`BotPetsId` = bp.`pets_index`;");
|
||||
|
||||
print get_mysql_result("RENAME TABLE `botpetinventory` TO `botpetinventory_old`;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'botgroup'") ne "" && $db){
|
||||
print get_mysql_result("INSERT INTO `bot_groups` (`groups_index`, `group_leader_id`, `group_name`) SELECT bg.`BotGroupId`, bg.`BotGroupLeaderBotId`, bg.`BotGroupName` FROM `botgroup` bg INNER JOIN `bot_data` bd ON bg.`BotGroupLeaderBotId` = bd.`bot_id`;");
|
||||
|
||||
print get_mysql_result("RENAME TABLE `botgroup` TO `botgroup_old`;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'botgroupmembers'") ne "" && $db){
|
||||
print get_mysql_result("INSERT INTO `bot_group_members` (`group_members_index`, `groups_index`, `bot_id`) SELECT bgm.`BotGroupMemberId`, bgm.`BotGroupId`, bgm.`BotId` FROM `botgroupmembers` bgm INNER JOIN `bot_groups` bg ON bgm.`BotGroupId` = bg.`groups_index` INNER JOIN `bot_data` bd ON bgm.`BotId` = bd.`bot_id`;");
|
||||
|
||||
print get_mysql_result("RENAME TABLE `botgroupmembers` TO `botgroupmembers_old`;");
|
||||
}
|
||||
|
||||
if(get_mysql_result("SHOW TABLES LIKE 'botguildmembers'") ne "" && $db){
|
||||
print get_mysql_result("INSERT INTO `bot_guild_members` (`bot_id`, `guild_id`, `rank`, `tribute_enable`, `total_tribute`, `last_tribute`, `banker`, `public_note`, `alt`) SELECT bgm.`char_id`, bgm.`guild_id`, bgm.`rank`, bgm.`tribute_enable`, bgm.`total_tribute`, bgm.`last_tribute`, bgm.`banker`, bgm.`public_note`, bgm.`alt` FROM `botguildmembers` bgm INNER JOIN `guilds` g ON bgm.`guild_id` = g.`id` INNER JOIN `bot_data` bd ON bgm.`char_id` = bd.`bot_id`;");
|
||||
|
||||
print get_mysql_result("RENAME TABLE `botguildmembers` TO `botguildmembers_old`;");
|
||||
}
|
||||
}
|
||||
|
||||
sub get_bots_db_version{
|
||||
#::: Check if bots_version column exists...
|
||||
if(get_mysql_result("SHOW COLUMNS FROM db_version LIKE 'bots_version'") eq "" && $db){
|
||||
@ -914,6 +1291,10 @@ sub run_database_check{
|
||||
print "Running Update: " . $val . " - " . $file_name . "\n";
|
||||
print get_mysql_result_from_file("db_update/$file_name");
|
||||
print get_mysql_result("UPDATE db_version SET version = $val WHERE version < $val");
|
||||
|
||||
if($bots_db_management == 1 && $val == 9000){
|
||||
modify_db_for_bots();
|
||||
}
|
||||
}
|
||||
$db_run_stage = 2;
|
||||
}
|
||||
|
||||
@ -343,6 +343,8 @@
|
||||
9087|2015_09_25_inventory_snapshots.sql|SHOW TABLES LIKE 'inventory_snapshots'|empty|
|
||||
9088|2015_11_01_perl_event_export_settings.sql|SHOW TABLES LIKE 'perl_event_export_settings'|empty|
|
||||
9089|2015_11_02_ai_idle_no_spell_recast_default_changes.sql|SELECT * FROM `rule_values` WHERE `rule_name` LIKE '%Spells:AI_IdleNoSpellMinRecast%' AND `rule_value` = '500'|not_empty|
|
||||
9090|2015_12_01_spell_scribe_restriction_rule.sql|SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Character:RestrictSpellScribing'|empty|
|
||||
9091|2015_12_07_command_settings.sql|SHOW TABLES LIKE 'command_settings'|empty|
|
||||
|
||||
# Upgrade conditions:
|
||||
# This won't be needed after this system is implemented, but it is used database that are not
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
-- 'drop_bots (pre-update script)' sql script file
|
||||
-- current as of 10/09/2015
|
||||
-- current as of 11/30/2015
|
||||
--
|
||||
-- Note: This file will remove bot schema loaded by 'load_bots' sql scripts.
|
||||
-- There may still be remnants of bot activity in tables `guild_members` and
|
||||
@ -50,12 +50,12 @@ BEGIN
|
||||
|
||||
|
||||
SELECT "restoring keys...";
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'group_id' AND `CONSTRAINT_NAME` = 'PRIMARY') > 0) THEN
|
||||
IF (EXISTS(SELECT `CONSTRAINT_NAME` FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'group_id' AND `CONSTRAINT_NAME` = 'PRIMARY')) THEN
|
||||
ALTER TABLE `group_id` DROP PRIMARY KEY;
|
||||
END IF;
|
||||
ALTER TABLE `group_id` ADD PRIMARY KEY (`groupid`, `charid`, `ismerc`);
|
||||
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'guild_members' AND `CONSTRAINT_NAME` = 'PRIMARY') > 0) THEN
|
||||
IF (EXISTS(SELECT `CONSTRAINT_NAME` FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'guild_members' AND `CONSTRAINT_NAME` = 'PRIMARY')) THEN
|
||||
ALTER TABLE `guild_members` DROP PRIMARY KEY;
|
||||
END IF;
|
||||
ALTER TABLE `guild_members` ADD PRIMARY KEY (`char_id`);
|
||||
@ -66,7 +66,7 @@ BEGIN
|
||||
|
||||
|
||||
SELECT "clearing database version...";
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'db_version' AND `COLUMN_NAME` = 'bots_version') > 0) THEN
|
||||
IF (EXISTS(SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'db_version' AND `COLUMN_NAME` = 'bots_version')) THEN
|
||||
UPDATE `db_version`
|
||||
SET `bots_version` = 0;
|
||||
END IF;
|
||||
|
||||
@ -1,26 +1,47 @@
|
||||
-- 'drop_bots' sql script file
|
||||
-- current as of 10/09/2015
|
||||
-- current as of 12/11/2015
|
||||
--
|
||||
-- Note: This file will remove bot schema loaded by 'load_bots' sql scripts.
|
||||
-- There may still be remnants of bot activity in tables `guild_members` and
|
||||
-- `group_id`. If these entries are causing issues, you may need to manually
|
||||
-- remove them.
|
||||
--
|
||||
-- Use eqemu_update.pl to administer this script
|
||||
|
||||
|
||||
SELECT "dropping views...";
|
||||
DROP VIEW IF EXISTS `vwguildmembers`;
|
||||
DROP VIEW IF EXISTS `vwgroups`;
|
||||
DROP VIEW IF EXISTS `vwbotgroups`;
|
||||
DROP VIEW IF EXISTS `vwbotcharactermobs`;
|
||||
|
||||
DROP VIEW IF EXISTS `vwGuildMembers`;
|
||||
DROP VIEW IF EXISTS `vwGroups`;
|
||||
DROP VIEW IF EXISTS `vwBotGroups`;
|
||||
DROP VIEW IF EXISTS `vwBotCharacterMobs`;
|
||||
|
||||
DROP VIEW IF EXISTS `vw_guild_members`;
|
||||
DROP VIEW IF EXISTS `vw_groups`;
|
||||
DROP VIEW IF EXISTS `vw_bot_groups`;
|
||||
DROP VIEW IF EXISTS `vw_bot_character_mobs`;
|
||||
|
||||
|
||||
SELECT "dropping functions...";
|
||||
DROP FUNCTION IF EXISTS `GetMobTypeByName`;
|
||||
DROP FUNCTION IF EXISTS `GetMobTypeByID`;
|
||||
DROP FUNCTION IF EXISTS `GetMobType`;
|
||||
|
||||
DROP TABLE IF EXISTS `botguildmembers`;
|
||||
DROP TABLE IF EXISTS `botgroupmembers`;
|
||||
DROP TABLE IF EXISTS `botgroup`;
|
||||
DROP TABLE IF EXISTS `botpetinventory`;
|
||||
DROP TABLE IF EXISTS `botpetbuffs`;
|
||||
DROP TABLE IF EXISTS `botpets`;
|
||||
DROP TABLE IF EXISTS `botinventory`;
|
||||
DROP TABLE IF EXISTS `botbuffs`;
|
||||
DROP TABLE IF EXISTS `bottimers`;
|
||||
DROP TABLE IF EXISTS `botstances`;
|
||||
DROP TABLE IF EXISTS `bots`;
|
||||
|
||||
DROP TABLE IF EXISTS `botgroups`; -- this table is not a part of 'load_bots.sql'
|
||||
|
||||
SELECT "dropping tables...";
|
||||
DROP TABLE IF EXISTS `botguildmembers_old`;
|
||||
DROP TABLE IF EXISTS `botgroupmembers_old`;
|
||||
DROP TABLE IF EXISTS `botgroup_old`;
|
||||
@ -46,51 +67,7 @@ DROP TABLE IF EXISTS `bot_stances`;
|
||||
DROP TABLE IF EXISTS `bot_inspect_messages`;
|
||||
DROP TABLE IF EXISTS `bot_data`;
|
||||
|
||||
DROP PROCEDURE IF EXISTS `DropBotsSchema`;
|
||||
|
||||
|
||||
DELIMITER $$
|
||||
|
||||
CREATE PROCEDURE `DropBotsSchema` ()
|
||||
BEGIN
|
||||
SELECT "deleting rules...";
|
||||
DELETE FROM `rule_values` WHERE `rule_name` LIKE 'Bots%';
|
||||
|
||||
|
||||
SELECT "deleting command...";
|
||||
DELETE FROM `commands` WHERE `command` LIKE 'bot';
|
||||
|
||||
|
||||
SELECT "restoring keys...";
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'group_id' AND `CONSTRAINT_NAME` = 'PRIMARY') > 0) THEN
|
||||
ALTER TABLE `group_id` DROP PRIMARY KEY;
|
||||
END IF;
|
||||
ALTER TABLE `group_id` ADD PRIMARY KEY (`groupid`, `charid`, `ismerc`);
|
||||
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'guild_members' AND `CONSTRAINT_NAME` = 'PRIMARY') > 0) THEN
|
||||
ALTER TABLE `guild_members` DROP PRIMARY KEY;
|
||||
END IF;
|
||||
ALTER TABLE `guild_members` ADD PRIMARY KEY (`char_id`);
|
||||
|
||||
|
||||
SELECT "de-activating spawns...";
|
||||
UPDATE `spawn2` SET `enabled` = 0 WHERE `id` IN (59297,59298);
|
||||
|
||||
|
||||
SELECT "clearing database version...";
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'db_version' AND `COLUMN_NAME` = 'bots_version') > 0) THEN
|
||||
UPDATE `db_version`
|
||||
SET `bots_version` = 0;
|
||||
END IF;
|
||||
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
||||
|
||||
CALL `DropBotsSchema`();
|
||||
|
||||
SELECT "dropping procedure...";
|
||||
DROP PROCEDURE IF EXISTS `LoadBotsSchema`;
|
||||
DROP PROCEDURE IF EXISTS `DropBotsSchema`;
|
||||
|
||||
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
-- '2015_09_30_bots' sql script file
|
||||
-- current as of 10/13/2015
|
||||
-- current as of 12/11/2015
|
||||
--
|
||||
-- Use eqemu_update.pl to administer this script
|
||||
|
||||
|
||||
-- Clean-up
|
||||
DROP VIEW IF EXISTS `vwbotcharactermobs`;
|
||||
DROP VIEW IF EXISTS `vwbotgroups`;
|
||||
DROP VIEW IF EXISTS `vwgroups`;
|
||||
DROP VIEW IF EXISTS `vwguildmembers`;
|
||||
|
||||
DROP VIEW IF EXISTS `vwBotCharacterMobs`;
|
||||
DROP VIEW IF EXISTS `vwBotGroups`;
|
||||
DROP VIEW IF EXISTS `vwGroups`;
|
||||
@ -22,659 +27,193 @@ DROP FUNCTION IF EXISTS `GetMobTypeByID`;
|
||||
DROP PROCEDURE IF EXISTS `LoadBotsSchema`;
|
||||
|
||||
|
||||
DELIMITER $$
|
||||
-- Tables
|
||||
CREATE TABLE `bot_data` (
|
||||
`bot_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`owner_id` INT(11) UNSIGNED NOT NULL,
|
||||
`spells_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`name` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`last_name` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`title` VARCHAR(32) NOT NULL DEFAULT '', -- Unused
|
||||
`suffix` VARCHAR(32) NOT NULL DEFAULT '', -- Unused
|
||||
`zone_id` SMALLINT(6) NOT NULL DEFAULT '0',
|
||||
`gender` TINYINT(2) NOT NULL DEFAULT '0',
|
||||
`race` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`class` TINYINT(2) NOT NULL DEFAULT '0',
|
||||
`level` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`deity` INT(11) UNSIGNED NOT NULL DEFAULT '0', -- Unused
|
||||
`creation_day` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`last_spawn` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`time_spawned` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`size` FLOAT NOT NULL DEFAULT '0',
|
||||
`face` INT(10) NOT NULL DEFAULT '1',
|
||||
`hair_color` INT(10) NOT NULL DEFAULT '1',
|
||||
`hair_style` INT(10) NOT NULL DEFAULT '1',
|
||||
`beard` INT(10) NOT NULL DEFAULT '0',
|
||||
`beard_color` INT(10) NOT NULL DEFAULT '1',
|
||||
`eye_color_1` INT(10) NOT NULL DEFAULT '1',
|
||||
`eye_color_2` INT(10) NOT NULL DEFAULT '1',
|
||||
`drakkin_heritage` INT(10) NOT NULL DEFAULT '0',
|
||||
`drakkin_tattoo` INT(10) NOT NULL DEFAULT '0',
|
||||
`drakkin_details` INT(10) NOT NULL DEFAULT '0',
|
||||
`ac` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`atk` MEDIUMINT(9) NOT NULL DEFAULT '0',
|
||||
`hp` INTEGER NOT NULL DEFAULT '0',
|
||||
`mana` INTEGER NOT NULL DEFAULT '0',
|
||||
`str` MEDIUMINT(8) NOT NULL DEFAULT '75',
|
||||
`sta` MEDIUMINT(8) NOT NULL DEFAULT '75',
|
||||
`cha` MEDIUMINT(8) NOT NULL DEFAULT '75',
|
||||
`dex` MEDIUMINT(8) NOT NULL DEFAULT '75',
|
||||
`int` MEDIUMINT(8) NOT NULL DEFAULT '75',
|
||||
`agi` MEDIUMINT(8) NOT NULL DEFAULT '75',
|
||||
`wis` MEDIUMINT(8) NOT NULL DEFAULT '75',
|
||||
`fire` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`cold` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`magic` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`poison` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`disease` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`corruption` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`show_helm` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`follow_distance` INT(11) UNSIGNED NOT NULL DEFAULT '200',
|
||||
PRIMARY KEY (`bot_id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE PROCEDURE `LoadBotsSchema` ()
|
||||
BEGIN
|
||||
-- Activate
|
||||
UPDATE `spawn2` SET `enabled` = 1 WHERE `id` IN (59297,59298);
|
||||
|
||||
|
||||
-- Alter
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'guild_members' AND `CONSTRAINT_NAME` = 'PRIMARY') > 0) THEN
|
||||
ALTER TABLE `guild_members` DROP PRIMARY KEY;
|
||||
END IF;
|
||||
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'group_id' AND `CONSTRAINT_NAME` = 'PRIMARY') > 0) THEN
|
||||
ALTER TABLE `group_id` DROP PRIMARY KEY;
|
||||
END IF;
|
||||
ALTER TABLE `group_id` ADD PRIMARY KEY USING BTREE(`groupid`, `charid`, `name`, `ismerc`);
|
||||
--
|
||||
-- From original bots.sql (for reference)
|
||||
-- ALTER TABLE `group_id` ADD UNIQUE INDEX `U_group_id_1`(`name`);
|
||||
-- ALTER TABLE `group_leaders` ADD UNIQUE INDEX `U_group_leaders_1`(`leadername`);
|
||||
|
||||
|
||||
-- Commands
|
||||
IF ((SELECT COUNT(`command`) FROM `commands` WHERE `command` LIKE 'bot') = 0) THEN
|
||||
INSERT INTO `commands` VALUES ('bot', '0');
|
||||
END IF;
|
||||
|
||||
|
||||
-- Rules
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotAAExpansion') > 0) THEN
|
||||
UPDATE `rule_values` SET `rule_name` = 'Bots:AAExpansion' WHERE `rule_name` LIKE 'Bots:BotAAExpansion';
|
||||
END IF;
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:AAExpansion') = 0) THEN
|
||||
INSERT INTO `rule_values` VALUES ('1', 'Bots:AAExpansion', '8', 'The expansion through which bots will obtain AAs');
|
||||
END IF;
|
||||
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:CreateBotCount') > 0) THEN
|
||||
UPDATE `rule_values` SET `rule_name` = 'Bots:CreationLimit' WHERE `rule_name` LIKE 'Bots:CreateBotCount';
|
||||
END IF;
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:CreationLimit') = 0) THEN
|
||||
INSERT INTO `rule_values` VALUES ('1', 'Bots:CreationLimit', '150', 'Number of bots that each account can create');
|
||||
END IF;
|
||||
CREATE TABLE `bot_inspect_messages` (
|
||||
`bot_id` INT(11) UNSIGNED NOT NULL,
|
||||
`inspect_message` VARCHAR(256) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`bot_id`),
|
||||
INDEX `bot_id` (`bot_id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotFinishBuffing') > 0) THEN
|
||||
UPDATE `rule_values` SET `rule_name` = 'Bots:FinishBuffing' WHERE `rule_name` LIKE 'Bots:BotFinishBuffing';
|
||||
END IF;
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:FinishBuffing') = 0) THEN
|
||||
INSERT INTO `rule_values` VALUES ('1', 'Bots:FinishBuffing', 'false', 'Allow for buffs to complete even if the bot caster is out of mana. Only affects buffing out of combat.');
|
||||
END IF;
|
||||
CREATE TABLE `bot_stances` (
|
||||
`bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`stance_id` TINYINT UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`bot_id`),
|
||||
CONSTRAINT `FK_bot_stances_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
|
||||
);
|
||||
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotGroupBuffing') > 0) THEN
|
||||
UPDATE `rule_values` SET `rule_name` = 'Bots:GroupBuffing' WHERE `rule_name` LIKE 'Bots:BotGroupBuffing';
|
||||
END IF;
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:GroupBuffing') = 0) THEN
|
||||
INSERT INTO `rule_values` VALUES ('1', 'Bots:GroupBuffing', 'false', 'Bots will cast single target buffs as group buffs, default is false for single. Does not make single target buffs work for MGB.');
|
||||
END IF;
|
||||
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotManaRegen') > 0) THEN
|
||||
UPDATE `rule_values` SET `rule_name` = 'Bots:ManaRegen' WHERE `rule_name` LIKE 'Bots:BotManaRegen';
|
||||
END IF;
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:ManaRegen') = 0) THEN
|
||||
INSERT INTO `rule_values` VALUES ('1', 'Bots:ManaRegen', '3.0', 'Adjust mana regen for bots, 1 is fast and higher numbers slow it down 3 is about the same as players.');
|
||||
END IF;
|
||||
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotQuest') > 0) THEN
|
||||
UPDATE `rule_values` SET `rule_name` = 'Bots:QuestableSpawnLimit' WHERE `rule_name` LIKE 'Bots:BotQuest';
|
||||
END IF;
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:QuestableSpawnLimit') = 0) THEN
|
||||
INSERT INTO `rule_values` VALUES ('1', 'Bots:QuestableSpawnLimit', 'false', 'Optional quest method to manage bot spawn limits using the quest_globals name bot_spawn_limit, see: /bazaar/Aediles_Thrall.pl');
|
||||
END IF;
|
||||
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotSpellQuest') > 0) THEN
|
||||
UPDATE `rule_values` SET `rule_name` = 'Bots:QuestableSpells' WHERE `rule_name` LIKE 'Bots:BotSpellQuest';
|
||||
END IF;
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:QuestableSpells') = 0) THEN
|
||||
INSERT INTO `rule_values` VALUES ('1', 'Bots:QuestableSpells', 'false', 'Anita Thrall\'s (Anita_Thrall.pl) Bot Spell Scriber quests.');
|
||||
END IF;
|
||||
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:SpawnBotCount') > 0) THEN
|
||||
UPDATE `rule_values` SET `rule_name` = 'Bots:SpawnLimit' WHERE `rule_name` LIKE 'Bots:SpawnBotCount';
|
||||
END IF;
|
||||
IF ((SELECT COUNT(`rule_name`) FROM `rule_values` WHERE `rule_name` LIKE 'Bots:SpawnLimit') = 0) THEN
|
||||
INSERT INTO `rule_values` VALUES ('1', 'Bots:SpawnLimit', '71', 'Number of bots a character can have spawned at one time, You + 71 bots is a 12 group raid');
|
||||
END IF;
|
||||
|
||||
|
||||
-- Tables
|
||||
CREATE TABLE `bot_data` (
|
||||
`bot_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`owner_id` INT(11) UNSIGNED NOT NULL,
|
||||
`spells_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`name` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`last_name` VARCHAR(64) NOT NULL DEFAULT '', -- Change unused (64) from (32)
|
||||
`title` VARCHAR(32) NOT NULL DEFAULT '', -- Unused
|
||||
`suffix` VARCHAR(32) NOT NULL DEFAULT '', -- Unused
|
||||
`zone_id` SMALLINT(6) NOT NULL DEFAULT '0',
|
||||
`gender` TINYINT(2) NOT NULL DEFAULT '0',
|
||||
`race` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`class` TINYINT(2) NOT NULL DEFAULT '0',
|
||||
`level` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`deity` INT(11) UNSIGNED NOT NULL DEFAULT '0', -- Unused
|
||||
`creation_day` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`last_spawn` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`time_spawned` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`size` FLOAT NOT NULL DEFAULT '0',
|
||||
`face` INT(10) NOT NULL DEFAULT '1',
|
||||
`hair_color` INT(10) NOT NULL DEFAULT '1',
|
||||
`hair_style` INT(10) NOT NULL DEFAULT '1',
|
||||
`beard` INT(10) NOT NULL DEFAULT '0',
|
||||
`beard_color` INT(10) NOT NULL DEFAULT '1',
|
||||
`eye_color_1` INT(10) NOT NULL DEFAULT '1',
|
||||
`eye_color_2` INT(10) NOT NULL DEFAULT '1',
|
||||
`drakkin_heritage` INT(10) NOT NULL DEFAULT '0',
|
||||
`drakkin_tattoo` INT(10) NOT NULL DEFAULT '0',
|
||||
`drakkin_details` INT(10) NOT NULL DEFAULT '0',
|
||||
`ac` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`atk` MEDIUMINT(9) NOT NULL DEFAULT '0',
|
||||
`hp` INTEGER NOT NULL DEFAULT '0',
|
||||
`mana` INTEGER NOT NULL DEFAULT '0',
|
||||
`str` MEDIUMINT(8) NOT NULL DEFAULT '75',
|
||||
`sta` MEDIUMINT(8) NOT NULL DEFAULT '75',
|
||||
`cha` MEDIUMINT(8) NOT NULL DEFAULT '75',
|
||||
`dex` MEDIUMINT(8) NOT NULL DEFAULT '75',
|
||||
`int` MEDIUMINT(8) NOT NULL DEFAULT '75',
|
||||
`agi` MEDIUMINT(8) NOT NULL DEFAULT '75',
|
||||
`wis` MEDIUMINT(8) NOT NULL DEFAULT '75',
|
||||
`fire` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`cold` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`magic` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`poison` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`disease` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`corruption` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
`show_helm` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`follow_distance` INT(11) UNSIGNED NOT NULL DEFAULT '200',
|
||||
PRIMARY KEY (`bot_id`)
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE `bot_inspect_messages` (
|
||||
`bot_id` INT(11) UNSIGNED NOT NULL,
|
||||
`inspect_message` VARCHAR(256) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`bot_id`),
|
||||
INDEX `bot_id` (`bot_id`)
|
||||
) ENGINE=InnoDB;
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'bots') > 0) THEN
|
||||
INSERT INTO `bot_data` (
|
||||
`bot_id`,
|
||||
`owner_id`,
|
||||
`spells_id`,
|
||||
`name`,
|
||||
`last_name`,
|
||||
`zone_id`,
|
||||
`gender`,
|
||||
`race`,
|
||||
`class`,
|
||||
`level`,
|
||||
`creation_day`,
|
||||
`last_spawn`,
|
||||
`time_spawned`,
|
||||
`size`,
|
||||
`face`,
|
||||
`hair_color`,
|
||||
`hair_style`,
|
||||
`beard`,
|
||||
`beard_color`,
|
||||
`eye_color_1`,
|
||||
`eye_color_2`,
|
||||
`drakkin_heritage`,
|
||||
`drakkin_tattoo`,
|
||||
`drakkin_details`,
|
||||
`ac`,
|
||||
`atk`,
|
||||
`hp`,
|
||||
`mana`,
|
||||
`str`,
|
||||
`sta`,
|
||||
`cha`,
|
||||
`dex`,
|
||||
`int`,
|
||||
`agi`,
|
||||
`wis`,
|
||||
`fire`,
|
||||
`cold`,
|
||||
`magic`,
|
||||
`poison`,
|
||||
`disease`,
|
||||
`corruption`
|
||||
)
|
||||
SELECT
|
||||
`BotID`,
|
||||
`BotOwnerCharacterID`,
|
||||
`BotSpellsID`,
|
||||
`Name`,
|
||||
`LastName`,
|
||||
`LastZoneId`,
|
||||
`Gender`,
|
||||
`Race`,
|
||||
`Class`,
|
||||
`BotLevel`,
|
||||
UNIX_TIMESTAMP(`BotCreateDate`),
|
||||
UNIX_TIMESTAMP(`LastSpawnDate`),
|
||||
`TotalPlayTime`,
|
||||
`Size`,
|
||||
`Face`,
|
||||
`LuclinHairColor`,
|
||||
`LuclinHairStyle`,
|
||||
`LuclinBeard`,
|
||||
`LuclinBeardColor`,
|
||||
`LuclinEyeColor`,
|
||||
`LuclinEyeColor2`,
|
||||
`DrakkinHeritage`,
|
||||
`DrakkinTattoo`,
|
||||
`DrakkinDetails`,
|
||||
`AC`,
|
||||
`ATK`,
|
||||
`HP`,
|
||||
`Mana`,
|
||||
`STR`,
|
||||
`STA`,
|
||||
`CHA`,
|
||||
`DEX`,
|
||||
`_INT`,
|
||||
`AGI`,
|
||||
`WIS`,
|
||||
`FR`,
|
||||
`CR`,
|
||||
`MR`,
|
||||
`PR`,
|
||||
`DR`,
|
||||
`Corrup`
|
||||
FROM `bots`;
|
||||
|
||||
INSERT INTO `bot_inspect_messages` (
|
||||
`bot_id`,
|
||||
`inspect_message`
|
||||
)
|
||||
SELECT
|
||||
`BotID`,
|
||||
`BotInspectMessage`
|
||||
FROM `bots`;
|
||||
|
||||
RENAME TABLE `bots` TO `bots_old`;
|
||||
END IF;
|
||||
|
||||
CREATE TABLE `bot_stances` (
|
||||
`bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`stance_id` TINYINT UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`bot_id`),
|
||||
CONSTRAINT `FK_bot_stances_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
|
||||
);
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botstances') > 0) THEN
|
||||
INSERT INTO `bot_stances` (
|
||||
`bot_id`,
|
||||
`stance_id`
|
||||
)
|
||||
SELECT
|
||||
bs.`BotID`,
|
||||
bs.`StanceID`
|
||||
FROM `botstances` bs
|
||||
INNER JOIN `bot_data` bd
|
||||
ON bs.`BotID` = bd.`bot_id`;
|
||||
|
||||
RENAME TABLE `botstances` TO `botstances_old`;
|
||||
END IF;
|
||||
|
||||
CREATE TABLE `bot_timers` (
|
||||
`bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`timer_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`timer_value` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`bot_id`),
|
||||
CONSTRAINT `FK_bot_timers_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
|
||||
);
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'bottimers') > 0) THEN
|
||||
INSERT INTO `bot_timers` (
|
||||
`bot_id`,
|
||||
`timer_id`,
|
||||
`timer_value`
|
||||
)
|
||||
SELECT
|
||||
bt.`BotID`,
|
||||
bt.`TimerID`,
|
||||
bt.`Value`
|
||||
FROM `bottimers` bt
|
||||
INNER JOIN `bot_data` bd
|
||||
ON bt.`BotID` = bd.`bot_id`;
|
||||
|
||||
RENAME TABLE `bottimers` TO `bottimers_old`;
|
||||
END IF;
|
||||
|
||||
CREATE TABLE `bot_buffs` (
|
||||
`buffs_index` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`spell_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`caster_level` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`duration_formula` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`tics_remaining` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`poison_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`disease_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`curse_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`corruption_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`numhits` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`melee_rune` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`magic_rune` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`dot_rune` INT(10) UNSIGNED NOT NULL DEFAULT '0', -- Fix
|
||||
`persistent` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`caston_x` INT(10) NOT NULL DEFAULT '0', -- Fix
|
||||
`caston_y` INT(10) NOT NULL DEFAULT '0', -- Fix
|
||||
`caston_z` INT(10) NOT NULL DEFAULT '0', -- Fix
|
||||
`extra_di_chance` INT(10) UNSIGNED NOT NULL DEFAULT '0', -- Fix
|
||||
`instrument_mod` INT(10) NOT NULL DEFAULT '10', -- Unused
|
||||
PRIMARY KEY (`buffs_index`),
|
||||
KEY `FK_bot_buffs_1` (`bot_id`),
|
||||
CONSTRAINT `FK_bot_buffs_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botbuffs') > 0) THEN
|
||||
INSERT INTO `bot_buffs` (
|
||||
`buffs_index`,
|
||||
`bot_id`,
|
||||
`spell_id`,
|
||||
`caster_level`,
|
||||
`duration_formula`,
|
||||
`tics_remaining`,
|
||||
`poison_counters`,
|
||||
`disease_counters`,
|
||||
`curse_counters`,
|
||||
`corruption_counters`,
|
||||
`numhits`,
|
||||
`melee_rune`,
|
||||
`magic_rune`,
|
||||
`persistent`
|
||||
)
|
||||
SELECT
|
||||
bb.`BotBuffId`,
|
||||
bb.`BotId`,
|
||||
bb.`SpellId`,
|
||||
bb.`CasterLevel`,
|
||||
bb.`DurationFormula`,
|
||||
bb.`TicsRemaining`,
|
||||
bb.`PoisonCounters`,
|
||||
bb.`DiseaseCounters`,
|
||||
bb.`CurseCounters`,
|
||||
bb.`CorruptionCounters`,
|
||||
bb.`HitCount`,
|
||||
bb.`MeleeRune`,
|
||||
bb.`MagicRune`,
|
||||
bb.`Persistent`
|
||||
FROM `botbuffs` bb
|
||||
INNER JOIN `bot_data` bd
|
||||
ON bb.`BotId` = bd.`bot_id`;
|
||||
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botbuffs' AND `COLUMN_NAME` = 'dot_rune') > 0) THEN
|
||||
UPDATE `bot_buffs` bb
|
||||
INNER JOIN `botbuffs` bbo
|
||||
ON bb.`buffs_index` = bbo.`BotBuffId`
|
||||
SET bb.`dot_rune` = bbo.`dot_rune`
|
||||
WHERE bb.`bot_id` = bbo.`BotID`;
|
||||
END IF;
|
||||
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botbuffs' AND `COLUMN_NAME` = 'caston_x') > 0) THEN
|
||||
UPDATE `bot_buffs` bb
|
||||
INNER JOIN `botbuffs` bbo
|
||||
ON bb.`buffs_index` = bbo.`BotBuffId`
|
||||
SET bb.`caston_x` = bbo.`caston_x`
|
||||
WHERE bb.`bot_id` = bbo.`BotID`;
|
||||
END IF;
|
||||
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botbuffs' AND `COLUMN_NAME` = 'caston_y') > 0) THEN
|
||||
UPDATE `bot_buffs` bb
|
||||
INNER JOIN `botbuffs` bbo
|
||||
ON bb.`buffs_index` = bbo.`BotBuffId`
|
||||
SET bb.`caston_y` = bbo.`caston_y`
|
||||
WHERE bb.`bot_id` = bbo.`BotID`;
|
||||
END IF;
|
||||
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botbuffs' AND `COLUMN_NAME` = 'caston_z') > 0) THEN
|
||||
UPDATE `bot_buffs` bb
|
||||
INNER JOIN `botbuffs` bbo
|
||||
ON bb.`buffs_index` = bbo.`BotBuffId`
|
||||
SET bb.`caston_z` = bbo.`caston_z`
|
||||
WHERE bb.`bot_id` = bbo.`BotID`;
|
||||
END IF;
|
||||
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botbuffs' AND `COLUMN_NAME` = 'ExtraDIChance') > 0) THEN
|
||||
UPDATE `bot_buffs` bb
|
||||
INNER JOIN `botbuffs` bbo
|
||||
ON bb.`buffs_index` = bbo.`BotBuffId`
|
||||
SET bb.`extra_di_chance` = bbo.`ExtraDIChance`
|
||||
WHERE bb.`bot_id` = bbo.`BotID`;
|
||||
END IF;
|
||||
|
||||
RENAME TABLE `botbuffs` TO `botbuffs_old`;
|
||||
END IF;
|
||||
|
||||
CREATE TABLE `bot_inventories` (
|
||||
`inventories_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`slot_id` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`item_id` INT(11) UNSIGNED NULL DEFAULT '0',
|
||||
`inst_charges` TINYINT(3) UNSIGNED DEFAULT 0,
|
||||
`inst_color` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`inst_no_drop` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`inst_custom_data` TEXT NULL,
|
||||
`ornament_icon` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ornament_id_file` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ornament_hero_model` INT(11) NOT NULL DEFAULT '0',
|
||||
`augment_1` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augment_2` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augment_3` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augment_4` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augment_5` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augment_6` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`inventories_index`),
|
||||
KEY `FK_bot_inventories_1` (`bot_id`),
|
||||
CONSTRAINT `FK_bot_inventories_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
|
||||
) ENGINE=InnoDB;
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botinventory') > 0) THEN
|
||||
INSERT INTO `bot_inventories` (
|
||||
`inventories_index`,
|
||||
`bot_id`,
|
||||
`slot_id`,
|
||||
`item_id`,
|
||||
`inst_charges`,
|
||||
`inst_color`,
|
||||
`inst_no_drop`,
|
||||
`augment_1`,
|
||||
`augment_2`,
|
||||
`augment_3`,
|
||||
`augment_4`,
|
||||
`augment_5`
|
||||
)
|
||||
SELECT
|
||||
bi.`BotInventoryID`,
|
||||
bi.`BotID`,
|
||||
bi.`SlotID`,
|
||||
bi.`ItemID`,
|
||||
bi.`charges`,
|
||||
bi.`color`,
|
||||
bi.`instnodrop`,
|
||||
bi.`augslot1`,
|
||||
bi.`augslot2`,
|
||||
bi.`augslot3`,
|
||||
bi.`augslot4`,
|
||||
bi.`augslot5`
|
||||
FROM `botinventory` bi
|
||||
INNER JOIN `bot_data` bd
|
||||
ON bi.`BotID` = bd.`bot_id`;
|
||||
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botinventory' AND `COLUMN_NAME` = 'augslot6') > 0) THEN
|
||||
UPDATE `bot_inventories` bi
|
||||
INNER JOIN `botinventory` bio
|
||||
ON bi.`inventories_index` = bio.`BotInventoryID`
|
||||
SET bi.`augment_6` = bio.`augslot6`
|
||||
WHERE bi.`bot_id` = bio.`BotID`;
|
||||
END IF;
|
||||
|
||||
RENAME TABLE `botinventory` TO `botinventory_old`;
|
||||
END IF;
|
||||
|
||||
CREATE TABLE `bot_pets` (
|
||||
`pets_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`pet_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
`bot_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
`name` VARCHAR(64) NULL,
|
||||
`mana` INTEGER NOT NULL DEFAULT '0',
|
||||
`hp` INTEGER NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`pets_index`),
|
||||
KEY `FK_bot_pets_1` (`bot_id`),
|
||||
CONSTRAINT `FK_bot_pets_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`),
|
||||
CONSTRAINT `U_bot_pets_1` UNIQUE (`bot_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botpets') > 0) THEN
|
||||
INSERT INTO `bot_pets` (
|
||||
`pets_index`,
|
||||
`pet_id`,
|
||||
`bot_id`,
|
||||
`name`,
|
||||
`mana`,
|
||||
`hp`
|
||||
)
|
||||
SELECT
|
||||
bp.`BotPetsId`,
|
||||
bp.`PetId`,
|
||||
bp.`BotId`,
|
||||
bp.`Name`,
|
||||
bp.`Mana`,
|
||||
bp.`HitPoints`
|
||||
FROM `botpets` bp
|
||||
INNER JOIN `bot_data` bd
|
||||
ON bp.`BotId` = bd.`bot_id`;
|
||||
|
||||
RENAME TABLE `botpets` TO `botpets_old`;
|
||||
END IF;
|
||||
|
||||
CREATE TABLE `bot_pet_buffs` (
|
||||
`pet_buffs_index` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`pets_index` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`spell_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`caster_level` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`duration` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`pet_buffs_index`),
|
||||
KEY `FK_bot_pet_buffs_1` (`pets_index`),
|
||||
CONSTRAINT `FK_bot_pet_buffs_1` FOREIGN KEY (`pets_index`) REFERENCES `bot_pets` (`pets_index`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botpetbuffs') > 0) THEN
|
||||
INSERT INTO `bot_pet_buffs` (
|
||||
`pet_buffs_index`,
|
||||
`pets_index`,
|
||||
`spell_id`,
|
||||
`caster_level`,
|
||||
`duration`
|
||||
)
|
||||
SELECT
|
||||
bpb.`BotPetBuffId`,
|
||||
bpb.`BotPetsId`,
|
||||
bpb.`SpellId`,
|
||||
bpb.`CasterLevel`,
|
||||
bpb.`Duration`
|
||||
FROM `botpetbuffs` bpb
|
||||
INNER JOIN `bot_pets` bp
|
||||
ON bpb.`BotPetsId` = bp.`pets_index`;
|
||||
|
||||
RENAME TABLE `botpetbuffs` TO `botpetbuffs_old`;
|
||||
END IF;
|
||||
|
||||
CREATE TABLE `bot_pet_inventories` (
|
||||
`pet_inventories_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`pets_index` INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
`item_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`pet_inventories_index`),
|
||||
KEY `FK_bot_pet_inventories_1` (`pets_index`),
|
||||
CONSTRAINT `FK_bot_pet_inventories_1` FOREIGN KEY (`pets_index`) REFERENCES `bot_pets` (`pets_index`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botpetinventory') > 0) THEN
|
||||
INSERT INTO `bot_pet_inventories` (
|
||||
`pet_inventories_index`,
|
||||
`pets_index`,
|
||||
`item_id`
|
||||
)
|
||||
SELECT
|
||||
bpi.`BotPetInventoryId`,
|
||||
bpi.`BotPetsId`,
|
||||
bpi.`ItemId`
|
||||
FROM `botpetinventory` bpi
|
||||
INNER JOIN `bot_pets` bp
|
||||
ON bpi.`BotPetsId` = bp.`pets_index`;
|
||||
|
||||
RENAME TABLE `botpetinventory` TO `botpetinventory_old`;
|
||||
END IF;
|
||||
|
||||
CREATE TABLE `bot_groups` (
|
||||
`groups_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`group_leader_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
`group_name` VARCHAR(64) NOT NULL,
|
||||
PRIMARY KEY (`groups_index`),
|
||||
KEY `FK_bot_groups_1` (`group_leader_id`),
|
||||
CONSTRAINT `FK_bot_groups_1` FOREIGN KEY (`group_leader_id`) REFERENCES `bot_data` (`bot_id`)
|
||||
) ENGINE=InnoDB;
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botgroup') > 0) THEN
|
||||
INSERT INTO `bot_groups` (
|
||||
`groups_index`,
|
||||
`group_leader_id`,
|
||||
`group_name`
|
||||
)
|
||||
SELECT
|
||||
bg.`BotGroupId`,
|
||||
bg.`BotGroupLeaderBotId`,
|
||||
bg.`BotGroupName`
|
||||
FROM `botgroup` bg
|
||||
INNER JOIN `bot_data` bd
|
||||
ON bg.`BotGroupLeaderBotId` = bd.`bot_id`;
|
||||
|
||||
RENAME TABLE `botgroup` TO `botgroup_old`;
|
||||
END IF;
|
||||
|
||||
CREATE TABLE `bot_group_members` (
|
||||
`group_members_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`groups_index` INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
`bot_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`group_members_index`),
|
||||
KEY `FK_bot_group_members_1` (`groups_index`),
|
||||
CONSTRAINT `FK_bot_group_members_1` FOREIGN KEY (`groups_index`) REFERENCES `bot_groups` (`groups_index`),
|
||||
KEY `FK_bot_group_members_2` (`bot_id`),
|
||||
CONSTRAINT `FK_bot_group_members_2` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
|
||||
) ENGINE=InnoDB;
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botgroupmembers') > 0) THEN
|
||||
INSERT INTO `bot_group_members` (
|
||||
`group_members_index`,
|
||||
`groups_index`,
|
||||
`bot_id`
|
||||
)
|
||||
SELECT
|
||||
bgm.`BotGroupMemberId`,
|
||||
bgm.`BotGroupId`,
|
||||
bgm.`BotId`
|
||||
FROM `botgroupmembers` bgm
|
||||
INNER JOIN `bot_groups` bg
|
||||
ON bgm.`BotGroupId` = bg.`groups_index`
|
||||
INNER JOIN `bot_data` bd
|
||||
ON bgm.`BotId` = bd.`bot_id`;
|
||||
|
||||
RENAME TABLE `botgroupmembers` TO `botgroupmembers_old`;
|
||||
END IF;
|
||||
|
||||
CREATE TABLE `bot_guild_members` (
|
||||
`bot_id` INT(11) NOT NULL DEFAULT '0',
|
||||
`guild_id` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`rank` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`tribute_enable` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`total_tribute` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`last_tribute` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`banker` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`public_note` TEXT NULL,
|
||||
`alt` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`bot_id`)
|
||||
) ENGINE=InnoDB;
|
||||
IF ((SELECT COUNT(*) FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botguildmembers') > 0) THEN
|
||||
INSERT INTO `bot_guild_members` (
|
||||
`bot_id`,
|
||||
`guild_id`,
|
||||
`rank`,
|
||||
`tribute_enable`,
|
||||
`total_tribute`,
|
||||
`last_tribute`,
|
||||
`banker`,
|
||||
`public_note`,
|
||||
`alt`
|
||||
)
|
||||
SELECT
|
||||
bgm.`char_id`,
|
||||
bgm.`guild_id`,
|
||||
bgm.`rank`,
|
||||
bgm.`tribute_enable`,
|
||||
bgm.`total_tribute`,
|
||||
bgm.`last_tribute`,
|
||||
bgm.`banker`,
|
||||
bgm.`public_note`,
|
||||
bgm.`alt`
|
||||
FROM `botguildmembers` bgm
|
||||
INNER JOIN `guilds` g
|
||||
ON bgm.`guild_id` = g.`id`
|
||||
INNER JOIN `bot_data` bd
|
||||
ON bgm.`char_id` = bd.`bot_id`;
|
||||
|
||||
RENAME TABLE `botguildmembers` TO `botguildmembers_old`;
|
||||
END IF;
|
||||
|
||||
END$$
|
||||
CREATE TABLE `bot_timers` (
|
||||
`bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`timer_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`timer_value` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`bot_id`),
|
||||
CONSTRAINT `FK_bot_timers_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
|
||||
);
|
||||
|
||||
DELIMITER ;
|
||||
CREATE TABLE `bot_buffs` (
|
||||
`buffs_index` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`spell_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`caster_level` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`duration_formula` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`tics_remaining` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`poison_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`disease_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`curse_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`corruption_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`numhits` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`melee_rune` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`magic_rune` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`dot_rune` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`persistent` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`caston_x` INT(10) NOT NULL DEFAULT '0',
|
||||
`caston_y` INT(10) NOT NULL DEFAULT '0',
|
||||
`caston_z` INT(10) NOT NULL DEFAULT '0',
|
||||
`extra_di_chance` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`instrument_mod` INT(10) NOT NULL DEFAULT '10', -- Unused
|
||||
PRIMARY KEY (`buffs_index`),
|
||||
KEY `FK_bot_buffs_1` (`bot_id`),
|
||||
CONSTRAINT `FK_bot_buffs_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `bot_inventories` (
|
||||
`inventories_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`slot_id` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`item_id` INT(11) UNSIGNED NULL DEFAULT '0',
|
||||
`inst_charges` TINYINT(3) UNSIGNED DEFAULT 0,
|
||||
`inst_color` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`inst_no_drop` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`inst_custom_data` TEXT NULL,
|
||||
`ornament_icon` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ornament_id_file` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ornament_hero_model` INT(11) NOT NULL DEFAULT '0',
|
||||
`augment_1` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augment_2` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augment_3` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augment_4` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augment_5` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augment_6` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`inventories_index`),
|
||||
KEY `FK_bot_inventories_1` (`bot_id`),
|
||||
CONSTRAINT `FK_bot_inventories_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CALL `LoadBotsSchema`();
|
||||
CREATE TABLE `bot_pets` (
|
||||
`pets_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`pet_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
`bot_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
`name` VARCHAR(64) NULL,
|
||||
`mana` INTEGER NOT NULL DEFAULT '0',
|
||||
`hp` INTEGER NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`pets_index`),
|
||||
KEY `FK_bot_pets_1` (`bot_id`),
|
||||
CONSTRAINT `FK_bot_pets_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`),
|
||||
CONSTRAINT `U_bot_pets_1` UNIQUE (`bot_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
|
||||
DROP PROCEDURE IF EXISTS `LoadBotsSchema`;
|
||||
CREATE TABLE `bot_pet_buffs` (
|
||||
`pet_buffs_index` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`pets_index` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`spell_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`caster_level` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`duration` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`pet_buffs_index`),
|
||||
KEY `FK_bot_pet_buffs_1` (`pets_index`),
|
||||
CONSTRAINT `FK_bot_pet_buffs_1` FOREIGN KEY (`pets_index`) REFERENCES `bot_pets` (`pets_index`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `bot_pet_inventories` (
|
||||
`pet_inventories_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`pets_index` INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
`item_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`pet_inventories_index`),
|
||||
KEY `FK_bot_pet_inventories_1` (`pets_index`),
|
||||
CONSTRAINT `FK_bot_pet_inventories_1` FOREIGN KEY (`pets_index`) REFERENCES `bot_pets` (`pets_index`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `bot_groups` (
|
||||
`groups_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`group_leader_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
`group_name` VARCHAR(64) NOT NULL,
|
||||
PRIMARY KEY (`groups_index`),
|
||||
KEY `FK_bot_groups_1` (`group_leader_id`),
|
||||
CONSTRAINT `FK_bot_groups_1` FOREIGN KEY (`group_leader_id`) REFERENCES `bot_data` (`bot_id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `bot_group_members` (
|
||||
`group_members_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`groups_index` INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
`bot_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`group_members_index`),
|
||||
KEY `FK_bot_group_members_1` (`groups_index`),
|
||||
CONSTRAINT `FK_bot_group_members_1` FOREIGN KEY (`groups_index`) REFERENCES `bot_groups` (`groups_index`),
|
||||
KEY `FK_bot_group_members_2` (`bot_id`),
|
||||
CONSTRAINT `FK_bot_group_members_2` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `bot_guild_members` (
|
||||
`bot_id` INT(11) NOT NULL DEFAULT '0',
|
||||
`guild_id` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`rank` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`tribute_enable` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`total_tribute` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`last_tribute` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`banker` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`public_note` TEXT NULL,
|
||||
`alt` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`bot_id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
|
||||
-- Functions
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
INSERT INTO `rule_values` VALUES ('0', 'Character:RestrictSpellScribing', 'false', 'Restricts spell scribing to allowable races/classes of spell scroll, if true');
|
||||
INSERT INTO `rule_values` VALUES ('1', 'Character:RestrictSpellScribing', 'false', 'Restricts spell scribing to allowable races/classes of spell scroll, if true');
|
||||
INSERT INTO `rule_values` VALUES ('2', 'Character:RestrictSpellScribing', 'false', 'Restricts spell scribing to allowable races/classes of spell scroll, if true');
|
||||
INSERT INTO `rule_values` VALUES ('3', 'Character:RestrictSpellScribing', 'false', 'Restricts spell scribing to allowable races/classes of spell scroll, if true');
|
||||
INSERT INTO `rule_values` VALUES ('4', 'Character:RestrictSpellScribing', 'false', 'Restricts spell scribing to allowable races/classes of spell scroll, if true');
|
||||
INSERT INTO `rule_values` VALUES ('5', 'Character:RestrictSpellScribing', 'false', 'Restricts spell scribing to allowable races/classes of spell scroll, if true');
|
||||
INSERT INTO `rule_values` VALUES ('10', 'Character:RestrictSpellScribing', 'false', 'Restricts spell scribing to allowable races/classes of spell scroll, if true');
|
||||
11
utils/sql/git/required/2015_12_07_command_settings.sql
Normal file
11
utils/sql/git/required/2015_12_07_command_settings.sql
Normal file
File diff suppressed because one or more lines are too long
@ -145,7 +145,7 @@ bool LoginServer::Process() {
|
||||
break;
|
||||
}
|
||||
case ServerOP_LSClientAuth: {
|
||||
ServerLSClientAuth* slsca = (ServerLSClientAuth*) pack->pBuffer;
|
||||
ClientAuth_Struct* slsca = (ClientAuth_Struct*) pack->pBuffer;
|
||||
|
||||
if (RuleI(World, AccountSessionLimit) >= 0) {
|
||||
// Enforce the limit on the number of characters on the same account that can be
|
||||
|
||||
@ -114,6 +114,9 @@ void CatchSignal(int sig_num);
|
||||
int main(int argc, char** argv) {
|
||||
RegisterExecutablePlatform(ExePlatformWorld);
|
||||
Log.LoadLogSettingsDefaults();
|
||||
|
||||
|
||||
|
||||
set_exception_handler();
|
||||
|
||||
/* Database Version Check */
|
||||
@ -481,19 +484,16 @@ int main(int argc, char** argv) {
|
||||
if (InterserverTimer.Check()) {
|
||||
InterserverTimer.Start();
|
||||
database.ping();
|
||||
// AsyncLoadVariables(dbasync, &database);
|
||||
ReconnectCounter++;
|
||||
if (ReconnectCounter >= 12) { // only create thread to reconnect every 10 minutes. previously we were creating a new thread every 10 seconds
|
||||
ReconnectCounter = 0;
|
||||
if (loginserverlist.AllConnected() == false) {
|
||||
|
||||
if (loginserverlist.AllConnected() == false) {
|
||||
#ifdef _WINDOWS
|
||||
_beginthread(AutoInitLoginServer, 0, nullptr);
|
||||
_beginthread(AutoInitLoginServer, 0, nullptr);
|
||||
#else
|
||||
pthread_t thread;
|
||||
pthread_create(&thread, nullptr, &AutoInitLoginServer, nullptr);
|
||||
pthread_t thread;
|
||||
pthread_create(&thread, nullptr, &AutoInitLoginServer, nullptr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (numclients == 0) {
|
||||
Sleep(50);
|
||||
|
||||
10
zone/bot.cpp
10
zone/bot.cpp
@ -2026,6 +2026,16 @@ void Bot::LoadPetBuffs(SpellBuff_Struct* petBuffs, uint32 botPetSaveId) {
|
||||
petBuffs[buffIndex].spellid = atoi(row[0]);
|
||||
petBuffs[buffIndex].level = atoi(row[1]);
|
||||
petBuffs[buffIndex].duration = atoi(row[2]);
|
||||
//Work around for loading the counters and setting them back to max. Need entry in DB for saved counters
|
||||
if(CalculatePoisonCounters(petBuffs[buffIndex].spellid) > 0)
|
||||
petBuffs[buffIndex].counters = CalculatePoisonCounters(petBuffs[buffIndex].spellid);
|
||||
else if(CalculateDiseaseCounters(petBuffs[buffIndex].spellid) > 0)
|
||||
petBuffs[buffIndex].counters = CalculateDiseaseCounters(petBuffs[buffIndex].spellid);
|
||||
else if(CalculateCurseCounters(petBuffs[buffIndex].spellid) > 0)
|
||||
petBuffs[buffIndex].counters = CalculateCurseCounters(petBuffs[buffIndex].spellid);
|
||||
else if(CalculateCorruptionCounters(petBuffs[buffIndex].spellid) > 0)
|
||||
petBuffs[buffIndex].counters = CalculateCorruptionCounters(petBuffs[buffIndex].spellid);
|
||||
|
||||
buffIndex++;
|
||||
}
|
||||
query = StringFormat("DELETE FROM `bot_pet_buffs` WHERE `pets_index` = %u;", botPetSaveId);
|
||||
|
||||
@ -712,6 +712,7 @@ public:
|
||||
// use this one instead
|
||||
void MemSpell(uint16 spell_id, int slot, bool update_client = true);
|
||||
void UnmemSpell(int slot, bool update_client = true);
|
||||
void UnmemSpellBySpellID(int32 spell_id);
|
||||
void UnmemSpellAll(bool update_client = true);
|
||||
void ScribeSpell(uint16 spell_id, int slot, bool update_client = true);
|
||||
void UnscribeSpell(int slot, bool update_client = true);
|
||||
@ -925,6 +926,8 @@ public:
|
||||
void ResetTrade();
|
||||
void DropInst(const ItemInst* inst);
|
||||
bool TrainDiscipline(uint32 itemid);
|
||||
void TrainDiscBySpellID(int32 spell_id);
|
||||
int GetDiscSlotBySpellID(int32 spellid);
|
||||
void SendDisciplineUpdate();
|
||||
void SendDisciplineTimer(uint32 timer_id, uint32 duration);
|
||||
bool UseDiscipline(uint32 spell_id, uint32 target);
|
||||
|
||||
@ -1153,6 +1153,11 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app)
|
||||
{
|
||||
const Item_Struct* item = inst->GetItem();
|
||||
|
||||
if (RuleB(Character, RestrictSpellScribing) && !item->IsEquipable(GetRace(), GetClass())) {
|
||||
Message_StringID(13, CANNOT_USE_ITEM);
|
||||
break;
|
||||
}
|
||||
|
||||
if(item && item->Scroll.Effect == (int32)(memspell->spell_id))
|
||||
{
|
||||
ScribeSpell(memspell->spell_id, memspell->slot);
|
||||
|
||||
218
zone/command.cpp
218
zone/command.cpp
@ -23,12 +23,12 @@
|
||||
1. At the bottom of command.h you must add a prototype for it.
|
||||
2. Add the function in this file.
|
||||
3. In the command_init function you must add a call to command_add
|
||||
for your function. If you want an alias for your command, add
|
||||
a second call to command_add with the description and access args
|
||||
set to nullptr and 0 respectively since they aren't used when adding
|
||||
an alias. The function pointers being equal is makes it an alias.
|
||||
The access level you set with command_add is only a default if
|
||||
the command isn't listed in the commands db table.
|
||||
for your function.
|
||||
|
||||
Notes: If you want an alias for your command, add an entry to the
|
||||
`command_settings` table in your database. The access level you
|
||||
set with command_add is the default setting if the command isn't
|
||||
listed in the `command_settings` db table.
|
||||
|
||||
*/
|
||||
|
||||
@ -73,9 +73,7 @@ extern TaskManager *taskmanager;
|
||||
void CatchSignal(int sig_num);
|
||||
|
||||
|
||||
|
||||
//struct cl_struct *commandlist; // the actual linked list of commands
|
||||
int commandcount; // how many commands we have
|
||||
int commandcount; // how many commands we have
|
||||
|
||||
// this is the pointer to the dispatch function, updated once
|
||||
// init has been performed to point at the real function
|
||||
@ -86,11 +84,11 @@ void command_bestz(Client *c, const Seperator *message);
|
||||
void command_pf(Client *c, const Seperator *message);
|
||||
|
||||
std::map<std::string, CommandRecord *> commandlist;
|
||||
std::map<std::string, std::string> commandaliases;
|
||||
|
||||
//All allocated CommandRecords get put in here so they get deleted on shutdown
|
||||
LinkedList<CommandRecord *> cleanup_commandlist;
|
||||
|
||||
|
||||
/*
|
||||
* command_notavail
|
||||
* This is the default dispatch function when commands aren't loaded.
|
||||
@ -139,31 +137,17 @@ Access Levels:
|
||||
* Parameters:
|
||||
* none
|
||||
*
|
||||
* When adding a command, if it's the first time that function pointer is
|
||||
* used it is a new command. If that function pointer is used for another
|
||||
* command, the command is added as an alias; description and access level
|
||||
* are not used and can be nullptr.
|
||||
* When adding a new command, only hard-code 'real' commands -
|
||||
* all command aliases are added later through a database call
|
||||
*
|
||||
*/
|
||||
|
||||
int command_init(void) {
|
||||
|
||||
if
|
||||
(
|
||||
|
||||
#ifdef PACKET_PROFILER
|
||||
command_add("packetprofile", "- Dump packet profile for target or self.", 250, command_packetprofile) ||
|
||||
#endif
|
||||
#ifdef EQPROFILE
|
||||
command_add("profiledump", "- Dump profiling info to logs", 250, command_profiledump) ||
|
||||
command_add("profilereset", "- Reset profiling info", 250, command_profilereset) ||
|
||||
#endif
|
||||
#ifdef BOTS
|
||||
command_add("bot", "- Type \"#bot help\" to the see the list of available commands for bots.", 0, command_bot) ||
|
||||
#endif
|
||||
|
||||
int command_init(void)
|
||||
{
|
||||
commandaliases.clear();
|
||||
|
||||
if (
|
||||
command_add("acceptrules", "[acceptrules] - Accept the EQEmu Agreement", 0, command_acceptrules) ||
|
||||
command_add("advnpc", "analog for advnpcspawn [maketype|makegroup|addgroupentry|addgroupspawn][removegroupspawn|movespawn|editgroupbox|cleargroupbox]", 150, command_advnpcspawn) ||
|
||||
command_add("advnpcspawn", "[maketype|makegroup|addgroupentry|addgroupspawn][removegroupspawn|movespawn|editgroupbox|cleargroupbox]", 150, command_advnpcspawn) ||
|
||||
command_add("aggro", "(range) [-v] - Display aggro information for all mobs 'range' distance from your target. -v is verbose faction info.", 80, command_aggro) ||
|
||||
command_add("aggrozone", "[aggro] - Aggro every mob in the zone with X aggro. Default is 0. Not recommend if you're not invulnerable.", 100, command_aggrozone) ||
|
||||
@ -172,27 +156,27 @@ int command_init(void) {
|
||||
command_add("apply_shared_memory", "[shared_memory_name] - Tells every zone and world to apply a specific shared memory segment by name.", 250, command_apply_shared_memory) ||
|
||||
command_add("attack", "[targetname] - Make your NPC target attack targetname", 150, command_attack) ||
|
||||
command_add("augmentitem", "Force augments an item. Must have the augment item window open.", 250, command_augmentitem) ||
|
||||
command_add("aug", nullptr, 250, command_augmentitem) ||
|
||||
command_add("ban", "[name] [reason]- Ban by character name", 150, command_ban) ||
|
||||
command_add("beard", "- Change the beard of your target", 80, command_beard) ||
|
||||
command_add("beardcolor", "- Change the beard color of your target", 80, command_beardcolor) ||
|
||||
command_add("bestz", "- Ask map for a good Z coord for your x,y coords.", 0, command_bestz) ||
|
||||
command_add("bind", "- Sets your targets bind spot to their current location", 200, command_bind) ||
|
||||
|
||||
#ifdef BOTS
|
||||
command_add("bot", "- Type \"#bot help\" to the see the list of available commands for bots.", 0, command_bot) ||
|
||||
#endif
|
||||
|
||||
command_add("camerashake", "Shakes the camera on everyone's screen globally.", 80, command_camerashake) ||
|
||||
command_add("cast", nullptr,0, command_castspell) ||
|
||||
command_add("castspell", "[spellid] - Cast a spell", 50, command_castspell) ||
|
||||
command_add("chat", "[channel num] [message] - Send a channel message to all zones", 200, command_chat) ||
|
||||
command_add("checklos", "- Check for line of sight to your target", 50, command_checklos) ||
|
||||
command_add("clearinvsnapshots", "[use rule] - Clear inventory snapshot history (true - elapsed entries, false - all entries)", 200, command_clearinvsnapshots) ||
|
||||
command_add("close_shop", nullptr, 100, command_merchantcloseshop) ||
|
||||
command_add("connectworld", nullptr,0, command_connectworldserver) ||
|
||||
command_add("connectworldserver", "- Make zone attempt to connect to worldserver", 200, command_connectworldserver) ||
|
||||
command_add("corpse", "- Manipulate corpses, use with no arguments for help", 50, command_corpse) ||
|
||||
command_add("crashtest", "- Crash the zoneserver", 255, command_crashtest) ||
|
||||
command_add("cvs", "- Summary of client versions currently online.", 200, command_cvs) ||
|
||||
command_add("crashtest", "- Crash the zoneserver", 255, command_crashtest) ||
|
||||
command_add("cvs", "- Summary of client versions currently online.", 200, command_cvs) ||
|
||||
command_add("damage", "[amount] - Damage your target", 100, command_damage) ||
|
||||
command_add("date", "[yyyy] [mm] [dd] [HH] [MM] - Set EQ time", 90, command_date) ||
|
||||
command_add("dbspawn", nullptr,10, command_npctypespawn) ||
|
||||
command_add("dbspawn2", "[spawngroup] [respawn] [variance] - Spawn an NPC from a predefined row in the spawn2 table", 100, command_dbspawn2) ||
|
||||
command_add("delacct", "[accountname] - Delete an account", 150, command_delacct) ||
|
||||
command_add("deletegraveyard", "[zone name] - Deletes the graveyard for the specified zone.", 200, command_deletegraveyard) ||
|
||||
@ -210,8 +194,6 @@ int command_init(void) {
|
||||
command_add("enablerecipe", "[recipe_id] - Enables a recipe using the recipe id.", 80, command_enablerecipe) ||
|
||||
command_add("equipitem", "[slotid(0-21)] - Equip the item on your cursor into the specified slot", 50, command_equipitem) ||
|
||||
command_add("face", "- Change the face of your target", 80, command_face) ||
|
||||
command_add("fi", nullptr,10, command_itemsearch) ||
|
||||
command_add("finditem", nullptr,10, command_itemsearch) ||
|
||||
command_add("findnpctype", "[search criteria] - Search database NPC types", 100, command_findnpctype) ||
|
||||
command_add("findspell", "[searchstring] - Search for a spell", 50, command_findspell) ||
|
||||
command_add("findzone", "[search criteria] - Search database zones", 100, command_findzone) ||
|
||||
@ -220,22 +202,17 @@ int command_init(void) {
|
||||
command_add("flagedit", "- Edit zone flags on your target", 100, command_flagedit) ||
|
||||
command_add("flags", "- displays the flags of you or your target", 0, command_flags) ||
|
||||
command_add("flymode", "[0/1/2] - Set your or your player target's flymode to off/on/levitate", 50, command_flymode) ||
|
||||
command_add("fn", nullptr, 100, command_findnpctype) ||
|
||||
command_add("fov", "- Check wether you're behind or in your target's field of view", 80, command_fov) ||
|
||||
command_add("freeze", "- Freeze your target", 80, command_freeze) ||
|
||||
command_add("fs", nullptr, 50, command_findspell) ||
|
||||
command_add("fz", nullptr, 100, command_findzone) ||
|
||||
command_add("gassign", "[id] - Assign targetted NPC to predefined wandering grid id", 100, command_gassign) ||
|
||||
command_add("gender", "[0/1/2] - Change your or your target's gender to male/female/neuter", 50, command_gender) ||
|
||||
command_add("getplayerburiedcorpsecount", "- Get the target's total number of buried player corpses.", 100, command_getplayerburiedcorpsecount) ||
|
||||
command_add("getvariable", "[varname] - Get the value of a variable from the database", 200, command_getvariable) ||
|
||||
command_add("gi", nullptr,200, command_giveitem) ||
|
||||
command_add("ginfo", "- get group info on target.", 20, command_ginfo) ||
|
||||
command_add("giveitem", "[itemid] [charges] - Summon an item onto your target's cursor. Charges are optional.", 200, command_giveitem) ||
|
||||
command_add("givemoney", "[pp] [gp] [sp] [cp] - Gives specified amount of money to the target player.", 200, command_givemoney) ||
|
||||
command_add("globalview", "Lists all qglobals in cache if you were to do a quest with this target.", 80, command_globalview) ||
|
||||
command_add("gm", "- Turn player target's or your GM flag on or off", 80, command_gm) ||
|
||||
command_add("gmhideme", nullptr,0, command_hideme) ||
|
||||
command_add("gmspeed", "[on/off] - Turn GM speed hack on/off for you or your player target", 100, command_gmspeed) ||
|
||||
command_add("goto", "[x] [y] [z] - Teleport to the provided coordinates or to your target", 10, command_goto) ||
|
||||
command_add("grid", "[add/delete] [grid_num] [wandertype] [pausetype] - Create/delete a wandering grid", 170, command_grid) ||
|
||||
@ -243,7 +220,6 @@ int command_init(void) {
|
||||
command_add("guildapprove", "[guildapproveid] - Approve a guild with specified ID (guild creator receives the id)", 0, command_guildapprove) ||
|
||||
command_add("guildcreate", "[guildname] - Creates an approval setup for guild name specified", 0, command_guildcreate) ||
|
||||
command_add("guildlist", "[guildapproveid] - Lists character names who have approved the guild specified by the approve id", 0, command_guildlist) ||
|
||||
command_add("guilds", nullptr,0, command_guild) ||
|
||||
command_add("hair", "- Change the hair style of your target", 80, command_hair) ||
|
||||
command_add("haircolor", "- Change the hair color of your target", 80, command_haircolor) ||
|
||||
command_add("haste", "[percentage] - Set your haste percentage", 100, command_haste) ||
|
||||
@ -254,7 +230,6 @@ int command_init(void) {
|
||||
command_add("heritage", "- Change the heritage of your target (Drakkin Only)", 80, command_heritage) ||
|
||||
command_add("heromodel", "[hero model] [slot] - Full set of Hero's Forge Armor appearance. If slot is set, sends exact model just to slot.", 200, command_heromodel) ||
|
||||
command_add("hideme", "[on/off] - Hide yourself from spawn lists.", 80, command_hideme) ||
|
||||
command_add("hm", "[hero model] [slot] - Full set of Hero's Forge Armor appearance. If slot is set, sends exact model just to slot.)", 200, command_heromodel) ||
|
||||
command_add("hotfix", "[hotfix_name] - Reloads shared memory into a hotfix, equiv to load_shared_memory followed by apply_shared_memory", 250, command_hotfix) ||
|
||||
command_add("hp", "- Refresh your HP bar from the server.", 0, command_hp) ||
|
||||
command_add("incstat", "- Increases or Decreases a client's stats permanently.", 200, command_incstat) ||
|
||||
@ -262,8 +237,7 @@ int command_init(void) {
|
||||
command_add("interrogateinv", "- use [help] argument for available options", 0, command_interrogateinv) ||
|
||||
command_add("interrupt", "[message id] [color] - Interrupt your casting. Arguments are optional.", 50, command_interrupt) ||
|
||||
command_add("invsnapshot", "- Takes an inventory snapshot of your current target", 80, command_invsnapshot) ||
|
||||
command_add("invul", nullptr,0, command_invul) ||
|
||||
command_add("invulnerable", "[on/off] - Turn player target's or your invulnerable flag on or off", 80, command_invul) ||
|
||||
command_add("invul", "[on/off] - Turn player target's or your invulnerable flag on or off", 80, command_invul) ||
|
||||
command_add("ipban", "[IP address] - Ban IP by character name", 200, command_ipban) ||
|
||||
command_add("iplookup", "[charname] - Look up IP address of charname", 200, command_iplookup) ||
|
||||
command_add("iteminfo", "- Get information about the item on your cursor", 10, command_iteminfo) ||
|
||||
@ -279,10 +253,9 @@ int command_init(void) {
|
||||
command_add("lock", "- Lock the worldserver", 150, command_lock) ||
|
||||
command_add("logs", "Manage anything to do with logs", 250, command_logs) ||
|
||||
command_add("logtest", "Performs log performance testing.", 250, command_logtest) ||
|
||||
command_add("los", nullptr,0, command_checklos) ||
|
||||
command_add("makepet", "[level] [class] [race] [texture] - Make a pet", 50, command_makepet) ||
|
||||
command_add("mana", "- Fill your or your target's mana", 50, command_mana) ||
|
||||
command_add("maxskills", "Maxes skills for you.", 200, command_max_all_skills) ||
|
||||
command_add("maxskills", "Maxes skills for you.", 200, command_max_all_skills) ||
|
||||
command_add("memspell", "[slotid] [spellid] - Memorize spellid in the specified slot", 50, command_memspell) ||
|
||||
command_add("merchant_close_shop", "Closes a merchant shop", 100, command_merchantcloseshop) ||
|
||||
command_add("merchant_open_shop", "Opens a merchants shop", 100, command_merchantopenshop) ||
|
||||
@ -291,7 +264,7 @@ int command_init(void) {
|
||||
command_add("movechar", "[charname] [zonename] - Move charname to zonename", 50, command_movechar) ||
|
||||
command_add("myskills", "- Show details about your current skill levels", 0, command_myskills) ||
|
||||
command_add("mysqltest", "Akkadius MySQL Bench Test", 250, command_mysqltest) ||
|
||||
command_add("mysql", "Mysql CLI, see 'help' for options.", 250, command_mysql) ||
|
||||
command_add("mysql", "Mysql CLI, see 'help' for options.", 250, command_mysql) ||
|
||||
command_add("mystats", "- Show details about you or your pet", 50, command_mystats) ||
|
||||
command_add("name", "[newname] - Rename your player target", 150, command_name) ||
|
||||
command_add("netstats", "- Gets the network stats for a stream.", 200, command_netstats) ||
|
||||
@ -302,8 +275,6 @@ int command_init(void) {
|
||||
command_add("npcsay", "[message] - Make your NPC target say a message.", 150, command_npcsay) ||
|
||||
command_add("npcshout", "[message] - Make your NPC target shout a message.", 150, command_npcshout) ||
|
||||
command_add("npcspawn", "[create/add/update/remove/delete] - Manipulate spawn DB", 170, command_npcspawn) ||
|
||||
command_add("npcspecialatk", nullptr,0, command_npcspecialattk) ||
|
||||
command_add("npcspecialattack", nullptr,0, command_npcspecialattk) ||
|
||||
command_add("npcspecialattk", "[flagchar] [perm] - Set NPC special attack flags. Flags are E(nrage) F(lurry) R(ampage) S(ummon).", 80, command_npcspecialattk) ||
|
||||
command_add("npcstats", "- Show stats about target NPC", 80, command_npcstats) ||
|
||||
command_add("npctype_cache", "[id] or all - Clears the npc type cache for either the id or all npcs.", 250, command_npctype_cache) ||
|
||||
@ -313,7 +284,11 @@ int command_init(void) {
|
||||
command_add("object", "List|Add|Edit|Move|Rotate|Copy|Save|Undo|Delete - Manipulate static and tradeskill objects within the zone", 100, command_object) ||
|
||||
command_add("oocmute", "[1/0] - Mutes OOC chat", 200, command_oocmute) ||
|
||||
command_add("opcode", "- opcode management", 250, command_opcode) ||
|
||||
command_add("open_shop", nullptr, 100, command_merchantopenshop) ||
|
||||
|
||||
#ifdef PACKET_PROFILER
|
||||
command_add("packetprofile", "- Dump packet profile for target or self.", 250, command_packetprofile) ||
|
||||
#endif
|
||||
|
||||
command_add("path", "- view and edit pathing", 200, command_path) ||
|
||||
command_add("peekinv", "[worn/inv/cursor/trib/bank/trade/world/all] - Print out contents of your player target's inventory", 100, command_peekinv) ||
|
||||
command_add("peqzone", "[zonename] - Go to specified zone, if you have > 75% health", 0, command_peqzone) ||
|
||||
@ -323,9 +298,15 @@ int command_init(void) {
|
||||
command_add("petitioninfo", "[petition number] - Get info about a petition", 20, command_petitioninfo) ||
|
||||
command_add("pf", "- Display additional mob coordinate and wandering data", 0, command_pf) ||
|
||||
command_add("picklock", "Analog for ldon pick lock for the newer clients since we still don't have it working.", 0, command_picklock) ||
|
||||
|
||||
#ifdef EQPROFILE
|
||||
command_add("profiledump", "- Dump profiling info to logs", 250, command_profiledump) ||
|
||||
command_add("profilereset", "- Reset profiling info", 250, command_profilereset) ||
|
||||
#endif
|
||||
|
||||
command_add("pvp", "[on/off] - Set your or your player target's PVP status", 100, command_pvp) ||
|
||||
command_add("qglobal", "[on/off/view] - Toggles qglobal functionality on an NPC", 100, command_qglobal) ||
|
||||
command_add("questerrors", "Shows quest errors.", 100, command_questerrors) ||
|
||||
command_add("questerrors", "Shows quest errors.", 100, command_questerrors) ||
|
||||
command_add("race", "[racenum] - Change your or your target's race. Use racenum 0 to return to normal", 50, command_race) ||
|
||||
command_add("raidloot", "LEADER|GROUPLEADER|SELECTED|ALL - Sets your raid loot settings if you have permission to do so.", 0, command_raidloot) ||
|
||||
command_add("randomfeatures", "- Temporarily randomizes the Facial Features of your target", 80, command_randomfeatures) ||
|
||||
@ -333,41 +314,32 @@ int command_init(void) {
|
||||
command_add("reloadaa", "Reloads AA data", 200, command_reloadaa) ||
|
||||
command_add("reloadallrules", "Executes a reload of all rules.", 80, command_reloadallrules) ||
|
||||
command_add("reloademote", "Reloads NPC Emotes", 80, command_reloademote) ||
|
||||
command_add("reloadlevelmods", nullptr,255, command_reloadlevelmods) ||
|
||||
command_add("reloadlevelmods", nullptr, 255, command_reloadlevelmods) ||
|
||||
command_add("reloadperlexportsettings", nullptr, 255, command_reloadperlexportsettings) ||
|
||||
command_add("reloadqst", " - Clear quest cache (any argument causes it to also stop all timers)", 150, command_reloadqst) ||
|
||||
command_add("reloadquest", " - Clear quest cache (any argument causes it to also stop all timers)", 150, command_reloadqst) ||
|
||||
command_add("reloadrulesworld", "Executes a reload of all rules in world specifically.", 80, command_reloadworldrules) ||
|
||||
command_add("reloadstatic", "- Reload Static Zone Data", 150, command_reloadstatic) ||
|
||||
command_add("reloadtitles", "- Reload player titles from the database", 150, command_reloadtitles) ||
|
||||
command_add("reloadworld", "[0|1] - Clear quest cache (0 - no repop, 1 - repop)", 255, command_reloadworld) ||
|
||||
command_add("reloadzonepoints", "- Reload zone points from database", 150, command_reloadzps) ||
|
||||
command_add("reloadzps", nullptr,0, command_reloadzps) ||
|
||||
command_add("reloadzps", "- Reload zone points from database", 150, command_reloadzps) ||
|
||||
command_add("repop", "[delay] - Repop the zone with optional delay", 100, command_repop) ||
|
||||
command_add("repopclose", "[distance in units] Repops only NPC's nearby for fast development purposes", 100, command_repopclose) ||
|
||||
command_add("resetaa", "- Resets a Player's AA in their profile and refunds spent AA's to unspent, may disconnect player.", 200, command_resetaa) ||
|
||||
command_add("resetaa_timer", "Command to reset AA cooldown timers.", 200, command_resetaa_timer) ||
|
||||
command_add("revoke", "[charname] [1/0] - Makes charname unable to talk on OOC", 200, command_revoke) ||
|
||||
command_add("rq", nullptr, 150, command_reloadqst) ||
|
||||
command_add("rules", "(subcommand) - Manage server rules", 250, command_rules) ||
|
||||
command_add("rules", "(subcommand) - Manage server rules", 250, command_rules) ||
|
||||
command_add("save", "- Force your player or player corpse target to be saved to the database", 50, command_save) ||
|
||||
command_add("scribespell", "[spellid] - Scribe specified spell in your target's spell book.", 180, command_scribespell) ||
|
||||
command_add("scribespell", "[spellid] - Scribe specified spell in your target's spell book.", 180, command_scribespell) ||
|
||||
command_add("scribespells", "[max level] [min level] - Scribe all spells for you or your player target that are usable by them, up to level specified. (may freeze client for a few seconds)", 150, command_scribespells) ||
|
||||
command_add("search", nullptr,10, command_itemsearch) ||
|
||||
command_add("sendzonespawns", "- Refresh spawn list for all clients in zone", 150, command_sendzonespawns) ||
|
||||
command_add("sensetrap", "Analog for ldon sense trap for the newer clients since we still don't have it working.", 0, command_sensetrap) ||
|
||||
command_add("serverinfo", "- Get OS info about server host", 200, command_serverinfo) ||
|
||||
command_add("serverrules", "- Read this server's rules", 0, command_serverrules) ||
|
||||
command_add("setaaexp", nullptr,0, command_setaaxp) ||
|
||||
command_add("setaapoints", nullptr,0, command_setaapts) ||
|
||||
command_add("setaapts", "[value] - Set your or your player target's available AA points", 100, command_setaapts) ||
|
||||
command_add("setaaxp", "[value] - Set your or your player target's AA experience", 100, command_setaaxp) ||
|
||||
command_add("setadventurepoints", "- Set your or your player target's available adventure points", 150, command_set_adventure_points) ||
|
||||
command_add("setallskill", nullptr,0, command_setskillall) ||
|
||||
command_add("setallskills", nullptr,0, command_setskillall) ||
|
||||
command_add("setanim", "[animnum] - Set target's appearance to animnum", 200, command_setanim) ||
|
||||
command_add("setcrystals", "[value] - Set your or your player target's available radiant or ebon crystals", 100, command_setcrystals) ||
|
||||
command_add("setexp", nullptr,0, command_setxp) ||
|
||||
command_add("setfaction", "[faction number] - Sets targeted NPC's faction in the database", 170, command_setfaction) ||
|
||||
command_add("setgraveyard", "[zone name] - Creates a graveyard for the specified zone based on your target's LOC.", 200, command_setgraveyard) ||
|
||||
command_add("setlanguage", "[language ID] [value] - Set your target's language skillnum to value", 50, command_setlanguage) ||
|
||||
@ -386,13 +358,11 @@ int command_init(void) {
|
||||
command_add("showspellslist", "Shows spell list of targeted NPC", 100, command_showspellslist) ||
|
||||
command_add("showstats", "- Show details about you or your target", 50, command_showstats) ||
|
||||
command_add("shutdown", "- Shut this zone process down", 150, command_shutdown) ||
|
||||
command_add("si", nullptr,200, command_summonitem) ||
|
||||
command_add("size", "[size] - Change size of you or your target", 50, command_size) ||
|
||||
command_add("spawn", "[name] [race] [level] [material] [hp] [gender] [class] [priweapon] [secweapon] [merchantid] - Spawn an NPC", 10, command_spawn) ||
|
||||
command_add("spawnfix", "- Find targeted NPC in database based on its X/Y/heading and update the database to make it spawn at your current location/heading.", 170, command_spawnfix) ||
|
||||
command_add("spawnstatus", "- Show respawn timer status", 100, command_spawnstatus) ||
|
||||
command_add("spellinfo", "[spellid] - Get detailed info about a spell", 10, command_spellinfo) ||
|
||||
command_add("spfind", nullptr,0, command_findspell) ||
|
||||
command_add("spoff", "- Sends OP_ManaChange", 80, command_spoff) ||
|
||||
command_add("spon", "- Sends OP_MemorizeSpell", 80, command_spon) ||
|
||||
command_add("stun", "[duration] - Stuns you or your target for duration", 100, command_stun) ||
|
||||
@ -414,7 +384,7 @@ int command_init(void) {
|
||||
command_add("undyeme", "- Remove dye from all of your armor slots", 0, command_undyeme) ||
|
||||
command_add("unfreeze", "- Unfreeze your target", 80, command_unfreeze) ||
|
||||
command_add("unlock", "- Unlock the worldserver", 150, command_unlock) ||
|
||||
command_add("unscribespell", "[spellid] - Unscribe specified spell from your target's spell book.", 180, command_unscribespell) ||
|
||||
command_add("unscribespell", "[spellid] - Unscribe specified spell from your target's spell book.", 180, command_unscribespell) ||
|
||||
command_add("unscribespells", "- Clear out your or your player target's spell book.", 180, command_unscribespells) ||
|
||||
command_add("untraindisc", "[spellid] - Untrain specified discipline from your target.", 180, command_untraindisc) ||
|
||||
command_add("untraindiscs", "- Untrains all disciplines from your target.", 180, command_untraindiscs) ||
|
||||
@ -446,27 +416,38 @@ int command_init(void) {
|
||||
command_add("zstats", "- Show info about zone header", 80, command_zstats) ||
|
||||
command_add("zunderworld", "[zcoord] - Sets the underworld using zcoord", 80, command_zunderworld) ||
|
||||
command_add("zuwcoords", "[z coord] - Set underworld coord", 80, command_zuwcoords)
|
||||
)
|
||||
{
|
||||
) {
|
||||
command_deinit();
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::map<std::string, CommandRecord *>::iterator cur,end;
|
||||
cur = commandlist.begin();
|
||||
end = commandlist.end();
|
||||
std::map<std::string,uint8> command_settings;
|
||||
std::map<std::string,uint8>::iterator itr;
|
||||
|
||||
std::map<std::string, std::pair<uint8, std::vector<std::string>>> command_settings;
|
||||
database.GetCommandSettings(command_settings);
|
||||
for(; cur != end; ++cur) {
|
||||
if ((itr=command_settings.find(cur->first))!=command_settings.end()) {
|
||||
cur->second->access = itr->second;
|
||||
Log.Out(Logs::General, Logs::Commands, "command_init(): - Command '%s' set to access level %d.", cur->first.c_str(), itr->second);
|
||||
for (std::map<std::string, CommandRecord *>::iterator iter_cl = commandlist.begin(); iter_cl != commandlist.end(); ++iter_cl) {
|
||||
std::map<std::string, std::pair<uint8, std::vector<std::string>>>::iterator 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());
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(cur->second->access == 0)
|
||||
Log.Out(Logs::General, Logs::Commands, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str());
|
||||
|
||||
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);
|
||||
if (iter_cs->second.second.empty())
|
||||
continue;
|
||||
|
||||
for (std::vector<std::string>::iterator iter_aka = iter_cs->second.second.begin(); iter_aka != iter_cs->second.second.end(); ++iter_aka) {
|
||||
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());
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
@ -486,6 +467,7 @@ int command_init(void) {
|
||||
void command_deinit(void)
|
||||
{
|
||||
commandlist.clear();
|
||||
commandaliases.clear();
|
||||
|
||||
command_dispatch = command_notavail;
|
||||
commandcount = 0;
|
||||
@ -496,53 +478,43 @@ void command_deinit(void)
|
||||
* adds a command to the command list; used by command_init
|
||||
*
|
||||
* Parameters:
|
||||
* command_string - the command ex: "spawn"
|
||||
* desc - text description of command for #help
|
||||
* access - default access level required to use command
|
||||
* command_name - the command ex: "spawn"
|
||||
* desc - text description of command for #help
|
||||
* access - default access level required to use command
|
||||
* function - pointer to function that handles command
|
||||
*
|
||||
*/
|
||||
int command_add(const char *command_string, const char *desc, int access, CmdFuncPtr function)
|
||||
int command_add(std::string command_name, const char *desc, int access, CmdFuncPtr function)
|
||||
{
|
||||
if(function == nullptr)
|
||||
return(-1);
|
||||
|
||||
std::string cstr(command_string);
|
||||
|
||||
if(commandlist.count(cstr) != 0) {
|
||||
Log.Out(Logs::General, Logs::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string);
|
||||
return(-1);
|
||||
if (command_name.empty()) {
|
||||
Log.Out(Logs::General, Logs::Error, "command_add() - Command added with empty name string - check command.cpp.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//look for aliases...
|
||||
std::map<std::string, CommandRecord *>::iterator cur,end,del;
|
||||
cur = commandlist.begin();
|
||||
end = commandlist.end();
|
||||
for(; cur != end; ++cur) {
|
||||
if(cur->second->function == function) {
|
||||
int r;
|
||||
for(r = 1; r < CMDALIASES; r++) {
|
||||
if(cur->second->command[r] == nullptr) {
|
||||
cur->second->command[r] = command_string;
|
||||
break;
|
||||
}
|
||||
}
|
||||
commandlist[cstr] = cur->second;
|
||||
return(0);
|
||||
}
|
||||
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());
|
||||
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());
|
||||
return -1;
|
||||
}
|
||||
for (std::map<std::string, CommandRecord *>::iterator 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());
|
||||
return -1;
|
||||
}
|
||||
|
||||
CommandRecord *c = new CommandRecord;
|
||||
cleanup_commandlist.Append(c);
|
||||
c->desc = desc;
|
||||
c->access = access;
|
||||
c->desc = desc;
|
||||
c->function = function;
|
||||
memset(c->command, 0, sizeof(c->command));
|
||||
c->command[0] = command_string;
|
||||
|
||||
commandlist[cstr] = c;
|
||||
|
||||
commandlist[command_name] = c;
|
||||
commandaliases[command_name] = command_name;
|
||||
cleanup_commandlist.Append(c);
|
||||
commandcount++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
552
zone/command.h
552
zone/command.h
@ -25,324 +25,311 @@ class Seperator;
|
||||
|
||||
#include "../common/types.h"
|
||||
|
||||
#define COMMAND_CHAR '#'
|
||||
#define CMDALIASES 5
|
||||
#define COMMAND_CHAR '#'
|
||||
|
||||
typedef void (*CmdFuncPtr)(Client *,const Seperator *);
|
||||
|
||||
// this is a command list item
|
||||
/*struct cl_struct
|
||||
{
|
||||
char *command[CMDALIASES]; // the command(s)
|
||||
char *desc; // description of command
|
||||
CmdFuncPtr function; // the function to call
|
||||
int access; // the required 'status' level
|
||||
|
||||
struct cl_struct *next; // linked list
|
||||
};
|
||||
|
||||
extern struct cl_struct *commandlist; // the head of the list
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
const char *command[CMDALIASES]; // the command(s)
|
||||
int access;
|
||||
const char *desc; // description of command
|
||||
CmdFuncPtr function; //null means perl function
|
||||
const char *desc; // description of command
|
||||
CmdFuncPtr function; // null means perl function
|
||||
} CommandRecord;
|
||||
|
||||
extern int (*command_dispatch)(Client *,char const*);
|
||||
extern int commandcount; // number of commands loaded
|
||||
extern int commandcount; // number of commands loaded
|
||||
|
||||
// the command system:
|
||||
int command_init(void);
|
||||
void command_deinit(void);
|
||||
int command_add(const char *command_string, const char *desc, int access, CmdFuncPtr function);
|
||||
int command_add(std::string command_name, const char *desc, int access, CmdFuncPtr function);
|
||||
int command_notavail(Client *c, const char *message);
|
||||
int command_realdispatch(Client *c, char const *message);
|
||||
void command_logcommand(Client *c, const char *message);
|
||||
|
||||
//commands
|
||||
void command_resetaa(Client* c,const Seperator *sep);
|
||||
void command_bind(Client* c,const Seperator *sep);
|
||||
void command_sendop(Client *c, const Seperator *sep);
|
||||
void command_optest(Client *c, const Seperator *sep);
|
||||
void command_setstat(Client *c, const Seperator *sep);
|
||||
void command_incstat(Client *c, const Seperator *sep);
|
||||
void command_help(Client *c, const Seperator *sep);
|
||||
void command_version(Client *c, const Seperator *sep);
|
||||
void command_setfaction(Client *c, const Seperator *sep);
|
||||
void command_serversidename(Client *c, const Seperator *sep);
|
||||
void command_testspawnkill(Client *c, const Seperator *sep);
|
||||
void command_testspawn(Client *c, const Seperator *sep);
|
||||
void command_wc(Client *c, const Seperator *sep);
|
||||
void command_heromodel(Client *c, const Seperator *sep);
|
||||
void command_numauths(Client *c, const Seperator *sep);
|
||||
void command_setanim(Client *c, const Seperator *sep);
|
||||
void command_connectworldserver(Client *c, const Seperator *sep);
|
||||
void command_serverinfo(Client *c, const Seperator *sep);
|
||||
void command_crashtest(Client *c, const Seperator *sep);
|
||||
void command_getvariable(Client *c, const Seperator *sep);
|
||||
void command_chat(Client *c, const Seperator *sep);
|
||||
void command_showpetspell(Client *c, const Seperator *sep);
|
||||
void command_ipc(Client *c, const Seperator *sep);
|
||||
void command_npcloot(Client *c, const Seperator *sep);
|
||||
void command_gm(Client *c, const Seperator *sep);
|
||||
void command_summon(Client *c, const Seperator *sep);
|
||||
void command_zone(Client *c, const Seperator *sep);
|
||||
void command_zone_instance(Client *c, const Seperator *sep);
|
||||
void command_peqzone(Client *c, const Seperator *sep);
|
||||
void command_showbuffs(Client *c, const Seperator *sep);
|
||||
void command_movechar(Client *c, const Seperator *sep);
|
||||
void command_viewpetition(Client *c, const Seperator *sep);
|
||||
void command_petitioninfo(Client *c, const Seperator *sep);
|
||||
void command_delpetition(Client *c, const Seperator *sep);
|
||||
void command_listnpcs(Client *c, const Seperator *sep);
|
||||
void command_date(Client *c, const Seperator *sep);
|
||||
void command_timezone(Client *c, const Seperator *sep);
|
||||
void command_synctod(Client *c, const Seperator *sep);
|
||||
void command_invul(Client *c, const Seperator *sep);
|
||||
void command_hideme(Client *c, const Seperator *sep);
|
||||
void command_emote(Client *c, const Seperator *sep);
|
||||
void command_fov(Client *c, const Seperator *sep);
|
||||
void command_manastat(Client *c, const Seperator *sep);
|
||||
void command_npcstats(Client *c, const Seperator *sep);
|
||||
void command_zclip(Client *c, const Seperator *sep);
|
||||
void command_npccast(Client *c, const Seperator *sep);
|
||||
void command_zstats(Client *c, const Seperator *sep);
|
||||
void command_permaclass(Client *c, const Seperator *sep);
|
||||
void command_permarace(Client *c, const Seperator *sep);
|
||||
void command_permagender(Client *c, const Seperator *sep);
|
||||
void command_weather(Client *c, const Seperator *sep);
|
||||
void command_zheader(Client *c, const Seperator *sep);
|
||||
void command_zsky(Client *c, const Seperator *sep);
|
||||
void command_zcolor(Client *c, const Seperator *sep);
|
||||
void command_spon(Client *c, const Seperator *sep);
|
||||
void command_spoff(Client *c, const Seperator *sep);
|
||||
void command_itemtest(Client *c, const Seperator *sep);
|
||||
void command_gassign(Client *c, const Seperator *sep);
|
||||
void command_acceptrules(Client *c, const Seperator *sep);
|
||||
void command_advnpcspawn(Client *c, const Seperator *sep);
|
||||
void command_aggro(Client *c, const Seperator *sep);
|
||||
void command_aggrozone(Client *c, const Seperator *sep);
|
||||
void command_ai(Client *c, const Seperator *sep);
|
||||
void command_worldshutdown(Client *c, const Seperator *sep);
|
||||
void command_sendzonespawns(Client *c, const Seperator *sep);
|
||||
void command_zsave(Client *c, const Seperator *sep);
|
||||
void command_dbspawn2(Client *c, const Seperator *sep);
|
||||
void command_shutdown(Client *c, const Seperator *sep);
|
||||
void command_delacct(Client *c, const Seperator *sep);
|
||||
void command_setpass(Client *c, const Seperator *sep);
|
||||
void command_setlsinfo(Client *c, const Seperator *sep);
|
||||
void command_grid(Client *c, const Seperator *sep);
|
||||
void command_wp(Client *c, const Seperator *sep);
|
||||
void command_iplookup(Client *c, const Seperator *sep);
|
||||
void command_size(Client *c, const Seperator *sep);
|
||||
void command_mana(Client *c, const Seperator *sep);
|
||||
void command_flymode(Client *c, const Seperator *sep);
|
||||
void command_showskills(Client *c, const Seperator *sep);
|
||||
void command_findspell(Client *c, const Seperator *sep);
|
||||
void command_castspell(Client *c, const Seperator *sep);
|
||||
void command_setlanguage(Client *c, const Seperator *sep);
|
||||
void command_setskill(Client *c, const Seperator *sep);
|
||||
void command_setskillall(Client *c, const Seperator *sep);
|
||||
void command_race(Client *c, const Seperator *sep);
|
||||
void command_gender(Client *c, const Seperator *sep);
|
||||
void command_makepet(Client *c, const Seperator *sep);
|
||||
void command_level(Client *c, const Seperator *sep);
|
||||
void command_spawn(Client *c, const Seperator *sep);
|
||||
void command_texture(Client *c, const Seperator *sep);
|
||||
void command_npctypespawn(Client *c, const Seperator *sep);
|
||||
void command_heal(Client *c, const Seperator *sep);
|
||||
void command_appearance(Client *c, const Seperator *sep);
|
||||
void command_nukeitem(Client *c, const Seperator *sep);
|
||||
void command_peekinv(Client *c, const Seperator *sep);
|
||||
void command_interrogateinv(Client *c, const Seperator *sep);
|
||||
void command_invsnapshot(Client *c, const Seperator *sep);
|
||||
void command_clearinvsnapshots(Client *c, const Seperator *sep);
|
||||
void command_findnpctype(Client *c, const Seperator *sep);
|
||||
void command_findzone(Client *c, const Seperator *sep);
|
||||
void command_viewnpctype(Client *c, const Seperator *sep);
|
||||
void command_reloadqst(Client *c, const Seperator *sep);
|
||||
void command_reloadworld(Client *c, const Seperator *sep);
|
||||
void command_reloadzps(Client *c, const Seperator *sep);
|
||||
void command_zoneshutdown(Client *c, const Seperator *sep);
|
||||
void command_zonebootup(Client *c, const Seperator *sep);
|
||||
void command_kick(Client *c, const Seperator *sep);
|
||||
void command_apply_shared_memory(Client *c, const Seperator *sep);
|
||||
void command_attack(Client *c, const Seperator *sep);
|
||||
void command_lock(Client *c, const Seperator *sep);
|
||||
void command_unlock(Client *c, const Seperator *sep);
|
||||
void command_motd(Client *c, const Seperator *sep);
|
||||
void command_listpetition(Client *c, const Seperator *sep);
|
||||
void command_equipitem(Client *c, const Seperator *sep);
|
||||
void command_zonelock(Client *c, const Seperator *sep);
|
||||
void command_corpse(Client *c, const Seperator *sep);
|
||||
void command_fixmob(Client *c, const Seperator *sep);
|
||||
void command_gmspeed(Client *c, const Seperator *sep);
|
||||
void command_title(Client *c, const Seperator *sep);
|
||||
void command_titlesuffix(Client *c, const Seperator *sep);
|
||||
void command_spellinfo(Client *c, const Seperator *sep);
|
||||
void command_lastname(Client *c, const Seperator *sep);
|
||||
void command_memspell(Client *c, const Seperator *sep);
|
||||
void command_save(Client *c, const Seperator *sep);
|
||||
void command_showstats(Client *c, const Seperator *sep);
|
||||
void command_mystats(Client *c, const Seperator *sep);
|
||||
void command_myskills(Client *c, const Seperator *sep);
|
||||
void command_depop(Client *c, const Seperator *sep);
|
||||
void command_depopzone(Client *c, const Seperator *sep);
|
||||
void command_repop(Client *c, const Seperator *sep);
|
||||
void command_repopclose(Client *c, const Seperator *sep);
|
||||
void command_spawnstatus(Client *c, const Seperator *sep);
|
||||
void command_nukebuffs(Client *c, const Seperator *sep);
|
||||
void command_zuwcoords(Client *c, const Seperator *sep);
|
||||
void command_zunderworld(Client *c, const Seperator *sep);
|
||||
void command_zsafecoords(Client *c, const Seperator *sep);
|
||||
void command_freeze(Client *c, const Seperator *sep);
|
||||
void command_unfreeze(Client *c, const Seperator *sep);
|
||||
void command_pvp(Client *c, const Seperator *sep);
|
||||
void command_setxp(Client *c, const Seperator *sep);
|
||||
void command_setpvppoints(Client *c, const Seperator *sep);
|
||||
void command_name(Client *c, const Seperator *sep);
|
||||
void command_tempname(Client *c, const Seperator *sep);
|
||||
void command_npcspecialattk(Client *c, const Seperator *sep);
|
||||
void command_kill(Client *c, const Seperator *sep);
|
||||
void command_haste(Client *c, const Seperator *sep);
|
||||
void command_damage(Client *c, const Seperator *sep);
|
||||
void command_zonespawn(Client *c, const Seperator *sep);
|
||||
void command_npcspawn(Client *c, const Seperator *sep);
|
||||
void command_spawnfix(Client *c, const Seperator *sep);
|
||||
void command_loc(Client *c, const Seperator *sep);
|
||||
void command_goto(Client *c, const Seperator *sep);
|
||||
void command_augmentitem(Client *c, const Seperator *sep);
|
||||
void command_ban(Client *c, const Seperator *sep);
|
||||
void command_beard(Client *c, const Seperator *sep);
|
||||
void command_beardcolor(Client *c, const Seperator *sep);
|
||||
void command_bind(Client* c, const Seperator *sep);
|
||||
|
||||
#ifdef BUGTRACK
|
||||
void command_bug(Client *c, const Seperator *sep);
|
||||
#endif
|
||||
void command_iteminfo(Client *c, const Seperator *sep);
|
||||
void command_uptime(Client *c, const Seperator *sep);
|
||||
void command_flag(Client *c, const Seperator *sep);
|
||||
void command_time(Client *c, const Seperator *sep);
|
||||
void command_guild(Client *c, const Seperator *sep);
|
||||
bool helper_guild_edit(Client *c, uint32 dbid, uint32 eqid, uint8 rank, const char* what, const char* value);
|
||||
void command_zonestatus(Client *c, const Seperator *sep);
|
||||
void command_doanim(Client *c, const Seperator *sep);
|
||||
void command_randomfeatures(Client *c, const Seperator *sep);
|
||||
void command_face(Client *c, const Seperator *sep);
|
||||
void command_helm(Client *c, const Seperator *sep);
|
||||
void command_hair(Client *c, const Seperator *sep);
|
||||
void command_haircolor(Client *c, const Seperator *sep);
|
||||
void command_beard(Client *c, const Seperator *sep);
|
||||
void command_beardcolor(Client *c, const Seperator *sep);
|
||||
void command_tattoo(Client *c, const Seperator *sep);
|
||||
void command_heritage(Client *c, const Seperator *sep);
|
||||
void command_details(Client *c, const Seperator *sep);
|
||||
void command_scribespells(Client *c, const Seperator *sep);
|
||||
void command_unscribespells(Client *c, const Seperator *sep);
|
||||
void command_wpinfo(Client *c, const Seperator *sep);
|
||||
void command_wpadd(Client *c, const Seperator *sep);
|
||||
void command_interrupt(Client *c, const Seperator *sep);
|
||||
|
||||
void command_camerashake(Client *c, const Seperator *sep);
|
||||
void command_castspell(Client *c, const Seperator *sep);
|
||||
void command_chat(Client *c, const Seperator *sep);
|
||||
void command_checklos(Client *c, const Seperator *sep);
|
||||
void command_clearinvsnapshots(Client *c, const Seperator *sep);
|
||||
void command_connectworldserver(Client *c, const Seperator *sep);
|
||||
void command_corpse(Client *c, const Seperator *sep);
|
||||
void command_crashtest(Client *c, const Seperator *sep);
|
||||
void command_cvs(Client *c, const Seperator *sep);
|
||||
void command_d1(Client *c, const Seperator *sep);
|
||||
void command_summonitem(Client *c, const Seperator *sep);
|
||||
void command_damage(Client *c, const Seperator *sep);
|
||||
void command_date(Client *c, const Seperator *sep);
|
||||
void command_dbspawn2(Client *c, const Seperator *sep);
|
||||
void command_delacct(Client *c, const Seperator *sep);
|
||||
void command_deletegraveyard(Client *c, const Seperator *sep);
|
||||
void command_delpetition(Client *c, const Seperator *sep);
|
||||
void command_depop(Client *c, const Seperator *sep);
|
||||
void command_depopzone(Client *c, const Seperator *sep);
|
||||
void command_details(Client *c, const Seperator *sep);
|
||||
void command_disablerecipe(Client *c, const Seperator *sep);
|
||||
void command_disarmtrap(Client *c, const Seperator *sep);
|
||||
void command_distance(Client *c, const Seperator *sep);
|
||||
void command_doanim(Client *c, const Seperator *sep);
|
||||
void command_emote(Client *c, const Seperator *sep);
|
||||
void command_emotesearch(Client* c, const Seperator *sep);
|
||||
void command_emoteview(Client* c, const Seperator *sep);
|
||||
void command_enablerecipe(Client *c, const Seperator *sep);
|
||||
void command_equipitem(Client *c, const Seperator *sep);
|
||||
void command_face(Client *c, const Seperator *sep);
|
||||
void command_findnpctype(Client *c, const Seperator *sep);
|
||||
void command_findspell(Client *c, const Seperator *sep);
|
||||
void command_findzone(Client *c, const Seperator *sep);
|
||||
void command_fixmob(Client *c, const Seperator *sep);
|
||||
void command_flag(Client *c, const Seperator *sep);
|
||||
void command_flagedit(Client *c, const Seperator *sep);
|
||||
void command_flags(Client *c, const Seperator *sep);
|
||||
void command_flymode(Client *c, const Seperator *sep);
|
||||
void command_fov(Client *c, const Seperator *sep);
|
||||
void command_freeze(Client *c, const Seperator *sep);
|
||||
void command_gassign(Client *c, const Seperator *sep);
|
||||
void command_gender(Client *c, const Seperator *sep);
|
||||
void command_getplayerburiedcorpsecount(Client *c, const Seperator *sep);
|
||||
void command_getvariable(Client *c, const Seperator *sep);
|
||||
void command_ginfo(Client *c, const Seperator *sep);
|
||||
void command_giveitem(Client *c, const Seperator *sep);
|
||||
void command_givemoney(Client *c, const Seperator *sep);
|
||||
void command_itemsearch(Client *c, const Seperator *sep);
|
||||
void command_setaaxp(Client *c, const Seperator *sep);
|
||||
void command_setaapts(Client *c, const Seperator *sep);
|
||||
void command_setcrystals(Client *c, const Seperator *sep);
|
||||
void command_stun(Client *c, const Seperator *sep);
|
||||
void command_ban(Client *c, const Seperator *sep);
|
||||
void command_suspend(Client *c, const Seperator *sep);
|
||||
void command_globalview(Client* c, const Seperator *sep);
|
||||
void command_gm(Client *c, const Seperator *sep);
|
||||
void command_gmspeed(Client *c, const Seperator *sep);
|
||||
void command_goto(Client *c, const Seperator *sep);
|
||||
void command_grid(Client *c, const Seperator *sep);
|
||||
void command_guild(Client *c, const Seperator *sep);
|
||||
bool helper_guild_edit(Client *c, uint32 dbid, uint32 eqid, uint8 rank, const char* what, const char* value);
|
||||
void command_guildapprove(Client *c, const Seperator *sep);
|
||||
void command_guildcreate(Client *c, const Seperator *sep);
|
||||
void command_guildlist(Client *c, const Seperator *sep);
|
||||
void command_hair(Client *c, const Seperator *sep);
|
||||
void command_haircolor(Client *c, const Seperator *sep);
|
||||
void command_haste(Client *c, const Seperator *sep);
|
||||
void command_hatelist(Client *c, const Seperator *sep);
|
||||
void command_heal(Client *c, const Seperator *sep);
|
||||
void command_helm(Client *c, const Seperator *sep);
|
||||
void command_help(Client *c, const Seperator *sep);
|
||||
void command_heritage(Client *c, const Seperator *sep);
|
||||
void command_heromodel(Client *c, const Seperator *sep);
|
||||
void command_hideme(Client *c, const Seperator *sep);
|
||||
void command_hotfix(Client *c, const Seperator *sep);
|
||||
void command_hp(Client *c, const Seperator *sep);
|
||||
void command_incstat(Client *c, const Seperator *sep);
|
||||
void command_instance(Client *c, const Seperator *sep);
|
||||
void command_interrogateinv(Client *c, const Seperator *sep);
|
||||
void command_interrupt(Client *c, const Seperator *sep);
|
||||
void command_invsnapshot(Client *c, const Seperator *sep);
|
||||
void command_invul(Client *c, const Seperator *sep);
|
||||
void command_ipban(Client *c, const Seperator *sep);
|
||||
void command_oocmute(Client *c, const Seperator *sep);
|
||||
void command_revoke(Client *c, const Seperator *sep);
|
||||
void command_checklos(Client *c, const Seperator *sep);
|
||||
void command_set_adventure_points(Client *c, const Seperator *sep);
|
||||
void command_ipc(Client *c, const Seperator *sep);
|
||||
void command_iplookup(Client *c, const Seperator *sep);
|
||||
void command_iteminfo(Client *c, const Seperator *sep);
|
||||
void command_itemsearch(Client *c, const Seperator *sep);
|
||||
void command_itemtest(Client *c, const Seperator *sep);
|
||||
void command_kick(Client *c, const Seperator *sep);
|
||||
void command_kill(Client *c, const Seperator *sep);
|
||||
void command_lastname(Client *c, const Seperator *sep);
|
||||
void command_level(Client *c, const Seperator *sep);
|
||||
void command_listnpcs(Client *c, const Seperator *sep);
|
||||
void command_listpetition(Client *c, const Seperator *sep);
|
||||
void command_load_shared_memory(Client *c, const Seperator *sep);
|
||||
void command_loc(Client *c, const Seperator *sep);
|
||||
void command_lock(Client *c, const Seperator *sep);
|
||||
void command_logs(Client *c, const Seperator *sep);
|
||||
void command_logtest(Client *c, const Seperator *sep);
|
||||
void command_makepet(Client *c, const Seperator *sep);
|
||||
void command_mana(Client *c, const Seperator *sep);
|
||||
void command_manastat(Client *c, const Seperator *sep);
|
||||
void command_max_all_skills(Client *c, const Seperator *sep);
|
||||
void command_memspell(Client *c, const Seperator *sep);
|
||||
void command_merchantcloseshop(Client *c, const Seperator *sep);
|
||||
void command_merchantopenshop(Client *c, const Seperator *sep);
|
||||
void command_modifynpcstat(Client *c, const Seperator *sep);
|
||||
void command_motd(Client *c, const Seperator *sep);
|
||||
void command_movechar(Client *c, const Seperator *sep);
|
||||
void command_myskills(Client *c, const Seperator *sep);
|
||||
void command_mysql(Client *c, const Seperator *sep);
|
||||
void command_mysqltest(Client *c, const Seperator *sep);
|
||||
void command_mystats(Client *c, const Seperator *sep);
|
||||
void command_name(Client *c, const Seperator *sep);
|
||||
void command_netstats(Client *c, const Seperator *sep);
|
||||
void command_npccast(Client *c, const Seperator *sep);
|
||||
void command_npcedit(Client *c, const Seperator *sep);
|
||||
void command_npcemote(Client *c, const Seperator *sep);
|
||||
void command_npcloot(Client *c, const Seperator *sep);
|
||||
void command_npcsay(Client *c, const Seperator *sep);
|
||||
void command_npcshout(Client *c, const Seperator *sep);
|
||||
void command_npcemote(Client *c, const Seperator *sep);
|
||||
void command_npcedit(Client *c, const Seperator *sep);
|
||||
void command_timers(Client *c, const Seperator *sep);
|
||||
void command_undye(Client *c, const Seperator *sep);
|
||||
void command_undyeme(Client *c, const Seperator *sep);
|
||||
void command_hp(Client *c, const Seperator *sep);
|
||||
void command_ginfo(Client *c, const Seperator *sep);
|
||||
void command_qglobal(Client *c, const Seperator *sep);
|
||||
void command_path(Client *c, const Seperator *sep);
|
||||
void command_ginfo(Client *c, const Seperator *sep);
|
||||
void command_opcode(Client *c, const Seperator *sep);
|
||||
void command_aggro(Client *c, const Seperator *sep);
|
||||
void command_hatelist(Client *c, const Seperator *sep);
|
||||
void command_aggrozone(Client *c, const Seperator *sep);
|
||||
void command_reloadstatic(Client *c, const Seperator *sep);
|
||||
void command_flags(Client *c, const Seperator *sep);
|
||||
void command_flagedit(Client *c, const Seperator *sep);
|
||||
void command_serverrules(Client *c, const Seperator *sep);
|
||||
void command_acceptrules(Client *c, const Seperator *sep);
|
||||
void command_guildcreate(Client *c, const Seperator *sep);
|
||||
void command_guildapprove(Client *c, const Seperator *sep);
|
||||
void command_guildlist(Client *c, const Seperator *sep);
|
||||
void command_rules(Client *c, const Seperator *sep);
|
||||
void command_task(Client *c, const Seperator *sep);
|
||||
void command_reloadtitles(Client *c, const Seperator *sep);
|
||||
void command_refundaa(Client *c, const Seperator *sep);
|
||||
void command_traindisc(Client *c, const Seperator *sep);
|
||||
void command_deletegraveyard(Client *c, const Seperator *sep);
|
||||
void command_setgraveyard(Client *c, const Seperator *sep);
|
||||
void command_getplayerburiedcorpsecount(Client *c, const Seperator *sep);
|
||||
void command_summonburiedplayercorpse(Client *c, const Seperator *sep);
|
||||
void command_unscribespell(Client *c, const Seperator *sep);
|
||||
void command_scribespell(Client *c, const Seperator *sep);
|
||||
void command_refreshgroup(Client *c, const Seperator *sep);
|
||||
void command_advnpcspawn(Client *c, const Seperator *sep);
|
||||
void command_modifynpcstat(Client *c, const Seperator *sep);
|
||||
void command_instance(Client *c, const Seperator *sep);
|
||||
void command_setstartzone(Client *c, const Seperator *sep);
|
||||
void command_netstats(Client *c, const Seperator *sep);
|
||||
void command_object(Client* c, const Seperator *sep);
|
||||
void command_raidloot(Client* c, const Seperator *sep);
|
||||
void command_globalview(Client* c, const Seperator *sep);
|
||||
void command_emoteview(Client* c, const Seperator *sep);
|
||||
void command_reloademote(Client* c, const Seperator *sep);
|
||||
void command_emotesearch(Client* c, const Seperator *sep);
|
||||
void command_distance(Client *c, const Seperator *sep);
|
||||
void command_cvs(Client *c, const Seperator *sep);
|
||||
void command_max_all_skills(Client *c, const Seperator *sep);
|
||||
void command_showbonusstats(Client *c, const Seperator *sep);
|
||||
void command_reloadallrules(Client *c, const Seperator *sep);
|
||||
void command_reloadworldrules(Client *c, const Seperator *sep);
|
||||
void command_reloadlevelmods(Client *c, const Seperator *sep);
|
||||
void command_camerashake(Client *c, const Seperator *sep);
|
||||
void command_disarmtrap(Client *c, const Seperator *sep);
|
||||
void command_sensetrap(Client *c, const Seperator *sep);
|
||||
void command_picklock(Client *c, const Seperator *sep);
|
||||
void command_qtest(Client *c, const Seperator *sep);
|
||||
void command_mysql(Client *c, const Seperator *sep);
|
||||
void command_xtargets(Client *c, const Seperator *sep);
|
||||
void command_zopp(Client *c, const Seperator *sep);
|
||||
void command_augmentitem(Client *c, const Seperator *sep);
|
||||
void command_questerrors(Client *c, const Seperator *sep);
|
||||
void command_enablerecipe(Client *c, const Seperator *sep);
|
||||
void command_disablerecipe(Client *c, const Seperator *sep);
|
||||
void command_showspellslist(Client *c, const Seperator *sep);
|
||||
void command_npcspawn(Client *c, const Seperator *sep);
|
||||
void command_npcspecialattk(Client *c, const Seperator *sep);
|
||||
void command_npcstats(Client *c, const Seperator *sep);
|
||||
void command_npctype_cache(Client *c, const Seperator *sep);
|
||||
void command_merchantopenshop(Client *c, const Seperator *sep);
|
||||
void command_merchantcloseshop(Client *c, const Seperator *sep);
|
||||
void command_shownumhits(Client *c, const Seperator *sep);
|
||||
void command_tune(Client *c, const Seperator *sep);
|
||||
void command_logtest(Client *c, const Seperator *sep);
|
||||
void command_mysqltest(Client *c, const Seperator *sep);
|
||||
void command_logs(Client *c, const Seperator *sep);
|
||||
void command_resetaa_timer(Client *c, const Seperator *sep);
|
||||
void command_reloadaa(Client *c, const Seperator *sep);
|
||||
void command_hotfix(Client *c, const Seperator *sep);
|
||||
void command_load_shared_memory(Client *c, const Seperator *sep);
|
||||
void command_apply_shared_memory(Client *c, const Seperator *sep);
|
||||
void command_untraindisc(Client *c, const Seperator *sep);
|
||||
void command_untraindiscs(Client *c, const Seperator *sep);
|
||||
void command_reloadperlexportsettings(Client *c, const Seperator *sep);
|
||||
void command_npctypespawn(Client *c, const Seperator *sep);
|
||||
void command_nukebuffs(Client *c, const Seperator *sep);
|
||||
void command_nukeitem(Client *c, const Seperator *sep);
|
||||
void command_numauths(Client *c, const Seperator *sep);
|
||||
void command_object(Client* c, const Seperator *sep);
|
||||
void command_oocmute(Client *c, const Seperator *sep);
|
||||
void command_opcode(Client *c, const Seperator *sep);
|
||||
void command_optest(Client *c, const Seperator *sep);
|
||||
|
||||
#ifdef PACKET_PROFILER
|
||||
void command_packetprofile(Client *c, const Seperator *sep);
|
||||
#endif
|
||||
|
||||
void command_path(Client *c, const Seperator *sep);
|
||||
void command_peekinv(Client *c, const Seperator *sep);
|
||||
void command_peqzone(Client *c, const Seperator *sep);
|
||||
void command_permaclass(Client *c, const Seperator *sep);
|
||||
void command_permagender(Client *c, const Seperator *sep);
|
||||
void command_permarace(Client *c, const Seperator *sep);
|
||||
void command_petitioninfo(Client *c, const Seperator *sep);
|
||||
void command_picklock(Client *c, const Seperator *sep);
|
||||
|
||||
#ifdef EQPROFILE
|
||||
void command_profiledump(Client *c, const Seperator *sep);
|
||||
void command_profilereset(Client *c, const Seperator *sep);
|
||||
#endif
|
||||
|
||||
#ifdef PACKET_PROFILER
|
||||
void command_packetprofile(Client *c, const Seperator *sep);
|
||||
#endif
|
||||
void command_pvp(Client *c, const Seperator *sep);
|
||||
void command_qglobal(Client *c, const Seperator *sep);
|
||||
void command_qtest(Client *c, const Seperator *sep);
|
||||
void command_questerrors(Client *c, const Seperator *sep);
|
||||
void command_race(Client *c, const Seperator *sep);
|
||||
void command_raidloot(Client* c, const Seperator *sep);
|
||||
void command_randomfeatures(Client *c, const Seperator *sep);
|
||||
void command_refreshgroup(Client *c, const Seperator *sep);
|
||||
void command_refundaa(Client *c, const Seperator *sep);
|
||||
void command_reloadaa(Client *c, const Seperator *sep);
|
||||
void command_reloadallrules(Client *c, const Seperator *sep);
|
||||
void command_reloademote(Client* c, const Seperator *sep);
|
||||
void command_reloadlevelmods(Client *c, const Seperator *sep);
|
||||
void command_reloadperlexportsettings(Client *c, const Seperator *sep);
|
||||
void command_reloadqst(Client *c, const Seperator *sep);
|
||||
void command_reloadstatic(Client *c, const Seperator *sep);
|
||||
void command_reloadtitles(Client *c, const Seperator *sep);
|
||||
void command_reloadworld(Client *c, const Seperator *sep);
|
||||
void command_reloadworldrules(Client *c, const Seperator *sep);
|
||||
void command_reloadzps(Client *c, const Seperator *sep);
|
||||
void command_repop(Client *c, const Seperator *sep);
|
||||
void command_repopclose(Client *c, const Seperator *sep);
|
||||
void command_resetaa(Client* c,const Seperator *sep);
|
||||
void command_resetaa_timer(Client *c, const Seperator *sep);
|
||||
void command_revoke(Client *c, const Seperator *sep);
|
||||
void command_rules(Client *c, const Seperator *sep);
|
||||
void command_save(Client *c, const Seperator *sep);
|
||||
void command_scribespell(Client *c, const Seperator *sep);
|
||||
void command_scribespells(Client *c, const Seperator *sep);
|
||||
void command_sendop(Client *c, const Seperator *sep);
|
||||
void command_sendzonespawns(Client *c, const Seperator *sep);
|
||||
void command_sensetrap(Client *c, const Seperator *sep);
|
||||
void command_serverinfo(Client *c, const Seperator *sep);
|
||||
void command_serverrules(Client *c, const Seperator *sep);
|
||||
void command_serversidename(Client *c, const Seperator *sep);
|
||||
void command_set_adventure_points(Client *c, const Seperator *sep);
|
||||
void command_setaapts(Client *c, const Seperator *sep);
|
||||
void command_setaaxp(Client *c, const Seperator *sep);
|
||||
void command_setanim(Client *c, const Seperator *sep);
|
||||
void command_setcrystals(Client *c, const Seperator *sep);
|
||||
void command_setfaction(Client *c, const Seperator *sep);
|
||||
void command_setgraveyard(Client *c, const Seperator *sep);
|
||||
void command_setlanguage(Client *c, const Seperator *sep);
|
||||
void command_setlsinfo(Client *c, const Seperator *sep);
|
||||
void command_setpass(Client *c, const Seperator *sep);
|
||||
void command_setpvppoints(Client *c, const Seperator *sep);
|
||||
void command_setskill(Client *c, const Seperator *sep);
|
||||
void command_setskillall(Client *c, const Seperator *sep);
|
||||
void command_setstartzone(Client *c, const Seperator *sep);
|
||||
void command_setstat(Client *c, const Seperator *sep);
|
||||
void command_setxp(Client *c, const Seperator *sep);
|
||||
void command_showbonusstats(Client *c, const Seperator *sep);
|
||||
void command_showbuffs(Client *c, const Seperator *sep);
|
||||
void command_shownumhits(Client *c, const Seperator *sep);
|
||||
void command_showpetspell(Client *c, const Seperator *sep);
|
||||
void command_showskills(Client *c, const Seperator *sep);
|
||||
void command_showspellslist(Client *c, const Seperator *sep);
|
||||
void command_showstats(Client *c, const Seperator *sep);
|
||||
void command_shutdown(Client *c, const Seperator *sep);
|
||||
void command_size(Client *c, const Seperator *sep);
|
||||
void command_spawn(Client *c, const Seperator *sep);
|
||||
void command_spawnfix(Client *c, const Seperator *sep);
|
||||
void command_spawnstatus(Client *c, const Seperator *sep);
|
||||
void command_spellinfo(Client *c, const Seperator *sep);
|
||||
void command_spoff(Client *c, const Seperator *sep);
|
||||
void command_spon(Client *c, const Seperator *sep);
|
||||
void command_stun(Client *c, const Seperator *sep);
|
||||
void command_summon(Client *c, const Seperator *sep);
|
||||
void command_summonburiedplayercorpse(Client *c, const Seperator *sep);
|
||||
void command_summonitem(Client *c, const Seperator *sep);
|
||||
void command_suspend(Client *c, const Seperator *sep);
|
||||
void command_synctod(Client *c, const Seperator *sep);
|
||||
void command_task(Client *c, const Seperator *sep);
|
||||
void command_tattoo(Client *c, const Seperator *sep);
|
||||
void command_tempname(Client *c, const Seperator *sep);
|
||||
void command_testspawn(Client *c, const Seperator *sep);
|
||||
void command_testspawnkill(Client *c, const Seperator *sep);
|
||||
void command_texture(Client *c, const Seperator *sep);
|
||||
void command_time(Client *c, const Seperator *sep);
|
||||
void command_timers(Client *c, const Seperator *sep);
|
||||
void command_timezone(Client *c, const Seperator *sep);
|
||||
void command_title(Client *c, const Seperator *sep);
|
||||
void command_titlesuffix(Client *c, const Seperator *sep);
|
||||
void command_traindisc(Client *c, const Seperator *sep);
|
||||
void command_tune(Client *c, const Seperator *sep);
|
||||
void command_undye(Client *c, const Seperator *sep);
|
||||
void command_undyeme(Client *c, const Seperator *sep);
|
||||
void command_unfreeze(Client *c, const Seperator *sep);
|
||||
void command_unlock(Client *c, const Seperator *sep);
|
||||
void command_unscribespell(Client *c, const Seperator *sep);
|
||||
void command_unscribespells(Client *c, const Seperator *sep);
|
||||
void command_untraindisc(Client *c, const Seperator *sep);
|
||||
void command_untraindiscs(Client *c, const Seperator *sep);
|
||||
void command_uptime(Client *c, const Seperator *sep);
|
||||
void command_version(Client *c, const Seperator *sep);
|
||||
void command_viewnpctype(Client *c, const Seperator *sep);
|
||||
void command_viewpetition(Client *c, const Seperator *sep);
|
||||
void command_wc(Client *c, const Seperator *sep);
|
||||
void command_weather(Client *c, const Seperator *sep);
|
||||
void command_worldshutdown(Client *c, const Seperator *sep);
|
||||
void command_wp(Client *c, const Seperator *sep);
|
||||
void command_wpadd(Client *c, const Seperator *sep);
|
||||
void command_wpinfo(Client *c, const Seperator *sep);
|
||||
void command_xtargets(Client *c, const Seperator *sep);
|
||||
void command_zclip(Client *c, const Seperator *sep);
|
||||
void command_zcolor(Client *c, const Seperator *sep);
|
||||
void command_zheader(Client *c, const Seperator *sep);
|
||||
void command_zone(Client *c, const Seperator *sep);
|
||||
void command_zone_instance(Client *c, const Seperator *sep);
|
||||
void command_zonebootup(Client *c, const Seperator *sep);
|
||||
void command_zonelock(Client *c, const Seperator *sep);
|
||||
void command_zoneshutdown(Client *c, const Seperator *sep);
|
||||
void command_zonespawn(Client *c, const Seperator *sep);
|
||||
void command_zonestatus(Client *c, const Seperator *sep);
|
||||
void command_zopp(Client *c, const Seperator *sep);
|
||||
void command_zsafecoords(Client *c, const Seperator *sep);
|
||||
void command_zsave(Client *c, const Seperator *sep);
|
||||
void command_zsky(Client *c, const Seperator *sep);
|
||||
void command_zstats(Client *c, const Seperator *sep);
|
||||
void command_zunderworld(Client *c, const Seperator *sep);
|
||||
void command_zuwcoords(Client *c, const Seperator *sep);
|
||||
|
||||
#ifdef BOTS
|
||||
#include "bot.h"
|
||||
@ -350,4 +337,3 @@ void command_bot(Client*c, const Seperator *sep);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -571,6 +571,33 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
return(false);
|
||||
}
|
||||
|
||||
void Client::TrainDiscBySpellID(int32 spell_id)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < MAX_PP_DISCIPLINES; i++) {
|
||||
if(m_pp.disciplines.values[i] == 0) {
|
||||
m_pp.disciplines.values[i] = spell_id;
|
||||
database.SaveCharacterDisc(this->CharacterID(), i, spell_id);
|
||||
SendDisciplineUpdate();
|
||||
Message(15, "You have learned a new combat ability!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Client::GetDiscSlotBySpellID(int32 spellid)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < MAX_PP_DISCIPLINES; i++)
|
||||
{
|
||||
if(m_pp.disciplines.values[i] == spellid)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Client::SendDisciplineUpdate() {
|
||||
EQApplicationPacket app(OP_DisciplineUpdate, sizeof(Disciplines_Struct));
|
||||
Disciplines_Struct *d = (Disciplines_Struct*)app.pBuffer;
|
||||
|
||||
@ -2906,6 +2906,19 @@ XS(XS__DestroyInstance) {
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS__UpdateInstanceTimer);
|
||||
XS(XS__UpdateInstanceTimer) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: UpdateInstanceTimer(instance_id, new_duration)");
|
||||
|
||||
uint16 instance_id = (uint16)SvUV(ST(0));
|
||||
uint32 new_duration = (uint32)SvUV(ST(1));
|
||||
quest_manager.UpdateInstanceTimer(instance_id, new_duration);
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS__GetInstanceID);
|
||||
XS(XS__GetInstanceID) {
|
||||
dXSARGS;
|
||||
@ -3636,6 +3649,7 @@ EXTERN_C XS(boot_quest)
|
||||
newXS(strcpy(buf, "ChooseRandom"), XS__ChooseRandom, file);
|
||||
newXS(strcpy(buf, "CreateInstance"), XS__CreateInstance, file);
|
||||
newXS(strcpy(buf, "DestroyInstance"), XS__DestroyInstance, file);
|
||||
newXS(strcpy(buf, "UpdateInstanceTimer"), XS__UpdateInstanceTimer, file);
|
||||
newXS(strcpy(buf, "FlagInstanceByGroupLeader"), XS__FlagInstanceByGroupLeader, file);
|
||||
newXS(strcpy(buf, "FlagInstanceByRaidLeader"), XS__FlagInstanceByRaidLeader, file);
|
||||
newXS(strcpy(buf, "FlyMode"), XS__FlyMode, file);
|
||||
|
||||
@ -530,6 +530,11 @@ void Lua_Client::UnmemSpell(int slot, bool update_client) {
|
||||
self->UnmemSpell(slot, update_client);
|
||||
}
|
||||
|
||||
void Lua_Client::UnmemSpellBySpellID(int32 spell_id) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->UnmemSpellBySpellID(spell_id);
|
||||
}
|
||||
|
||||
void Lua_Client::UnmemSpellAll() {
|
||||
Lua_Safe_Call_Void();
|
||||
self->UnmemSpellAll();
|
||||
@ -575,6 +580,16 @@ void Lua_Client::TrainDisc(int itemid) {
|
||||
self->TrainDiscipline(itemid);
|
||||
}
|
||||
|
||||
void Lua_Client::TrainDiscBySpellID(int32 spell_id) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->TrainDiscBySpellID(spell_id);
|
||||
}
|
||||
|
||||
int Lua_Client::GetDiscSlotBySpellID(int32 spell_id) {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetDiscSlotBySpellID(spell_id);
|
||||
}
|
||||
|
||||
void Lua_Client::UntrainDisc(int slot) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->UntrainDisc(slot);
|
||||
@ -1426,6 +1441,7 @@ luabind::scope lua_register_client() {
|
||||
.def("MemSpell", (void(Lua_Client::*)(int,int,bool))&Lua_Client::MemSpell)
|
||||
.def("UnmemSpell", (void(Lua_Client::*)(int))&Lua_Client::UnmemSpell)
|
||||
.def("UnmemSpell", (void(Lua_Client::*)(int,bool))&Lua_Client::UnmemSpell)
|
||||
.def("UnmemSpellBySpellID", (void(Lua_Client::*)(int32))&Lua_Client::UnmemSpellBySpellID)
|
||||
.def("UnmemSpellAll", (void(Lua_Client::*)(void))&Lua_Client::UnmemSpellAll)
|
||||
.def("UnmemSpellAll", (void(Lua_Client::*)(bool))&Lua_Client::UnmemSpellAll)
|
||||
.def("ScribeSpell", (void(Lua_Client::*)(int,int))&Lua_Client::ScribeSpell)
|
||||
@ -1435,6 +1451,8 @@ luabind::scope lua_register_client() {
|
||||
.def("UnscribeSpellAll", (void(Lua_Client::*)(void))&Lua_Client::UnscribeSpellAll)
|
||||
.def("UnscribeSpellAll", (void(Lua_Client::*)(bool))&Lua_Client::UnscribeSpellAll)
|
||||
.def("TrainDisc", (void(Lua_Client::*)(int))&Lua_Client::TrainDisc)
|
||||
.def("TrainDiscBySpellID", (void(Lua_Client::*)(int32))&Lua_Client::TrainDiscBySpellID)
|
||||
.def("GetDiscSlotBySpellID", (int(Lua_Client::*)(int32))&Lua_Client::GetDiscSlotBySpellID)
|
||||
.def("UntrainDisc", (void(Lua_Client::*)(int))&Lua_Client::UntrainDisc)
|
||||
.def("UntrainDisc", (void(Lua_Client::*)(int,bool))&Lua_Client::UntrainDisc)
|
||||
.def("UntrainDiscAll", (void(Lua_Client::*)(void))&Lua_Client::UntrainDiscAll)
|
||||
|
||||
@ -131,6 +131,7 @@ public:
|
||||
void MemSpell(int spell_id, int slot, bool update_client);
|
||||
void UnmemSpell(int slot);
|
||||
void UnmemSpell(int slot, bool update_client);
|
||||
void UnmemSpellBySpellID(int32 spell_id);
|
||||
void UnmemSpellAll();
|
||||
void UnmemSpellAll(bool update_client);
|
||||
void ScribeSpell(int spell_id, int slot);
|
||||
@ -140,6 +141,8 @@ public:
|
||||
void UnscribeSpellAll();
|
||||
void UnscribeSpellAll(bool update_client);
|
||||
void TrainDisc(int itemid);
|
||||
void TrainDiscBySpellID(int32 spell_id);
|
||||
int GetDiscSlotBySpellID(int32 spell_id);
|
||||
void UntrainDisc(int slot);
|
||||
void UntrainDisc(int slot, bool update_client);
|
||||
void UntrainDiscAll();
|
||||
|
||||
@ -804,6 +804,10 @@ void lua_destroy_instance(uint32 instance_id) {
|
||||
quest_manager.DestroyInstance(instance_id);
|
||||
}
|
||||
|
||||
void lua_update_instance_timer(uint16 instance_id, uint32 new_duration) {
|
||||
quest_manager.UpdateInstanceTimer(instance_id, new_duration);
|
||||
}
|
||||
|
||||
int lua_get_instance_id(const char *zone, uint32 version) {
|
||||
return quest_manager.GetInstanceID(zone, version);
|
||||
}
|
||||
@ -1576,6 +1580,7 @@ luabind::scope lua_register_general() {
|
||||
luabind::def("get_guild_name_by_id", &lua_get_guild_name_by_id),
|
||||
luabind::def("create_instance", &lua_create_instance),
|
||||
luabind::def("destroy_instance", &lua_destroy_instance),
|
||||
luabind::def("update_instance_timer", &lua_update_instance_timer),
|
||||
luabind::def("get_instance_id", &lua_get_instance_id),
|
||||
luabind::def("get_characters_in_instance", &lua_get_characters_in_instance),
|
||||
luabind::def("assign_to_instance", &lua_assign_to_instance),
|
||||
|
||||
@ -1871,6 +1871,16 @@ void Lua_Mob::SetPseudoRoot(bool in) {
|
||||
self->SetPseudoRoot(in);
|
||||
}
|
||||
|
||||
bool Lua_Mob::IsFeared() {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->IsFeared();
|
||||
}
|
||||
|
||||
bool Lua_Mob::IsBlind() {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->IsBlind();
|
||||
}
|
||||
|
||||
luabind::scope lua_register_mob() {
|
||||
return luabind::class_<Lua_Mob, Lua_Entity>("Mob")
|
||||
.def(luabind::constructor<>())
|
||||
@ -2156,6 +2166,8 @@ luabind::scope lua_register_mob() {
|
||||
.def("WearChange", (void(Lua_Mob::*)(int,int,uint32))&Lua_Mob::WearChange)
|
||||
.def("DoKnockback", (void(Lua_Mob::*)(Lua_Mob,uint32,uint32))&Lua_Mob::DoKnockback)
|
||||
.def("RemoveNimbusEffect", (void(Lua_Mob::*)(int))&Lua_Mob::RemoveNimbusEffect)
|
||||
.def("IsFeared", (bool(Lua_Mob::*)(void))&Lua_Mob::IsFeared)
|
||||
.def("IsBlind", (bool(Lua_Mob::*)(void))&Lua_Mob::IsBlind)
|
||||
.def("IsRunning", (bool(Lua_Mob::*)(void))&Lua_Mob::IsRunning)
|
||||
.def("SetRunning", (void(Lua_Mob::*)(bool))&Lua_Mob::SetRunning)
|
||||
.def("SetBodyType", (void(Lua_Mob::*)(int,bool))&Lua_Mob::SetBodyType)
|
||||
|
||||
@ -40,6 +40,8 @@ public:
|
||||
void SetLevel(int level, bool command);
|
||||
void SendWearChange(int material_slot);
|
||||
bool IsMoving();
|
||||
bool IsFeared();
|
||||
bool IsBlind();
|
||||
void GotoBind();
|
||||
void Gate();
|
||||
bool Attack(Lua_Mob other);
|
||||
|
||||
@ -2445,6 +2445,30 @@ XS(XS_Client_UnmemSpell)
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_UnmemSpellBySpellID); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_UnmemSpellBySpellID)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Client::UnmemSpellBySpellID(THIS, spell_id)");
|
||||
{
|
||||
Client * THIS;
|
||||
int32 spell_id = (int32)SvIV(ST(1));
|
||||
|
||||
if (sv_derived_from(ST(0), "Client")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Client *,tmp);
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->UnmemSpellBySpellID(spell_id);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_UnmemSpellAll); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_UnmemSpellAll)
|
||||
{
|
||||
@ -2568,6 +2592,57 @@ XS(XS_Client_UnscribeSpellAll)
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_TrainDiscBySpellID); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_TrainDiscBySpellID)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Client::TrainDiscBySpellID(THIS, spell_id)");
|
||||
{
|
||||
Client * THIS;
|
||||
int32 spell_id = (int32)SvIV(ST(1));
|
||||
|
||||
if (sv_derived_from(ST(0), "Client")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Client *,tmp);
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->TrainDiscBySpellID(spell_id);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_GetDiscSlotBySpellID); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_GetDiscSlotBySpellID)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Client::GetDiscSlotBySpellID(THIS, spell_id)");
|
||||
{
|
||||
Client * THIS;
|
||||
int RETVAL;
|
||||
int32 spell_id = (int32)SvIV(ST(1));
|
||||
dXSTARG;
|
||||
|
||||
if (sv_derived_from(ST(0), "Client")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Client *,tmp);
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->GetDiscSlotBySpellID(spell_id);
|
||||
XSprePUSH; PUSHi((IV)RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Client_UntrainDisc); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_UntrainDisc)
|
||||
{
|
||||
@ -6443,10 +6518,13 @@ XS(boot_Client)
|
||||
newXSproto(strcpy(buf, "ResetAA"), XS_Client_ResetAA, file, "$");
|
||||
newXSproto(strcpy(buf, "MemSpell"), XS_Client_MemSpell, file, "$$$;$");
|
||||
newXSproto(strcpy(buf, "UnmemSpell"), XS_Client_UnmemSpell, file, "$$;$");
|
||||
newXSproto(strcpy(buf, "UnmemSpellBySpellID"), XS_Client_UnmemSpellBySpellID, file, "$$");
|
||||
newXSproto(strcpy(buf, "UnmemSpellAll"), XS_Client_UnmemSpellAll, file, "$;$");
|
||||
newXSproto(strcpy(buf, "ScribeSpell"), XS_Client_ScribeSpell, file, "$$$;$");
|
||||
newXSproto(strcpy(buf, "UnscribeSpell"), XS_Client_UnscribeSpell, file, "$$;$");
|
||||
newXSproto(strcpy(buf, "UnscribeSpellAll"), XS_Client_UnscribeSpellAll, file, "$;$");
|
||||
newXSproto(strcpy(buf, "TrainDiscBySpellID"), XS_Client_TrainDiscBySpellID, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetDiscSlotBySpellID"), XS_Client_GetDiscSlotBySpellID, file, "$$");
|
||||
newXSproto(strcpy(buf, "UntrainDisc"), XS_Client_UntrainDisc, file, "$$;$");
|
||||
newXSproto(strcpy(buf, "UntrainDiscAll"), XS_Client_UntrainDiscAll, file, "$;$");
|
||||
newXSproto(strcpy(buf, "IsSitting"), XS_Client_IsSitting, file, "$");
|
||||
|
||||
@ -8440,6 +8440,56 @@ XS(XS_Mob_CanClassEquipItem)
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Mob_IsFeared);
|
||||
XS(XS_Mob_IsFeared) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: Mob::IsFeared(THIS)");
|
||||
{
|
||||
Mob* THIS;
|
||||
bool RETVAL;
|
||||
if (sv_derived_from(ST(0), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Mob*, tmp);
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ "THIS is not of type Mob");
|
||||
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->IsFeared();
|
||||
ST(0) = boolSV(RETVAL);
|
||||
sv_2mortal(ST(0));
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Mob_IsBlind);
|
||||
XS(XS_Mob_IsBlind) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: Mob::IsBlind(THIS)");
|
||||
{
|
||||
Mob* THIS;
|
||||
bool RETVAL;
|
||||
if (sv_derived_from(ST(0), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Mob*, tmp);
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ "THIS is not of type Mob");
|
||||
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->IsBlind();
|
||||
ST(0) = boolSV(RETVAL);
|
||||
sv_2mortal(ST(0));
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
@ -8751,6 +8801,8 @@ XS(boot_Mob)
|
||||
newXSproto(strcpy(buf, "ClearSpecialAbilities"), XS_Mob_ClearSpecialAbilities, file, "$");
|
||||
newXSproto(strcpy(buf, "ProcessSpecialAbilities"), XS_Mob_ProcessSpecialAbilities, file, "$$");
|
||||
newXSproto(strcpy(buf, "CanClassEquipItem"), XS_Mob_CanClassEquipItem, file, "$$");
|
||||
newXSproto(strcpy(buf, "IsFeared"), XS_Mob_IsFeared, file, "$");
|
||||
newXSproto(strcpy(buf, "IsBlind"), XS_Mob_IsBlind, file, "$");
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
|
||||
@ -2582,6 +2582,22 @@ void QuestManager::DestroyInstance(uint16 instance_id)
|
||||
database.DeleteInstance(instance_id);
|
||||
}
|
||||
|
||||
void QuestManager::UpdateInstanceTimer(uint16 instance_id, uint32 new_duration)
|
||||
{
|
||||
std::string query = StringFormat("UPDATE instance_list SET duration = %lu, start_time = UNIX_TIMESTAMP() WHERE id = %lu",
|
||||
(unsigned long)new_duration, (unsigned long)instance_id);
|
||||
auto results = database.QueryDatabase(query);
|
||||
|
||||
if (results.Success()) {
|
||||
auto pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct));
|
||||
ServerInstanceUpdateTime_Struct *ut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer;
|
||||
ut->instance_id = instance_id;
|
||||
ut->new_duration = new_duration;
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
}
|
||||
|
||||
uint16 QuestManager::GetInstanceID(const char *zone, int16 version)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
@ -217,6 +217,7 @@ public:
|
||||
void MerchantSetItem(uint32 NPCid, uint32 itemid, uint32 quantity = 0);
|
||||
uint32 MerchantCountItem(uint32 NPCid, uint32 itemid);
|
||||
uint16 CreateInstance(const char *zone, int16 version, uint32 duration);
|
||||
void UpdateInstanceTimer(uint16 instance_id, uint32 new_duration);
|
||||
void DestroyInstance(uint16 instance_id);
|
||||
uint16 GetInstanceID(const char *zone, int16 version);
|
||||
void AssignToInstance(uint16 instance_id);
|
||||
|
||||
@ -4910,6 +4910,16 @@ void Client::UnmemSpell(int slot, bool update_client)
|
||||
}
|
||||
}
|
||||
|
||||
void Client::UnmemSpellBySpellID(int32 spell_id)
|
||||
{
|
||||
for(int i = 0; i < MAX_PP_MEMSPELL; i++) {
|
||||
if(m_pp.mem_spells[i] == spell_id) {
|
||||
UnmemSpell(i, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Client::UnmemSpellAll(bool update_client)
|
||||
{
|
||||
int i;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user