mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
We don't need to cast these anymore
This commit is contained in:
parent
8cde35ca88
commit
f4224b296a
@ -1143,7 +1143,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID
|
|||||||
ItemInst *inst = EQEmu::any_cast<ItemInst*>(extra_pointers->at(i));
|
ItemInst *inst = EQEmu::any_cast<ItemInst*>(extra_pointers->at(i));
|
||||||
|
|
||||||
std::string var_name = "item";
|
std::string var_name = "item";
|
||||||
var_name += std::to_string(static_cast<long long>(i + 1));
|
var_name += std::to_string(i + 1);
|
||||||
|
|
||||||
if(inst) {
|
if(inst) {
|
||||||
ExportVar(package_name.c_str(), var_name.c_str(), inst->GetItem()->ID);
|
ExportVar(package_name.c_str(), var_name.c_str(), inst->GetItem()->ID);
|
||||||
|
|||||||
@ -200,7 +200,7 @@ void unregister_player_event(int evt) {
|
|||||||
|
|
||||||
void register_item_event(std::string name, int evt, int item_id, luabind::adl::object func) {
|
void register_item_event(std::string name, int evt, int item_id, luabind::adl::object func) {
|
||||||
std::string package_name = "item_";
|
std::string package_name = "item_";
|
||||||
package_name += std::to_string(static_cast<long long>(item_id));
|
package_name += std::to_string(item_id);
|
||||||
|
|
||||||
if(luabind::type(func) == LUA_TFUNCTION) {
|
if(luabind::type(func) == LUA_TFUNCTION) {
|
||||||
register_event(package_name, name, evt, func);
|
register_event(package_name, name, evt, func);
|
||||||
@ -214,7 +214,7 @@ void register_item_event(int evt, int item_id, luabind::adl::object func) {
|
|||||||
|
|
||||||
void unregister_item_event(std::string name, int evt, int item_id) {
|
void unregister_item_event(std::string name, int evt, int item_id) {
|
||||||
std::string package_name = "item_";
|
std::string package_name = "item_";
|
||||||
package_name += std::to_string(static_cast<long long>(item_id));
|
package_name += std::to_string(item_id);
|
||||||
|
|
||||||
unregister_event(package_name, name, evt);
|
unregister_event(package_name, name, evt);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -235,7 +235,7 @@ int LuaParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string package_name = "npc_" + std::to_string(static_cast<long long>(npc->GetNPCTypeID()));
|
std::string package_name = "npc_" + std::to_string(npc->GetNPCTypeID());
|
||||||
return _EventNPC(package_name, evt, npc, init, data, extra_data, extra_pointers);
|
return _EventNPC(package_name, evt, npc, init, data, extra_data, extra_pointers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ int LuaParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string package_name = "item_";
|
std::string package_name = "item_";
|
||||||
package_name += std::to_string(static_cast<long long>(item->GetID()));
|
package_name += std::to_string(item->GetID());
|
||||||
return _EventItem(package_name, evt, client, item, mob, data, extra_data, extra_pointers);
|
return _EventItem(package_name, evt, client, item, mob, data, extra_data, extra_pointers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,7 +499,7 @@ int LuaParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spe
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string package_name = "spell_" + std::to_string(static_cast<long long>(spell_id));
|
std::string package_name = "spell_" + std::to_string(spell_id);
|
||||||
|
|
||||||
if(!SpellHasQuestSub(spell_id, evt)) {
|
if(!SpellHasQuestSub(spell_id, evt)) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -646,7 +646,7 @@ bool LuaParser::HasQuestSub(uint32 npc_id, QuestEventID evt) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string package_name = "npc_" + std::to_string(static_cast<long long>(npc_id));
|
std::string package_name = "npc_" + std::to_string(npc_id);
|
||||||
|
|
||||||
const char *subname = LuaEvents[evt];
|
const char *subname = LuaEvents[evt];
|
||||||
return HasFunction(subname, package_name);
|
return HasFunction(subname, package_name);
|
||||||
@ -688,7 +688,7 @@ bool LuaParser::SpellHasQuestSub(uint32 spell_id, QuestEventID evt) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string package_name = "spell_" + std::to_string(static_cast<long long>(spell_id));
|
std::string package_name = "spell_" + std::to_string(spell_id);
|
||||||
|
|
||||||
const char *subname = LuaEvents[evt];
|
const char *subname = LuaEvents[evt];
|
||||||
return HasFunction(subname, package_name);
|
return HasFunction(subname, package_name);
|
||||||
@ -704,7 +704,7 @@ bool LuaParser::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string package_name = "item_";
|
std::string package_name = "item_";
|
||||||
package_name += std::to_string(static_cast<long long>(itm->GetID()));
|
package_name += std::to_string(itm->GetID());
|
||||||
|
|
||||||
const char *subname = LuaEvents[evt];
|
const char *subname = LuaEvents[evt];
|
||||||
return HasFunction(subname, package_name);
|
return HasFunction(subname, package_name);
|
||||||
@ -723,7 +723,7 @@ bool LuaParser::EncounterHasQuestSub(std::string encounter_name, QuestEventID ev
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LuaParser::LoadNPCScript(std::string filename, int npc_id) {
|
void LuaParser::LoadNPCScript(std::string filename, int npc_id) {
|
||||||
std::string package_name = "npc_" + std::to_string(static_cast<long long>(npc_id));
|
std::string package_name = "npc_" + std::to_string(npc_id);
|
||||||
|
|
||||||
LoadScript(filename, package_name);
|
LoadScript(filename, package_name);
|
||||||
}
|
}
|
||||||
@ -744,13 +744,13 @@ void LuaParser::LoadItemScript(std::string filename, ItemInst *item) {
|
|||||||
if (item == nullptr)
|
if (item == nullptr)
|
||||||
return;
|
return;
|
||||||
std::string package_name = "item_";
|
std::string package_name = "item_";
|
||||||
package_name += std::to_string(static_cast<long long>(item->GetID()));
|
package_name += std::to_string(item->GetID());
|
||||||
|
|
||||||
LoadScript(filename, package_name);
|
LoadScript(filename, package_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaParser::LoadSpellScript(std::string filename, uint32 spell_id) {
|
void LuaParser::LoadSpellScript(std::string filename, uint32 spell_id) {
|
||||||
std::string package_name = "spell_" + std::to_string(static_cast<long long>(spell_id));
|
std::string package_name = "spell_" + std::to_string(spell_id);
|
||||||
|
|
||||||
LoadScript(filename, package_name);
|
LoadScript(filename, package_name);
|
||||||
}
|
}
|
||||||
@ -1011,7 +1011,7 @@ int LuaParser::DispatchEventNPC(QuestEventID evt, NPC* npc, Mob *init, std::stri
|
|||||||
if(!npc)
|
if(!npc)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
std::string package_name = "npc_" + std::to_string(static_cast<long long>(npc->GetNPCTypeID()));
|
std::string package_name = "npc_" + std::to_string(npc->GetNPCTypeID());
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
auto iter = lua_encounter_events_registered.find(package_name);
|
auto iter = lua_encounter_events_registered.find(package_name);
|
||||||
@ -1087,7 +1087,7 @@ int LuaParser::DispatchEventItem(QuestEventID evt, Client *client, ItemInst *ite
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
std::string package_name = "item_";
|
std::string package_name = "item_";
|
||||||
package_name += std::to_string(static_cast<long long>(item->GetID()));
|
package_name += std::to_string(item->GetID());
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
auto iter = lua_encounter_events_registered.find(package_name);
|
auto iter = lua_encounter_events_registered.find(package_name);
|
||||||
@ -1129,7 +1129,7 @@ int LuaParser::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, ui
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string package_name = "spell_" + std::to_string(static_cast<long long>(spell_id));
|
std::string package_name = "spell_" + std::to_string(spell_id);
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
auto iter = lua_encounter_events_registered.find(package_name);
|
auto iter = lua_encounter_events_registered.find(package_name);
|
||||||
|
|||||||
@ -56,7 +56,7 @@ void handle_npc_event_trade(QuestInterface *parse, lua_State* L, NPC* npc, Mob *
|
|||||||
if(extra_pointers) {
|
if(extra_pointers) {
|
||||||
size_t sz = extra_pointers->size();
|
size_t sz = extra_pointers->size();
|
||||||
for(size_t i = 0; i < sz; ++i) {
|
for(size_t i = 0; i < sz; ++i) {
|
||||||
std::string prefix = "item" + std::to_string(static_cast<long long>(i + 1));
|
std::string prefix = "item" + std::to_string(i + 1);
|
||||||
ItemInst *inst = EQEmu::any_cast<ItemInst*>(extra_pointers->at(i));
|
ItemInst *inst = EQEmu::any_cast<ItemInst*>(extra_pointers->at(i));
|
||||||
|
|
||||||
Lua_ItemInst l_inst = inst;
|
Lua_ItemInst l_inst = inst;
|
||||||
|
|||||||
@ -206,11 +206,11 @@ bool QuestParserCollection::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) {
|
|||||||
std::string item_script;
|
std::string item_script;
|
||||||
if(itm->GetItem()->ScriptFileID != 0) {
|
if(itm->GetItem()->ScriptFileID != 0) {
|
||||||
item_script = "script_";
|
item_script = "script_";
|
||||||
item_script += std::to_string(static_cast<long long>(itm->GetItem()->ScriptFileID));
|
item_script += std::to_string(itm->GetItem()->ScriptFileID);
|
||||||
} else if(strlen(itm->GetItem()->CharmFile) > 0) {
|
} else if(strlen(itm->GetItem()->CharmFile) > 0) {
|
||||||
item_script = itm->GetItem()->CharmFile;
|
item_script = itm->GetItem()->CharmFile;
|
||||||
} else {
|
} else {
|
||||||
item_script = std::to_string(static_cast<long long>(itm->GetID()));
|
item_script = std::to_string(itm->GetID());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 item_id = itm->GetID();
|
uint32 item_id = itm->GetID();
|
||||||
@ -358,11 +358,11 @@ int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst
|
|||||||
std::string item_script;
|
std::string item_script;
|
||||||
if(item->GetItem()->ScriptFileID != 0) {
|
if(item->GetItem()->ScriptFileID != 0) {
|
||||||
item_script = "script_";
|
item_script = "script_";
|
||||||
item_script += std::to_string(static_cast<long long>(item->GetItem()->ScriptFileID));
|
item_script += std::to_string(item->GetItem()->ScriptFileID);
|
||||||
} else if(strlen(item->GetItem()->CharmFile) > 0) {
|
} else if(strlen(item->GetItem()->CharmFile) > 0) {
|
||||||
item_script = item->GetItem()->CharmFile;
|
item_script = item->GetItem()->CharmFile;
|
||||||
} else {
|
} else {
|
||||||
item_script = std::to_string(static_cast<long long>(item->GetID()));
|
item_script = std::to_string(item->GetID());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 item_id = item->GetID();
|
uint32 item_id = item->GetID();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user