Changed a bunch of event names, made event_death returning more seamless and fixed up trading quests to have them always face target outside the parser

This commit is contained in:
KimLS 2013-05-15 18:43:06 -07:00
parent b26df187e6
commit f2e0f9cca5
20 changed files with 101 additions and 140 deletions

View File

@ -382,7 +382,7 @@ RULE_BOOL ( NPC, EnableNPCQuestJournal, false)
RULE_INT ( NPC, LastFightingDelayMovingMin, 10000) RULE_INT ( NPC, LastFightingDelayMovingMin, 10000)
RULE_INT ( NPC, LastFightingDelayMovingMax, 20000) RULE_INT ( NPC, LastFightingDelayMovingMax, 20000)
RULE_BOOL ( NPC, SmartLastFightingDelayMoving, true) RULE_BOOL ( NPC, SmartLastFightingDelayMoving, true)
RULE_BOOL ( NPC, ReturnNonQuestNoDropItems, false) // Returns NO DROP items on NPCs that don't have an EVENT_ITEM sub in their script RULE_BOOL ( NPC, ReturnNonQuestNoDropItems, false) // Returns NO DROP items on NPCs that don't have an EVENT_TRADE sub in their script
RULE_INT ( NPC, StartEnrageValue, 9) // % HP that an NPC will begin to enrage RULE_INT ( NPC, StartEnrageValue, 9) // % HP that an NPC will begin to enrage
RULE_BOOL ( NPC, LiveLikeEnrage, false) // If set to true then only player controlled pets will enrage RULE_BOOL ( NPC, LiveLikeEnrage, false) // If set to true then only player controlled pets will enrage
RULE_BOOL (NPC, UseMultiQuest, false) // If true, NPC will remember items handed to them for classic multiquest support. RULE_BOOL (NPC, UseMultiQuest, false) // If true, NPC will remember items handed to them for classic multiquest support.

View File

@ -432,7 +432,7 @@ void Client::HandleAAAction(aaID activate) {
int curhp = GetTarget()->GetHP(); int curhp = GetTarget()->GetHP();
target = aaTargetCurrent; target = aaTargetCurrent;
GetTarget()->HealDamage(curhp, this); GetTarget()->HealDamage(curhp, this);
Death(this,0,SPELL_UNKNOWN,HAND_TO_HAND); Death(this, 0, SPELL_UNKNOWN, HAND_TO_HAND);
} }
break; break;

View File

@ -39,7 +39,7 @@ public:
~Corpse(); ~Corpse();
//abstract virtual function implementations requird by base abstract class //abstract virtual function implementations requird by base abstract class
virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill) { return; } virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill) { return true; }
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; } virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; }
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = true, bool IsFromSpell = false) { return false; } virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = true, bool IsFromSpell = false) { return false; }
virtual bool HasRaid() { return false; } virtual bool HasRaid() { return false; }

View File

