mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-10 17:38:08 +00:00
Merge remote-tracking branch 'upstream/main' into PetFixes
This commit is contained in:
@@ -14,6 +14,6 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG
|
||||
"NpcCowboyServer.cpp"
|
||||
"NpcPirateServer.cpp")
|
||||
|
||||
add_library(dScriptsServerMapAG ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG})
|
||||
add_library(dScriptsServerMapAG OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG})
|
||||
target_include_directories(dScriptsServerMapAG PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapAG REUSE_FROM dScriptsBase)
|
||||
|
@@ -2,7 +2,7 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN
|
||||
"ZoneAgSpiderQueen.cpp"
|
||||
"SpiderBossTreasureChestServer.cpp")
|
||||
|
||||
add_library(dScriptsServerMapAGSpiderQueen ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN})
|
||||
add_library(dScriptsServerMapAGSpiderQueen OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN})
|
||||
target_include_directories(dScriptsServerMapAGSpiderQueen PUBLIC ".")
|
||||
target_link_libraries(dScriptsServerMapAGSpiderQueen dScriptsServerMapProperty)
|
||||
target_precompile_headers(dScriptsServerMapAGSpiderQueen REUSE_FROM dScriptsBase)
|
||||
|
@@ -15,8 +15,10 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AM
|
||||
"AmSkullkinDrillStand.cpp"
|
||||
"AmSkullkinTower.cpp"
|
||||
"AmBlueX.cpp"
|
||||
"AmTeapotServer.cpp")
|
||||
"AmTeapotServer.cpp"
|
||||
"WanderingVendor.cpp"
|
||||
)
|
||||
|
||||
add_library(dScriptsServerMapAM ${DSCRIPTS_SOURCES_02_SERVER_MAP_AM})
|
||||
add_library(dScriptsServerMapAM OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_AM})
|
||||
target_include_directories(dScriptsServerMapAM PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapAM REUSE_FROM dScriptsBase)
|
||||
|
33
dScripts/02_server/Map/AM/WanderingVendor.cpp
Normal file
33
dScripts/02_server/Map/AM/WanderingVendor.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "WanderingVendor.h"
|
||||
#include "MovementAIComponent.h"
|
||||
#include "ProximityMonitorComponent.h"
|
||||
|
||||
void WanderingVendor::OnStartup(Entity* self) {
|
||||
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
|
||||
if (!movementAIComponent) return;
|
||||
// movementAIComponent->Resume();
|
||||
self->SetProximityRadius(10, "playermonitor");
|
||||
}
|
||||
|
||||
void WanderingVendor::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (status == "ENTER" && entering->IsPlayer()) {
|
||||
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
|
||||
if (!movementAIComponent) return;
|
||||
// movementAIComponent->Pause();
|
||||
self->CancelTimer("startWalking");
|
||||
} else if (status == "LEAVE") {
|
||||
auto* proximityMonitorComponent = self->GetComponent<ProximityMonitorComponent>();
|
||||
if (!proximityMonitorComponent) self->AddComponent<ProximityMonitorComponent>();
|
||||
|
||||
const auto proxObjs = proximityMonitorComponent->GetProximityObjects("playermonitor");
|
||||
if (proxObjs.empty()) self->AddTimer("startWalking", 1.5);
|
||||
}
|
||||
}
|
||||
|
||||
void WanderingVendor::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "startWalking") {
|
||||
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
|
||||
if (!movementAIComponent) return;
|
||||
// movementAIComponent->Resume();
|
||||
}
|
||||
}
|
13
dScripts/02_server/Map/AM/WanderingVendor.h
Normal file
13
dScripts/02_server/Map/AM/WanderingVendor.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef __WANDERINGVENDOR__H__
|
||||
#define __WANDERINGVENDOR__H__
|
||||
|
||||
#include "CppScripts.h"
|
||||
|
||||
class WanderingVendor : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
||||
|
||||
#endif //!__WANDERINGVENDOR__H__
|
@@ -13,17 +13,33 @@ add_subdirectory(SS)
|
||||
add_subdirectory(VE)
|
||||
|
||||
add_library(dScriptsServerMap INTERFACE)
|
||||
target_link_libraries(dScriptsServerMap INTERFACE
|
||||
dScriptsServerMapAG
|
||||
dScriptsServerMapAGSpiderQueen
|
||||
dScriptsServerMapAM
|
||||
dScriptsServerMapFV
|
||||
dScriptsServerMapGeneral
|
||||
dScriptsServerMapGF
|
||||
dScriptsServerMapNJHub
|
||||
dScriptsServerMapNS
|
||||
dScriptsServerMapNT
|
||||
dScriptsServerMapPR
|
||||
dScriptsServerMapProperty
|
||||
dScriptsServerMapSS
|
||||
dScriptsServerMapVE)
|
||||
target_sources(dScriptsServerMap INTERFACE
|
||||
$<TARGET_OBJECTS:dScriptsServerMapAG>
|
||||
$<TARGET_OBJECTS:dScriptsServerMapAGSpiderQueen>
|
||||
$<TARGET_OBJECTS:dScriptsServerMapAM>
|
||||
$<TARGET_OBJECTS:dScriptsServerMapFV>
|
||||
$<TARGET_OBJECTS:dScriptsServerMapGeneral>
|
||||
$<TARGET_OBJECTS:dScriptsServerMapGF>
|
||||
$<TARGET_OBJECTS:dScriptsServerMapNJHub>
|
||||
$<TARGET_OBJECTS:dScriptsServerMapNS>
|
||||
$<TARGET_OBJECTS:dScriptsServerMapNT>
|
||||
$<TARGET_OBJECTS:dScriptsServerMapPR>
|
||||
$<TARGET_OBJECTS:dScriptsServerMapProperty>
|
||||
$<TARGET_OBJECTS:dScriptsServerMapSS>
|
||||
$<TARGET_OBJECTS:dScriptsServerMapVE>
|
||||
)
|
||||
target_include_directories(dScriptsServerMap INTERFACE
|
||||
$<TARGET_PROPERTY:dScriptsServerMapAG,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:dScriptsServerMapAGSpiderQueen,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:dScriptsServerMapAM,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:dScriptsServerMapFV,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:dScriptsServerMapGeneral,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:dScriptsServerMapGF,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:dScriptsServerMapNJHub,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:dScriptsServerMapNS,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:dScriptsServerMapNT,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:dScriptsServerMapPR,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:dScriptsServerMapProperty,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:dScriptsServerMapSS,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:dScriptsServerMapVE,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
|
@@ -11,6 +11,6 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV_RACING})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_FV ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV} "Racing/${file}")
|
||||
endforeach()
|
||||
|
||||
add_library(dScriptsServerMapFV ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV})
|
||||
add_library(dScriptsServerMapFV OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV})
|
||||
target_include_directories(dScriptsServerMapFV PUBLIC "." "Racing")
|
||||
target_precompile_headers(dScriptsServerMapFV REUSE_FROM dScriptsBase)
|
||||
|
@@ -4,6 +4,6 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_GF
|
||||
"MastTeleport.cpp"
|
||||
"SpawnLionServer.cpp")
|
||||
|
||||
add_library(dScriptsServerMapGF ${DSCRIPTS_SOURCES_02_SERVER_MAP_GF})
|
||||
add_library(dScriptsServerMapGF OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_GF})
|
||||
target_include_directories(dScriptsServerMapGF PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapGF REUSE_FROM dScriptsBase)
|
||||
|
@@ -27,6 +27,6 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL_NINJAGO})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL} "Ninjago/${file}")
|
||||
endforeach()
|
||||
|
||||
add_library(dScriptsServerMapGeneral ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL})
|
||||
add_library(dScriptsServerMapGeneral OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL})
|
||||
target_include_directories(dScriptsServerMapGeneral PUBLIC "." "Ninjago")
|
||||
target_precompile_headers(dScriptsServerMapGeneral REUSE_FROM dScriptsBase)
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#include "Entity.h"
|
||||
|
||||
void StoryBoxInteractServer::OnUse(Entity* self, Entity* user) {
|
||||
if (self->GetVar<bool>(u"hasCustomText")) {
|
||||
if (self->HasVar(u"customText")) {
|
||||
const auto& customText = self->GetVar<std::string>(u"customText");
|
||||
|
||||
{
|
||||
@@ -29,15 +29,19 @@ void StoryBoxInteractServer::OnUse(Entity* self, Entity* user) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self->HasVar(u"storyText") || !self->HasVar(u"altFlagID")) return;
|
||||
const auto storyText = self->GetVarAsString(u"storyText");
|
||||
if (storyText.length() > 2) {
|
||||
auto storyValue = GeneralUtils::TryParse<uint32_t>(storyText.substr(storyText.length() - 2));
|
||||
if(!storyValue) return;
|
||||
int32_t boxFlag = self->GetVar<int32_t>(u"altFlagID");
|
||||
if (boxFlag <= 0) {
|
||||
boxFlag = (10000 + Game::server->GetZoneID() + storyValue.value());
|
||||
}
|
||||
|
||||
int32_t boxFlag = self->GetVar<int32_t>(u"altFlagID");
|
||||
if (boxFlag <= 0) {
|
||||
boxFlag = (10000 + Game::server->GetZoneID() + std::stoi(storyText.substr(storyText.length() - 2)));
|
||||
}
|
||||
|
||||
if (user->GetCharacter()->GetPlayerFlag(boxFlag) == false) {
|
||||
user->GetCharacter()->SetPlayerFlag(boxFlag, true);
|
||||
GameMessages::SendFireEventClientSide(self->GetObjectID(), user->GetSystemAddress(), u"achieve", LWOOBJID_EMPTY, 0, -1, LWOOBJID_EMPTY);
|
||||
if (user->GetCharacter()->GetPlayerFlag(boxFlag) == false) {
|
||||
user->GetCharacter()->SetPlayerFlag(boxFlag, true);
|
||||
GameMessages::SendFireEventClientSide(self->GetObjectID(), user->GetSystemAddress(), u"achieve", LWOOBJID_EMPTY, 0, -1, LWOOBJID_EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,6 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS_WAVES})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NS ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS} "Waves/${file}")
|
||||
endforeach()
|
||||
|
||||
add_library(dScriptsServerMapNS ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS})
|
||||
add_library(dScriptsServerMapNS OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS})
|
||||
target_include_directories(dScriptsServerMapNS PUBLIC "." "Waves")
|
||||
target_precompile_headers(dScriptsServerMapNS REUSE_FROM dScriptsBase)
|
||||
|
@@ -27,6 +27,6 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_NT
|
||||
"NtBcSubmitServer.cpp"
|
||||
"NtNaomiBreadcrumbServer.cpp")
|
||||
|
||||
add_library(dScriptsServerMapNT ${DSCRIPTS_SOURCES_02_SERVER_MAP_NT})
|
||||
add_library(dScriptsServerMapNT OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_NT})
|
||||
target_include_directories(dScriptsServerMapNT PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapNT REUSE_FROM dScriptsBase)
|
||||
|
@@ -3,6 +3,6 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_PR
|
||||
"PrSeagullFly.cpp"
|
||||
"SpawnGryphonServer.cpp")
|
||||
|
||||
add_library(dScriptsServerMapPR ${DSCRIPTS_SOURCES_02_SERVER_MAP_PR})
|
||||
add_library(dScriptsServerMapPR OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_PR})
|
||||
target_include_directories(dScriptsServerMapPR PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapPR REUSE_FROM dScriptsBase)
|
||||
|
@@ -19,7 +19,7 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY_NS_MED})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY} "NS_Med/${file}")
|
||||
endforeach()
|
||||
|
||||
add_library(dScriptsServerMapProperty ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY})
|
||||
add_library(dScriptsServerMapProperty OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY})
|
||||
target_precompile_headers(dScriptsServerMapProperty REUSE_FROM dScriptsBase)
|
||||
target_include_directories(dScriptsServerMapProperty PUBLIC "."
|
||||
"AG_Med"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_SS
|
||||
"SsModularBuildServer.cpp")
|
||||
|
||||
add_library(dScriptsServerMapSS ${DSCRIPTS_SOURCES_02_SERVER_MAP_SS})
|
||||
add_library(dScriptsServerMapSS OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_SS})
|
||||
target_include_directories(dScriptsServerMapSS PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapSS REUSE_FROM dScriptsBase)
|
||||
|
@@ -3,6 +3,6 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_VE
|
||||
"VeEpsilonServer.cpp"
|
||||
"VeBricksampleServer.cpp")
|
||||
|
||||
add_library(dScriptsServerMapVE ${DSCRIPTS_SOURCES_02_SERVER_MAP_VE})
|
||||
add_library(dScriptsServerMapVE OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_VE})
|
||||
target_include_directories(dScriptsServerMapVE PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapVE REUSE_FROM dScriptsBase)
|
||||
|
@@ -28,7 +28,7 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB_BOSS_INSTANCE})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB} "boss_instance/${file}")
|
||||
endforeach()
|
||||
|
||||
add_library(dScriptsServerMapNJHub ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB})
|
||||
add_library(dScriptsServerMapNJHub OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB})
|
||||
target_include_directories(dScriptsServerMapNJHub PUBLIC "." "boss_instance")
|
||||
target_link_libraries(dScriptsServerMapNJHub
|
||||
dScriptsServerPets
|
||||
|
Reference in New Issue
Block a user