mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
Added EVENT_COMBINE_VALIDATE to facilitate special case tradeskill combines
This commit is contained in:
parent
598204d75c
commit
a325a9978b
@ -118,6 +118,7 @@ const char *QuestEventSubroutines[_LargestEventID] = {
|
|||||||
"EVENT_SPAWN_ZONE",
|
"EVENT_SPAWN_ZONE",
|
||||||
"EVENT_DEATH_ZONE",
|
"EVENT_DEATH_ZONE",
|
||||||
"EVENT_USE_SKILL",
|
"EVENT_USE_SKILL",
|
||||||
|
"EVENT_COMBINE_VALIDATE",
|
||||||
};
|
};
|
||||||
|
|
||||||
PerlembParser::PerlembParser() : perl(nullptr) {
|
PerlembParser::PerlembParser() : perl(nullptr) {
|
||||||
@ -1440,6 +1441,24 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID
|
|||||||
ExportVar(package_name.c_str(), "skill_level", sep.arg[1]);
|
ExportVar(package_name.c_str(), "skill_level", sep.arg[1]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case EVENT_COMBINE_VALIDATE: {
|
||||||
|
Seperator sep(data);
|
||||||
|
ExportVar(package_name.c_str(), "recipe_id", extradata);
|
||||||
|
ExportVar(package_name.c_str(), "validate_type", sep.arg[0]);
|
||||||
|
|
||||||
|
std::string zone_id = "-1";
|
||||||
|
std::string tradeskill_id = "-1";
|
||||||
|
if (strcmp(sep.arg[0], "check_zone") == 0) {
|
||||||
|
zone_id = sep.arg[1];
|
||||||
|
}
|
||||||
|
else if (strcmp(sep.arg[0], "check_tradeskill") == 0) {
|
||||||
|
tradeskill_id = sep.arg[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
ExportVar(package_name.c_str(), "zone_id", zone_id.c_str());
|
||||||
|
ExportVar(package_name.c_str(), "tradeskill_id", tradeskill_id.c_str());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -86,6 +86,7 @@ typedef enum {
|
|||||||
EVENT_SPAWN_ZONE,
|
EVENT_SPAWN_ZONE,
|
||||||
EVENT_DEATH_ZONE,
|
EVENT_DEATH_ZONE,
|
||||||
EVENT_USE_SKILL,
|
EVENT_USE_SKILL,
|
||||||
|
EVENT_COMBINE_VALIDATE,
|
||||||
_LargestEventID
|
_LargestEventID
|
||||||
} QuestEventID;
|
} QuestEventID;
|
||||||
|
|
||||||
|
|||||||
@ -123,7 +123,8 @@ const char *LuaEvents[_LargestEventID] = {
|
|||||||
"event_tick",
|
"event_tick",
|
||||||
"event_spawn_zone",
|
"event_spawn_zone",
|
||||||
"event_death_zone",
|
"event_death_zone",
|
||||||
"event_use_skill"
|
"event_use_skill",
|
||||||
|
"event_combine_validate"
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Zone *zone;
|
extern Zone *zone;
|
||||||
@ -206,6 +207,7 @@ LuaParser::LuaParser() {
|
|||||||
PlayerArgumentDispatch[EVENT_RESPAWN] = handle_player_respawn;
|
PlayerArgumentDispatch[EVENT_RESPAWN] = handle_player_respawn;
|
||||||
PlayerArgumentDispatch[EVENT_UNHANDLED_OPCODE] = handle_player_packet;
|
PlayerArgumentDispatch[EVENT_UNHANDLED_OPCODE] = handle_player_packet;
|
||||||
PlayerArgumentDispatch[EVENT_USE_SKILL] = handle_player_use_skill;
|
PlayerArgumentDispatch[EVENT_USE_SKILL] = handle_player_use_skill;
|
||||||
|
PlayerArgumentDispatch[EVENT_COMBINE_VALIDATE] = handle_player_combine_validate;
|
||||||
|
|
||||||
ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click;
|
ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click;
|
||||||
ItemArgumentDispatch[EVENT_ITEM_CLICK_CAST] = handle_item_click;
|
ItemArgumentDispatch[EVENT_ITEM_CLICK_CAST] = handle_item_click;
|
||||||
|
|||||||
@ -514,6 +514,31 @@ void handle_player_use_skill(QuestInterface *parse, lua_State* L, Client* client
|
|||||||
lua_setfield(L, -2, "skill_level");
|
lua_setfield(L, -2, "skill_level");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handle_player_combine_validate(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||||
|
std::vector<EQEmu::Any>* extra_pointers) {
|
||||||
|
Seperator sep(data.c_str());
|
||||||
|
lua_pushinteger(L, extra_data);
|
||||||
|
lua_setfield(L, -2, "recipe_id");
|
||||||
|
|
||||||
|
lua_pushstring(L, sep.arg[0]);
|
||||||
|
lua_setfield(L, -2, "validate_type");
|
||||||
|
|
||||||
|
int zone_id = -1;
|
||||||
|
int tradeskill_id = -1;
|
||||||
|
if (strcmp(sep.arg[0], "check_zone") == 0) {
|
||||||
|
zone_id = std::stoi(sep.arg[1]);
|
||||||
|
}
|
||||||
|
else if (strcmp(sep.arg[0], "check_tradeskill") == 0) {
|
||||||
|
tradeskill_id = std::stoi(sep.arg[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
lua_pushinteger(L, zone_id);
|
||||||
|
lua_setfield(L, -2, "zone_id");
|
||||||
|
|
||||||
|
lua_pushinteger(L, tradeskill_id);
|
||||||
|
lua_setfield(L, -2, "tradeskill_id");
|
||||||
|
}
|
||||||
|
|
||||||
//Item
|
//Item
|
||||||
void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data,
|
void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data,
|
||||||
std::vector<EQEmu::Any> *extra_pointers) {
|
std::vector<EQEmu::Any> *extra_pointers) {
|
||||||
|
|||||||
@ -97,6 +97,8 @@ void handle_player_null(QuestInterface *parse, lua_State* L, Client* client, std
|
|||||||
std::vector<EQEmu::Any> *extra_pointers);
|
std::vector<EQEmu::Any> *extra_pointers);
|
||||||
void handle_player_use_skill(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
void handle_player_use_skill(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||||
std::vector<EQEmu::Any> *extra_pointers);
|
std::vector<EQEmu::Any> *extra_pointers);
|
||||||
|
void handle_player_combine_validate(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||||
|
std::vector<EQEmu::Any>* extra_pointers);
|
||||||
|
|
||||||
//Item
|
//Item
|
||||||
void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data,
|
void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data,
|
||||||
|
|||||||
@ -392,6 +392,15 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// final check for any additional quest requirements .. "check_zone" in this case - exported as variable [validate_type]
|
||||||
|
if (parse->EventPlayer(EVENT_COMBINE_VALIDATE, user, fmt::format("check_zone {}", zone->GetZoneID()), spec.recipe_id) != 0) {
|
||||||
|
user->Message(Chat::Emote, "You cannot make this combine because the location requirement has not been met.");
|
||||||
|
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
|
||||||
|
user->QueuePacket(outapp);
|
||||||
|
safe_delete(outapp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Send acknowledgement packets to client
|
// Send acknowledgement packets to client
|
||||||
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
|
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
|
||||||
user->QueuePacket(outapp);
|
user->QueuePacket(outapp);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user