@ -185,7 +185,7 @@ bool QuestParserCollection::SpellHasQuestSub(uint32 spell_id, const char *subnam
bool QuestParserCollection::ItemHasQuestSub(ItemInst *itm, const char *subname) { bool QuestParserCollection::ItemHasQuestSub(ItemInst *itm, const char *subname) {
std::string item_script; std::string item_script;
if(strcmp("EVENT_SCALE_CALC", subname) == 0 || strcmp("EVENT_ITEM_ENTERZONE", subname) == 0) { if(strcmp("EVENT_SCALE_CALC", subname) == 0 || strcmp("EVENT_ITEM_ENTER_ZONE", subname) == 0) {
item_script = itm->GetItem()->CharmFile; item_script = itm->GetItem()->CharmFile;
} else if(strcmp("EVENT_ITEM_CLICK", subname) == 0 || strcmp("EVENT_ITEM_CLICK_CAST", subname) == 0) { } else if(strcmp("EVENT_ITEM_CLICK", subname) == 0 || strcmp("EVENT_ITEM_CLICK_CAST", subname) == 0) {
item_script = "script_"; item_script = "script_";
@ -321,7 +321,7 @@ int QuestParserCollection::EventPlayerGlobal(QuestEventID evt, Client *client, s
int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) {
std::string item_script; std::string item_script;
if(evt == EVENT_SCALE_CALC || evt == EVENT_ITEM_ENTERZONE) { if(evt == EVENT_SCALE_CALC || evt == EVENT_ITEM_ENTER_ZONE) {
item_script = item->GetItem()->CharmFile; item_script = item->GetItem()->CharmFile;
} else if(evt == EVENT_ITEM_CLICK || evt == EVENT_ITEM_CLICK_CAST) { } else if(evt == EVENT_ITEM_CLICK || evt == EVENT_ITEM_CLICK_CAST) {
item_script = "script_"; item_script = "script_";

View File

@ -1417,13 +1417,13 @@ void Client::Damage(Mob* other, int32 damage, uint16 spell_id, SkillType attack_
} }
} }
void Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_skill) bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_skill)
{ {
if(!ClientFinishedLoading()) if(!ClientFinishedLoading())
return; return false;
if(dead) if(dead)
return; //cant die more than once... return false; //cant die more than once...
if(!spell) if(!spell)
spell = SPELL_UNKNOWN; spell = SPELL_UNKNOWN;
@ -1431,11 +1431,19 @@ void Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_
char buffer[48] = { 0 }; char buffer[48] = { 0 };
snprintf(buffer, 47, "%d %d %d %d", killerMob ? killerMob->GetID() : 0, damage, spell, static_cast<int>(attack_skill)); snprintf(buffer, 47, "%d %d %d %d", killerMob ? killerMob->GetID() : 0, damage, spell, static_cast<int>(attack_skill));
if(parse->EventPlayer(EVENT_DEATH, this, buffer, 0) != 0) { if(parse->EventPlayer(EVENT_DEATH, this, buffer, 0) != 0) {
return; if(GetHP() < 0) {
SetHP(0);
}
return false;
}
if(killerMob && killerMob->IsClient() && (spell != SPELL_UNKNOWN) && damage > 0) {
char val1[20]={0};
entity_list.MessageClose_StringID(this, false, 100, MT_NonMelee, HIT_NON_MELEE,
killerMob->GetCleanName(), GetCleanName(), ConvertArray(damage, val1));
} }
int exploss; int exploss;
mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill); mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill);
// //
@ -1649,42 +1657,6 @@ void Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_
BuffFadeDetrimental(); BuffFadeDetrimental();
} }
#if 0 // solar: commenting this out for now TODO reimplement becomenpc stuff
if (IsBecomeNPC() == true)
{
if (killerMob != nullptr && killerMob->IsClient()) {
if (killerMob->CastToClient()->isgrouped && entity_list.GetGroupByMob(killerMob) != 0)
entity_list.GetGroupByMob(killerMob->CastToClient())->SplitExp((uint32)(level*level*75*3.5f), this);
else
killerMob->CastToClient()->AddEXP((uint32)(level*level*75*3.5f)); // Pyro: Comment this if NPC death crashes zone
//hate_list.DoFactionHits(GetNPCFactionID());
}
Corpse* corpse = new Corpse(this->CastToClient(), 0);
entity_list.AddCorpse(corpse, this->GetID());
this->SetID(0);
if(killerMob->GetOwner() != 0 && killerMob->GetOwner()->IsClient())
killerMob = killerMob->GetOwner();
if(killerMob != 0 && killerMob->IsClient()) {
corpse->AllowMobLoot(killerMob, 0);
if(killerMob->CastToClient()->isgrouped) {
Group* group = entity_list.GetGroupByClient(killerMob->CastToClient());
if(group != 0) {
for(int i=0; i < MAX_GROUP_MEMBERS; i++) { // Doesnt work right, needs work
if(group->members[i] != nullptr) {
corpse->AllowMobLoot(group->members[i],i);
}
}
}
}
}
}
#endif
// //
// Finally, send em home // Finally, send em home
// //
@ -1725,6 +1697,8 @@ void Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_
GoToDeath(); GoToDeath();
} }
return true;
} }
bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell) // Kaiyodo - base function has changed prototype, need to update overloaded version bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell) // Kaiyodo - base function has changed prototype, need to update overloaded version
@ -2041,7 +2015,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillType attack_ski
} }
} }
void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_skill) { bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_skill) {
_ZP(NPC_Death); _ZP(NPC_Death);
mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill);
@ -2053,11 +2027,20 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski
snprintf(buffer, 31, "%d %d %d", damage, spell, static_cast<int>(attack_skill)); snprintf(buffer, 31, "%d %d %d", damage, spell, static_cast<int>(attack_skill));
if(parse->EventNPC(EVENT_DEATH, this, oos, buffer, 0) != 0) if(parse->EventNPC(EVENT_DEATH, this, oos, buffer, 0) != 0)
{ {
return; if(GetHP() < 0) {
SetHP(0);
}
return false;
}
if(killerMob && killerMob->IsClient() && (spell != SPELL_UNKNOWN) && damage > 0) {
char val1[20]={0};
entity_list.MessageClose_StringID(this, false, 100, MT_NonMelee, HIT_NON_MELEE,
killerMob->GetCleanName(), GetCleanName(), ConvertArray(damage, val1));
} }
} }
if (this->IsEngaged()) if (IsEngaged())
{ {
zone->DelAggroMob(); zone->DelAggroMob();
#if EQDEBUG >= 11 #if EQDEBUG >= 11
@ -2071,7 +2054,7 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski
entity_list.RemoveFromTargets(this, p_depop); entity_list.RemoveFromTargets(this, p_depop);
if(p_depop == true) if(p_depop == true)
return; return false;
BuffFadeAll(); BuffFadeAll();
uint8 killed_level = GetLevel(); uint8 killed_level = GetLevel();
@ -2379,12 +2362,14 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski
} }
} }
this->WipeHateList(); WipeHateList();
p_depop = true; p_depop = true;
if(killerMob && killerMob->GetTarget() == this) //we can kill things without having them targeted if(killerMob && killerMob->GetTarget() == this) //we can kill things without having them targeted
killerMob->SetTarget(nullptr); //via AE effects and such.. killerMob->SetTarget(nullptr); //via AE effects and such..
entity_list.UpdateFindableNPCState(this, true); entity_list.UpdateFindableNPCState(this, true);
return true;
} }
void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, bool bFrenzy, bool iBuffTic) { void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, bool bFrenzy, bool iBuffTic) {
@ -3404,23 +3389,6 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
} }
//final damage has been determined. //final damage has been determined.
/*
//check for death conditions
if(IsClient()) {
if((GetHP()) <= -10) {
Death(attacker, damage, spell_id, skill_used);
return;
}
} else {
if (damage >= GetHP()) {
//killed...
SetHP(-100);
Death(attacker, damage, spell_id, skill_used);
return;
}
}
*/
SetHP(GetHP() - damage); SetHP(GetHP() - damage);
if(HasDied()) { if(HasDied()) {
@ -3432,16 +3400,11 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
if(!IsSaved && !TrySpellOnDeath()) { if(!IsSaved && !TrySpellOnDeath()) {
SetHP(-500); SetHP(-500);
if(attacker && attacker->IsClient() && (spell_id != SPELL_UNKNOWN) && damage>0) { if(Death(attacker, damage, spell_id, skill_used)) {
char val1[20]={0}; return;
entity_list.MessageClose_StringID(this, false, 100, MT_NonMelee, HIT_NON_MELEE, attacker->GetCleanName(), GetCleanName(),ConvertArray(damage,val1));
} }
Death(attacker, damage, spell_id, skill_used);
return;
} }
} }
else{ else{
if(GetHPRatio() < 16) if(GetHPRatio() < 16)
TryDeathSave(); TryDeathSave();
@ -3548,10 +3511,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
a->source = attacker->GetID(); a->source = attacker->GetID();
a->type = SkillDamageTypes[skill_used]; // was 0x1c a->type = SkillDamageTypes[skill_used]; // was 0x1c
a->damage = damage; a->damage = damage;
// if (attack_skill != 231) a->spellid = spell_id;
// a->spellid = SPELL_UNKNOWN;
// else
a->spellid = spell_id;
//Note: if players can become pets, they will not receive damage messages of their own //Note: if players can become pets, they will not receive damage messages of their own
//this was done to simplify the code here (since we can only effectively skip one mob on queue) //this was done to simplify the code here (since we can only effectively skip one mob on queue)
@ -3627,8 +3587,6 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
filter = FilterOthersMiss; filter = FilterOthersMiss;
//make attacker (the attacker) send the packet so we can skip them and the owner //make attacker (the attacker) send the packet so we can skip them and the owner
//this call will send the packet to `this` as well (using the wrong filter) (will not happen until PC charm works) //this call will send the packet to `this` as well (using the wrong filter) (will not happen until PC charm works)
//LogFile->write(EQEMuLog::Debug, "Queue damage to all except %s with filter %d (%d), type %d", skip->GetName(), filter, IsClient()?CastToClient()->GetFilter(filter):-1, a->type);
//
// If this is Damage Shield damage, the correct OP_Damage packets will be sent from Mob::DamageShield, so // If this is Damage Shield damage, the correct OP_Damage packets will be sent from Mob::DamageShield, so
// we don't send them here. // we don't send them here.
if(!FromDamageShield) { if(!FromDamageShield) {

View File

@ -31,7 +31,7 @@ public:
~Beacon(); ~Beacon();
//abstract virtual function implementations requird by base abstract class //abstract virtual function implementations requird by base abstract class
virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill) { return; } virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill) { return true; }
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; } virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; }
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false) { return false; } virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false) { return false; }
virtual bool HasRaid() { return false; } virtual bool HasRaid() { return false; }

