mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
Merge pull request #408 from hateborne/master
Exporting ConnectNodeToNode and AddNode (from Pathing) to Perl
This commit is contained in:
commit
53a139256d
@ -1917,6 +1917,52 @@ XS(XS__repopzone)
|
|||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XS(XS__ConnectNodeToNode);
|
||||||
|
XS(XS__ConnectNodeToNode)
|
||||||
|
{
|
||||||
|
dXSARGS;
|
||||||
|
if (items != 4)
|
||||||
|
Perl_croak(aTHX_ "Usage: ConnectNodeToNode(node1, node2, teleport, doorid)");
|
||||||
|
|
||||||
|
int node1 = (int)SvIV(ST(0));
|
||||||
|
int node2 = (int)SvIV(ST(1));
|
||||||
|
int teleport = (int)SvIV(ST(2));
|
||||||
|
int doorid = (int)SvIV(ST(3));
|
||||||
|
|
||||||
|
quest_manager.ConnectNodeToNode(node1, node2, teleport, doorid);
|
||||||
|
|
||||||
|
XSRETURN_EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
XS(XS__AddNode);
|
||||||
|
XS(XS__AddNode)
|
||||||
|
{
|
||||||
|
dXSARGS;
|
||||||
|
//void QuestManager::AddNode(float x, float y, float z, float best_z, int32 requested_id);
|
||||||
|
if (items < 3 || items > 5)
|
||||||
|
Perl_croak(aTHX_ "Usage: AddNode(x, y, z, [best_z], [requested_id])");
|
||||||
|
|
||||||
|
int x = (int)SvIV(ST(0));
|
||||||
|
int y = (int)SvIV(ST(1));
|
||||||
|
int z = (int)SvIV(ST(2));
|
||||||
|
int best_z = 0;
|
||||||
|
int requested_id = 0;
|
||||||
|
|
||||||
|
if (items == 4)
|
||||||
|
{
|
||||||
|
best_z = (int)SvIV(ST(3));
|
||||||
|
}
|
||||||
|
else if (items == 5)
|
||||||
|
{
|
||||||
|
best_z = (int)SvIV(ST(3));
|
||||||
|
requested_id = (int)SvIV(ST(4));
|
||||||
|
}
|
||||||
|
|
||||||
|
quest_manager.AddNode(x, y, z, best_z, requested_id);
|
||||||
|
|
||||||
|
XSRETURN_EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
XS(XS__npcrace);
|
XS(XS__npcrace);
|
||||||
XS(XS__npcrace)
|
XS(XS__npcrace)
|
||||||
{
|
{
|
||||||
@ -3699,6 +3745,8 @@ EXTERN_C XS(boot_quest)
|
|||||||
newXS(strcpy(buf, "reloadzonestaticdata"), XS__reloadzonestaticdata, file);
|
newXS(strcpy(buf, "reloadzonestaticdata"), XS__reloadzonestaticdata, file);
|
||||||
newXS(strcpy(buf, "removetitle"), XS__removetitle, file);
|
newXS(strcpy(buf, "removetitle"), XS__removetitle, file);
|
||||||
newXS(strcpy(buf, "repopzone"), XS__repopzone, file);
|
newXS(strcpy(buf, "repopzone"), XS__repopzone, file);
|
||||||
|
newXS(strcpy(buf, "ConnectNodeToNode"), XS__ConnectNodeToNode, file);
|
||||||
|
newXS(strcpy(buf, "AddNode"), XS__AddNode, file);
|
||||||
newXS(strcpy(buf, "resettaskactivity"), XS__resettaskactivity, file);
|
newXS(strcpy(buf, "resettaskactivity"), XS__resettaskactivity, file);
|
||||||
newXS(strcpy(buf, "respawn"), XS__respawn, file);
|
newXS(strcpy(buf, "respawn"), XS__respawn, file);
|
||||||
newXS(strcpy(buf, "resume"), XS__resume, file);
|
newXS(strcpy(buf, "resume"), XS__resume, file);
|
||||||
|
|||||||
@ -668,6 +668,79 @@ void QuestManager::repopzone() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QuestManager::ConnectNodeToNode(int node1, int node2, int teleport, int doorid) {
|
||||||
|
if (!node1 || !node2)
|
||||||
|
{
|
||||||
|
Log.Out(Logs::General, Logs::Quests, "QuestManager::ConnectNodeToNode called without node1 or node2. Probably syntax error in quest file.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!teleport)
|
||||||
|
{
|
||||||
|
teleport = 0;
|
||||||
|
}
|
||||||
|
else if (teleport == 1 || teleport == -1)
|
||||||
|
{
|
||||||
|
teleport = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!doorid)
|
||||||
|
{
|
||||||
|
doorid = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!zone->pathing)
|
||||||
|
{
|
||||||
|
// if no pathing bits available, make them available.
|
||||||
|
zone->pathing = new PathManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zone->pathing)
|
||||||
|
{
|
||||||
|
zone->pathing->ConnectNodeToNode(node1, node2, teleport, doorid);
|
||||||
|
Log.Out(Logs::Moderate, Logs::Quests, "QuestManager::ConnectNodeToNode connecting node %i to node %i.", node1, node2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuestManager::AddNode(float x, float y, float z, float best_z, int32 requested_id)
|
||||||
|
{
|
||||||
|
if (!x || !y || !z)
|
||||||
|
{
|
||||||
|
Log.Out(Logs::General, Logs::Quests, "QuestManager::AddNode called without x, y, z. Probably syntax error in quest file.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!best_z || best_z == 0)
|
||||||
|
{
|
||||||
|
if (zone->zonemap)
|
||||||
|
{
|
||||||
|
glm::vec3 loc(x, y, z);
|
||||||
|
best_z = zone->zonemap->FindBestZ(loc, nullptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
best_z = z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!requested_id)
|
||||||
|
{
|
||||||
|
requested_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!zone->pathing)
|
||||||
|
{
|
||||||
|
// if no pathing bits available, make them available.
|
||||||
|
zone->pathing = new PathManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zone->pathing)
|
||||||
|
{
|
||||||
|
zone->pathing->AddNode(x, y, z, best_z, requested_id);
|
||||||
|
Log.Out(Logs::Moderate, Logs::Quests, "QuestManager::AddNode adding node at (%i, %i, %i).", x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QuestManager::settarget(const char *type, int target_id) {
|
void QuestManager::settarget(const char *type, int target_id) {
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
if (!owner || !owner->IsNPC())
|
if (!owner || !owner->IsNPC())
|
||||||
|
|||||||
@ -87,6 +87,8 @@ public:
|
|||||||
void depopall(int npc_type = 0);
|
void depopall(int npc_type = 0);
|
||||||
void depopzone(bool StartSpawnTimer = true);
|
void depopzone(bool StartSpawnTimer = true);
|
||||||
void repopzone();
|
void repopzone();
|
||||||
|
void ConnectNodeToNode(int node1, int node2, int teleport, int doorid);
|
||||||
|
void AddNode(float x, float y, float z, float best_z, int32 requested_id);
|
||||||
void settarget(const char *type, int target_id);
|
void settarget(const char *type, int target_id);
|
||||||
void follow(int entity_id, int distance);
|
void follow(int entity_id, int distance);
|
||||||
void sfollow();
|
void sfollow();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user