mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-21 03:35:05 -06:00
Compare commits
1 Commits
crashFix
...
CDClientWo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae65ebc9df |
@@ -144,7 +144,7 @@ std::vector<std::pair<uint8_t, uint8_t>> dChatFilter::IsSentenceOkay(const std::
|
||||
listOfBadSegments.emplace_back(position, originalSegment.length());
|
||||
}
|
||||
|
||||
position += originalSegment.length() + 1;
|
||||
position += segment.length() + 1;
|
||||
}
|
||||
|
||||
return listOfBadSegments;
|
||||
|
||||
@@ -145,8 +145,7 @@ void CatchUnhandled(int sig) {
|
||||
std::string functionName = strings[i];
|
||||
std::string::size_type start = functionName.find('(');
|
||||
std::string::size_type end = functionName.find('+');
|
||||
// strengthened check
|
||||
if (start != std::string::npos && start + 1 < functionName.size() && end != std::string::npos && start < end) {
|
||||
if (start != std::string::npos && end != std::string::npos) {
|
||||
std::string demangled = functionName.substr(start + 1, end - start - 1);
|
||||
|
||||
demangled = Demangler::Demangle(demangled.c_str());
|
||||
|
||||
@@ -2523,9 +2523,15 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
inStream->Read(sd0Size);
|
||||
std::shared_ptr<char[]> sd0Data(new char[sd0Size]);
|
||||
|
||||
if (sd0Data == nullptr) return;
|
||||
if (sd0Data == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
inStream->ReadAlignedBytes(reinterpret_cast<unsigned char*>(sd0Data.get()), sd0Size);
|
||||
for (uint32_t i = 0; i < sd0Size; ++i) {
|
||||
uint8_t c;
|
||||
inStream->Read(c);
|
||||
sd0Data[i] = c;
|
||||
}
|
||||
|
||||
uint32_t timeTaken;
|
||||
inStream->Read(timeTaken);
|
||||
@@ -2559,6 +2565,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
|
||||
//We runs this in async because the http library here is blocking, meaning it'll halt the thread.
|
||||
//But we don't want the server to go unresponsive, because then the client would disconnect.
|
||||
auto returnVal = std::async(std::launch::async, [&]() {
|
||||
|
||||
//We need to get a new ID for our model first:
|
||||
ObjectIDManager::Instance()->RequestPersistentID([=](uint32_t newID) {
|
||||
@@ -2566,7 +2573,8 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
GeneralUtils::SetBit(newIDL, eObjectBits::CHARACTER);
|
||||
GeneralUtils::SetBit(newIDL, eObjectBits::PERSISTENT);
|
||||
|
||||
uint32_t blueprintIDSmall = ObjectIDManager::Instance()->GenerateRandomObjectID();
|
||||
ObjectIDManager::Instance()->RequestPersistentID([=](uint32_t blueprintIDSmall) {
|
||||
blueprintIDSmall = ObjectIDManager::Instance()->GenerateRandomObjectID();
|
||||
LWOOBJID blueprintID = blueprintIDSmall;
|
||||
GeneralUtils::SetBit(blueprintID, eObjectBits::CHARACTER);
|
||||
GeneralUtils::SetBit(blueprintID, eObjectBits::PERSISTENT);
|
||||
@@ -2587,6 +2595,8 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
|
||||
int templateId = result.getIntField(0);
|
||||
|
||||
result.finalize();
|
||||
|
||||
auto* propertyLookup = Database::CreatePreppedStmt("SELECT * FROM properties WHERE template_id = ? AND clone_id = ?;");
|
||||
|
||||
propertyLookup->setInt(1, templateId);
|
||||
@@ -2612,6 +2622,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
//whacky stream biz
|
||||
std::string s(sd0Data.get(), sd0Size);
|
||||
std::istringstream iss(s);
|
||||
std::istream& stream = iss;
|
||||
|
||||
ugcs->setBlob(5, &iss);
|
||||
ugcs->setBoolean(6, false);
|
||||
@@ -2672,7 +2683,9 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
|
||||
bitStream.Write<uint32_t>(sd0Size);
|
||||
|
||||
bitStream.WriteAlignedBytes(reinterpret_cast<unsigned char*>(sd0Data.get()), sd0Size);
|
||||
for (size_t i = 0; i < sd0Size; ++i) {
|
||||
bitStream.Write(sd0Data[i]);
|
||||
}
|
||||
|
||||
SEND_PACKET;
|
||||
|
||||
@@ -2709,6 +2722,8 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void GameMessages::HandlePropertyEntranceSync(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||
|
||||
@@ -29,7 +29,7 @@ void ReportCheat(User* user, const SystemAddress& sysAddr, const char* messageIf
|
||||
std::unique_ptr<sql::PreparedStatement> stmt(Database::CreatePreppedStmt(
|
||||
"INSERT INTO player_cheat_detections (account_id, name, violation_msg, violation_system_address) VALUES (?, ?, ?, ?)")
|
||||
);
|
||||
user ? stmt->setInt(1, user->GetAccountID()) : stmt->setNull(1, sql::DataType::INTEGER);
|
||||
stmt->setInt(1, user ? user->GetAccountID() : 0);
|
||||
stmt->setString(2, user ? user->GetUsername().c_str() : "User is null.");
|
||||
|
||||
constexpr int32_t bufSize = 4096;
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
#include "MissionComponent.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "CDClientManager.h"
|
||||
#include "CDObjectSkillsTable.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
//TODO: this has to be updated so that you only get killed if you're in a certain radius.
|
||||
@@ -41,11 +39,9 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) {
|
||||
self->SetOwnerOverride(attacker->GetObjectID());
|
||||
|
||||
GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake", self->GetObjectID(), 16);
|
||||
self->Smash(attacker->GetObjectID());
|
||||
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (skillComponent != nullptr) {
|
||||
// Technically supposed to get first skill in the skill component but only 1 object in the live game used this.
|
||||
skillComponent->CalculateBehavior(147, 4721, LWOOBJID_EMPTY, true);
|
||||
}
|
||||
|
||||
@@ -69,6 +65,8 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self->ScheduleKillAfterUpdate();
|
||||
}
|
||||
|
||||
void ExplodingAsset::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "NtCombatChallengeExplodingDummy.h"
|
||||
#include "EntityManager.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "DestroyableComponent.h"
|
||||
|
||||
void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
|
||||
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
|
||||
@@ -16,17 +15,6 @@ void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
|
||||
}
|
||||
|
||||
void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto numTimesHit = self->GetVar<int32_t>(u"numTimesHit");
|
||||
if (destroyableComponent && numTimesHit == 0) {
|
||||
self->SetVar<int32_t>(u"numTimesHit", 1);
|
||||
destroyableComponent->SetHealth(destroyableComponent->GetHealth() / 2);
|
||||
return;
|
||||
} else if (numTimesHit == 2) {
|
||||
return;
|
||||
}
|
||||
self->SetVar<int32_t>(u"numTimesHit", 2);
|
||||
|
||||
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
|
||||
|
||||
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
|
||||
@@ -40,6 +28,5 @@ void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* at
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->CalculateBehavior(1338, 30875, attacker->GetObjectID());
|
||||
}
|
||||
GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake", self->GetObjectID(), 16.0f);
|
||||
self->Smash(attacker->GetObjectID());
|
||||
self->Kill(attacker);
|
||||
}
|
||||
|
||||
@@ -925,7 +925,7 @@ void HandlePacket(Packet* packet) {
|
||||
//We need to delete the entity first, otherwise the char list could delete it while it exists in the world!
|
||||
if (Game::server->GetZoneID() != 0) {
|
||||
auto user = UserManager::Instance()->GetUser(packet->systemAddress);
|
||||
if (!user || !user->GetLastUsedChar()) return;
|
||||
if (!user) return;
|
||||
Game::entityManager->DestroyEntity(user->GetLastUsedChar()->GetEntity());
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user