View File

@ -2443,7 +2443,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y, bool login)
uint16 oldexp = e_inst->GetExp(); uint16 oldexp = e_inst->GetExp();
if(login) { if(login) {
parse->EventItem(EVENT_ITEM_ENTERZONE, this, e_inst, e_inst->GetID(), 0); parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, e_inst, e_inst->GetID(), 0);
} }
parse->EventItem(EVENT_SCALE_CALC, this, e_inst, e_inst->GetID(), 0); parse->EventItem(EVENT_SCALE_CALC, this, e_inst, e_inst->GetID(), 0);
@ -2467,7 +2467,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y, bool login)
uint16 oldexp = e_inst->GetExp(); uint16 oldexp = e_inst->GetExp();
if(login) { if(login) {
parse->EventItem(EVENT_ITEM_ENTERZONE, this, e_inst, e_inst->GetID(), 0); parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, e_inst, e_inst->GetID(), 0);
} }
parse->EventItem(EVENT_SCALE_CALC, this, e_inst, e_inst->GetID(), 0); parse->EventItem(EVENT_SCALE_CALC, this, e_inst, e_inst->GetID(), 0);

View File

@ -6199,8 +6199,9 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
} }
} }
void Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, SkillType attack_skill) { bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, SkillType attack_skill) {
NPC::Death(killerMob, damage, spell_id, attack_skill); if(!NPC::Death(killerMob, damage, spell_id, attack_skill))
return false;
Save(); Save();
@ -6299,6 +6300,8 @@ void Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, SkillType attack_
} }
entity_list.RemoveBot(this->GetID()); entity_list.RemoveBot(this->GetID());
return true;
} }
void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable, int8 buffslot, bool iBuffTic) { void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable, int8 buffslot, bool iBuffTic) {

View File

@ -136,7 +136,7 @@ public:
Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double totalPlayTime, uint32 lastZoneId, NPCType npcTypeData); Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double totalPlayTime, uint32 lastZoneId, NPCType npcTypeData);
//abstract virtual function implementations requird by base abstract class //abstract virtual function implementations requird by base abstract class
virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill); virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill);
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false);
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false); virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false);
virtual bool HasRaid() { return (GetRaid() ? true : false); } virtual bool HasRaid() { return (GetRaid() ? true : false); }

