mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[Item Ticks] Remove Item Ticks Code (#3955)
* [Items] Convert Load of Item Ticks to Repositories - Convert `LoadItemTicks()` to repositories. * Remove item tick code. * Remove repository references. * Update zone.h
This commit is contained in:
parent
e182d685d3
commit
d59531b16f
@ -230,7 +230,6 @@ SET(repositories
|
||||
repositories/base/base_inventory_snapshots_repository.h
|
||||
repositories/base/base_ip_exemptions_repository.h
|
||||
repositories/base/base_items_repository.h
|
||||
repositories/base/base_item_tick_repository.h
|
||||
repositories/base/base_ldon_trap_entries_repository.h
|
||||
repositories/base/base_ldon_trap_templates_repository.h
|
||||
repositories/base/base_level_exp_mods_repository.h
|
||||
@ -408,7 +407,6 @@ SET(repositories
|
||||
repositories/inventory_snapshots_repository.h
|
||||
repositories/ip_exemptions_repository.h
|
||||
repositories/items_repository.h
|
||||
repositories/item_tick_repository.h
|
||||
repositories/ldon_trap_entries_repository.h
|
||||
repositories/ldon_trap_templates_repository.h
|
||||
repositories/level_exp_mods_repository.h
|
||||
|
||||
@ -1,439 +0,0 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ITEM_TICK_REPOSITORY_H
|
||||
#define EQEMU_BASE_ITEM_TICK_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
class BaseItemTickRepository {
|
||||
public:
|
||||
struct ItemTick {
|
||||
int32_t it_itemid;
|
||||
int32_t it_chance;
|
||||
int32_t it_level;
|
||||
int32_t it_id;
|
||||
std::string it_qglobal;
|
||||
int8_t it_bagslot;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("it_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"it_itemid",
|
||||
"it_chance",
|
||||
"it_level",
|
||||
"it_id",
|
||||
"it_qglobal",
|
||||
"it_bagslot",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"it_itemid",
|
||||
"it_chance",
|
||||
"it_level",
|
||||
"it_id",
|
||||
"it_qglobal",
|
||||
"it_bagslot",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(Strings::Implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string SelectColumnsRaw()
|
||||
{
|
||||
return std::string(Strings::Implode(", ", SelectColumns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("item_tick");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static ItemTick NewEntity()
|
||||
{
|
||||
ItemTick e{};
|
||||
|
||||
e.it_itemid = 0;
|
||||
e.it_chance = 0;
|
||||
e.it_level = 0;
|
||||
e.it_id = 0;
|
||||
e.it_qglobal = "";
|
||||
e.it_bagslot = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static ItemTick GetItemTick(
|
||||
const std::vector<ItemTick> &item_ticks,
|
||||
int item_tick_id
|
||||
)
|
||||
{
|
||||
for (auto &item_tick : item_ticks) {
|
||||
if (item_tick.it_id == item_tick_id) {
|
||||
return item_tick;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static ItemTick FindOne(
|
||||
Database& db,
|
||||
int item_tick_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
item_tick_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
ItemTick e{};
|
||||
|
||||
e.it_itemid = static_cast<int32_t>(atoi(row[0]));
|
||||
e.it_chance = static_cast<int32_t>(atoi(row[1]));
|
||||
e.it_level = static_cast<int32_t>(atoi(row[2]));
|
||||
e.it_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.it_qglobal = row[4] ? row[4] : "";
|
||||
e.it_bagslot = static_cast<int8_t>(atoi(row[5]));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int item_tick_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
item_tick_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const ItemTick &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[0] + " = " + std::to_string(e.it_itemid));
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.it_chance));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.it_level));
|
||||
v.push_back(columns[4] + " = '" + Strings::Escape(e.it_qglobal) + "'");
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.it_bagslot));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.it_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static ItemTick InsertOne(
|
||||
Database& db,
|
||||
ItemTick e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.it_itemid));
|
||||
v.push_back(std::to_string(e.it_chance));
|
||||
v.push_back(std::to_string(e.it_level));
|
||||
v.push_back(std::to_string(e.it_id));
|
||||
v.push_back("'" + Strings::Escape(e.it_qglobal) + "'");
|
||||
v.push_back(std::to_string(e.it_bagslot));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.it_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<ItemTick> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.it_itemid));
|
||||
v.push_back(std::to_string(e.it_chance));
|
||||
v.push_back(std::to_string(e.it_level));
|
||||
v.push_back(std::to_string(e.it_id));
|
||||
v.push_back("'" + Strings::Escape(e.it_qglobal) + "'");
|
||||
v.push_back(std::to_string(e.it_bagslot));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<ItemTick> All(Database& db)
|
||||
{
|
||||
std::vector<ItemTick> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
ItemTick e{};
|
||||
|
||||
e.it_itemid = static_cast<int32_t>(atoi(row[0]));
|
||||
e.it_chance = static_cast<int32_t>(atoi(row[1]));
|
||||
e.it_level = static_cast<int32_t>(atoi(row[2]));
|
||||
e.it_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.it_qglobal = row[4] ? row[4] : "";
|
||||
e.it_bagslot = static_cast<int8_t>(atoi(row[5]));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<ItemTick> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<ItemTick> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
ItemTick e{};
|
||||
|
||||
e.it_itemid = static_cast<int32_t>(atoi(row[0]));
|
||||
e.it_chance = static_cast<int32_t>(atoi(row[1]));
|
||||
e.it_level = static_cast<int32_t>(atoi(row[2]));
|
||||
e.it_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.it_qglobal = row[4] ? row[4] : "";
|
||||
e.it_bagslot = static_cast<int8_t>(atoi(row[5]));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int64 GetMaxId(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"SELECT COALESCE(MAX({}), 0) FROM {}",
|
||||
PrimaryKey(),
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static int64 Count(Database& db, const std::string &where_filter = "")
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"SELECT COUNT(*) FROM {} {}",
|
||||
TableName(),
|
||||
(where_filter.empty() ? "" : "WHERE " + where_filter)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const ItemTick &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.it_itemid));
|
||||
v.push_back(std::to_string(e.it_chance));
|
||||
v.push_back(std::to_string(e.it_level));
|
||||
v.push_back(std::to_string(e.it_id));
|
||||
v.push_back("'" + Strings::Escape(e.it_qglobal) + "'");
|
||||
v.push_back(std::to_string(e.it_bagslot));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int ReplaceMany(
|
||||
Database& db,
|
||||
const std::vector<ItemTick> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.it_itemid));
|
||||
v.push_back(std::to_string(e.it_chance));
|
||||
v.push_back(std::to_string(e.it_level));
|
||||
v.push_back(std::to_string(e.it_id));
|
||||
v.push_back("'" + Strings::Escape(e.it_qglobal) + "'");
|
||||
v.push_back(std::to_string(e.it_bagslot));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_ITEM_TICK_REPOSITORY_H
|
||||
@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_ITEM_TICK_REPOSITORY_H
|
||||
#define EQEMU_ITEM_TICK_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_item_tick_repository.h"
|
||||
|
||||
class ItemTickRepository: public BaseItemTickRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* ItemTickRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* ItemTickRepository::GetWhereNeverExpires()
|
||||
* ItemTickRepository::GetWhereXAndY()
|
||||
* ItemTickRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_ITEM_TICK_REPOSITORY_H
|
||||
@ -165,7 +165,6 @@ Client::Client(EQStreamInterface *ieqs) : Mob(
|
||||
TrackingTimer(2000),
|
||||
RespawnFromHoverTimer(0),
|
||||
merc_timer(RuleI(Mercs, UpkeepIntervalMS)),
|
||||
ItemTickTimer(10000),
|
||||
ItemQuestTimer(500),
|
||||
anon_toggle_timer(250),
|
||||
afk_toggle_timer(250),
|
||||
@ -6568,7 +6567,7 @@ void Client::SendAltCurrencies() {
|
||||
if (!currency_count) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
auto outapp = new EQApplicationPacket(
|
||||
OP_AltCurrency,
|
||||
sizeof(AltCurrencyPopulate_Struct) +
|
||||
@ -7744,68 +7743,6 @@ std::vector<std::string> Client::GetAccountFlags()
|
||||
return l;
|
||||
}
|
||||
|
||||
void Client::TickItemCheck()
|
||||
{
|
||||
int i;
|
||||
|
||||
if(zone->tick_items.empty()) { return; }
|
||||
|
||||
//Scan equip, general, cursor slots for items
|
||||
for (i = EQ::invslot::POSSESSIONS_BEGIN; i <= EQ::invslot::POSSESSIONS_END; i++)
|
||||
{
|
||||
TryItemTick(i);
|
||||
}
|
||||
//Scan bags
|
||||
for (i = EQ::invbag::GENERAL_BAGS_BEGIN; i <= EQ::invbag::CURSOR_BAG_END; i++)
|
||||
{
|
||||
TryItemTick(i);
|
||||
}
|
||||
}
|
||||
|
||||
void Client::TryItemTick(int slot)
|
||||
{
|
||||
int iid = 0;
|
||||
const EQ::ItemInstance* inst = m_inv[slot];
|
||||
if(inst == 0) { return; }
|
||||
|
||||
iid = inst->GetID();
|
||||
|
||||
if(zone->tick_items.count(iid) > 0)
|
||||
{
|
||||
if (GetLevel() >= zone->tick_items[iid].level && zone->random.Int(0, 100) >= (100 - zone->tick_items[iid].chance) && (zone->tick_items[iid].bagslot || slot <= EQ::invslot::EQUIPMENT_END))
|
||||
{
|
||||
EQ::ItemInstance* e_inst = (EQ::ItemInstance*)inst;
|
||||
|
||||
if (parse->ItemHasQuestSub(e_inst, EVENT_ITEM_TICK)) {
|
||||
parse->EventItem(EVENT_ITEM_TICK, this, e_inst, nullptr, "", slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Only look at augs in main inventory
|
||||
if (slot > EQ::invslot::EQUIPMENT_END) { return; }
|
||||
|
||||
for (int x = EQ::invaug::SOCKET_BEGIN; x <= EQ::invaug::SOCKET_END; ++x)
|
||||
{
|
||||
EQ::ItemInstance * a_inst = inst->GetAugment(x);
|
||||
if(!a_inst) { continue; }
|
||||
|
||||
iid = a_inst->GetID();
|
||||
|
||||
if(zone->tick_items.count(iid) > 0)
|
||||
{
|
||||
if( GetLevel() >= zone->tick_items[iid].level && zone->random.Int(0, 100) >= (100 - zone->tick_items[iid].chance) )
|
||||
{
|
||||
EQ::ItemInstance* e_inst = (EQ::ItemInstance*) a_inst;
|
||||
|
||||
if (parse->ItemHasQuestSub(e_inst, EVENT_ITEM_TICK)) {
|
||||
parse->EventItem(EVENT_ITEM_TICK, this, e_inst, nullptr, "", slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Client::ItemTimerCheck()
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1590,8 +1590,6 @@ public:
|
||||
void DuplicateLoreMessage(uint32 ItemID);
|
||||
void GarbleMessage(char *, uint8);
|
||||
|
||||
void TickItemCheck();
|
||||
void TryItemTick(int slot);
|
||||
void ItemTimerCheck();
|
||||
void TryItemTimer(int slot);
|
||||
void SendItemScale(EQ::ItemInstance *inst);
|
||||
@ -2008,7 +2006,6 @@ private:
|
||||
|
||||
AggroMeter m_aggrometer;
|
||||
|
||||
Timer ItemTickTimer;
|
||||
Timer ItemQuestTimer;
|
||||
std::map<std::string,std::string> accountflags;
|
||||
|
||||
|
||||
@ -525,11 +525,6 @@ bool Client::Process() {
|
||||
CalcBonuses();
|
||||
}
|
||||
|
||||
if (ItemTickTimer.Check())
|
||||
{
|
||||
TickItemCheck();
|
||||
}
|
||||
|
||||
if (ItemQuestTimer.Check())
|
||||
{
|
||||
ItemTimerCheck();
|
||||
|
||||
@ -61,7 +61,7 @@ typedef enum {
|
||||
EVENT_DISCOVER_ITEM,
|
||||
EVENT_DISCONNECT,
|
||||
EVENT_CONNECT,
|
||||
EVENT_ITEM_TICK,
|
||||
EVENT_ITEM_TICK, // Unused, keeping so event IDs don't get out of wack
|
||||
EVENT_DUEL_WIN,
|
||||
EVENT_DUEL_LOSE,
|
||||
EVENT_ENCOUNTER_LOAD,
|
||||
|
||||
@ -6547,7 +6547,6 @@ luabind::scope lua_register_events() {
|
||||
luabind::value("discover_item", static_cast<int>(EVENT_DISCOVER_ITEM)),
|
||||
luabind::value("disconnect", static_cast<int>(EVENT_DISCONNECT)),
|
||||
luabind::value("connect", static_cast<int>(EVENT_CONNECT)),
|
||||
luabind::value("item_tick", static_cast<int>(EVENT_ITEM_TICK)),
|
||||
luabind::value("duel_win", static_cast<int>(EVENT_DUEL_WIN)),
|
||||
luabind::value("duel_lose", static_cast<int>(EVENT_DUEL_LOSE)),
|
||||
luabind::value("encounter_load", static_cast<int>(EVENT_ENCOUNTER_LOAD)),
|
||||
|
||||
@ -1219,7 +1219,6 @@ bool Zone::Init(bool is_static) {
|
||||
LogInfo("Zone booted successfully zone_id [{}] time_offset [{}]", zoneid, zone_time.getEQTimeZone());
|
||||
|
||||
LoadGrids();
|
||||
LoadTickItems();
|
||||
|
||||
npc_scale_manager->LoadScaleData();
|
||||
|
||||
@ -2664,34 +2663,6 @@ void Zone::ClearSpawnTimers()
|
||||
);
|
||||
}
|
||||
|
||||
void Zone::LoadTickItems()
|
||||
{
|
||||
tick_items.clear();
|
||||
|
||||
const std::string query = "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick";
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
if(Strings::ToInt(row[0]) == 0)
|
||||
continue;
|
||||
|
||||
item_tick_struct ti_tmp;
|
||||
ti_tmp.itemid = Strings::ToInt(row[0]);
|
||||
ti_tmp.chance = Strings::ToInt(row[1]);
|
||||
ti_tmp.level = Strings::ToInt(row[2]);
|
||||
ti_tmp.bagslot = (int16)Strings::ToInt(row[4]);
|
||||
ti_tmp.qglobal = std::string(row[3]);
|
||||
tick_items[Strings::ToInt(row[0])] = ti_tmp;
|
||||
|
||||
}
|
||||
|
||||
LogInfo("Loaded [{}] item_tick entries", Strings::Commify(results.RowCount()));
|
||||
}
|
||||
|
||||
uint32 Zone::GetSpawnKillCount(uint32 in_spawnid) {
|
||||
LinkedListIterator<Spawn2*> iterator(spawn2_list);
|
||||
|
||||
|
||||
10
zone/zone.h
10
zone/zone.h
@ -77,14 +77,6 @@ struct ZoneEXPModInfo {
|
||||
float AAExpMod;
|
||||
};
|
||||
|
||||
struct item_tick_struct {
|
||||
uint32 itemid;
|
||||
uint32 chance;
|
||||
uint32 level;
|
||||
int16 bagslot;
|
||||
std::string qglobal;
|
||||
};
|
||||
|
||||
class Client;
|
||||
class Expedition;
|
||||
class Map;
|
||||
@ -219,7 +211,6 @@ public:
|
||||
|
||||
std::pair<AA::Ability *, AA::Rank *> GetAlternateAdvancementAbilityAndRank(int id, int points_spent);
|
||||
|
||||
std::unordered_map<int, item_tick_struct> tick_items;
|
||||
std::unordered_map<int, std::unique_ptr<AA::Ability>> aa_abilities;
|
||||
std::unordered_map<int, std::unique_ptr<AA::Rank>> aa_ranks;
|
||||
|
||||
@ -285,7 +276,6 @@ public:
|
||||
void LoadNewMerchantData(uint32 merchantid);
|
||||
void LoadNPCEmotes(std::vector<NPC_Emote_Struct *> *NPCEmoteList);
|
||||
void LoadTempMerchantData();
|
||||
void LoadTickItems();
|
||||
void LoadVeteranRewards();
|
||||
void LoadZoneDoors();
|
||||
void ReloadStaticData();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user