Fix for perl not loading events if they're chained, fix for items not being removed from inventory at an intuitive time in event_trade

This commit is contained in:
KimLS 2013-06-27 14:14:10 -07:00
parent a5db4310c6
commit 945cc2117f
3 changed files with 11 additions and 37 deletions

View File

@ -366,11 +366,6 @@ void PerlembParser::LoadNPCScript(std::string filename, int npc_id) {
if(!perl) if(!perl)
return; return;
if(perl->InUse())
{
return;
}
auto iter = npc_quest_status_.find(npc_id); auto iter = npc_quest_status_.find(npc_id);
if(iter != npc_quest_status_.end()) { if(iter != npc_quest_status_.end()) {
return; return;
@ -396,11 +391,6 @@ void PerlembParser::LoadGlobalNPCScript(std::string filename) {
if(!perl) if(!perl)
return; return;
if(perl->InUse())
{
return;
}
if(global_npc_quest_status_ != questUnloaded) { if(global_npc_quest_status_ != questUnloaded) {
return; return;
} }
@ -425,11 +415,6 @@ void PerlembParser::LoadPlayerScript(std::string filename) {
if(!perl) if(!perl)
return; return;
if(perl->InUse())
{
return;
}
if(player_quest_status_ != questUnloaded) { if(player_quest_status_ != questUnloaded) {
return; return;
} }
@ -454,11 +439,6 @@ void PerlembParser::LoadGlobalPlayerScript(std::string filename) {
if(!perl) if(!perl)
return; return;
if(perl->InUse())
{
return;
}
if(global_player_quest_status_ != questUnloaded) { if(global_player_quest_status_ != questUnloaded) {
return; return;
} }
@ -486,11 +466,6 @@ void PerlembParser::LoadItemScript(std::string filename, ItemInst *item) {
if(!perl) if(!perl)
return; return;
if(perl->InUse())
{
return;
}
auto iter = item_quest_status_.find(item->GetID()); auto iter = item_quest_status_.find(item->GetID());
if(iter != item_quest_status_.end()) { if(iter != item_quest_status_.end()) {
return; return;
@ -519,11 +494,6 @@ void PerlembParser::LoadSpellScript(std::string filename, uint32 spell_id) {
if(!perl) if(!perl)
return; return;
if(perl->InUse())
{
return;
}
auto iter = spell_quest_status_.find(spell_id); auto iter = spell_quest_status_.find(spell_id);
if(iter != spell_quest_status_.end()) { if(iter != spell_quest_status_.end()) {
return; return;

View File

@ -255,7 +255,7 @@ void Embperl::eval_file(const char * packagename, const char * filename)
std::vector<std::string> args; std::vector<std::string> args;
args.push_back(packagename); args.push_back(packagename);
args.push_back(filename); args.push_back(filename);
dosub("eval_file", &args); dosub("main::eval_file", &args);
} }
void Embperl::dosub(const char * subname, const std::vector<std::string> * args, int mode) void Embperl::dosub(const char * subname, const std::vector<std::string> * args, int mode)
@ -303,7 +303,7 @@ void Embperl::eval(const char * code)
std::vector<std::string> arg; std::vector<std::string> arg;
arg.push_back(code); arg.push_back(code);
// MYRA - added EVAL & KEEPERR to eval per Eglin's recommendation // MYRA - added EVAL & KEEPERR to eval per Eglin's recommendation
dosub("my_eval", &arg, G_SCALAR|G_DISCARD|G_EVAL|G_KEEPERR); dosub("main::my_eval", &arg, G_SCALAR|G_DISCARD|G_EVAL|G_KEEPERR);
//end Myra //end Myra
} }

View File

@ -645,12 +645,16 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
tradingWith->FaceTarget(this); tradingWith->FaceTarget(this);
} }
ItemInst *insts[4] = { 0 };
for(int i = 3000; i < 3004; ++i) {
insts[i - 3000] = m_inv.PopItem(i);
}
parse->EventNPC(EVENT_TRADE, tradingWith->CastToNPC(), this, "", 0, &item_list); parse->EventNPC(EVENT_TRADE, tradingWith->CastToNPC(), this, "", 0, &item_list);
for(int i = 3000; i < 3004; ++i) { for(int i = 0; i < 4; ++i) {
ItemInst *inst = m_inv.GetItem(i); if(insts[i]) {
if(inst) { safe_delete(insts[i]);
DeleteItemInInventory(i);
} }
} }
} }