View File

@ -192,7 +192,7 @@ public:
~Client(); ~Client();
//abstract virtual function implementations requird by base abstract class //abstract virtual function implementations requird by base abstract class
virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill); virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill);
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false);
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false); virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false);
virtual bool HasRaid() { return (GetRaid() ? true : false); } virtual bool HasRaid() { return (GetRaid() ? true : false); }

View File

@ -6303,7 +6303,7 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app)
char buf[20]; char buf[20];
snprintf(buf, 19, "%u", cd->doorid); snprintf(buf, 19, "%u", cd->doorid);
buf[19] = '\0'; buf[19] = '\0';
parse->EventPlayer(EVENT_CLICKDOOR, this, buf, 0); parse->EventPlayer(EVENT_CLICK_DOOR, this, buf, 0);
currentdoor->HandleClick(this,0); currentdoor->HandleClick(this,0);
return; return;
@ -9627,7 +9627,7 @@ void Client::CompleteConnect()
SendDisciplineTimers(); SendDisciplineTimers();
parse->EventPlayer(EVENT_ENTERZONE, this, "", 0); parse->EventPlayer(EVENT_ENTER_ZONE, this, "", 0);
//This sub event is for if a player logs in for the first time since entering world. //This sub event is for if a player logs in for the first time since entering world.
if(firstlogon == 1) if(firstlogon == 1)
@ -10670,11 +10670,11 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) {
char buf[16]; char buf[16];
sprintf(buf, "%d\0", prs->popupid); sprintf(buf, "%d\0", prs->popupid);
parse->EventPlayer(EVENT_POPUPRESPONSE, this, buf, 0); parse->EventPlayer(EVENT_POPUP_RESPONSE, this, buf, 0);
Mob* Target = GetTarget(); Mob* Target = GetTarget();
if(Target && Target->IsNPC()) { if(Target && Target->IsNPC()) {
parse->EventNPC(EVENT_POPUPRESPONSE, Target->CastToNPC(), this, buf, 0); parse->EventNPC(EVENT_POPUP_RESPONSE, Target->CastToNPC(), this, buf, 0);
} }
} }

View File

