2020-08-29 11:43:33 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-03-17 19:07:40 +00:00
|
|
|
#include "servers/CNShardServer.hpp"
|
2020-09-17 02:27:21 +00:00
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
2020-09-25 18:42:31 +00:00
|
|
|
const int SLIDER_SPEED = 1200;
|
2020-10-20 14:40:50 +00:00
|
|
|
const int SLIDER_STOP_TICKS = 16;
|
2020-12-19 00:18:39 +00:00
|
|
|
const int SLIDER_GAP_SIZE = 45000;
|
2020-09-25 18:42:31 +00:00
|
|
|
|
2021-05-03 19:29:33 +00:00
|
|
|
const int NPC_DEFAULT_SPEED = 300;
|
|
|
|
|
2021-05-01 15:04:28 +00:00
|
|
|
struct Vec3 {
|
|
|
|
int x, y, z;
|
|
|
|
};
|
|
|
|
|
2021-05-01 15:06:48 +00:00
|
|
|
struct WarpLocation {
|
|
|
|
int x, y, z, instanceID, isInstance, limitTaskID, npcID;
|
|
|
|
};
|
2020-08-29 11:43:33 +00:00
|
|
|
|
2020-09-13 20:26:16 +00:00
|
|
|
struct TransportRoute {
|
|
|
|
int type, start, end, cost, mssSpeed, mssRouteNum;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TransportLocation {
|
|
|
|
int npcID, x, y, z;
|
|
|
|
};
|
|
|
|
|
2021-05-03 19:29:33 +00:00
|
|
|
struct NPCPath {
|
|
|
|
std::vector<Vec3> points;
|
|
|
|
std::vector<int32_t> targetIDs;
|
|
|
|
std::vector<int32_t> targetTypes;
|
|
|
|
int speed;
|
|
|
|
int escortTaskID;
|
|
|
|
bool isRelative;
|
|
|
|
};
|
|
|
|
|
2021-03-16 22:29:13 +00:00
|
|
|
namespace Transport {
|
2020-09-13 20:26:16 +00:00
|
|
|
extern std::map<int32_t, TransportRoute> Routes;
|
|
|
|
extern std::map<int32_t, TransportLocation> Locations;
|
2021-05-03 19:29:33 +00:00
|
|
|
extern std::vector<NPCPath> NPCPaths; // predefined NPC paths
|
2021-05-01 15:04:28 +00:00
|
|
|
extern std::map<int32_t, std::queue<Vec3>> SkywayPaths; // predefined skyway paths with points
|
|
|
|
extern std::unordered_map<CNSocket*, std::queue<Vec3>> SkywayQueues; // player sockets with queued broomstick points
|
|
|
|
extern std::unordered_map<int32_t, std::queue<Vec3>> NPCQueues; // NPC ids with queued pathing points
|
2020-09-13 20:26:16 +00:00
|
|
|
|
2020-08-29 11:43:33 +00:00
|
|
|
void init();
|
|
|
|
|
2021-05-01 15:04:28 +00:00
|
|
|
void testMssRoute(CNSocket *sock, std::vector<Vec3>* route);
|
2020-10-06 19:53:21 +00:00
|
|
|
|
2021-05-01 15:04:28 +00:00
|
|
|
void lerp(std::queue<Vec3>*, Vec3, Vec3, int, float);
|
|
|
|
void lerp(std::queue<Vec3>*, Vec3, Vec3, int);
|
2021-05-06 01:17:06 +00:00
|
|
|
|
|
|
|
NPCPath* findApplicablePath(int32_t, int32_t, int = -1);
|
2021-05-06 01:22:11 +00:00
|
|
|
void constructPathNPC(int32_t, NPCPath*);
|
2020-08-29 11:43:33 +00:00
|
|
|
}
|