Implemented standardized zone controller scripts (Rule Zone, UseZoneController) Defaulted to true

- When a zone boots, it will spawn an invisible npc by the name of zone_controller
	- Lua and Perl scripts can be represented with this npc as zone_controller.pl/lua
	- This NPC's ID is ruled be define ZONE_CONTROLLER_NPC_ID 10
	- Two EVENT's uniquely are handled with this NPC/controller (They only work with the zone_controller NPC)
		- EVENT_SPAWN_ZONE :: All NPC spawns in the zone trigger the controller and pass the following variables:
			$spawned_entity_id
			$spawned_npc_id
		- EVENT_DEATH_ZONE :: All NPC deaths in the zone trigger the controller event and pass the following variables:
			$killer_id
			$killer_damage
			$killer_spell
			$killer_skill
			$killed_npc_id
This commit is contained in:
Akkadius
2015-12-29 04:08:10 -06:00
parent f25246e1a0
commit 8425607460
14 changed files with 111 additions and 31 deletions
+10
View File
@@ -641,8 +641,18 @@ void EntityList::AddNPC(NPC *npc, bool SendSpawnPacket, bool dontqueue)
{
npc->SetID(GetFreeID());
npc->SetMerchantProbability((uint8) zone->random.Int(0, 99));
parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0);
/* Zone controller process EVENT_SPAWN_ZONE */
if (RuleB(Zone, UseZoneController)) {
if (entity_list.GetNPCByNPCTypeID(ZONE_CONTROLLER_NPC_ID) && npc->GetNPCTypeID() != ZONE_CONTROLLER_NPC_ID){
char data_pass[100] = { 0 };
snprintf(data_pass, 99, "%d %d", npc->GetID(), npc->GetNPCTypeID());
parse->EventNPC(EVENT_SPAWN_ZONE, entity_list.GetNPCByNPCTypeID(ZONE_CONTROLLER_NPC_ID)->CastToNPC(), nullptr, data_pass, 0);
}
}
uint16 emoteid = npc->GetEmoteID();
if (emoteid != 0)
npc->DoNPCEmote(ONSPAWN, emoteid);