@ -34,7 +34,7 @@ extern Zone* zone;
const char *QuestEventSubroutines[_LargestEventID] = { const char *QuestEventSubroutines[_LargestEventID] = {
"EVENT_SAY", "EVENT_SAY",
"EVENT_ITEM", "EVENT_TRADE",
"EVENT_DEATH", "EVENT_DEATH",
"EVENT_SPAWN", "EVENT_SPAWN",
"EVENT_ATTACK", "EVENT_ATTACK",
@ -49,25 +49,25 @@ const char *QuestEventSubroutines[_LargestEventID] = {
"EVENT_HP", "EVENT_HP",
"EVENT_ENTER", "EVENT_ENTER",
"EVENT_EXIT", "EVENT_EXIT",
"EVENT_ENTERZONE", "EVENT_ENTER_ZONE",
"EVENT_CLICKDOOR", "EVENT_CLICK_DOOR",
"EVENT_LOOT", "EVENT_LOOT",
"EVENT_ZONE", "EVENT_ZONE",
"EVENT_LEVEL_UP", "EVENT_LEVEL_UP",
"EVENT_KILLED_MERIT", "EVENT_KILLED_MERIT",
"EVENT_CAST_ON", "EVENT_CAST_ON",
"EVENT_TASKACCEPTED", "EVENT_TASK_ACCEPTED",
"EVENT_TASK_STAGE_COMPLETE", "EVENT_TASK_STAGE_COMPLETE",
"EVENT_TASK_UPDATE", "EVENT_TASK_UPDATE",
"EVENT_TASK_COMPLETE", "EVENT_TASK_COMPLETE",
"EVENT_TASK_FAIL", "EVENT_TASK_FAIL",
"EVENT_AGGRO_SAY", "EVENT_AGGRO_SAY",
"EVENT_PLAYER_PICKUP", "EVENT_PLAYER_PICKUP",
"EVENT_POPUPRESPONSE", "EVENT_POPUP_RESPONSE",
"EVENT_PROXIMITY_SAY", "EVENT_PROXIMITY_SAY",
"EVENT_CAST", "EVENT_CAST",
"EVENT_SCALE_CALC", "EVENT_SCALE_CALC",
"EVENT_ITEM_ENTERZONE", "EVENT_ITEM_ENTER_ZONE",
"EVENT_TARGET_CHANGE", "EVENT_TARGET_CHANGE",
"EVENT_HATE_LIST", "EVENT_HATE_LIST",
"EVENT_SPELL_EFFECT_CLIENT", "EVENT_SPELL_EFFECT_CLIENT",
@ -295,7 +295,7 @@ bool PerlembParser::ItemHasQuestSub(ItemInst *itm, const char *subname) {
std::string item_name; std::string item_name;
const Item_Struct* item = itm->GetItem(); const Item_Struct* item = itm->GetItem();
if(strcmp("EVENT_SCALE_CALC", subname) == 0 || strcmp("EVENT_ITEM_ENTERZONE", subname) == 0) if(strcmp("EVENT_SCALE_CALC", subname) == 0 || strcmp("EVENT_ITEM_ENTER_ZONE", subname) == 0)
{ {
item_name = item->CharmFile; item_name = item->CharmFile;
} }
@ -793,7 +793,7 @@ void PerlembParser::GetQuestPackageName(bool &isPlayerQuest, bool &isGlobalPlaye
const Item_Struct* item = iteminst->GetItem(); const Item_Struct* item = iteminst->GetItem();
package_name = "qst_item_"; package_name = "qst_item_";
if (event == EVENT_SCALE_CALC || event == EVENT_ITEM_ENTERZONE) { if (event == EVENT_SCALE_CALC || event == EVENT_ITEM_ENTER_ZONE) {
package_name += item->CharmFile; package_name += item->CharmFile;
} }
else if (event == EVENT_ITEM_CLICK || event == EVENT_ITEM_CLICK_CAST) { else if (event == EVENT_ITEM_CLICK || event == EVENT_ITEM_CLICK_CAST) {
@ -1070,11 +1070,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID
break; break;
} }
case EVENT_ITEM: { case EVENT_TRADE: {
if (npcmob->GetAppearance() != eaDead) {
npcmob->FaceTarget(mob);
}
//this is such a hack... why aren't these just set directly.. //this is such a hack... why aren't these just set directly..
ExportVar(package_name.c_str(), "item1", GetVar("item1." + std::string(itoa(objid))).c_str()); ExportVar(package_name.c_str(), "item1", GetVar("item1." + std::string(itoa(objid))).c_str());
ExportVar(package_name.c_str(), "item2", GetVar("item2." + std::string(itoa(objid))).c_str()); ExportVar(package_name.c_str(), "item2", GetVar("item2." + std::string(itoa(objid))).c_str());
@ -1140,7 +1136,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID
break; break;
} }
case EVENT_CLICKDOOR: { case EVENT_CLICK_DOOR: {
ExportVar(package_name.c_str(), "doorid", data); ExportVar(package_name.c_str(), "doorid", data);
ExportVar(package_name.c_str(), "version", zone->GetInstanceVersion()); ExportVar(package_name.c_str(), "version", zone->GetInstanceVersion());
break; break;
@ -1165,7 +1161,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID
break; break;
} }
case EVENT_TASKACCEPTED:{ case EVENT_TASK_ACCEPTED:{
ExportVar(package_name.c_str(), "task_id", data); ExportVar(package_name.c_str(), "task_id", data);
break; break;
} }
@ -1204,7 +1200,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID
break; break;
} }
case EVENT_POPUPRESPONSE:{ case EVENT_POPUP_RESPONSE:{
ExportVar(package_name.c_str(), "popupid", data); ExportVar(package_name.c_str(), "popupid", data);
break; break;
} }
@ -1217,7 +1213,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID
} }
case EVENT_SCALE_CALC: case EVENT_SCALE_CALC:
case EVENT_ITEM_ENTERZONE: { case EVENT_ITEM_ENTER_ZONE: {
ExportVar(package_name.c_str(), "itemid", objid); ExportVar(package_name.c_str(), "itemid", objid);
ExportVar(package_name.c_str(), "itemname", iteminst->GetItem()->Name); ExportVar(package_name.c_str(), "itemname", iteminst->GetItem()->Name);
break; break;

View File

@ -3,7 +3,7 @@
typedef enum { typedef enum {
EVENT_SAY = 0, EVENT_SAY = 0,
EVENT_ITEM, //being given an item EVENT_TRADE, //being given an item or money
EVENT_DEATH, //being killed EVENT_DEATH, //being killed
EVENT_SPAWN, //triggered when we first spawn EVENT_SPAWN, //triggered when we first spawn
EVENT_ATTACK, //being attacked (resets after an interval of not being attacked) EVENT_ATTACK, //being attacked (resets after an interval of not being attacked)
@ -18,25 +18,25 @@ typedef enum {
EVENT_HP, EVENT_HP,
EVENT_ENTER, //PC entering your set proximity EVENT_ENTER, //PC entering your set proximity
EVENT_EXIT, //PC leaving your set proximity EVENT_EXIT, //PC leaving your set proximity
EVENT_ENTERZONE, //PC only, you enter zone EVENT_ENTER_ZONE, //PC only, you enter zone
EVENT_CLICKDOOR, //pc only, you click a door EVENT_CLICK_DOOR, //pc only, you click a door
EVENT_LOOT, //pc only EVENT_LOOT, //pc only
EVENT_ZONE, //pc only EVENT_ZONE, //pc only
EVENT_LEVEL_UP, //pc only EVENT_LEVEL_UP, //pc only
EVENT_KILLED_MERIT, //killed by a PC or group, gave experience; will repeat several times for groups EVENT_KILLED_MERIT, //killed by a PC or group, gave experience; will repeat several times for groups
EVENT_CAST_ON, //pc casted a spell on npc EVENT_CAST_ON, //pc casted a spell on npc
EVENT_TASKACCEPTED, //pc accepted a task EVENT_TASK_ACCEPTED, //pc accepted a task
EVENT_TASK_STAGE_COMPLETE, EVENT_TASK_STAGE_COMPLETE,
EVENT_TASK_UPDATE, EVENT_TASK_UPDATE,
EVENT_TASK_COMPLETE, EVENT_TASK_COMPLETE,
EVENT_TASK_FAIL, EVENT_TASK_FAIL,
EVENT_AGGRO_SAY, EVENT_AGGRO_SAY,
EVENT_PLAYER_PICKUP, EVENT_PLAYER_PICKUP,
EVENT_POPUPRESPONSE, EVENT_POPUP_RESPONSE,
EVENT_PROXIMITY_SAY, EVENT_PROXIMITY_SAY,
EVENT_CAST, EVENT_CAST,
EVENT_SCALE_CALC, EVENT_SCALE_CALC,
EVENT_ITEM_ENTERZONE, EVENT_ITEM_ENTER_ZONE,
EVENT_TARGET_CHANGE, //target selected, target changed, or target removed EVENT_TARGET_CHANGE, //target selected, target changed, or target removed
EVENT_HATE_LIST, EVENT_HATE_LIST,
EVENT_SPELL_EFFECT_CLIENT, EVENT_SPELL_EFFECT_CLIENT,

View File

@ -21,7 +21,7 @@
const char *LuaEvents[_LargestEventID] = { const char *LuaEvents[_LargestEventID] = {
"event_say", "event_say",
"event_item", "event_trade",
"event_death", "event_death",
"event_spawn", "event_spawn",
"event_attack", "event_attack",
@ -36,25 +36,25 @@ const char *LuaEvents[_LargestEventID] = {
"event_hp", "event_hp",
"event_enter", "event_enter",
"event_exit", "event_exit",
"event_enterzone", "event_enter_zone",
"event_clickdoor", "event_click_door",
"event_loot", "event_loot",
"event_zone", "event_zone",
"event_level_up", "event_level_up",
"event_killed_merit", "event_killed_merit",
"event_cast_on", "event_cast_on",
"event_taskaccepted", "event_task_accepted",
"event_task_stage_complete", "event_task_stage_complete",
"event_task_update", "event_task_update",
"event_task_complete", "event_task_complete",
"event_task_fail", "event_task_fail",
"event_aggro_say", "event_aggro_say",
"event_player_pickup", "event_player_pickup",
"event_popupresponse", "event_popup_response",
"event_proximity_say", "event_proximity_say",
"event_cast", "event_cast",
"event_scale_calc", "event_scale_calc",
"event_item_enterzone", "event_item_enter_zone",
"event_target_change", "event_target_change",
"event_hate_list", "event_hate_list",
"event_spell_effect_client", "event_spell_effect_client",
@ -165,7 +165,7 @@ int LuaParser::_EventNPC(std::string package_name, QuestEventID evt, NPC* npc, M
break; break;
} }
case EVENT_ITEM: { case EVENT_TRADE: {
//client //client
Lua_Client l_client(reinterpret_cast<Client*>(init)); Lua_Client l_client(reinterpret_cast<Client*>(init));
luabind::object l_client_o = luabind::object(L, l_client); luabind::object l_client_o = luabind::object(L, l_client);
@ -231,7 +231,7 @@ int LuaParser::_EventNPC(std::string package_name, QuestEventID evt, NPC* npc, M
case EVENT_SLAY: case EVENT_SLAY:
case EVENT_ENTER: case EVENT_ENTER:
case EVENT_EXIT: case EVENT_EXIT:
case EVENT_TASKACCEPTED: { case EVENT_TASK_ACCEPTED: {
//client //client
Lua_Client l_client(reinterpret_cast<Client*>(init)); Lua_Client l_client(reinterpret_cast<Client*>(init));
luabind::object l_client_o = luabind::object(L, l_client); luabind::object l_client_o = luabind::object(L, l_client);
@ -251,7 +251,7 @@ int LuaParser::_EventNPC(std::string package_name, QuestEventID evt, NPC* npc, M
break; break;
} }
case EVENT_POPUPRESPONSE: case EVENT_POPUP_RESPONSE:
case EVENT_WAYPOINT_ARRIVE: case EVENT_WAYPOINT_ARRIVE:
case EVENT_WAYPOINT_DEPART: { case EVENT_WAYPOINT_DEPART: {
//client //client
@ -417,9 +417,9 @@ int LuaParser::_EventPlayer(std::string package_name, QuestEventID evt, Client *
} }
case EVENT_CLICK_OBJECT: case EVENT_CLICK_OBJECT:
case EVENT_CLICKDOOR: case EVENT_CLICK_DOOR:
case EVENT_SIGNAL: case EVENT_SIGNAL:
case EVENT_POPUPRESPONSE: case EVENT_POPUP_RESPONSE:
case EVENT_PLAYER_PICKUP: case EVENT_PLAYER_PICKUP:
case EVENT_CAST: case EVENT_CAST:
case EVENT_TASK_FAIL: case EVENT_TASK_FAIL:
@ -542,7 +542,7 @@ bool LuaParser::ItemHasQuestSub(ItemInst *itm, const char *subname) {
std::stringstream item_name; std::stringstream item_name;
const Item_Struct* item = itm->GetItem(); const Item_Struct* item = itm->GetItem();
if(strcmp("EVENT_SCALE_CALC", subname) == 0 || strcmp("EVENT_ITEM_ENTERZONE", subname) == 0) if(strcmp("EVENT_SCALE_CALC", subname) == 0 || strcmp("EVENT_ITEM_ENTER_ZONE", subname) == 0)
{ {
item_name << item->CharmFile; item_name << item->CharmFile;
} }

View File

@ -4792,9 +4792,11 @@ Mob* Merc::GetOwnerOrSelf() {
return Result; return Result;
} }
void Merc::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_skill) bool Merc::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_skill)
{ {
NPC::Death(killerMob, damage, spell, attack_skill); if(!NPC::Death(killerMob, damage, spell, attack_skill))
return false;
Save(); Save();
Mob *give_exp = hate_list.GetDamageTop(this); Mob *give_exp = hate_list.GetDamageTop(this);
@ -4809,9 +4811,7 @@ void Merc::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_sk
if(entity_list.GetCorpseByID(GetID())) if(entity_list.GetCorpseByID(GetID()))
entity_list.GetCorpseByID(GetID())->Depop(); entity_list.GetCorpseByID(GetID())->Depop();
if(Suspend()) return true;
{
}
} }
Client* Merc::GetMercOwner() { Client* Merc::GetMercOwner() {

View File

@ -47,7 +47,7 @@ public:
virtual ~Merc(); virtual ~Merc();
//abstract virtual function implementations requird by base abstract class //abstract virtual function implementations requird by base abstract class
virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill); virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill);
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false);
virtual bool Attack(Mob* other, int Hand = SLOT_PRIMARY, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false); virtual bool Attack(Mob* other, int Hand = SLOT_PRIMARY, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false);
virtual bool HasRaid() { return false; } virtual bool HasRaid() { return false; }

View File

@ -255,7 +255,7 @@ public:
virtual uint32 GetEquipmentColor(uint8 material_slot) const; virtual uint32 GetEquipmentColor(uint8 material_slot) const;
virtual uint32 IsEliteMaterialItem(uint8 material_slot) const; virtual uint32 IsEliteMaterialItem(uint8 material_slot) const;
bool AffectedBySpellExcludingSlot(int slot, int effect); bool AffectedBySpellExcludingSlot(int slot, int effect);
virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill) = 0; virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill) = 0;
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill,
bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) = 0; bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) = 0;
inline virtual void SetHP(int32 hp) { if (hp >= max_hp) cur_hp = max_hp; else cur_hp = hp;} inline virtual void SetHP(int32 hp) { if (hp >= max_hp) cur_hp = max_hp; else cur_hp = hp;}

View File

@ -80,7 +80,7 @@ public:
virtual ~NPC(); virtual ~NPC();
//abstract virtual function implementations requird by base abstract class //abstract virtual function implementations requird by base abstract class
virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill); virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill);
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false);
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false); virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false);
virtual bool HasRaid() { return false; } virtual bool HasRaid() { return false; }

View File

@ -3252,7 +3252,7 @@ void ClientTaskState::AcceptNewTask(Client *c, int TaskID, int NPCID) {
return; return;
} }
taskmanager->SaveClientState(c, this); taskmanager->SaveClientState(c, this);
parse->EventNPC(EVENT_TASKACCEPTED, npc, c, buf, 0); parse->EventNPC(EVENT_TASK_ACCEPTED, npc, c, buf, 0);
safe_delete_array(buf); safe_delete_array(buf);
} }

