mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-22 09:42:26 +00:00
[Quest API] Allow CreateInstance to be used without a Client initiator. (#2399)
* [Quest API] Allow CreateInstance to be used without a Client initiator. Currently, you have to create the instance with a client initiator, whether that's in an NPC's EVENT_SAY /EVENT_ITEM or in a player script. This will allow you to create instances without needing a client, but if there is one and there are errors, the messages will be sent to the client. * Update questmgr.h * Instance version.
This commit is contained in:
parent
57b3255fad
commit
3e703769a4
@ -2780,30 +2780,33 @@ std::string QuestManager::getcleannpcnamebyid(uint32 npc_id) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 QuestManager::CreateInstance(const char *zone, int16 version, uint32 duration)
|
uint16 QuestManager::CreateInstance(const char *zone_short_name, int16 instance_version, uint32 duration)
|
||||||
{
|
{
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
if(initiator)
|
|
||||||
{
|
|
||||||
uint32 zone_id = ZoneID(zone);
|
|
||||||
if(zone_id == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
uint16 id = 0;
|
uint32 zone_id = ZoneID(zone_short_name);
|
||||||
if(!database.GetUnusedInstanceID(id))
|
if (!zone_id) {
|
||||||
{
|
return 0;
|
||||||
initiator->Message(Chat::Red, "Server was unable to find a free instance id.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!database.CreateInstance(id, zone_id, version, duration))
|
|
||||||
{
|
|
||||||
initiator->Message(Chat::Red, "Server was unable to create a new instance.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
uint16 instance_id = 0;
|
||||||
|
if (!database.GetUnusedInstanceID(instance_id)) {
|
||||||
|
if (initiator) {
|
||||||
|
initiator->Message(Chat::Red, "Server was unable to find a free instance id.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!database.CreateInstance(instance_id, zone_id, instance_version, duration)) {
|
||||||
|
if (initiator) {
|
||||||
|
initiator->Message(Chat::Red, "Server was unable to create a new instance.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return instance_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::DestroyInstance(uint16 instance_id)
|
void QuestManager::DestroyInstance(uint16 instance_id)
|
||||||
|
|||||||
@ -254,7 +254,7 @@ public:
|
|||||||
void UpdateSpawnTimer(uint32 id, uint32 newTime);
|
void UpdateSpawnTimer(uint32 id, uint32 newTime);
|
||||||
void MerchantSetItem(uint32 NPCid, uint32 itemid, uint32 quantity = 0);
|
void MerchantSetItem(uint32 NPCid, uint32 itemid, uint32 quantity = 0);
|
||||||
uint32 MerchantCountItem(uint32 NPCid, uint32 itemid);
|
uint32 MerchantCountItem(uint32 NPCid, uint32 itemid);
|
||||||
uint16 CreateInstance(const char *zone, int16 version, uint32 duration);
|
uint16 CreateInstance(const char *zone_short_name, int16 instance_version, uint32 duration);
|
||||||
void UpdateInstanceTimer(uint16 instance_id, uint32 new_duration);
|
void UpdateInstanceTimer(uint16 instance_id, uint32 new_duration);
|
||||||
void UpdateZoneHeader(std::string type, std::string value);
|
void UpdateZoneHeader(std::string type, std::string value);
|
||||||
uint32 GetInstanceTimer();
|
uint32 GetInstanceTimer();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user