mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-15 04:38:21 +00:00
Merge branch 'main' into speed
This commit is contained in:
commit
f820324282
@ -94,6 +94,8 @@ int main(int argc, char** argv) {
|
|||||||
uint32_t framesSinceMasterDisconnect = 0;
|
uint32_t framesSinceMasterDisconnect = 0;
|
||||||
uint32_t framesSinceLastSQLPing = 0;
|
uint32_t framesSinceLastSQLPing = 0;
|
||||||
|
|
||||||
|
AuthPackets::LoadClaimCodes();
|
||||||
|
|
||||||
while (!Game::shouldShutdown) {
|
while (!Game::shouldShutdown) {
|
||||||
//Check if we're still connected to master:
|
//Check if we're still connected to master:
|
||||||
if (!Game::server->GetIsConnectedToMaster()) {
|
if (!Game::server->GetIsConnectedToMaster()) {
|
||||||
|
@ -166,7 +166,8 @@ enum ePlayerFlag : int32_t {
|
|||||||
NJ_LIGHTNING_SPINJITZU = 2031,
|
NJ_LIGHTNING_SPINJITZU = 2031,
|
||||||
NJ_ICE_SPINJITZU = 2032,
|
NJ_ICE_SPINJITZU = 2032,
|
||||||
NJ_FIRE_SPINJITZU = 2033,
|
NJ_FIRE_SPINJITZU = 2033,
|
||||||
NJ_WU_SHOW_DAILY_CHEST = 2099
|
NJ_WU_SHOW_DAILY_CHEST = 2099,
|
||||||
|
DLU_SKIP_CINEMATICS = 1'000'000,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EPLAYERFLAG__H__
|
#endif //!__EPLAYERFLAG__H__
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "CDPropertyTemplateTable.h"
|
#include "CDPropertyTemplateTable.h"
|
||||||
#include "CDFeatureGatingTable.h"
|
#include "CDFeatureGatingTable.h"
|
||||||
#include "CDRailActivatorComponent.h"
|
#include "CDRailActivatorComponent.h"
|
||||||
|
#include "CDRewardCodesTable.h"
|
||||||
|
|
||||||
// Uncomment this to cache the full cdclient database into memory. This will make the server load faster, but will use more memory.
|
// Uncomment this to cache the full cdclient database into memory. This will make the server load faster, but will use more memory.
|
||||||
// A vanilla CDClient takes about 46MB of memory + the regular world data.
|
// A vanilla CDClient takes about 46MB of memory + the regular world data.
|
||||||
@ -82,6 +83,7 @@ CDClientManager::CDClientManager() {
|
|||||||
CDRailActivatorComponentTable::Instance().LoadValuesFromDatabase();
|
CDRailActivatorComponentTable::Instance().LoadValuesFromDatabase();
|
||||||
CDRarityTableTable::Instance().LoadValuesFromDatabase();
|
CDRarityTableTable::Instance().LoadValuesFromDatabase();
|
||||||
CDRebuildComponentTable::Instance().LoadValuesFromDatabase();
|
CDRebuildComponentTable::Instance().LoadValuesFromDatabase();
|
||||||
|
CDRewardCodesTable::Instance().LoadValuesFromDatabase();
|
||||||
CDRewardsTable::Instance().LoadValuesFromDatabase();
|
CDRewardsTable::Instance().LoadValuesFromDatabase();
|
||||||
CDScriptComponentTable::Instance().LoadValuesFromDatabase();
|
CDScriptComponentTable::Instance().LoadValuesFromDatabase();
|
||||||
CDSkillBehaviorTable::Instance().LoadValuesFromDatabase();
|
CDSkillBehaviorTable::Instance().LoadValuesFromDatabase();
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
#include "CDRewardCodesTable.h"
|
||||||
|
|
||||||
|
void CDRewardCodesTable::LoadValuesFromDatabase() {
|
||||||
|
|
||||||
|
// First, get the size of the table
|
||||||
|
unsigned int size = 0;
|
||||||
|
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM RewardCodes");
|
||||||
|
while (!tableSize.eof()) {
|
||||||
|
size = tableSize.getIntField(0, 0);
|
||||||
|
|
||||||
|
tableSize.nextRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
tableSize.finalize();
|
||||||
|
|
||||||
|
// Reserve the size
|
||||||
|
this->entries.reserve(size);
|
||||||
|
|
||||||
|
// Now get the data
|
||||||
|
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RewardCodes");
|
||||||
|
while (!tableData.eof()) {
|
||||||
|
CDRewardCode entry;
|
||||||
|
entry.id = tableData.getIntField("id", -1);
|
||||||
|
entry.code = tableData.getStringField("code", "");
|
||||||
|
entry.attachmentLOT = tableData.getIntField("attachmentLOT", -1);
|
||||||
|
UNUSED_COLUMN(entry.locStatus = tableData.getIntField("locStatus", -1));
|
||||||
|
UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||||
|
|
||||||
|
this->entries.push_back(entry);
|
||||||
|
tableData.nextRow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOT CDRewardCodesTable::GetAttachmentLOT(uint32_t rewardCodeId) const {
|
||||||
|
for (auto const &entry : this->entries){
|
||||||
|
if (rewardCodeId == entry.id) return entry.attachmentLOT;
|
||||||
|
}
|
||||||
|
return LOT_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CDRewardCodesTable::GetCodeID(std::string code) const {
|
||||||
|
for (auto const &entry : this->entries){
|
||||||
|
if (code == entry.code) return entry.id;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Custom Classes
|
||||||
|
#include "CDTable.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct CDRewardCode {
|
||||||
|
uint32_t id;
|
||||||
|
std::string code;
|
||||||
|
LOT attachmentLOT;
|
||||||
|
UNUSED(uint32_t locStatus);
|
||||||
|
UNUSED(std::string gate_version);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CDRewardCodesTable : public CDTable<CDRewardCodesTable> {
|
||||||
|
private:
|
||||||
|
std::vector<CDRewardCode> entries;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void LoadValuesFromDatabase();
|
||||||
|
const std::vector<CDRewardCode>& GetEntries() const;
|
||||||
|
LOT GetAttachmentLOT(uint32_t rewardCodeId) const;
|
||||||
|
uint32_t GetCodeID(std::string code) const;
|
||||||
|
};
|
@ -8,6 +8,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
// CPPLinq
|
// CPPLinq
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -31,6 +31,7 @@ set(DDATABASE_CDCLIENTDATABASE_CDCLIENTTABLES_SOURCES "CDActivitiesTable.cpp"
|
|||||||
"CDRailActivatorComponent.cpp"
|
"CDRailActivatorComponent.cpp"
|
||||||
"CDRarityTableTable.cpp"
|
"CDRarityTableTable.cpp"
|
||||||
"CDRebuildComponentTable.cpp"
|
"CDRebuildComponentTable.cpp"
|
||||||
|
"CDRewardCodesTable.cpp"
|
||||||
"CDRewardsTable.cpp"
|
"CDRewardsTable.cpp"
|
||||||
"CDScriptComponentTable.cpp"
|
"CDScriptComponentTable.cpp"
|
||||||
"CDSkillBehaviorTable.cpp"
|
"CDSkillBehaviorTable.cpp"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "ICharInfo.h"
|
#include "ICharInfo.h"
|
||||||
#include "IAccounts.h"
|
#include "IAccounts.h"
|
||||||
#include "IActivityLog.h"
|
#include "IActivityLog.h"
|
||||||
|
#include "IAccountsRewardCodes.h"
|
||||||
|
|
||||||
namespace sql {
|
namespace sql {
|
||||||
class Statement;
|
class Statement;
|
||||||
@ -38,7 +39,7 @@ class GameDatabase :
|
|||||||
public IMail, public ICommandLog, public IPlayerCheatDetections, public IBugReports,
|
public IMail, public ICommandLog, public IPlayerCheatDetections, public IBugReports,
|
||||||
public IPropertyContents, public IProperty, public IPetNames, public ICharXml,
|
public IPropertyContents, public IProperty, public IPetNames, public ICharXml,
|
||||||
public IMigrationHistory, public IUgc, public IFriends, public ICharInfo,
|
public IMigrationHistory, public IUgc, public IFriends, public ICharInfo,
|
||||||
public IAccounts, public IActivityLog {
|
public IAccounts, public IActivityLog, public IAccountsRewardCodes {
|
||||||
public:
|
public:
|
||||||
virtual ~GameDatabase() = default;
|
virtual ~GameDatabase() = default;
|
||||||
// TODO: These should be made private.
|
// TODO: These should be made private.
|
||||||
|
13
dDatabase/GameDatabase/ITables/IAccountsRewardCodes.h
Normal file
13
dDatabase/GameDatabase/ITables/IAccountsRewardCodes.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef __IACCOUNTSREWARDCODES__H__
|
||||||
|
#define __IACCOUNTSREWARDCODES__H__
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class IAccountsRewardCodes {
|
||||||
|
public:
|
||||||
|
virtual void InsertRewardCode(const uint32_t account_id, const uint32_t reward_code) = 0;
|
||||||
|
virtual std::vector<uint32_t> GetRewardCodesByAccountID(const uint32_t account_id) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //!__IACCOUNTSREWARDCODES__H__
|
@ -103,6 +103,8 @@ public:
|
|||||||
std::optional<uint32_t> GetDonationTotal(const uint32_t activityId) override;
|
std::optional<uint32_t> GetDonationTotal(const uint32_t activityId) override;
|
||||||
std::optional<bool> IsPlaykeyActive(const int32_t playkeyId) override;
|
std::optional<bool> IsPlaykeyActive(const int32_t playkeyId) override;
|
||||||
std::vector<IUgc::Model> GetUgcModels(const LWOOBJID& propertyId) override;
|
std::vector<IUgc::Model> GetUgcModels(const LWOOBJID& propertyId) override;
|
||||||
|
void InsertRewardCode(const uint32_t account_id, const uint32_t reward_code) override;
|
||||||
|
std::vector<uint32_t> GetRewardCodesByAccountID(const uint32_t account_id) override;
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Generic query functions that can be used for any query.
|
// Generic query functions that can be used for any query.
|
||||||
|
17
dDatabase/GameDatabase/MySQL/Tables/AccountsRewardCodes.cpp
Normal file
17
dDatabase/GameDatabase/MySQL/Tables/AccountsRewardCodes.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "MySQLDatabase.h"
|
||||||
|
|
||||||
|
void MySQLDatabase::InsertRewardCode(const uint32_t account_id, const uint32_t reward_code) {
|
||||||
|
ExecuteInsert("INSERT IGNORE INTO accounts_rewardcodes (account_id, rewardcode) VALUES (?, ?);", account_id, reward_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<uint32_t> MySQLDatabase::GetRewardCodesByAccountID(const uint32_t account_id) {
|
||||||
|
auto result = ExecuteSelect("SELECT rewardcode FROM accounts_rewardcodes WHERE account_id = ?;", account_id);
|
||||||
|
|
||||||
|
std::vector<uint32_t> toReturn;
|
||||||
|
toReturn.reserve(result->rowsCount());
|
||||||
|
while (result->next()) {
|
||||||
|
toReturn.push_back(result->getUInt("rewardcode"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return toReturn;
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
set(DDATABASES_DATABASES_MYSQL_TABLES_SOURCES
|
set(DDATABASES_DATABASES_MYSQL_TABLES_SOURCES
|
||||||
"Accounts.cpp"
|
"Accounts.cpp"
|
||||||
|
"AccountsRewardCodes.cpp"
|
||||||
"ActivityLog.cpp"
|
"ActivityLog.cpp"
|
||||||
"BugReports.cpp"
|
"BugReports.cpp"
|
||||||
"CharInfo.cpp"
|
"CharInfo.cpp"
|
||||||
|
@ -16,6 +16,10 @@
|
|||||||
#include "Amf3.h"
|
#include "Amf3.h"
|
||||||
#include "eGameMasterLevel.h"
|
#include "eGameMasterLevel.h"
|
||||||
#include "eGameActivity.h"
|
#include "eGameActivity.h"
|
||||||
|
#include "User.h"
|
||||||
|
#include "Database.h"
|
||||||
|
#include "CDRewardCodesTable.h"
|
||||||
|
#include "Mail.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
CharacterComponent::CharacterComponent(Entity* parent, Character* character) : Component(parent) {
|
CharacterComponent::CharacterComponent(Entity* parent, Character* character) : Component(parent) {
|
||||||
@ -74,10 +78,14 @@ CharacterComponent::~CharacterComponent() {
|
|||||||
void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
|
void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
|
||||||
|
|
||||||
if (bIsInitialUpdate) {
|
if (bIsInitialUpdate) {
|
||||||
outBitStream->Write0();
|
outBitStream->Write(m_ClaimCodes[0] != 0);
|
||||||
outBitStream->Write0();
|
if (m_ClaimCodes[0] != 0) outBitStream->Write(m_ClaimCodes[0]);
|
||||||
outBitStream->Write0();
|
outBitStream->Write(m_ClaimCodes[1] != 0);
|
||||||
outBitStream->Write0();
|
if (m_ClaimCodes[1] != 0) outBitStream->Write(m_ClaimCodes[1]);
|
||||||
|
outBitStream->Write(m_ClaimCodes[2] != 0);
|
||||||
|
if (m_ClaimCodes[2] != 0) outBitStream->Write(m_ClaimCodes[2]);
|
||||||
|
outBitStream->Write(m_ClaimCodes[3] != 0);
|
||||||
|
if (m_ClaimCodes[3] != 0) outBitStream->Write(m_ClaimCodes[3]);
|
||||||
|
|
||||||
outBitStream->Write(m_Character->GetHairColor());
|
outBitStream->Write(m_Character->GetHairColor());
|
||||||
outBitStream->Write(m_Character->GetHairStyle());
|
outBitStream->Write(m_Character->GetHairStyle());
|
||||||
@ -186,6 +194,13 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
|||||||
SetReputation(0);
|
SetReputation(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
character->QueryUnsigned64Attribute("co", &m_ClaimCodes[0]);
|
||||||
|
character->QueryUnsigned64Attribute("co1", &m_ClaimCodes[1]);
|
||||||
|
character->QueryUnsigned64Attribute("co2", &m_ClaimCodes[2]);
|
||||||
|
character->QueryUnsigned64Attribute("co3", &m_ClaimCodes[3]);
|
||||||
|
|
||||||
|
AwardClaimCodes();
|
||||||
|
|
||||||
character->QueryInt64Attribute("ls", &m_Uscore);
|
character->QueryInt64Attribute("ls", &m_Uscore);
|
||||||
|
|
||||||
// Load the statistics
|
// Load the statistics
|
||||||
@ -308,6 +323,11 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_ClaimCodes[0] != 0) character->SetAttribute("co", m_ClaimCodes[0]);
|
||||||
|
if (m_ClaimCodes[1] != 0) character->SetAttribute("co1", m_ClaimCodes[1]);
|
||||||
|
if (m_ClaimCodes[2] != 0) character->SetAttribute("co2", m_ClaimCodes[2]);
|
||||||
|
if (m_ClaimCodes[3] != 0) character->SetAttribute("co3", m_ClaimCodes[3]);
|
||||||
|
|
||||||
character->SetAttribute("ls", m_Uscore);
|
character->SetAttribute("ls", m_Uscore);
|
||||||
// Custom attribute to keep track of reputation.
|
// Custom attribute to keep track of reputation.
|
||||||
character->SetAttribute("rpt", GetReputation());
|
character->SetAttribute("rpt", GetReputation());
|
||||||
@ -738,3 +758,31 @@ void CharacterComponent::UpdateClientMinimap(bool showFaction, std::string ventu
|
|||||||
arrayToSend.Insert(ventureVisionType, showFaction);
|
arrayToSend.Insert(ventureVisionType, showFaction);
|
||||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent ? m_Parent->GetSystemAddress() : UNASSIGNED_SYSTEM_ADDRESS, "SetFactionVisibility", arrayToSend);
|
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent ? m_Parent->GetSystemAddress() : UNASSIGNED_SYSTEM_ADDRESS, "SetFactionVisibility", arrayToSend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CharacterComponent::AwardClaimCodes() {
|
||||||
|
if (!m_Parent) return;
|
||||||
|
auto* user = m_Parent->GetParentUser();
|
||||||
|
if (!user) return;
|
||||||
|
|
||||||
|
auto rewardCodes = Database::Get()->GetRewardCodesByAccountID(user->GetAccountID());
|
||||||
|
if (rewardCodes.empty()) return;
|
||||||
|
|
||||||
|
auto* cdrewardCodes = CDClientManager::Instance().GetTable<CDRewardCodesTable>();
|
||||||
|
for (auto const rewardCode: rewardCodes){
|
||||||
|
LOG_DEBUG("Processing RewardCode %i", rewardCode);
|
||||||
|
const uint32_t rewardCodeIndex = rewardCode >> 6;
|
||||||
|
const uint32_t bitIndex = rewardCode % 64;
|
||||||
|
if (GeneralUtils::CheckBit(m_ClaimCodes[rewardCodeIndex], bitIndex)) continue;
|
||||||
|
m_ClaimCodes[rewardCodeIndex] = GeneralUtils::SetBit(m_ClaimCodes[rewardCodeIndex], bitIndex);
|
||||||
|
|
||||||
|
// Don't send it on this one since it's default and the mail doesn't make sense
|
||||||
|
if (rewardCode == 30) continue;
|
||||||
|
|
||||||
|
auto attachmentLOT = cdrewardCodes->GetAttachmentLOT(rewardCode);
|
||||||
|
std::ostringstream subject;
|
||||||
|
subject << "%[RewardCodes_" << rewardCode << "_subjectText]";
|
||||||
|
std::ostringstream body;
|
||||||
|
body << "%[RewardCodes_" << rewardCode << "_bodyText]";
|
||||||
|
Mail::SendMail(LWOOBJID_EMPTY, "%[MAIL_SYSTEM_NOTIFICATION]", m_Parent, subject.str(), body.str(), attachmentLOT, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "CDMissionsTable.h"
|
#include "CDMissionsTable.h"
|
||||||
#include "tinyxml2.h"
|
#include "tinyxml2.h"
|
||||||
#include "eReplicaComponentType.h"
|
#include "eReplicaComponentType.h"
|
||||||
|
#include <array>
|
||||||
|
|
||||||
enum class eGameActivity : uint32_t;
|
enum class eGameActivity : uint32_t;
|
||||||
|
|
||||||
@ -566,6 +567,10 @@ private:
|
|||||||
LWOOBJID m_LastRocketItemID = LWOOBJID_EMPTY;
|
LWOOBJID m_LastRocketItemID = LWOOBJID_EMPTY;
|
||||||
|
|
||||||
LWOOBJID m_CurrentInteracting = LWOOBJID_EMPTY;
|
LWOOBJID m_CurrentInteracting = LWOOBJID_EMPTY;
|
||||||
|
|
||||||
|
std::array<uint64_t, 4> m_ClaimCodes{};
|
||||||
|
|
||||||
|
void AwardClaimCodes();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHARACTERCOMPONENT_H
|
#endif // CHARACTERCOMPONENT_H
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
#include "eMissionTaskType.h"
|
#include "eMissionTaskType.h"
|
||||||
#include "eReplicaComponentType.h"
|
#include "eReplicaComponentType.h"
|
||||||
#include "eConnectionType.h"
|
#include "eConnectionType.h"
|
||||||
|
#include "ePlayerFlag.h"
|
||||||
|
#include "dConfig.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -173,6 +175,13 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
|||||||
GameMessages::SendPlayerReady(entity, sysAddr);
|
GameMessages::SendPlayerReady(entity, sysAddr);
|
||||||
GameMessages::SendPlayerReady(Game::zoneManager->GetZoneControlObject(), sysAddr);
|
GameMessages::SendPlayerReady(Game::zoneManager->GetZoneControlObject(), sysAddr);
|
||||||
|
|
||||||
|
if (Game::config->GetValue("allow_players_to_skip_cinematics") != "1"
|
||||||
|
|| !entity->GetCharacter()
|
||||||
|
|| !entity->GetCharacter()->GetPlayerFlag(ePlayerFlag::DLU_SKIP_CINEMATICS)) return;
|
||||||
|
entity->AddCallbackTimer(0.5f, [entity, sysAddr]() {
|
||||||
|
if (!entity) return;
|
||||||
|
GameMessages::SendEndCinematic(entity->GetObjectID(), u"", sysAddr);
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include "eControlScheme.h"
|
#include "eControlScheme.h"
|
||||||
#include "eStateChangeType.h"
|
#include "eStateChangeType.h"
|
||||||
#include "eConnectionType.h"
|
#include "eConnectionType.h"
|
||||||
|
#include "ePlayerFlag.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <future>
|
#include <future>
|
||||||
@ -5161,6 +5162,14 @@ void GameMessages::HandleMissionDialogOK(RakNet::BitStream* inStream, Entity* en
|
|||||||
} else if (iMissionState == eMissionState::READY_TO_COMPLETE || iMissionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
} else if (iMissionState == eMissionState::READY_TO_COMPLETE || iMissionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
||||||
missionComponent->CompleteMission(missionID);
|
missionComponent->CompleteMission(missionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Game::config->GetValue("allow_players_to_skip_cinematics") != "1"
|
||||||
|
|| !player->GetCharacter()
|
||||||
|
|| !player->GetCharacter()->GetPlayerFlag(ePlayerFlag::DLU_SKIP_CINEMATICS)) return;
|
||||||
|
player->AddCallbackTimer(0.5f, [player]() {
|
||||||
|
if (!player) return;
|
||||||
|
GameMessages::SendEndCinematic(player->GetObjectID(), u"", player->GetSystemAddress());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameMessages::HandleRequestLinkedMission(RakNet::BitStream* inStream, Entity* entity) {
|
void GameMessages::HandleRequestLinkedMission(RakNet::BitStream* inStream, Entity* entity) {
|
||||||
|
@ -83,8 +83,10 @@
|
|||||||
#include "eChatInternalMessageType.h"
|
#include "eChatInternalMessageType.h"
|
||||||
#include "eMasterMessageType.h"
|
#include "eMasterMessageType.h"
|
||||||
|
|
||||||
|
#include "CDRewardCodesTable.h"
|
||||||
#include "CDObjectsTable.h"
|
#include "CDObjectsTable.h"
|
||||||
#include "CDZoneTableTable.h"
|
#include "CDZoneTableTable.h"
|
||||||
|
#include "ePlayerFlag.h"
|
||||||
|
|
||||||
void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entity* entity, const SystemAddress& sysAddr) {
|
void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entity* entity, const SystemAddress& sysAddr) {
|
||||||
auto commandCopy = command;
|
auto commandCopy = command;
|
||||||
@ -171,6 +173,21 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chatCommand == "toggleskipcinematics" && (Game::config->GetValue("allow_players_to_skip_cinematics") == "1" || entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER)) {
|
||||||
|
auto* character = entity->GetCharacter();
|
||||||
|
if (!character) return;
|
||||||
|
bool current = character->GetPlayerFlag(ePlayerFlag::DLU_SKIP_CINEMATICS);
|
||||||
|
character->SetPlayerFlag(ePlayerFlag::DLU_SKIP_CINEMATICS, !current);
|
||||||
|
if (!current) {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"You have elected to skip cinematics. Note that not all cinematics can be skipped, but most will be skipped now.");
|
||||||
|
} else {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Cinematics will no longer be skipped.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
//HANDLE ALL NON GM SLASH COMMANDS RIGHT HERE!
|
//HANDLE ALL NON GM SLASH COMMANDS RIGHT HERE!
|
||||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
@ -1891,6 +1908,13 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chatCommand == "setrewardcode" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() == 1) {
|
||||||
|
auto* cdrewardCodes = CDClientManager::Instance().GetTable<CDRewardCodesTable>();
|
||||||
|
|
||||||
|
auto id = cdrewardCodes->GetCodeID(args[0]);
|
||||||
|
if (id != -1) Database::Get()->InsertRewardCode(user->GetAccountID(), id);
|
||||||
|
}
|
||||||
|
|
||||||
if (chatCommand == "inspect" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 1) {
|
if (chatCommand == "inspect" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 1) {
|
||||||
Entity* closest = nullptr;
|
Entity* closest = nullptr;
|
||||||
|
|
||||||
|
@ -29,6 +29,22 @@
|
|||||||
#include "eMasterMessageType.h"
|
#include "eMasterMessageType.h"
|
||||||
#include "eGameMasterLevel.h"
|
#include "eGameMasterLevel.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
std::vector<uint32_t> claimCodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AuthPackets::LoadClaimCodes() {
|
||||||
|
if(!claimCodes.empty()) return;
|
||||||
|
auto rcstring = Game::config->GetValue("rewardcodes");
|
||||||
|
auto codestrings = GeneralUtils::SplitString(rcstring, ',');
|
||||||
|
for(auto const &codestring: codestrings){
|
||||||
|
uint32_t code = -1;
|
||||||
|
if(GeneralUtils::TryParse(codestring, code) && code != -1){
|
||||||
|
claimCodes.push_back(code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AuthPackets::HandleHandshake(dServer* server, Packet* packet) {
|
void AuthPackets::HandleHandshake(dServer* server, Packet* packet) {
|
||||||
RakNet::BitStream inStream(packet->data, packet->length, false);
|
RakNet::BitStream inStream(packet->data, packet->length, false);
|
||||||
uint64_t header = inStream.Read(header);
|
uint64_t header = inStream.Read(header);
|
||||||
@ -129,6 +145,10 @@ void AuthPackets::HandleLoginRequest(dServer* server, Packet* packet) {
|
|||||||
AuthPackets::SendLoginResponse(server, system, eLoginResponse::SUCCESS, "", zoneIP, zonePort, username);
|
AuthPackets::SendLoginResponse(server, system, eLoginResponse::SUCCESS, "", zoneIP, zonePort, username);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(auto const code: claimCodes){
|
||||||
|
Database::Get()->InsertRewardCode(accountInfo->id, code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuthPackets::SendLoginResponse(dServer* server, const SystemAddress& sysAddr, eLoginResponse responseCode, const std::string& errorMsg, const std::string& wServerIP, uint16_t wServerPort, std::string username) {
|
void AuthPackets::SendLoginResponse(dServer* server, const SystemAddress& sysAddr, eLoginResponse responseCode, const std::string& errorMsg, const std::string& wServerIP, uint16_t wServerPort, std::string username) {
|
||||||
|
@ -15,6 +15,8 @@ namespace AuthPackets {
|
|||||||
|
|
||||||
void HandleLoginRequest(dServer* server, Packet* packet);
|
void HandleLoginRequest(dServer* server, Packet* packet);
|
||||||
void SendLoginResponse(dServer* server, const SystemAddress& sysAddr, eLoginResponse responseCode, const std::string& errorMsg, const std::string& wServerIP, uint16_t wServerPort, std::string username);
|
void SendLoginResponse(dServer* server, const SystemAddress& sysAddr, eLoginResponse responseCode, const std::string& errorMsg, const std::string& wServerIP, uint16_t wServerPort, std::string username);
|
||||||
|
void LoadClaimCodes();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // AUTHPACKETS_H
|
#endif // AUTHPACKETS_H
|
||||||
|
@ -1033,9 +1033,8 @@ void HandlePacket(Packet* packet) {
|
|||||||
Game::entityManager->ConstructAllEntities(packet->systemAddress);
|
Game::entityManager->ConstructAllEntities(packet->systemAddress);
|
||||||
|
|
||||||
auto* characterComponent = player->GetComponent<CharacterComponent>();
|
auto* characterComponent = player->GetComponent<CharacterComponent>();
|
||||||
if (characterComponent) {
|
if (!characterComponent) return;
|
||||||
player->GetComponent<CharacterComponent>()->RocketUnEquip(player);
|
characterComponent->RocketUnEquip(player);
|
||||||
}
|
|
||||||
|
|
||||||
// Do charxml fixes here
|
// Do charxml fixes here
|
||||||
auto* levelComponent = player->GetComponent<LevelProgressionComponent>();
|
auto* levelComponent = player->GetComponent<LevelProgressionComponent>();
|
||||||
|
@ -16,6 +16,12 @@
|
|||||||
#include "AssetManager.h"
|
#include "AssetManager.h"
|
||||||
#include "dConfig.h"
|
#include "dConfig.h"
|
||||||
|
|
||||||
|
void Level::SceneObjectDataChunk::PrintAllObjects() const {
|
||||||
|
for (const auto& [id, sceneObj] : objects) {
|
||||||
|
LOG("ID: %d LOT: %d", id, sceneObj.lot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Level::Level(Zone* parentZone, const std::string& filepath) {
|
Level::Level(Zone* parentZone, const std::string& filepath) {
|
||||||
m_ParentZone = parentZone;
|
m_ParentZone = parentZone;
|
||||||
|
|
||||||
@ -226,8 +232,8 @@ void Level::ReadSceneObjectDataChunk(std::istream& file, Header& header) {
|
|||||||
BinaryIO::BinaryRead(file, obj.id);
|
BinaryIO::BinaryRead(file, obj.id);
|
||||||
BinaryIO::BinaryRead(file, obj.lot);
|
BinaryIO::BinaryRead(file, obj.lot);
|
||||||
|
|
||||||
/*if (header.fileInfo.version >= 0x26)*/ BinaryIO::BinaryRead(file, obj.nodeType);
|
/*if (header.fileInfo->version >= 0x26)*/ BinaryIO::BinaryRead(file, obj.nodeType);
|
||||||
/*if (header.fileInfo.version >= 0x20)*/ BinaryIO::BinaryRead(file, obj.glomId);
|
/*if (header.fileInfo->version >= 0x20)*/ BinaryIO::BinaryRead(file, obj.glomId);
|
||||||
|
|
||||||
BinaryIO::BinaryRead(file, obj.position);
|
BinaryIO::BinaryRead(file, obj.position);
|
||||||
BinaryIO::BinaryRead(file, obj.rotation);
|
BinaryIO::BinaryRead(file, obj.rotation);
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|resurrect|`/resurrect`|Resurrects the player.||
|
|resurrect|`/resurrect`|Resurrects the player.||
|
||||||
|requestmailcount|`/requestmailcount`|Sends notification with number of unread messages in the player's mailbox.||
|
|requestmailcount|`/requestmailcount`|Sends notification with number of unread messages in the player's mailbox.||
|
||||||
|who|`/who`|Displays in chat all players on the instance.||
|
|who|`/who`|Displays in chat all players on the instance.||
|
||||||
|
|togglenameplate|`/togglenameplate`|Turns the nameplate above your head that is visible to other players off and on.|8 or if `allow_nameplate_off` is set to exactly `1` in the settings|
|
||||||
|
|toggleskipcinematics|`/toggleskipcinematics`|Skips mission and world load related cinematics.|8 or if `allow_players_to_skip_cinematics` is set to exactly `1` in the settings then 0|
|
||||||
|
|
||||||
## Moderation Commands
|
## Moderation Commands
|
||||||
|
|
||||||
@ -49,7 +51,6 @@ These commands are primarily for development and testing. The usage of many of t
|
|||||||
|
|
||||||
|Command|Usage|Description|Admin Level Requirement|
|
|Command|Usage|Description|Admin Level Requirement|
|
||||||
|--- |--- |--- |--- |
|
|--- |--- |--- |--- |
|
||||||
|togglenameplate|`/togglenameplate`|Turns the nameplate above your head that is visible to other players off and on.|8 or if `allow_nameplate_off` is set to exactly `1` in the settings|
|
|
||||||
|fix-stats|`/fix-stats`|Resets skills, buffs, and destroyables.||
|
|fix-stats|`/fix-stats`|Resets skills, buffs, and destroyables.||
|
||||||
|join|`/join <password>`|Joins a private zone with given password.||
|
|join|`/join <password>`|Joins a private zone with given password.||
|
||||||
|leave-zone|`/leave-zone`|If you are in an instanced zone, transfers you to the closest main world. For example, if you are in an instance of Avant Gardens Survival or the Spider Queen Battle, you are sent to Avant Gardens. If you are in the Battle of Nimbus Station, you are sent to Nimbus Station.||
|
|leave-zone|`/leave-zone`|If you are in an instanced zone, transfers you to the closest main world. For example, if you are in an instance of Avant Gardens Survival or the Spider Queen Battle, you are sent to Avant Gardens. If you are in the Battle of Nimbus Station, you are sent to Nimbus Station.||
|
||||||
@ -112,6 +113,7 @@ These commands are primarily for development and testing. The usage of many of t
|
|||||||
|setfaction|`/setfaction <faction id>`|Clears the users current factions and sets it|8|
|
|setfaction|`/setfaction <faction id>`|Clears the users current factions and sets it|8|
|
||||||
|addfaction|`/addfaction <faction id>`|Add the faction to the users list of factions|8|
|
|addfaction|`/addfaction <faction id>`|Add the faction to the users list of factions|8|
|
||||||
|getfactions|`/getfactions`|Shows the player's factions|8|
|
|getfactions|`/getfactions`|Shows the player's factions|8|
|
||||||
|
|setrewardcode|`/setrewardcode <code>`|Sets the rewardcode for the account you are logged into if it's a valid rewardcode, See cdclient table `RewardCodes`|8|
|
||||||
## Detailed `/inspect` Usage
|
## Detailed `/inspect` Usage
|
||||||
|
|
||||||
`/inspect <component> (-m <waypoint> | -a <animation> | -s | -p | -f (faction) | -t)`
|
`/inspect <component> (-m <waypoint> | -a <animation> | -s | -p | -f (faction) | -t)`
|
||||||
|
5
migrations/dlu/14_reward_codes.sql
Normal file
5
migrations/dlu/14_reward_codes.sql
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS accounts_rewardcodes (
|
||||||
|
account_id INT NOT NULL REFERENCES accounts(id) ON DELETE CASCADE,
|
||||||
|
rewardcode INT NOT NULL,
|
||||||
|
PRIMARY KEY (account_id, rewardcode)
|
||||||
|
);
|
@ -4,3 +4,11 @@ port=1001
|
|||||||
# 0 or 1, should ignore playkeys
|
# 0 or 1, should ignore playkeys
|
||||||
# If 1 everyone with an account will be able to login, regardless of if they have a key or not
|
# If 1 everyone with an account will be able to login, regardless of if they have a key or not
|
||||||
dont_use_keys=0
|
dont_use_keys=0
|
||||||
|
|
||||||
|
# list of rewardcodes to set on the accounts by default
|
||||||
|
# ex: 30,1,0,3
|
||||||
|
# See RewardCodes in the CDclient for what codes exist
|
||||||
|
# Default 4,30
|
||||||
|
# 4 allows LEGOClub access
|
||||||
|
# 30 makes the client not consume bricks when in bbb mode
|
||||||
|
rewardcodes=4,30
|
||||||
|
@ -61,6 +61,7 @@ allow_nameplate_off=0
|
|||||||
# Turn logging of IP addresses for anti-cheat reporting on (1) or off(0)
|
# Turn logging of IP addresses for anti-cheat reporting on (1) or off(0)
|
||||||
log_ip_addresses_for_anti_cheat=1
|
log_ip_addresses_for_anti_cheat=1
|
||||||
|
|
||||||
|
# These are the 5 items items that are shown in the "Help" menu in-game along with their coresponding descriptions below.
|
||||||
help_0_summary=Got an issue?
|
help_0_summary=Got an issue?
|
||||||
help_1_summary=Stuck loading?
|
help_1_summary=Stuck loading?
|
||||||
help_2_summary=Missing features?
|
help_2_summary=Missing features?
|
||||||
@ -72,3 +73,6 @@ help_1_description=Try switching networks, using a VPN, or using your phone's ho
|
|||||||
help_2_description=While DarkflameServer is a mostly complete emulator, there are still some features that aren't implemented. You can track these on the GitHub issues page.<br/><br/>
|
help_2_description=While DarkflameServer is a mostly complete emulator, there are still some features that aren't implemented. You can track these on the GitHub issues page.<br/><br/>
|
||||||
help_3_description=Skill issue!<br/><br/>
|
help_3_description=Skill issue!<br/><br/>
|
||||||
help_4_description=Visit Discussions on the DarkflameServer GitHub page<br/>to ask questions and collaborate with other devs!<br/><br/>
|
help_4_description=Visit Discussions on the DarkflameServer GitHub page<br/>to ask questions and collaborate with other devs!<br/><br/>
|
||||||
|
|
||||||
|
# Toggleable quality of life feature to allow users to skip most cinematics.
|
||||||
|
allow_players_to_skip_cinematics=0
|
||||||
|
Loading…
Reference in New Issue
Block a user