View File

@ -569,7 +569,7 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
} }
bool quest_npc = false; bool quest_npc = false;
if(parse->HasQuestSub(tradingWith->GetNPCTypeID(), "EVENT_ITEM")) { if(parse->HasQuestSub(tradingWith->GetNPCTypeID(), "EVENT_TRADE")) {
// This is a quest NPC // This is a quest NPC
quest_npc = true; quest_npc = true;
if(RuleB(NPC, UseMultiQuest)){ if(RuleB(NPC, UseMultiQuest)){
@ -630,12 +630,11 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
//dont bother with this crap unless we have a quest... //dont bother with this crap unless we have a quest...
//pets can have quests! (especially charmed NPCs) //pets can have quests! (especially charmed NPCs)
if (quest_npc) { if (quest_npc) {
char temp1[100]; char temp1[100];
memset(temp1,0x0,100); memset(temp1,0x0,100);
char temp2[100]; char temp2[100];
memset(temp2,0x0,100); memset(temp2,0x0,100);
for ( int z=0; z < 4; z++ ) { for(int z = 0; z < 4; z++) {
snprintf(temp1, 100, "item%d.%d", z+1,tradingWith->GetNPCTypeID()); snprintf(temp1, 100, "item%d.%d", z+1,tradingWith->GetNPCTypeID());
snprintf(temp2, 100, "%d",items[z]); snprintf(temp2, 100, "%d",items[z]);
parse->AddVar(temp1,temp2); parse->AddVar(temp1,temp2);
@ -658,7 +657,12 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
snprintf(temp1, 100, "platinum.%d", tradingWith->GetNPCTypeID()); snprintf(temp1, 100, "platinum.%d", tradingWith->GetNPCTypeID());
snprintf(temp2, 100, "%i",trade->pp); snprintf(temp2, 100, "%i",trade->pp);
parse->AddVar(temp1,temp2); parse->AddVar(temp1,temp2);
parse->EventNPC(EVENT_ITEM, tradingWith->CastToNPC(), this, "", 0);
if(tradingWith->GetAppearance() != eaDead) {
tradingWith->FaceTarget(this);
}
parse->EventNPC(EVENT_TRADE, tradingWith->CastToNPC(), this, "", 0);
} }
} }
} }