mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-23 14:07:20 +00:00
Merge remote-tracking branch 'origin/main' into scripting-lua
This commit is contained in:
commit
1ab1c8eaf5
@ -493,7 +493,7 @@ enum eLootSourceType : int32_t {
|
|||||||
LOOT_SOURCE_CLAIMCODE,
|
LOOT_SOURCE_CLAIMCODE,
|
||||||
LOOT_SOURCE_CONSUMPTION,
|
LOOT_SOURCE_CONSUMPTION,
|
||||||
LOOT_SOURCE_CRAFTING,
|
LOOT_SOURCE_CRAFTING,
|
||||||
LOOT_SOURCE_LEVELREWARD,
|
LOOT_SOURCE_LEVEL_REWARD,
|
||||||
LOOT_SOURCE_RELOCATE
|
LOOT_SOURCE_RELOCATE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -534,7 +534,7 @@ void Character::OnZoneLoad()
|
|||||||
*/
|
*/
|
||||||
if (HasPermission(PermissionMap::Old)) {
|
if (HasPermission(PermissionMap::Old)) {
|
||||||
if (GetCoins() > 1000000) {
|
if (GetCoins() > 1000000) {
|
||||||
SetCoins(1000000, LOOT_SOURCE_NONE);
|
SetCoins(1000000, eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1637,7 +1637,7 @@ void Entity::PickupItem(const LWOOBJID& objectID) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
inv->AddItem(p.second.lot, p.second.count, INVALID, {}, LWOOBJID_EMPTY, true, false, LWOOBJID_EMPTY, INVALID, 1);
|
inv->AddItem(p.second.lot, p.second.count, eLootSourceType::LOOT_SOURCE_PICKUP, eInventoryType::INVALID, {}, LWOOBJID_EMPTY, true, false, LWOOBJID_EMPTY, eInventoryType::INVALID, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2173,3 +2173,15 @@ void Entity::AddToGroup(const std::string& group) {
|
|||||||
m_Groups.push_back(group);
|
m_Groups.push_back(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Entity::RetroactiveVaultSize() {
|
||||||
|
auto inventoryComponent = GetComponent<InventoryComponent>();
|
||||||
|
if (!inventoryComponent) return;
|
||||||
|
|
||||||
|
auto itemsVault = inventoryComponent->GetInventory(eInventoryType::VAULT_ITEMS);
|
||||||
|
auto modelVault = inventoryComponent->GetInventory(eInventoryType::VAULT_MODELS);
|
||||||
|
|
||||||
|
if (itemsVault->GetSize() == modelVault->GetSize()) return;
|
||||||
|
|
||||||
|
modelVault->SetSize(itemsVault->GetSize());
|
||||||
|
}
|
||||||
|
@ -220,7 +220,11 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Utility
|
* Utility
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* Retroactively corrects the model vault size due to incorrect initialization in a previous patch.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void RetroactiveVaultSize();
|
||||||
bool GetBoolean(const std::u16string& name) const;
|
bool GetBoolean(const std::u16string& name) const;
|
||||||
int32_t GetI32(const std::u16string& name) const;
|
int32_t GetI32(const std::u16string& name) const;
|
||||||
int64_t GetI64(const std::u16string& name) const;
|
int64_t GetI64(const std::u16string& name) const;
|
||||||
|
@ -151,8 +151,8 @@ void Trade::Complete()
|
|||||||
|
|
||||||
if (inventoryA == nullptr || inventoryB == nullptr || characterA == nullptr || characterB == nullptr || missionsA == nullptr || missionsB == nullptr) return;
|
if (inventoryA == nullptr || inventoryB == nullptr || characterA == nullptr || characterB == nullptr || missionsA == nullptr || missionsB == nullptr) return;
|
||||||
|
|
||||||
characterA->SetCoins(characterA->GetCoins() - m_CoinsA + m_CoinsB, LOOT_SOURCE_TRADE);
|
characterA->SetCoins(characterA->GetCoins() - m_CoinsA + m_CoinsB, eLootSourceType::LOOT_SOURCE_TRADE);
|
||||||
characterB->SetCoins(characterB->GetCoins() - m_CoinsB + m_CoinsA, LOOT_SOURCE_TRADE);
|
characterB->SetCoins(characterB->GetCoins() - m_CoinsB + m_CoinsA, eLootSourceType::LOOT_SOURCE_TRADE);
|
||||||
|
|
||||||
for (const auto& tradeItem : m_ItemsA)
|
for (const auto& tradeItem : m_ItemsA)
|
||||||
{
|
{
|
||||||
@ -170,12 +170,12 @@ void Trade::Complete()
|
|||||||
|
|
||||||
for (const auto& tradeItem : m_ItemsA)
|
for (const auto& tradeItem : m_ItemsA)
|
||||||
{
|
{
|
||||||
inventoryB->AddItem(tradeItem.itemLot, tradeItem.itemCount);
|
inventoryB->AddItem(tradeItem.itemLot, tradeItem.itemCount, eLootSourceType::LOOT_SOURCE_TRADE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& tradeItem : m_ItemsB)
|
for (const auto& tradeItem : m_ItemsB)
|
||||||
{
|
{
|
||||||
inventoryA->AddItem(tradeItem.itemLot, tradeItem.itemCount);
|
inventoryA->AddItem(tradeItem.itemLot, tradeItem.itemCount, eLootSourceType::LOOT_SOURCE_TRADE);
|
||||||
}
|
}
|
||||||
|
|
||||||
TradingManager::Instance()->CancelTrade(m_TradeId);
|
TradingManager::Instance()->CancelTrade(m_TradeId);
|
||||||
|
@ -291,7 +291,7 @@ void UserManager::CreateCharacter(const SystemAddress& sysAddr, Packet* packet)
|
|||||||
xml << "ls=\"0\" lzx=\"-626.5847\" lzy=\"613.3515\" lzz=\"-28.6374\" lzrx=\"0.0\" lzry=\"0.7015\" lzrz=\"0.0\" lzrw=\"0.7126\" ";
|
xml << "ls=\"0\" lzx=\"-626.5847\" lzy=\"613.3515\" lzz=\"-28.6374\" lzrx=\"0.0\" lzry=\"0.7015\" lzrz=\"0.0\" lzrw=\"0.7126\" ";
|
||||||
xml << "stt=\"0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;\"></char>";
|
xml << "stt=\"0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;\"></char>";
|
||||||
xml << "<dest hm=\"4\" hc=\"4\" im=\"0\" ic=\"0\" am=\"0\" ac=\"0\" d=\"0\"/>";
|
xml << "<dest hm=\"4\" hc=\"4\" im=\"0\" ic=\"0\" am=\"0\" ac=\"0\" d=\"0\"/>";
|
||||||
xml << "<inv><bag><b t=\"0\" m=\"20\"/><b t=\"1\" m=\"240\"/><b t=\"2\" m=\"240\"/><b t=\"3\" m=\"240\"/></bag><items><in t=\"0\">";
|
xml << "<inv><bag><b t=\"0\" m=\"20\"/><b t=\"1\" m=\"40\"/><b t=\"2\" m=\"240\"/><b t=\"3\" m=\"240\"/><b t=\"14\" m=\"40\"/></bag><items><in t=\"0\">";
|
||||||
std::string xmlSave1 = xml.str();
|
std::string xmlSave1 = xml.str();
|
||||||
|
|
||||||
ObjectIDManager::Instance()->RequestPersistentID([=](uint32_t idforshirt) {
|
ObjectIDManager::Instance()->RequestPersistentID([=](uint32_t idforshirt) {
|
||||||
|
@ -217,11 +217,11 @@ void CharacterComponent::HandleLevelUp()
|
|||||||
switch (reward->rewardType)
|
switch (reward->rewardType)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
inventoryComponent->AddItem(reward->value, reward->count);
|
inventoryComponent->AddItem(reward->value, reward->count, eLootSourceType::LOOT_SOURCE_LEVEL_REWARD);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
auto* items = inventoryComponent->GetInventory(ITEMS);
|
auto* items = inventoryComponent->GetInventory(eInventoryType::ITEMS);
|
||||||
items->SetSize(items->GetSize() + reward->value);
|
items->SetSize(items->GetSize() + reward->value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -215,6 +215,8 @@ void DestroyableComponent::SetHealth(int32_t value) {
|
|||||||
|
|
||||||
void DestroyableComponent::SetMaxHealth(float value, bool playAnim) {
|
void DestroyableComponent::SetMaxHealth(float value, bool playAnim) {
|
||||||
m_DirtyHealth = true;
|
m_DirtyHealth = true;
|
||||||
|
// Used for playAnim if opted in for.
|
||||||
|
int32_t difference = static_cast<int32_t>(std::abs(m_fMaxHealth - value));
|
||||||
m_fMaxHealth = value;
|
m_fMaxHealth = value;
|
||||||
|
|
||||||
if (m_iHealth > m_fMaxHealth) {
|
if (m_iHealth > m_fMaxHealth) {
|
||||||
@ -225,22 +227,20 @@ void DestroyableComponent::SetMaxHealth(float value, bool playAnim) {
|
|||||||
// Now update the player bar
|
// Now update the player bar
|
||||||
if (!m_Parent->GetParentUser()) return;
|
if (!m_Parent->GetParentUser()) return;
|
||||||
AMFStringValue* amount = new AMFStringValue();
|
AMFStringValue* amount = new AMFStringValue();
|
||||||
amount->SetStringValue(std::to_string(value));
|
amount->SetStringValue(std::to_string(difference));
|
||||||
AMFStringValue* type = new AMFStringValue();
|
AMFStringValue* type = new AMFStringValue();
|
||||||
type->SetStringValue("health");
|
type->SetStringValue("health");
|
||||||
|
|
||||||
AMFArrayValue args;
|
AMFArrayValue args;
|
||||||
args.InsertValue("amount", amount);
|
args.InsertValue("amount", amount);
|
||||||
args.InsertValue("type", type);
|
args.InsertValue("type", type);
|
||||||
|
|
||||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
|
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
|
||||||
|
|
||||||
delete amount;
|
delete amount;
|
||||||
delete type;
|
delete type;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DestroyableComponent::SetArmor(int32_t value) {
|
void DestroyableComponent::SetArmor(int32_t value) {
|
||||||
@ -287,9 +287,8 @@ void DestroyableComponent::SetMaxArmor(float value, bool playAnim) {
|
|||||||
delete amount;
|
delete amount;
|
||||||
delete type;
|
delete type;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DestroyableComponent::SetImagination(int32_t value) {
|
void DestroyableComponent::SetImagination(int32_t value) {
|
||||||
@ -310,6 +309,8 @@ void DestroyableComponent::SetImagination(int32_t value) {
|
|||||||
|
|
||||||
void DestroyableComponent::SetMaxImagination(float value, bool playAnim) {
|
void DestroyableComponent::SetMaxImagination(float value, bool playAnim) {
|
||||||
m_DirtyHealth = true;
|
m_DirtyHealth = true;
|
||||||
|
// Used for playAnim if opted in for.
|
||||||
|
int32_t difference = static_cast<int32_t>(std::abs(m_fMaxImagination - value));
|
||||||
m_fMaxImagination = value;
|
m_fMaxImagination = value;
|
||||||
|
|
||||||
if (m_iImagination > m_fMaxImagination) {
|
if (m_iImagination > m_fMaxImagination) {
|
||||||
@ -320,22 +321,19 @@ void DestroyableComponent::SetMaxImagination(float value, bool playAnim) {
|
|||||||
// Now update the player bar
|
// Now update the player bar
|
||||||
if (!m_Parent->GetParentUser()) return;
|
if (!m_Parent->GetParentUser()) return;
|
||||||
AMFStringValue* amount = new AMFStringValue();
|
AMFStringValue* amount = new AMFStringValue();
|
||||||
amount->SetStringValue(std::to_string(value));
|
amount->SetStringValue(std::to_string(difference));
|
||||||
AMFStringValue* type = new AMFStringValue();
|
AMFStringValue* type = new AMFStringValue();
|
||||||
type->SetStringValue("imagination");
|
type->SetStringValue("imagination");
|
||||||
|
|
||||||
AMFArrayValue args;
|
AMFArrayValue args;
|
||||||
args.InsertValue("amount", amount);
|
args.InsertValue("amount", amount);
|
||||||
args.InsertValue("type", type);
|
args.InsertValue("type", type);
|
||||||
|
|
||||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
|
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
|
||||||
|
|
||||||
delete amount;
|
delete amount;
|
||||||
delete type;
|
delete type;
|
||||||
}
|
}
|
||||||
else {
|
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DestroyableComponent::SetDamageToAbsorb(int32_t value)
|
void DestroyableComponent::SetDamageToAbsorb(int32_t value)
|
||||||
@ -821,7 +819,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
|||||||
coinsTotal -= coinsToLoose;
|
coinsTotal -= coinsToLoose;
|
||||||
|
|
||||||
LootGenerator::Instance().DropLoot(m_Parent, m_Parent, -1, coinsToLoose, coinsToLoose);
|
LootGenerator::Instance().DropLoot(m_Parent, m_Parent, -1, coinsToLoose, coinsToLoose);
|
||||||
character->SetCoins(coinsTotal, LOOT_SOURCE_PICKUP);
|
character->SetCoins(coinsTotal, eLootSourceType::LOOT_SOURCE_PICKUP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,10 +84,13 @@ Inventory* InventoryComponent::GetInventory(const eInventoryType type)
|
|||||||
case eInventoryType::ITEMS:
|
case eInventoryType::ITEMS:
|
||||||
size = 20u;
|
size = 20u;
|
||||||
break;
|
break;
|
||||||
|
case eInventoryType::VAULT_MODELS:
|
||||||
case eInventoryType::VAULT_ITEMS:
|
case eInventoryType::VAULT_ITEMS:
|
||||||
size = 40u;
|
size = 40u;
|
||||||
break;
|
break;
|
||||||
|
case eInventoryType::VENDOR_BUYBACK:
|
||||||
|
size = 27u;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -138,6 +141,7 @@ const EquipmentMap& InventoryComponent::GetEquippedItems() const
|
|||||||
void InventoryComponent::AddItem(
|
void InventoryComponent::AddItem(
|
||||||
const LOT lot,
|
const LOT lot,
|
||||||
const uint32_t count,
|
const uint32_t count,
|
||||||
|
eLootSourceType lootSourceType,
|
||||||
eInventoryType inventoryType,
|
eInventoryType inventoryType,
|
||||||
const std::vector<LDFBaseData*>& config,
|
const std::vector<LDFBaseData*>& config,
|
||||||
const LWOOBJID parent,
|
const LWOOBJID parent,
|
||||||
@ -177,7 +181,7 @@ void InventoryComponent::AddItem(
|
|||||||
|
|
||||||
if (!config.empty() || bound)
|
if (!config.empty() || bound)
|
||||||
{
|
{
|
||||||
const auto slot = inventory->FindEmptySlot();
|
const auto slot = preferredSlot != -1 && inventory->IsSlotEmpty(preferredSlot) ? preferredSlot : inventory->FindEmptySlot();
|
||||||
|
|
||||||
if (slot == -1)
|
if (slot == -1)
|
||||||
{
|
{
|
||||||
@ -185,8 +189,7 @@ void InventoryComponent::AddItem(
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
auto* item = new Item(lot, inventory, slot, count, config, parent, showFlyingLoot, isModMoveAndEquip, subKey, bound, lootSourceType);
|
||||||
auto* item = new Item(lot, inventory, slot, count, config, parent, showFlyingLoot, isModMoveAndEquip, subKey, bound);
|
|
||||||
|
|
||||||
if (missions != nullptr && !IsTransferInventory(inventoryType))
|
if (missions != nullptr && !IsTransferInventory(inventoryType))
|
||||||
{
|
{
|
||||||
@ -204,7 +207,7 @@ void InventoryComponent::AddItem(
|
|||||||
|
|
||||||
auto stack = static_cast<uint32_t>(info.stackSize);
|
auto stack = static_cast<uint32_t>(info.stackSize);
|
||||||
|
|
||||||
if (inventoryType == BRICKS)
|
if (inventoryType == eInventoryType::BRICKS)
|
||||||
{
|
{
|
||||||
stack = 999;
|
stack = 999;
|
||||||
}
|
}
|
||||||
@ -221,7 +224,7 @@ void InventoryComponent::AddItem(
|
|||||||
|
|
||||||
left -= delta;
|
left -= delta;
|
||||||
|
|
||||||
existing->SetCount(existing->GetCount() + delta, false, true, showFlyingLoot);
|
existing->SetCount(existing->GetCount() + delta, false, true, showFlyingLoot, lootSourceType);
|
||||||
|
|
||||||
if (isModMoveAndEquip)
|
if (isModMoveAndEquip)
|
||||||
{
|
{
|
||||||
@ -281,8 +284,7 @@ void InventoryComponent::AddItem(
|
|||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
auto* item = new Item(lot, inventory, slot, size, {}, parent, showFlyingLoot, isModMoveAndEquip, subKey, false, lootSourceType);
|
||||||
auto* item = new Item(lot, inventory, slot, size, {}, parent, showFlyingLoot, isModMoveAndEquip, subKey);
|
|
||||||
|
|
||||||
isModMoveAndEquip = false;
|
isModMoveAndEquip = false;
|
||||||
}
|
}
|
||||||
@ -366,7 +368,7 @@ void InventoryComponent::MoveItemToInventory(Item* item, const eInventoryType in
|
|||||||
|
|
||||||
left -= delta;
|
left -= delta;
|
||||||
|
|
||||||
AddItem(lot, delta, inventory, {}, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, LWOOBJID_EMPTY, origin->GetType(), 0, false, preferredSlot);
|
AddItem(lot, delta, eLootSourceType::LOOT_SOURCE_NONE, inventory, {}, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, LWOOBJID_EMPTY, origin->GetType(), 0, false, preferredSlot);
|
||||||
|
|
||||||
item->SetCount(item->GetCount() - delta, false, false);
|
item->SetCount(item->GetCount() - delta, false, false);
|
||||||
|
|
||||||
@ -384,7 +386,7 @@ void InventoryComponent::MoveItemToInventory(Item* item, const eInventoryType in
|
|||||||
|
|
||||||
const auto delta = std::min<uint32_t>(item->GetCount(), count);
|
const auto delta = std::min<uint32_t>(item->GetCount(), count);
|
||||||
|
|
||||||
AddItem(lot, delta, inventory, config, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, LWOOBJID_EMPTY, origin->GetType(), 0, item->GetBound(), preferredSlot);
|
AddItem(lot, delta, eLootSourceType::LOOT_SOURCE_NONE, inventory, config, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, LWOOBJID_EMPTY, origin->GetType(), 0, item->GetBound(), preferredSlot);
|
||||||
|
|
||||||
item->SetCount(item->GetCount() - delta, false, false);
|
item->SetCount(item->GetCount() - delta, false, false);
|
||||||
}
|
}
|
||||||
|
@ -87,10 +87,12 @@ public:
|
|||||||
* @param sourceType the source of the item, used to determine if the item is dropped or mailed if the inventory is full
|
* @param sourceType the source of the item, used to determine if the item is dropped or mailed if the inventory is full
|
||||||
* @param bound whether this item is bound
|
* @param bound whether this item is bound
|
||||||
* @param preferredSlot the preferred slot to store this item
|
* @param preferredSlot the preferred slot to store this item
|
||||||
|
* @param lootSourceType The source of the loot. Defaults to none.
|
||||||
*/
|
*/
|
||||||
void AddItem(
|
void AddItem(
|
||||||
LOT lot,
|
LOT lot,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
|
eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE,
|
||||||
eInventoryType inventoryType = INVALID,
|
eInventoryType inventoryType = INVALID,
|
||||||
const std::vector<LDFBaseData*>& config = {},
|
const std::vector<LDFBaseData*>& config = {},
|
||||||
LWOOBJID parent = LWOOBJID_EMPTY,
|
LWOOBJID parent = LWOOBJID_EMPTY,
|
||||||
|
@ -615,7 +615,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position)
|
|||||||
|
|
||||||
GameMessages::SendRegisterPetDBID(m_Tamer, petSubKey, tamer->GetSystemAddress());
|
GameMessages::SendRegisterPetDBID(m_Tamer, petSubKey, tamer->GetSystemAddress());
|
||||||
|
|
||||||
inventoryComponent->AddItem(m_Parent->GetLOT(), 1, MODELS, {}, LWOOBJID_EMPTY, true, false, petSubKey);
|
inventoryComponent->AddItem(m_Parent->GetLOT(), 1, eLootSourceType::LOOT_SOURCE_ACTIVITY, eInventoryType::MODELS, {}, LWOOBJID_EMPTY, true, false, petSubKey);
|
||||||
auto* item = inventoryComponent->FindItemBySubKey(petSubKey, MODELS);
|
auto* item = inventoryComponent->FindItemBySubKey(petSubKey, MODELS);
|
||||||
|
|
||||||
if (item == nullptr)
|
if (item == nullptr)
|
||||||
|
@ -491,7 +491,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
|
|||||||
settings.push_back(propertyObjectID);
|
settings.push_back(propertyObjectID);
|
||||||
settings.push_back(modelType);
|
settings.push_back(modelType);
|
||||||
|
|
||||||
inventoryComponent->AddItem(6662, 1, HIDDEN, settings, LWOOBJID_EMPTY, false, false, spawnerId, INVALID, 13, false, -1);
|
inventoryComponent->AddItem(6662, 1, eLootSourceType::LOOT_SOURCE_DELETION, eInventoryType::HIDDEN, settings, LWOOBJID_EMPTY, false, false, spawnerId);
|
||||||
auto* item = inventoryComponent->FindItemBySubKey(spawnerId);
|
auto* item = inventoryComponent->FindItemBySubKey(spawnerId);
|
||||||
|
|
||||||
if (item == nullptr) {
|
if (item == nullptr) {
|
||||||
@ -526,7 +526,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
inventoryComponent->AddItem(model->GetLOT(), 1, INVALID, {}, LWOOBJID_EMPTY, false);
|
inventoryComponent->AddItem(model->GetLOT(), 1, eLootSourceType::LOOT_SOURCE_DELETION, INVALID, {}, LWOOBJID_EMPTY, false);
|
||||||
|
|
||||||
auto* item = inventoryComponent->FindItemByLot(model->GetLOT());
|
auto* item = inventoryComponent->FindItemByLot(model->GetLOT());
|
||||||
|
|
||||||
|
@ -53,6 +53,11 @@ RacingControlComponent::RacingControlComponent(Entity *parent)
|
|||||||
m_MainWorld = 1200;
|
m_MainWorld = 1200;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 1261:
|
||||||
|
m_ActivityID = 60;
|
||||||
|
m_MainWorld = 1260;
|
||||||
|
break;
|
||||||
|
|
||||||
case 1303:
|
case 1303:
|
||||||
m_ActivityID = 39;
|
m_ActivityID = 39;
|
||||||
m_MainWorld = 1300;
|
m_MainWorld = 1300;
|
||||||
@ -410,10 +415,13 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity *player,
|
|||||||
// If solo racing is enabled OR if there are 3 players in the race, progress placement tasks.
|
// If solo racing is enabled OR if there are 3 players in the race, progress placement tasks.
|
||||||
if(m_SoloRacing || m_LoadedPlayers > 2) {
|
if(m_SoloRacing || m_LoadedPlayers > 2) {
|
||||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, data->finished, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_FINISH_WITH_PLACEMENT); // Finish in 1st place on a race
|
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, data->finished, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_FINISH_WITH_PLACEMENT); // Finish in 1st place on a race
|
||||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, data->finished, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_FIRST_PLACE_MULTIPLE_TRACKS); // Finish in 1st place on multiple tracks.
|
if(data->finished == 1) {
|
||||||
if(m_Finished != 1) return;
|
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_FIRST_PLACE_MULTIPLE_TRACKS); // Finish in 1st place on multiple tracks.
|
||||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_WIN_RACE_IN_WORLD); // Finished first place in specific world.
|
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_WIN_RACE_IN_WORLD); // Finished first place in specific world.
|
||||||
|
}
|
||||||
|
if (data->finished == m_LoadedPlayers) {
|
||||||
|
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_LAST_PLACE_FINISH); // Finished first place in specific world.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (id == "ACT_RACE_EXIT_THE_RACE?" || id == "Exit") {
|
} else if (id == "ACT_RACE_EXIT_THE_RACE?" || id == "Exit") {
|
||||||
auto *vehicle = EntityManager::Instance()->GetEntity(data->vehicleID);
|
auto *vehicle = EntityManager::Instance()->GetEntity(data->vehicleID);
|
||||||
|
@ -28,7 +28,7 @@ ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent, int activit
|
|||||||
|
|
||||||
const auto mapID = m_ActivityInfo.instanceMapID;
|
const auto mapID = m_ActivityInfo.instanceMapID;
|
||||||
|
|
||||||
if ((mapID == 1203 || mapID == 1303 || mapID == 1403) && Game::config->GetValue("solo_racing") == "1") {
|
if ((mapID == 1203 || mapID == 1261 || mapID == 1303 || mapID == 1403) && Game::config->GetValue("solo_racing") == "1") {
|
||||||
m_ActivityInfo.minTeamSize = 1;
|
m_ActivityInfo.minTeamSize = 1;
|
||||||
m_ActivityInfo.minTeams = 1;
|
m_ActivityInfo.minTeams = 1;
|
||||||
}
|
}
|
||||||
|
@ -411,7 +411,7 @@ void GameMessages::SendGMLevelBroadcast(const LWOOBJID& objectID, uint8_t level)
|
|||||||
SEND_PACKET_BROADCAST
|
SEND_PACKET_BROADCAST
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameMessages::SendAddItemToInventoryClientSync(Entity* entity, const SystemAddress& sysAddr, Item* item, const LWOOBJID& objectID, bool showFlyingLoot, int itemCount, LWOOBJID subKey) {
|
void GameMessages::SendAddItemToInventoryClientSync(Entity* entity, const SystemAddress& sysAddr, Item* item, const LWOOBJID& objectID, bool showFlyingLoot, int itemCount, LWOOBJID subKey, eLootSourceType lootSourceType) {
|
||||||
CBITSTREAM
|
CBITSTREAM
|
||||||
CMSGHEADER
|
CMSGHEADER
|
||||||
|
|
||||||
@ -421,9 +421,8 @@ void GameMessages::SendAddItemToInventoryClientSync(Entity* entity, const System
|
|||||||
bitStream.Write(item->GetInfo().isBOE);
|
bitStream.Write(item->GetInfo().isBOE);
|
||||||
bitStream.Write(item->GetInfo().isBOP);
|
bitStream.Write(item->GetInfo().isBOP);
|
||||||
|
|
||||||
bitStream.Write0(); // Loot source
|
bitStream.Write(lootSourceType != eLootSourceType::LOOT_SOURCE_NONE); // Loot source
|
||||||
//if (invType != LOOTTYPE_NONE) bitStream.Write(invType);
|
if (lootSourceType != eLootSourceType::LOOT_SOURCE_NONE) bitStream.Write(lootSourceType);
|
||||||
|
|
||||||
LWONameValue extraInfo;
|
LWONameValue extraInfo;
|
||||||
|
|
||||||
auto config = item->GetConfig();
|
auto config = item->GetConfig();
|
||||||
@ -451,8 +450,8 @@ void GameMessages::SendAddItemToInventoryClientSync(Entity* entity, const System
|
|||||||
auto* inventory = item->GetInventory();
|
auto* inventory = item->GetInventory();
|
||||||
const auto inventoryType = inventory->GetType();
|
const auto inventoryType = inventory->GetType();
|
||||||
|
|
||||||
bitStream.Write(inventoryType != INVENTORY_DEFAULT);
|
bitStream.Write(inventoryType != eInventoryType::ITEMS);
|
||||||
if (inventoryType != INVENTORY_DEFAULT) bitStream.Write(inventoryType);
|
if (inventoryType != eInventoryType::ITEMS) bitStream.Write(inventoryType);
|
||||||
|
|
||||||
bitStream.Write(itemCount != 1);
|
bitStream.Write(itemCount != 1);
|
||||||
if (itemCount != 1) bitStream.Write(itemCount);
|
if (itemCount != 1) bitStream.Write(itemCount);
|
||||||
@ -566,8 +565,8 @@ void GameMessages::SendModifyLEGOScore(Entity* entity, const SystemAddress& sysA
|
|||||||
bitStream.Write((uint16_t)GAME_MSG_MODIFY_LEGO_SCORE);
|
bitStream.Write((uint16_t)GAME_MSG_MODIFY_LEGO_SCORE);
|
||||||
bitStream.Write(score);
|
bitStream.Write(score);
|
||||||
|
|
||||||
bitStream.Write(sourceType != LOOT_SOURCE_NONE);
|
bitStream.Write(sourceType != eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
if (sourceType != LOOT_SOURCE_NONE) bitStream.Write(sourceType);
|
if (sourceType != eLootSourceType::LOOT_SOURCE_NONE) bitStream.Write(sourceType);
|
||||||
|
|
||||||
SEND_PACKET
|
SEND_PACKET
|
||||||
}
|
}
|
||||||
@ -4700,7 +4699,7 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti
|
|||||||
|
|
||||||
inv->RemoveItem(tokenId, altCurrencyCost);
|
inv->RemoveItem(tokenId, altCurrencyCost);
|
||||||
|
|
||||||
inv->AddItem(item, count);
|
inv->AddItem(item, count, eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4725,8 +4724,8 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti
|
|||||||
inv->RemoveItem(itemComp.currencyLOT, altCurrencyCost);
|
inv->RemoveItem(itemComp.currencyLOT, altCurrencyCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
character->SetCoins(character->GetCoins() - (coinCost), LOOT_SOURCE_VENDOR);
|
character->SetCoins(character->GetCoins() - (coinCost), eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||||
inv->AddItem(item, count);
|
inv->AddItem(item, count, eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
||||||
@ -4769,12 +4768,12 @@ void GameMessages::HandleSellToVendor(RakNet::BitStream* inStream, Entity* entit
|
|||||||
if (Inventory::IsValidItem(itemComp.currencyLOT))
|
if (Inventory::IsValidItem(itemComp.currencyLOT))
|
||||||
{
|
{
|
||||||
const auto altCurrency = (itemComp.altCurrencyCost * sellScalar) * count;
|
const auto altCurrency = (itemComp.altCurrencyCost * sellScalar) * count;
|
||||||
inv->AddItem(itemComp.currencyLOT, std::floor(altCurrency)); // Return alt currencies like faction tokens.
|
inv->AddItem(itemComp.currencyLOT, std::floor(altCurrency), eLootSourceType::LOOT_SOURCE_VENDOR); // Return alt currencies like faction tokens.
|
||||||
}
|
}
|
||||||
|
|
||||||
//inv->RemoveItem(count, -1, iObjID);
|
//inv->RemoveItem(count, -1, iObjID);
|
||||||
inv->MoveItemToInventory(item, VENDOR_BUYBACK, count, true, false, true);
|
inv->MoveItemToInventory(item, eInventoryType::VENDOR_BUYBACK, count, true, false, true);
|
||||||
character->SetCoins(std::floor(character->GetCoins() + ((itemComp.baseValue * sellScalar)*count)), LOOT_SOURCE_VENDOR);
|
character->SetCoins(std::floor(character->GetCoins() + ((itemComp.baseValue * sellScalar)*count)), eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||||
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates
|
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates
|
||||||
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
||||||
}
|
}
|
||||||
@ -4836,7 +4835,7 @@ void GameMessages::HandleBuybackFromVendor(RakNet::BitStream* inStream, Entity*
|
|||||||
|
|
||||||
//inv->RemoveItem(count, -1, iObjID);
|
//inv->RemoveItem(count, -1, iObjID);
|
||||||
inv->MoveItemToInventory(item, Inventory::FindInventoryTypeForLot(item->GetLot()), count, true, false);
|
inv->MoveItemToInventory(item, Inventory::FindInventoryTypeForLot(item->GetLot()), count, true, false);
|
||||||
character->SetCoins(character->GetCoins() - cost, LOOT_SOURCE_VENDOR);
|
character->SetCoins(character->GetCoins() - cost, eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||||
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates
|
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates
|
||||||
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
||||||
}
|
}
|
||||||
@ -5103,7 +5102,7 @@ void GameMessages::HandleModularBuildConvertModel(RakNet::BitStream* inStream, E
|
|||||||
|
|
||||||
item->Disassemble(TEMP_MODELS);
|
item->Disassemble(TEMP_MODELS);
|
||||||
|
|
||||||
item->SetCount(item->GetCount() - 1, false, false);
|
item->SetCount(item->GetCount() - 1, false, false, true, eLootSourceType::LOOT_SOURCE_QUICKBUILD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameMessages::HandleSetFlag(RakNet::BitStream* inStream, Entity* entity) {
|
void GameMessages::HandleSetFlag(RakNet::BitStream* inStream, Entity* entity) {
|
||||||
@ -5269,7 +5268,7 @@ void GameMessages::HandlePickupCurrency(RakNet::BitStream* inStream, Entity* ent
|
|||||||
|
|
||||||
auto* ch = entity->GetCharacter();
|
auto* ch = entity->GetCharacter();
|
||||||
if (entity->CanPickupCoins(currency)) {
|
if (entity->CanPickupCoins(currency)) {
|
||||||
ch->SetCoins(ch->GetCoins() + currency, LOOT_SOURCE_PICKUP);
|
ch->SetCoins(ch->GetCoins() + currency, eLootSourceType::LOOT_SOURCE_PICKUP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5433,6 +5432,8 @@ void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream* inStream, En
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iStackCount = std::min<uint32_t>(item->GetCount(), iStackCount);
|
||||||
|
|
||||||
if (bConfirmed) {
|
if (bConfirmed) {
|
||||||
for (auto i = 0; i < iStackCount; ++i) {
|
for (auto i = 0; i < iStackCount; ++i) {
|
||||||
if (eInvType == eInventoryType::MODELS)
|
if (eInvType == eInventoryType::MODELS)
|
||||||
@ -5482,8 +5483,8 @@ void GameMessages::HandleMoveItemInInventory(RakNet::BitStream* inStream, Entity
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GameMessages::HandleMoveItemBetweenInventoryTypes(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
void GameMessages::HandleMoveItemBetweenInventoryTypes(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||||
int inventoryTypeA;
|
eInventoryType inventoryTypeA;
|
||||||
int inventoryTypeB;
|
eInventoryType inventoryTypeB;
|
||||||
LWOOBJID objectID;
|
LWOOBJID objectID;
|
||||||
bool showFlyingLoot = true;
|
bool showFlyingLoot = true;
|
||||||
bool stackCountIsDefault = false;
|
bool stackCountIsDefault = false;
|
||||||
@ -5500,7 +5501,7 @@ void GameMessages::HandleMoveItemBetweenInventoryTypes(RakNet::BitStream* inStre
|
|||||||
inStream->Read(templateIDIsDefault);
|
inStream->Read(templateIDIsDefault);
|
||||||
if (templateIDIsDefault) inStream->Read(templateID);
|
if (templateIDIsDefault) inStream->Read(templateID);
|
||||||
|
|
||||||
InventoryComponent* inv = static_cast<InventoryComponent*>(entity->GetComponent(COMPONENT_TYPE_INVENTORY));
|
auto inv = entity->GetComponent<InventoryComponent>();
|
||||||
if (!inv) return;
|
if (!inv) return;
|
||||||
|
|
||||||
auto* item = inv->FindItemById(objectID);
|
auto* item = inv->FindItemById(objectID);
|
||||||
@ -5521,7 +5522,7 @@ void GameMessages::HandleMoveItemBetweenInventoryTypes(RakNet::BitStream* inStre
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inv->MoveItemToInventory(item, static_cast<eInventoryType>(inventoryTypeB), stackCount, showFlyingLoot, false);
|
inv->MoveItemToInventory(item, inventoryTypeB, stackCount, showFlyingLoot);
|
||||||
EntityManager::Instance()->SerializeEntity(entity);
|
EntityManager::Instance()->SerializeEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5588,11 +5589,11 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
|
|||||||
|
|
||||||
if (count == 3)
|
if (count == 3)
|
||||||
{
|
{
|
||||||
inv->AddItem(6416, 1, MODELS, config);
|
inv->AddItem(6416, 1, eLootSourceType::LOOT_SOURCE_QUICKBUILD, eInventoryType::MODELS, config);
|
||||||
}
|
}
|
||||||
else if (count == 7)
|
else if (count == 7)
|
||||||
{
|
{
|
||||||
inv->AddItem(8092, 1, MODELS, config);
|
inv->AddItem(8092, 1, eLootSourceType::LOOT_SOURCE_QUICKBUILD, eInventoryType::MODELS, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* missionComponent = character->GetComponent<MissionComponent>();
|
auto* missionComponent = character->GetComponent<MissionComponent>();
|
||||||
@ -5622,7 +5623,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
|
|||||||
|
|
||||||
for (auto* item : items)
|
for (auto* item : items)
|
||||||
{
|
{
|
||||||
inv->MoveItemToInventory(item, MODELS, item->GetCount(), false);
|
inv->MoveItemToInventory(item, eInventoryType::MODELS, item->GetCount(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5737,7 +5738,7 @@ void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Enti
|
|||||||
|
|
||||||
for (auto* item : items)
|
for (auto* item : items)
|
||||||
{
|
{
|
||||||
inv->MoveItemToInventory(item, MODELS, item->GetCount(), false, false);
|
inv->MoveItemToInventory(item, eInventoryType::MODELS, item->GetCount(), false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5763,7 +5764,7 @@ void GameMessages::HandleModularBuildMoveAndEquip(RakNet::BitStream* inStream, E
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
inv->MoveItemToInventory(item, MODELS, 1, false, true);
|
inv->MoveItemToInventory(item, eInventoryType::MODELS, 1, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameMessages::HandlePickupItem(RakNet::BitStream* inStream, Entity* entity) {
|
void GameMessages::HandlePickupItem(RakNet::BitStream* inStream, Entity* entity) {
|
||||||
|
@ -61,7 +61,7 @@ namespace GameMessages {
|
|||||||
void SendGMLevelBroadcast(const LWOOBJID& objectID, uint8_t level);
|
void SendGMLevelBroadcast(const LWOOBJID& objectID, uint8_t level);
|
||||||
void SendChatModeUpdate(const LWOOBJID& objectID, uint8_t level);
|
void SendChatModeUpdate(const LWOOBJID& objectID, uint8_t level);
|
||||||
|
|
||||||
void SendAddItemToInventoryClientSync(Entity* entity, const SystemAddress& sysAddr, Item* item, const LWOOBJID& objectID, bool showFlyingLoot, int itemCount, LWOOBJID subKey = LWOOBJID_EMPTY);
|
void SendAddItemToInventoryClientSync(Entity* entity, const SystemAddress& sysAddr, Item* item, const LWOOBJID& objectID, bool showFlyingLoot, int itemCount, LWOOBJID subKey = LWOOBJID_EMPTY, eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
void SendNotifyClientFlagChange(const LWOOBJID& objectID, int iFlagID, bool bFlag, const SystemAddress& sysAddr);
|
void SendNotifyClientFlagChange(const LWOOBJID& objectID, int iFlagID, bool bFlag, const SystemAddress& sysAddr);
|
||||||
void SendChangeObjectWorldState(const LWOOBJID& objectID, int state, const SystemAddress& sysAddr);
|
void SendChangeObjectWorldState(const LWOOBJID& objectID, int state, const SystemAddress& sysAddr);
|
||||||
|
|
||||||
|
@ -90,17 +90,17 @@ int32_t Inventory::FindEmptySlot()
|
|||||||
{
|
{
|
||||||
if (free <= 6) // Up from 1
|
if (free <= 6) // Up from 1
|
||||||
{
|
{
|
||||||
if (type != ITEMS && type != VAULT_ITEMS)
|
if (type != ITEMS && type != VAULT_ITEMS && type != eInventoryType::VAULT_MODELS)
|
||||||
{
|
{
|
||||||
uint32_t newSize = size;
|
uint32_t newSize = size;
|
||||||
|
|
||||||
if (type == MODELS || type == VAULT_MODELS)
|
if (type == MODELS)
|
||||||
{
|
{
|
||||||
newSize = 240;
|
newSize = 240;
|
||||||
}
|
}
|
||||||
else
|
else if (type == eInventoryType::VENDOR_BUYBACK)
|
||||||
{
|
{
|
||||||
newSize += 20;
|
newSize += 9u;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newSize > GetSize())
|
if (newSize > GetSize())
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
class Inventory;
|
class Inventory;
|
||||||
|
|
||||||
|
|
||||||
Item::Item(const LWOOBJID id, const LOT lot, Inventory* inventory, const uint32_t slot, const uint32_t count, const bool bound, const std::vector<LDFBaseData*>& config, const LWOOBJID parent, LWOOBJID subKey)
|
Item::Item(const LWOOBJID id, const LOT lot, Inventory* inventory, const uint32_t slot, const uint32_t count, const bool bound, const std::vector<LDFBaseData*>& config, const LWOOBJID parent, LWOOBJID subKey, eLootSourceType lootSourceType)
|
||||||
{
|
{
|
||||||
if (!Inventory::IsValidItem(lot))
|
if (!Inventory::IsValidItem(lot))
|
||||||
{
|
{
|
||||||
@ -46,7 +46,8 @@ Item::Item(
|
|||||||
bool showFlyingLoot,
|
bool showFlyingLoot,
|
||||||
bool isModMoveAndEquip,
|
bool isModMoveAndEquip,
|
||||||
LWOOBJID subKey,
|
LWOOBJID subKey,
|
||||||
bool bound)
|
bool bound,
|
||||||
|
eLootSourceType lootSourceType)
|
||||||
{
|
{
|
||||||
if (!Inventory::IsValidItem(lot))
|
if (!Inventory::IsValidItem(lot))
|
||||||
{
|
{
|
||||||
@ -80,8 +81,7 @@ Item::Item(
|
|||||||
inventory->AddManagedItem(this);
|
inventory->AddManagedItem(this);
|
||||||
|
|
||||||
auto* entity = inventory->GetComponent()->GetParent();
|
auto* entity = inventory->GetComponent()->GetParent();
|
||||||
|
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, static_cast<int>(this->count), subKey, lootSourceType);
|
||||||
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, static_cast<int>(this->count), subKey);
|
|
||||||
|
|
||||||
if (isModMoveAndEquip)
|
if (isModMoveAndEquip)
|
||||||
{
|
{
|
||||||
@ -148,7 +148,7 @@ PreconditionExpression* Item::GetPreconditionExpression() const
|
|||||||
return preconditions;
|
return preconditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item::SetCount(const uint32_t value, const bool silent, const bool disassemble, const bool showFlyingLoot)
|
void Item::SetCount(const uint32_t value, const bool silent, const bool disassemble, const bool showFlyingLoot, eLootSourceType lootSourceType)
|
||||||
{
|
{
|
||||||
if (value == count)
|
if (value == count)
|
||||||
{
|
{
|
||||||
@ -176,7 +176,7 @@ void Item::SetCount(const uint32_t value, const bool silent, const bool disassem
|
|||||||
|
|
||||||
if (value > count)
|
if (value > count)
|
||||||
{
|
{
|
||||||
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, delta);
|
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, delta, LWOOBJID_EMPTY, lootSourceType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -340,7 +340,7 @@ bool Item::UseNonEquip()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LootGenerator::Instance().GiveLoot(inventory->GetComponent()->GetParent(), result);
|
LootGenerator::Instance().GiveLoot(inventory->GetComponent()->GetParent(), result, eLootSourceType::LOOT_SOURCE_CONSUMPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
inventory->GetComponent()->RemoveItem(lot, 1);
|
inventory->GetComponent()->RemoveItem(lot, 1);
|
||||||
@ -374,7 +374,7 @@ void Item::Disassemble(const eInventoryType inventoryType)
|
|||||||
|
|
||||||
for (const auto mod : modArray)
|
for (const auto mod : modArray)
|
||||||
{
|
{
|
||||||
inventory->GetComponent()->AddItem(mod, 1, inventoryType);
|
inventory->GetComponent()->AddItem(mod, 1, eLootSourceType::LOOT_SOURCE_DELETION, inventoryType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -472,7 +472,7 @@ void Item::DisassembleModel()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetInventory()->GetComponent()->AddItem(brickID[0].NDObjectID, 1);
|
GetInventory()->GetComponent()->AddItem(brickID[0].NDObjectID, 1, eLootSourceType::LOOT_SOURCE_DELETION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,8 @@ public:
|
|||||||
bool bound,
|
bool bound,
|
||||||
const std::vector<LDFBaseData*>& config,
|
const std::vector<LDFBaseData*>& config,
|
||||||
LWOOBJID parent,
|
LWOOBJID parent,
|
||||||
LWOOBJID subKey
|
LWOOBJID subKey,
|
||||||
|
eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,7 +63,8 @@ public:
|
|||||||
bool showFlyingLoot = true,
|
bool showFlyingLoot = true,
|
||||||
bool isModMoveAndEquip = false,
|
bool isModMoveAndEquip = false,
|
||||||
LWOOBJID subKey = LWOOBJID_EMPTY,
|
LWOOBJID subKey = LWOOBJID_EMPTY,
|
||||||
bool bound = false
|
bool bound = false,
|
||||||
|
eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE
|
||||||
);
|
);
|
||||||
|
|
||||||
~Item();
|
~Item();
|
||||||
@ -86,7 +88,7 @@ public:
|
|||||||
* @param disassemble if items were removed, this returns all the sub parts of the item individually if it had assembly part lots
|
* @param disassemble if items were removed, this returns all the sub parts of the item individually if it had assembly part lots
|
||||||
* @param showFlyingLoot shows flying loot to the client, if not silent
|
* @param showFlyingLoot shows flying loot to the client, if not silent
|
||||||
*/
|
*/
|
||||||
void SetCount(uint32_t value, bool silent = false, bool disassemble = true, bool showFlyingLoot = true);
|
void SetCount(uint32_t value, bool silent = false, bool disassemble = true, bool showFlyingLoot = true, eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of items this item represents (e.g. for stacks)
|
* Returns the number of items this item represents (e.g. for stacks)
|
||||||
|
@ -430,7 +430,7 @@ void Mission::YieldRewards() {
|
|||||||
|
|
||||||
int32_t coinsToSend = 0;
|
int32_t coinsToSend = 0;
|
||||||
if (info->LegoScore > 0) {
|
if (info->LegoScore > 0) {
|
||||||
eLootSourceType lootSource = info->isMission ? LOOT_SOURCE_MISSION : LOOT_SOURCE_ACHIEVEMENT;
|
eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT;
|
||||||
if(characterComponent->GetLevel() >= dZoneManager::Instance()->GetMaxLevel()) {
|
if(characterComponent->GetLevel() >= dZoneManager::Instance()->GetMaxLevel()) {
|
||||||
// Since the character is at the level cap we reward them with coins instead of UScore.
|
// Since the character is at the level cap we reward them with coins instead of UScore.
|
||||||
coinsToSend += info->LegoScore * dZoneManager::Instance()->GetLevelCapCurrencyConversion();
|
coinsToSend += info->LegoScore * dZoneManager::Instance()->GetLevelCapCurrencyConversion();
|
||||||
@ -463,11 +463,11 @@ void Mission::YieldRewards() {
|
|||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inventoryComponent->AddItem(pair.first, count);
|
inventoryComponent->AddItem(pair.first, count, IsMission() ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->reward_currency_repeatable > 0 || coinsToSend > 0) {
|
if (info->reward_currency_repeatable > 0 || coinsToSend > 0) {
|
||||||
eLootSourceType lootSource = info->isMission ? LOOT_SOURCE_MISSION : LOOT_SOURCE_ACHIEVEMENT;
|
eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT;
|
||||||
character->SetCoins(character->GetCoins() + info->reward_currency_repeatable + coinsToSend, lootSource);
|
character->SetCoins(character->GetCoins() + info->reward_currency_repeatable + coinsToSend, lootSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,11 +496,11 @@ void Mission::YieldRewards() {
|
|||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inventoryComponent->AddItem(pair.first, count);
|
inventoryComponent->AddItem(pair.first, count, IsMission() ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->reward_currency > 0 || coinsToSend > 0) {
|
if (info->reward_currency > 0 || coinsToSend > 0) {
|
||||||
eLootSourceType lootSource = info->isMission ? LOOT_SOURCE_MISSION : LOOT_SOURCE_ACHIEVEMENT;
|
eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT;
|
||||||
character->SetCoins(character->GetCoins() + info->reward_currency + coinsToSend, lootSource);
|
character->SetCoins(character->GetCoins() + info->reward_currency + coinsToSend, lootSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,9 +511,11 @@ void Mission::YieldRewards() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (info->reward_bankinventory > 0) {
|
if (info->reward_bankinventory > 0) {
|
||||||
auto* inventory = inventoryComponent->GetInventory(VAULT_ITEMS);
|
auto* inventory = inventoryComponent->GetInventory(eInventoryType::VAULT_ITEMS);
|
||||||
|
auto modelInventory = inventoryComponent->GetInventory(eInventoryType::VAULT_MODELS);
|
||||||
|
|
||||||
inventory->SetSize(inventory->GetSize() + info->reward_bankinventory);
|
inventory->SetSize(inventory->GetSize() + info->reward_bankinventory);
|
||||||
|
modelInventory->SetSize(modelInventory->GetSize() + info->reward_bankinventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->reward_reputation > 0) {
|
if (info->reward_reputation > 0) {
|
||||||
@ -526,11 +528,11 @@ void Mission::YieldRewards() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (info->reward_maxhealth > 0) {
|
if (info->reward_maxhealth > 0) {
|
||||||
destroyableComponent->SetMaxHealth(destroyableComponent->GetMaxHealth() + static_cast<float>(info->reward_maxhealth));
|
destroyableComponent->SetMaxHealth(destroyableComponent->GetMaxHealth() + static_cast<float>(info->reward_maxhealth), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->reward_maximagination > 0) {
|
if (info->reward_maximagination > 0) {
|
||||||
destroyableComponent->SetMaxImagination(destroyableComponent->GetMaxImagination() + static_cast<float>(info->reward_maximagination));
|
destroyableComponent->SetMaxImagination(destroyableComponent->GetMaxImagination() + static_cast<float>(info->reward_maximagination), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityManager::Instance()->SerializeEntity(entity);
|
EntityManager::Instance()->SerializeEntity(entity);
|
||||||
|
@ -183,7 +183,13 @@ bool MissionTask::InParameters(const uint32_t value) const
|
|||||||
|
|
||||||
bool MissionTask::IsComplete() const
|
bool MissionTask::IsComplete() const
|
||||||
{
|
{
|
||||||
return progress >= info->targetValue;
|
// Mission 668 has task uid 984 which is a bit mask. Its completion value is 3.
|
||||||
|
if (info->uid == 984) {
|
||||||
|
return progress >= 3;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return progress >= info->targetValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -423,12 +429,23 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
|||||||
|
|
||||||
if (parameters[0] != associate) break;
|
if (parameters[0] != associate) break;
|
||||||
|
|
||||||
if (associate == 1 || associate == 15 || associate == 2 || associate == 3)
|
if (associate == 1 || associate == 2 || associate == 3)
|
||||||
{
|
{
|
||||||
if (value > info->targetValue) break;
|
if (value > info->targetValue) break;
|
||||||
|
|
||||||
AddProgress(info->targetValue);
|
AddProgress(info->targetValue);
|
||||||
}
|
}
|
||||||
|
// task 15 is a bit mask!
|
||||||
|
else if (associate == 15) {
|
||||||
|
if (!InAllTargets(value)) break;
|
||||||
|
|
||||||
|
auto tempProgress = GetProgress();
|
||||||
|
// If we won at Nimbus Station, set bit 0
|
||||||
|
if (value == 1203) SetProgress(tempProgress |= 1 << 0);
|
||||||
|
// If we won at Gnarled Forest, set bit 1
|
||||||
|
else if (value == 1303) SetProgress(tempProgress |= 1 << 1);
|
||||||
|
// If both bits are set, then the client sees the mission as complete.
|
||||||
|
}
|
||||||
else if (associate == 10)
|
else if (associate == 10)
|
||||||
{
|
{
|
||||||
// If the player did not crash during the race, progress this task by count.
|
// If the player did not crash during the race, progress this task by count.
|
||||||
|
@ -268,15 +268,15 @@ std::unordered_map<LOT, int32_t> LootGenerator::RollLootMatrix(uint32_t matrixIn
|
|||||||
return drops;
|
return drops;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LootGenerator::GiveLoot(Entity* player, uint32_t matrixIndex) {
|
void LootGenerator::GiveLoot(Entity* player, uint32_t matrixIndex, eLootSourceType lootSourceType) {
|
||||||
player = player->GetOwner(); // If the owner is overwritten, we collect that here
|
player = player->GetOwner(); // If the owner is overwritten, we collect that here
|
||||||
|
|
||||||
std::unordered_map<LOT, int32_t> result = RollLootMatrix(player, matrixIndex);
|
std::unordered_map<LOT, int32_t> result = RollLootMatrix(player, matrixIndex);
|
||||||
|
|
||||||
GiveLoot(player, result);
|
GiveLoot(player, result, lootSourceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LootGenerator::GiveLoot(Entity* player, std::unordered_map<LOT, int32_t>& result) {
|
void LootGenerator::GiveLoot(Entity* player, std::unordered_map<LOT, int32_t>& result, eLootSourceType lootSourceType) {
|
||||||
player = player->GetOwner(); // if the owner is overwritten, we collect that here
|
player = player->GetOwner(); // if the owner is overwritten, we collect that here
|
||||||
|
|
||||||
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
|
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||||
@ -285,7 +285,7 @@ void LootGenerator::GiveLoot(Entity* player, std::unordered_map<LOT, int32_t>& r
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (const auto& pair : result) {
|
for (const auto& pair : result) {
|
||||||
inventoryComponent->AddItem(pair.first, pair.second);
|
inventoryComponent->AddItem(pair.first, pair.second, lootSourceType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,13 +314,13 @@ void LootGenerator::GiveActivityLoot(Entity* player, Entity* source, uint32_t ac
|
|||||||
maxCoins = currencyTable[0].maxvalue;
|
maxCoins = currencyTable[0].maxvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
GiveLoot(player, selectedReward->LootMatrixIndex);
|
GiveLoot(player, selectedReward->LootMatrixIndex, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||||
|
|
||||||
uint32_t coins = (int)(minCoins + GeneralUtils::GenerateRandomNumber<float>(0, 1) * (maxCoins - minCoins));
|
uint32_t coins = (int)(minCoins + GeneralUtils::GenerateRandomNumber<float>(0, 1) * (maxCoins - minCoins));
|
||||||
|
|
||||||
auto* character = player->GetCharacter();
|
auto* character = player->GetCharacter();
|
||||||
|
|
||||||
character->SetCoins(character->GetCoins() + coins, LOOT_SOURCE_ACTIVITY);
|
character->SetCoins(character->GetCoins() + coins, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LootGenerator::DropLoot(Entity* player, Entity* killedObject, uint32_t matrixIndex, uint32_t minCoins, uint32_t maxCoins) {
|
void LootGenerator::DropLoot(Entity* player, Entity* killedObject, uint32_t matrixIndex, uint32_t minCoins, uint32_t maxCoins) {
|
||||||
|
@ -47,8 +47,8 @@ class LootGenerator : public Singleton<LootGenerator> {
|
|||||||
|
|
||||||
std::unordered_map<LOT, int32_t> RollLootMatrix(Entity* player, uint32_t matrixIndex);
|
std::unordered_map<LOT, int32_t> RollLootMatrix(Entity* player, uint32_t matrixIndex);
|
||||||
std::unordered_map<LOT, int32_t> RollLootMatrix(uint32_t matrixIndex);
|
std::unordered_map<LOT, int32_t> RollLootMatrix(uint32_t matrixIndex);
|
||||||
void GiveLoot(Entity* player, uint32_t matrixIndex);
|
void GiveLoot(Entity* player, uint32_t matrixIndex, eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
void GiveLoot(Entity* player, std::unordered_map<LOT, int32_t>& result);
|
void GiveLoot(Entity* player, std::unordered_map<LOT, int32_t>& result, eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
void GiveActivityLoot(Entity* player, Entity* source, uint32_t activityID, int32_t rating = 0);
|
void GiveActivityLoot(Entity* player, Entity* source, uint32_t activityID, int32_t rating = 0);
|
||||||
void DropLoot(Entity* player, Entity* killedObject, uint32_t matrixIndex, uint32_t minCoins, uint32_t maxCoins);
|
void DropLoot(Entity* player, Entity* killedObject, uint32_t matrixIndex, uint32_t minCoins, uint32_t maxCoins);
|
||||||
void DropLoot(Entity* player, Entity* killedObject, std::unordered_map<LOT, int32_t>& result, uint32_t minCoins, uint32_t maxCoins);
|
void DropLoot(Entity* player, Entity* killedObject, std::unordered_map<LOT, int32_t>& result, uint32_t minCoins, uint32_t maxCoins);
|
||||||
|
@ -262,7 +262,7 @@ void Mail::HandleSendMail(RakNet::BitStream* packet, const SystemAddress& sysAdd
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mail::SendSendResponse(sysAddr, Mail::MailSendResponse::Success);
|
Mail::SendSendResponse(sysAddr, Mail::MailSendResponse::Success);
|
||||||
entity->GetCharacter()->SetCoins(entity->GetCharacter()->GetCoins() - mailCost, LOOT_SOURCE_MAIL);
|
entity->GetCharacter()->SetCoins(entity->GetCharacter()->GetCoins() - mailCost, eLootSourceType::LOOT_SOURCE_MAIL);
|
||||||
|
|
||||||
Game::logger->Log("Mail", "Seeing if we need to remove item with ID/count/LOT: %i %i %i\n", itemID, attachmentCount, itemLOT);
|
Game::logger->Log("Mail", "Seeing if we need to remove item with ID/count/LOT: %i %i %i\n", itemID, attachmentCount, itemLOT);
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ void Mail::HandleAttachmentCollect(RakNet::BitStream* packet, const SystemAddres
|
|||||||
auto inv = static_cast<InventoryComponent*>(player->GetComponent(COMPONENT_TYPE_INVENTORY));
|
auto inv = static_cast<InventoryComponent*>(player->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||||
if (!inv) return;
|
if (!inv) return;
|
||||||
|
|
||||||
inv->AddItem(attachmentLOT, attachmentCount);
|
inv->AddItem(attachmentLOT, attachmentCount, eLootSourceType::LOOT_SOURCE_MAIL);
|
||||||
|
|
||||||
Mail::SendAttachmentRemoveConfirm(sysAddr, mailID);
|
Mail::SendAttachmentRemoveConfirm(sysAddr, mailID);
|
||||||
|
|
||||||
|
@ -70,49 +70,49 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entity* entity, const SystemAddress& sysAddr) {
|
void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entity* entity, const SystemAddress& sysAddr) {
|
||||||
std::string chatCommand;
|
std::string chatCommand;
|
||||||
std::vector<std::string> args;
|
std::vector<std::string> args;
|
||||||
|
|
||||||
uint32_t breakIndex = 0;
|
uint32_t breakIndex = 0;
|
||||||
for (uint32_t i = 1; i < command.size(); ++i) {
|
for (uint32_t i = 1; i < command.size(); ++i) {
|
||||||
if (command[i] == L' ') {
|
if (command[i] == L' ') {
|
||||||
breakIndex = i;
|
breakIndex = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
chatCommand.push_back(static_cast<unsigned char>(command[i]));
|
chatCommand.push_back(static_cast<unsigned char>(command[i]));
|
||||||
breakIndex++;
|
breakIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t index = ++breakIndex;
|
uint32_t index = ++breakIndex;
|
||||||
while (true) {
|
while (true) {
|
||||||
std::string arg;
|
std::string arg;
|
||||||
|
|
||||||
while (index < command.size()) {
|
while (index < command.size()) {
|
||||||
if (command[index] == L' ') {
|
if (command[index] == L' ') {
|
||||||
args.push_back(arg);
|
args.push_back(arg);
|
||||||
arg = "";
|
arg = "";
|
||||||
index++;
|
index++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
arg.push_back(static_cast<char>(command[index]));
|
arg.push_back(static_cast<char>(command[index]));
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg != "") {
|
if (arg != "") {
|
||||||
args.push_back(arg);
|
args.push_back(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Game::logger->Log("SlashCommandHandler", "Received chat command \"%s\"\n", GeneralUtils::UTF16ToWTF8(command).c_str());
|
||||||
|
|
||||||
|
User* user = UserManager::Instance()->GetUser(sysAddr);
|
||||||
|
if ((chatCommand == "setgmlevel" || chatCommand == "makegm" || chatCommand == "gmlevel") && user->GetMaxGMLevel() > GAME_MASTER_LEVEL_CIVILIAN) {
|
||||||
|
if (args.size() != 1) return;
|
||||||
|
|
||||||
//Game::logger->Log("SlashCommandHandler", "Received chat command \"%s\"\n", GeneralUtils::UTF16ToWTF8(command).c_str());
|
|
||||||
|
|
||||||
User* user = UserManager::Instance()->GetUser(sysAddr);
|
|
||||||
if ((chatCommand == "setgmlevel" || chatCommand == "makegm" || chatCommand == "gmlevel") && user->GetMaxGMLevel() > GAME_MASTER_LEVEL_CIVILIAN) {
|
|
||||||
if (args.size() != 1) return;
|
|
||||||
|
|
||||||
uint32_t level;
|
uint32_t level;
|
||||||
|
|
||||||
if (!GeneralUtils::TryParse(args[0], level))
|
if (!GeneralUtils::TryParse(args[0], level))
|
||||||
@ -133,10 +133,10 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
level = user->GetMaxGMLevel();
|
level = user->GetMaxGMLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level == entity->GetGMLevel()) return;
|
if (level == entity->GetGMLevel()) return;
|
||||||
bool success = user->GetMaxGMLevel() >= level;
|
bool success = user->GetMaxGMLevel() >= level;
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
if (entity->GetGMLevel() > GAME_MASTER_LEVEL_CIVILIAN && level == GAME_MASTER_LEVEL_CIVILIAN)
|
if (entity->GetGMLevel() > GAME_MASTER_LEVEL_CIVILIAN && level == GAME_MASTER_LEVEL_CIVILIAN)
|
||||||
{
|
{
|
||||||
GameMessages::SendToggleGMInvis(entity->GetObjectID(), false, UNASSIGNED_SYSTEM_ADDRESS);
|
GameMessages::SendToggleGMInvis(entity->GetObjectID(), false, UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
@ -146,12 +146,12 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
GameMessages::SendToggleGMInvis(entity->GetObjectID(), true, UNASSIGNED_SYSTEM_ADDRESS);
|
GameMessages::SendToggleGMInvis(entity->GetObjectID(), true, UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldPackets::SendGMLevelChange(sysAddr, success, user->GetMaxGMLevel(), entity->GetGMLevel(), level);
|
WorldPackets::SendGMLevelChange(sysAddr, success, user->GetMaxGMLevel(), entity->GetGMLevel(), level);
|
||||||
GameMessages::SendChatModeUpdate(entity->GetObjectID(), level);
|
GameMessages::SendChatModeUpdate(entity->GetObjectID(), level);
|
||||||
entity->SetGMLevel(level);
|
entity->SetGMLevel(level);
|
||||||
Game::logger->Log("SlashCommandHandler", "User %s (%i) has changed their GM level to %i for charID %llu\n", user->GetUsername().c_str(), user->GetAccountID(), level, entity->GetObjectID());
|
Game::logger->Log("SlashCommandHandler", "User %s (%i) has changed their GM level to %i for charID %llu\n", user->GetUsername().c_str(), user->GetAccountID(), level, entity->GetObjectID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DEVELOPER_SERVER
|
#ifndef DEVELOPER_SERVER
|
||||||
if ((entity->GetGMLevel() > user->GetMaxGMLevel()) || (entity->GetGMLevel() > GAME_MASTER_LEVEL_CIVILIAN && user->GetMaxGMLevel() == GAME_MASTER_LEVEL_JUNIOR_DEVELOPER))
|
if ((entity->GetGMLevel() > user->GetMaxGMLevel()) || (entity->GetGMLevel() > GAME_MASTER_LEVEL_CIVILIAN && user->GetMaxGMLevel() == GAME_MASTER_LEVEL_JUNIOR_DEVELOPER))
|
||||||
@ -180,10 +180,10 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
|
|
||||||
character->SetPvpEnabled(!character->GetPvpEnabled());
|
character->SetPvpEnabled(!character->GetPvpEnabled());
|
||||||
EntityManager::Instance()->SerializeEntity(entity);
|
EntityManager::Instance()->SerializeEntity(entity);
|
||||||
|
|
||||||
std::stringstream message;
|
std::stringstream message;
|
||||||
message << character->GetName() << " changed their PVP flag to " << std::to_string(character->GetPvpEnabled()) << "!";
|
message << character->GetName() << " changed their PVP flag to " << std::to_string(character->GetPvpEnabled()) << "!";
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(UNASSIGNED_SYSTEM_ADDRESS, GeneralUtils::ASCIIToUTF16(message.str()), true);
|
ChatPackets::SendSystemMessage(UNASSIGNED_SYSTEM_ADDRESS, GeneralUtils::ASCIIToUTF16(message.str()), true);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -212,14 +212,14 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
{
|
{
|
||||||
std::stringstream message;
|
std::stringstream message;
|
||||||
message << "Your latest ping: " << std::to_string(Game::server->GetLatestPing(sysAddr)) << "ms";
|
message << "Your latest ping: " << std::to_string(Game::server->GetLatestPing(sysAddr)) << "ms";
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(message.str()));
|
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(message.str()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::stringstream message;
|
std::stringstream message;
|
||||||
message << "Your average ping: " << std::to_string(Game::server->GetPing(sysAddr)) << "ms";
|
message << "Your average ping: " << std::to_string(Game::server->GetPing(sysAddr)) << "ms";
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(message.str()));
|
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(message.str()));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -299,7 +299,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
Game::logger->Log("SlashCommandHandler", "Sending \n%s\n", customText.c_str());
|
Game::logger->Log("SlashCommandHandler", "Sending \n%s\n", customText.c_str());
|
||||||
|
|
||||||
GameMessages::SendUIMessageServerToSingleClient(entity, entity->GetSystemAddress(), "ToggleStoryBox", &args);
|
GameMessages::SendUIMessageServerToSingleClient(entity, entity->GetSystemAddress(), "ToggleStoryBox", &args);
|
||||||
|
|
||||||
delete visiable;
|
delete visiable;
|
||||||
delete text;
|
delete text;
|
||||||
});
|
});
|
||||||
@ -351,7 +351,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
if ((chatCommand == "join" && !args.empty())) {
|
if ((chatCommand == "join" && !args.empty())) {
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Requesting private map...");
|
ChatPackets::SendSystemMessage(sysAddr, u"Requesting private map...");
|
||||||
const auto& password = args[0];
|
const auto& password = args[0];
|
||||||
|
|
||||||
ZoneInstanceManager::Instance()->RequestPrivateZone(Game::server, false, password, [=](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort)
|
ZoneInstanceManager::Instance()->RequestPrivateZone(Game::server, false, password, [=](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort)
|
||||||
{
|
{
|
||||||
Game::logger->Log("UserManager", "Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i\n", sysAddr.ToString(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
|
Game::logger->Log("UserManager", "Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i\n", sysAddr.ToString(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
|
||||||
@ -368,19 +368,19 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user->GetMaxGMLevel() == 0 || entity->GetGMLevel() >= 0) {
|
if (user->GetMaxGMLevel() == 0 || entity->GetGMLevel() >= 0) {
|
||||||
if (chatCommand == "die") {
|
if (chatCommand == "die") {
|
||||||
entity->Smash(entity->GetObjectID());
|
entity->Smash(entity->GetObjectID());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "resurrect") {
|
if (chatCommand == "resurrect") {
|
||||||
ScriptedActivityComponent* scriptedActivityComponent = dZoneManager::Instance()->GetZoneControlObject()->GetComponent<ScriptedActivityComponent>();
|
ScriptedActivityComponent* scriptedActivityComponent = dZoneManager::Instance()->GetZoneControlObject()->GetComponent<ScriptedActivityComponent>();
|
||||||
|
|
||||||
if (scriptedActivityComponent) { // check if user is in activity world and if so, they can't resurrect
|
if (scriptedActivityComponent) { // check if user is in activity world and if so, they can't resurrect
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"You cannot resurrect in an activity world.");
|
ChatPackets::SendSystemMessage(sysAddr, u"You cannot resurrect in an activity world.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameMessages::SendResurrect(entity);
|
GameMessages::SendResurrect(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,15 +395,15 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (entity->GetGMLevel() == 0) return;
|
if (entity->GetGMLevel() == 0) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log command to database
|
// Log command to database
|
||||||
auto stmt = Database::CreatePreppedStmt("INSERT INTO command_log (character_id, command) VALUES (?, ?);");
|
auto stmt = Database::CreatePreppedStmt("INSERT INTO command_log (character_id, command) VALUES (?, ?);");
|
||||||
stmt->setInt(1, entity->GetCharacter()->GetID());
|
stmt->setInt(1, entity->GetCharacter()->GetID());
|
||||||
stmt->setString(2, GeneralUtils::UTF16ToWTF8(command).c_str());
|
stmt->setString(2, GeneralUtils::UTF16ToWTF8(command).c_str());
|
||||||
stmt->execute();
|
stmt->execute();
|
||||||
delete stmt;
|
delete stmt;
|
||||||
|
|
||||||
if (chatCommand == "setminifig" && args.size() == 2 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_FORUM_MODERATOR) { // could break characters so only allow if GM > 0
|
if (chatCommand == "setminifig" && args.size() == 2 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_FORUM_MODERATOR) { // could break characters so only allow if GM > 0
|
||||||
int32_t minifigItemId;
|
int32_t minifigItemId;
|
||||||
if (!GeneralUtils::TryParse(args[1], minifigItemId)) {
|
if (!GeneralUtils::TryParse(args[1], minifigItemId)) {
|
||||||
@ -441,13 +441,13 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid Minifig item to change, try one of the following: Eyebrows, Eyes, HairColor, HairStyle, Pants, LeftHand, Mouth, RightHand, Shirt, Hands");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid Minifig item to change, try one of the following: Eyebrows, Eyes, HairColor, HairStyle, Pants, LeftHand, Mouth, RightHand, Shirt, Hands");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityManager::Instance()->ConstructEntity(entity);
|
EntityManager::Instance()->ConstructEntity(entity);
|
||||||
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(lowerName) + u" set to " + (GeneralUtils::to_u16string(minifigItemId)));
|
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(lowerName) + u" set to " + (GeneralUtils::to_u16string(minifigItemId)));
|
||||||
|
|
||||||
GameMessages::SendToggleGMInvis(entity->GetObjectID(), false, UNASSIGNED_SYSTEM_ADDRESS); // need to retoggle because it gets reenabled on creation of new character
|
GameMessages::SendToggleGMInvis(entity->GetObjectID(), false, UNASSIGNED_SYSTEM_ADDRESS); // need to retoggle because it gets reenabled on creation of new character
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((chatCommand == "playanimation" || chatCommand == "playanim") && args.size() == 1 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
if ((chatCommand == "playanimation" || chatCommand == "playanim") && args.size() == 1 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
||||||
std::u16string anim = GeneralUtils::ASCIIToUTF16(args[0], args[0].size());
|
std::u16string anim = GeneralUtils::ASCIIToUTF16(args[0], args[0].size());
|
||||||
GameMessages::SendPlayAnimation(entity, anim);
|
GameMessages::SendPlayAnimation(entity, anim);
|
||||||
@ -457,15 +457,15 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
for (const auto& pair : EntityManager::Instance()->GetSpawnPointEntities()) {
|
for (const auto& pair : EntityManager::Instance()->GetSpawnPointEntities()) {
|
||||||
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(pair.first));
|
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(pair.first));
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Current: " + GeneralUtils::ASCIIToUTF16(entity->GetCharacter()->GetTargetScene()));
|
ChatPackets::SendSystemMessage(sysAddr, u"Current: " + GeneralUtils::ASCIIToUTF16(entity->GetCharacter()->GetTargetScene()));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "unlock-emote" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
if (chatCommand == "unlock-emote" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
||||||
int32_t emoteID;
|
int32_t emoteID;
|
||||||
|
|
||||||
if (!GeneralUtils::TryParse(args[0], emoteID))
|
if (!GeneralUtils::TryParse(args[0], emoteID))
|
||||||
{
|
{
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid emote ID.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid emote ID.");
|
||||||
@ -497,7 +497,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
if (chatCommand == "speedboost" && args.size() == 1 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER)
|
if (chatCommand == "speedboost" && args.size() == 1 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER)
|
||||||
{
|
{
|
||||||
float boost;
|
float boost;
|
||||||
|
|
||||||
if (!GeneralUtils::TryParse(args[0], boost))
|
if (!GeneralUtils::TryParse(args[0], boost))
|
||||||
{
|
{
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid boost.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid boost.");
|
||||||
@ -521,7 +521,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
entity->SetVar<bool>(u"freecam", state);
|
entity->SetVar<bool>(u"freecam", state);
|
||||||
|
|
||||||
GameMessages::SendSetPlayerControlScheme(entity, static_cast<eControlSceme>(state ? 9 : 1));
|
GameMessages::SendSetPlayerControlScheme(entity, static_cast<eControlSceme>(state ? 9 : 1));
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Toggled freecam.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Toggled freecam.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -534,9 +534,9 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid control scheme.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid control scheme.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameMessages::SendSetPlayerControlScheme(entity, static_cast<eControlSceme>(scheme));
|
GameMessages::SendSetPlayerControlScheme(entity, static_cast<eControlSceme>(scheme));
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Switched control scheme.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Switched control scheme.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -558,7 +558,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
AMFArrayValue args;
|
AMFArrayValue args;
|
||||||
args.InsertValue("state", value);
|
args.InsertValue("state", value);
|
||||||
GameMessages::SendUIMessageServerToSingleClient(entity, sysAddr, "pushGameState", &args);
|
GameMessages::SendUIMessageServerToSingleClient(entity, sysAddr, "pushGameState", &args);
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Switched UI state.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Switched UI state.");
|
||||||
|
|
||||||
delete value;
|
delete value;
|
||||||
@ -572,7 +572,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
AMFArrayValue amfArgs;
|
AMFArrayValue amfArgs;
|
||||||
amfArgs.InsertValue("visible", value);
|
amfArgs.InsertValue("visible", value);
|
||||||
GameMessages::SendUIMessageServerToSingleClient(entity, sysAddr, args[0], &amfArgs);
|
GameMessages::SendUIMessageServerToSingleClient(entity, sysAddr, args[0], &amfArgs);
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Toggled UI state.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Toggled UI state.");
|
||||||
|
|
||||||
delete value;
|
delete value;
|
||||||
@ -590,12 +590,12 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid size.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid size.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryComponent* inventory = static_cast<InventoryComponent*>(entity->GetComponent(COMPONENT_TYPE_INVENTORY));
|
InventoryComponent* inventory = static_cast<InventoryComponent*>(entity->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||||
if (inventory)
|
if (inventory)
|
||||||
{
|
{
|
||||||
auto* items = inventory->GetInventory(ITEMS);
|
auto* items = inventory->GetInventory(ITEMS);
|
||||||
|
|
||||||
items->SetSize(size);
|
items->SetSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,7 +616,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
else {
|
else {
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Unknown macro! Is the filename right?");
|
ChatPackets::SendSystemMessage(sysAddr, u"Unknown macro! Is the filename right?");
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,7 +702,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid mission id.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid mission id.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto comp = static_cast<MissionComponent*>(entity->GetComponent(COMPONENT_TYPE_MISSION));
|
auto comp = static_cast<MissionComponent*>(entity->GetComponent(COMPONENT_TYPE_MISSION));
|
||||||
if (comp) comp->AcceptMission(missionID, true);
|
if (comp) comp->AcceptMission(missionID, true);
|
||||||
return;
|
return;
|
||||||
@ -718,7 +718,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid mission id.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid mission id.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto comp = static_cast<MissionComponent*>(entity->GetComponent(COMPONENT_TYPE_MISSION));
|
auto comp = static_cast<MissionComponent*>(entity->GetComponent(COMPONENT_TYPE_MISSION));
|
||||||
if (comp) comp->CompleteMission(missionID, true);
|
if (comp) comp->CompleteMission(missionID, true);
|
||||||
return;
|
return;
|
||||||
@ -734,7 +734,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity->GetCharacter()->SetPlayerFlag(flagId, true);
|
entity->GetCharacter()->SetPlayerFlag(flagId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "setflag" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() == 2)
|
if (chatCommand == "setflag" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() == 2)
|
||||||
@ -750,7 +750,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid flag type.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid flag type.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
entity->GetCharacter()->SetPlayerFlag(flagId, onOffFlag == "on");
|
entity->GetCharacter()->SetPlayerFlag(flagId, onOffFlag == "on");
|
||||||
}
|
}
|
||||||
if (chatCommand == "clearflag" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() == 1)
|
if (chatCommand == "clearflag" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() == 1)
|
||||||
{
|
{
|
||||||
@ -762,7 +762,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity->GetCharacter()->SetPlayerFlag(flagId, false);
|
entity->GetCharacter()->SetPlayerFlag(flagId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "resetmission" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
if (chatCommand == "resetmission" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
||||||
@ -775,7 +775,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid mission id.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid mission id.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* comp = static_cast<MissionComponent*>(entity->GetComponent(COMPONENT_TYPE_MISSION));
|
auto* comp = static_cast<MissionComponent*>(entity->GetComponent(COMPONENT_TYPE_MISSION));
|
||||||
|
|
||||||
if (comp == nullptr) {
|
if (comp == nullptr) {
|
||||||
@ -787,7 +787,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
if (mission == nullptr) {
|
if (mission == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mission->SetMissionState(MissionState::MISSION_STATE_ACTIVE);
|
mission->SetMissionState(MissionState::MISSION_STATE_ACTIVE);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -860,8 +860,8 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
ChatPackets::SendSystemMessage(sysAddr, msg);
|
ChatPackets::SendSystemMessage(sysAddr, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "gmadditem" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
if (chatCommand == "gmadditem" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
||||||
if (args.size() == 1) {
|
if (args.size() == 1) {
|
||||||
uint32_t itemLOT;
|
uint32_t itemLOT;
|
||||||
|
|
||||||
if (!GeneralUtils::TryParse(args[0], itemLOT))
|
if (!GeneralUtils::TryParse(args[0], itemLOT))
|
||||||
@ -869,11 +869,11 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid item LOT.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid item LOT.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryComponent * inventory = static_cast<InventoryComponent*>(entity->GetComponent(COMPONENT_TYPE_INVENTORY));
|
InventoryComponent * inventory = static_cast<InventoryComponent*>(entity->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||||
|
|
||||||
inventory->AddItem(itemLOT, 1);
|
inventory->AddItem(itemLOT, 1, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||||
} else if(args.size() == 2) {
|
} else if(args.size() == 2) {
|
||||||
uint32_t itemLOT;
|
uint32_t itemLOT;
|
||||||
|
|
||||||
if (!GeneralUtils::TryParse(args[0], itemLOT))
|
if (!GeneralUtils::TryParse(args[0], itemLOT))
|
||||||
@ -892,12 +892,12 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
|
|
||||||
InventoryComponent* inventory = static_cast<InventoryComponent*>(entity->GetComponent(COMPONENT_TYPE_INVENTORY));
|
InventoryComponent* inventory = static_cast<InventoryComponent*>(entity->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||||
|
|
||||||
inventory->AddItem(itemLOT, count);
|
inventory->AddItem(itemLOT, count, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Correct usage: /gmadditem <lot>");
|
ChatPackets::SendSystemMessage(sysAddr, u"Correct usage: /gmadditem <lot>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "mailitem" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_MODERATOR && args.size() >= 2) {
|
if (chatCommand == "mailitem" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_MODERATOR && args.size() >= 2) {
|
||||||
const auto& playerName = args[0];
|
const auto& playerName = args[0];
|
||||||
@ -917,7 +917,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
if (receiverID == 0)
|
if (receiverID == 0)
|
||||||
{
|
{
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Failed to find that player");
|
ChatPackets::SendSystemMessage(sysAddr, u"Failed to find that player");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -944,7 +944,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
ins->setInt(11, 1);
|
ins->setInt(11, 1);
|
||||||
ins->execute();
|
ins->execute();
|
||||||
delete ins;
|
delete ins;
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Mail sent");
|
ChatPackets::SendSystemMessage(sysAddr, u"Mail sent");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -961,7 +961,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
|
|
||||||
GameMessages::SendSetName(entity->GetObjectID(), GeneralUtils::ASCIIToUTF16(name), UNASSIGNED_SYSTEM_ADDRESS);
|
GameMessages::SendSetName(entity->GetObjectID(), GeneralUtils::ASCIIToUTF16(name), UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "title" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER)
|
if (chatCommand == "title" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER)
|
||||||
{
|
{
|
||||||
std::string name = entity->GetCharacter()->GetName() + " - ";
|
std::string name = entity->GetCharacter()->GetName() + " - ";
|
||||||
@ -974,37 +974,37 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
GameMessages::SendSetName(entity->GetObjectID(), GeneralUtils::ASCIIToUTF16(name), UNASSIGNED_SYSTEM_ADDRESS);
|
GameMessages::SendSetName(entity->GetObjectID(), GeneralUtils::ASCIIToUTF16(name), UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((chatCommand == "teleport" || chatCommand == "tele") && entity->GetGMLevel() >= GAME_MASTER_LEVEL_JUNIOR_MODERATOR) {
|
if ((chatCommand == "teleport" || chatCommand == "tele") && entity->GetGMLevel() >= GAME_MASTER_LEVEL_JUNIOR_MODERATOR) {
|
||||||
NiPoint3 pos {};
|
NiPoint3 pos {};
|
||||||
if (args.size() == 3) {
|
if (args.size() == 3) {
|
||||||
|
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
|
|
||||||
if (!GeneralUtils::TryParse(args[0], x))
|
if (!GeneralUtils::TryParse(args[0], x))
|
||||||
{
|
{
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid x.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid x.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GeneralUtils::TryParse(args[1], y))
|
if (!GeneralUtils::TryParse(args[1], y))
|
||||||
{
|
{
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid y.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid y.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GeneralUtils::TryParse(args[2], z))
|
if (!GeneralUtils::TryParse(args[2], z))
|
||||||
{
|
{
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid z.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid z.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pos.SetX(x);
|
pos.SetX(x);
|
||||||
pos.SetY(y);
|
pos.SetY(y);
|
||||||
pos.SetZ(z);
|
pos.SetZ(z);
|
||||||
|
|
||||||
Game::logger->Log("SlashCommandHandler", "Teleporting objectID: %llu to %f, %f, %f\n", entity->GetObjectID(), pos.x, pos.y, pos.z);
|
Game::logger->Log("SlashCommandHandler", "Teleporting objectID: %llu to %f, %f, %f\n", entity->GetObjectID(), pos.x, pos.y, pos.z);
|
||||||
GameMessages::SendTeleport(entity->GetObjectID(), pos, NiQuaternion(), sysAddr);
|
GameMessages::SendTeleport(entity->GetObjectID(), pos, NiQuaternion(), sysAddr);
|
||||||
} else if (args.size() == 2) {
|
} else if (args.size() == 2) {
|
||||||
float x, z;
|
float x, z;
|
||||||
|
|
||||||
if (!GeneralUtils::TryParse(args[0], x))
|
if (!GeneralUtils::TryParse(args[0], x))
|
||||||
@ -1023,12 +1023,12 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
pos.SetY(0.0f);
|
pos.SetY(0.0f);
|
||||||
pos.SetZ(z);
|
pos.SetZ(z);
|
||||||
|
|
||||||
|
|
||||||
Game::logger->Log("SlashCommandHandler", "Teleporting objectID: %llu to X: %f, Z: %f\n", entity->GetObjectID(), pos.x, pos.z);
|
Game::logger->Log("SlashCommandHandler", "Teleporting objectID: %llu to X: %f, Z: %f\n", entity->GetObjectID(), pos.x, pos.z);
|
||||||
GameMessages::SendTeleport(entity->GetObjectID(), pos, NiQuaternion(), sysAddr);
|
GameMessages::SendTeleport(entity->GetObjectID(), pos, NiQuaternion(), sysAddr);
|
||||||
} else {
|
} else {
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Correct usage: /teleport <x> (<y>) <z> - if no Y given, will teleport to the height of the terrain (or any physics object).");
|
ChatPackets::SendSystemMessage(sysAddr, u"Correct usage: /teleport <x> (<y>) <z> - if no Y given, will teleport to the height of the terrain (or any physics object).");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* possessorComponent = entity->GetComponent<PossessorComponent>();
|
auto* possessorComponent = entity->GetComponent<PossessorComponent>();
|
||||||
|
|
||||||
@ -1050,7 +1050,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "tpall" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER)
|
if (chatCommand == "tpall" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER)
|
||||||
{
|
{
|
||||||
@ -1096,7 +1096,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
if (player == nullptr)
|
if (player == nullptr)
|
||||||
{
|
{
|
||||||
auto* accountQuery = Database::CreatePreppedStmt("SELECT account_id, id FROM charinfo WHERE name=? LIMIT 1;");
|
auto* accountQuery = Database::CreatePreppedStmt("SELECT account_id, id FROM charinfo WHERE name=? LIMIT 1;");
|
||||||
|
|
||||||
accountQuery->setString(1, args[0]);
|
accountQuery->setString(1, args[0]);
|
||||||
|
|
||||||
auto result = accountQuery->executeQuery();
|
auto result = accountQuery->executeQuery();
|
||||||
@ -1106,7 +1106,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
while (result->next()) {
|
while (result->next()) {
|
||||||
accountId = result->getUInt(1);
|
accountId = result->getUInt(1);
|
||||||
characterId = result->getUInt64(2);
|
characterId = result->getUInt64(2);
|
||||||
|
|
||||||
characterId = GeneralUtils::SetBit(characterId, OBJECT_BIT_CHARACTER);
|
characterId = GeneralUtils::SetBit(characterId, OBJECT_BIT_CHARACTER);
|
||||||
characterId = GeneralUtils::SetBit(characterId, OBJECT_BIT_PERSISTENT);
|
characterId = GeneralUtils::SetBit(characterId, OBJECT_BIT_PERSISTENT);
|
||||||
}
|
}
|
||||||
@ -1164,7 +1164,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
userUpdate->executeUpdate();
|
userUpdate->executeUpdate();
|
||||||
|
|
||||||
delete userUpdate;
|
delete userUpdate;
|
||||||
|
|
||||||
char buffer[32] = "brought up for review.\0";
|
char buffer[32] = "brought up for review.\0";
|
||||||
|
|
||||||
if (expire != 1)
|
if (expire != 1)
|
||||||
@ -1173,12 +1173,12 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
// Format: Mo, 15.06.2009 20:20:00
|
// Format: Mo, 15.06.2009 20:20:00
|
||||||
std::strftime(buffer, 32, "%a, %d.%m.%Y %H:%M:%S", ptm);
|
std::strftime(buffer, 32, "%a, %d.%m.%Y %H:%M:%S", ptm);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto timeStr = GeneralUtils::ASCIIToUTF16(std::string(buffer));
|
const auto timeStr = GeneralUtils::ASCIIToUTF16(std::string(buffer));
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Muted: " + GeneralUtils::ASCIIToUTF16(args[0]) + u" until " + timeStr);
|
ChatPackets::SendSystemMessage(sysAddr, u"Muted: " + GeneralUtils::ASCIIToUTF16(args[0]) + u" until " + timeStr);
|
||||||
|
|
||||||
//Notify chat about it
|
//Notify chat about it
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
PacketUtils::WriteHeader(bitStream, CHAT_INTERNAL, MSG_CHAT_INTERNAL_MUTE_UPDATE);
|
PacketUtils::WriteHeader(bitStream, CHAT_INTERNAL, MSG_CHAT_INTERNAL_MUTE_UPDATE);
|
||||||
|
|
||||||
@ -1221,7 +1221,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
if (player == nullptr)
|
if (player == nullptr)
|
||||||
{
|
{
|
||||||
auto* accountQuery = Database::CreatePreppedStmt("SELECT account_id FROM charinfo WHERE name=? LIMIT 1;");
|
auto* accountQuery = Database::CreatePreppedStmt("SELECT account_id FROM charinfo WHERE name=? LIMIT 1;");
|
||||||
|
|
||||||
accountQuery->setString(1, args[0]);
|
accountQuery->setString(1, args[0]);
|
||||||
|
|
||||||
auto result = accountQuery->executeQuery();
|
auto result = accountQuery->executeQuery();
|
||||||
@ -1267,8 +1267,8 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
if (chatCommand == "buffme" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
if (chatCommand == "buffme" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
||||||
auto dest = static_cast<DestroyableComponent*>(entity->GetComponent(COMPONENT_TYPE_DESTROYABLE));
|
auto dest = static_cast<DestroyableComponent*>(entity->GetComponent(COMPONENT_TYPE_DESTROYABLE));
|
||||||
if (dest) {
|
if (dest) {
|
||||||
dest->SetHealth(999);
|
dest->SetHealth(999);
|
||||||
@ -1278,13 +1278,13 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
dest->SetImagination(999);
|
dest->SetImagination(999);
|
||||||
dest->SetMaxImagination(999.0f);
|
dest->SetMaxImagination(999.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityManager::Instance()->SerializeEntity(entity);
|
EntityManager::Instance()->SerializeEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "startcelebration" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() == 1) {
|
if (chatCommand == "startcelebration" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() == 1) {
|
||||||
int32_t celebration;
|
int32_t celebration;
|
||||||
|
|
||||||
if (!GeneralUtils::TryParse(args[0], celebration))
|
if (!GeneralUtils::TryParse(args[0], celebration))
|
||||||
{
|
{
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid celebration.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid celebration.");
|
||||||
@ -1293,8 +1293,8 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
|
|
||||||
GameMessages::SendStartCelebrationEffect(entity, entity->GetSystemAddress(), celebration);
|
GameMessages::SendStartCelebrationEffect(entity, entity->GetSystemAddress(), celebration);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "buffmed" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
if (chatCommand == "buffmed" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
||||||
auto dest = static_cast<DestroyableComponent*>(entity->GetComponent(COMPONENT_TYPE_DESTROYABLE));
|
auto dest = static_cast<DestroyableComponent*>(entity->GetComponent(COMPONENT_TYPE_DESTROYABLE));
|
||||||
if (dest) {
|
if (dest) {
|
||||||
dest->SetHealth(9);
|
dest->SetHealth(9);
|
||||||
@ -1305,10 +1305,10 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
dest->SetMaxImagination(9.0f);
|
dest->SetMaxImagination(9.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityManager::Instance()->SerializeEntity(entity);
|
EntityManager::Instance()->SerializeEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "refillstats" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
if (chatCommand == "refillstats" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
||||||
auto dest = static_cast<DestroyableComponent*>(entity->GetComponent(COMPONENT_TYPE_DESTROYABLE));
|
auto dest = static_cast<DestroyableComponent*>(entity->GetComponent(COMPONENT_TYPE_DESTROYABLE));
|
||||||
if (dest) {
|
if (dest) {
|
||||||
dest->SetHealth((int)dest->GetMaxHealth());
|
dest->SetHealth((int)dest->GetMaxHealth());
|
||||||
@ -1316,48 +1316,48 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
dest->SetImagination((int)dest->GetMaxImagination());
|
dest->SetImagination((int)dest->GetMaxImagination());
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityManager::Instance()->SerializeEntity(entity);
|
EntityManager::Instance()->SerializeEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "lookup" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() == 1) {
|
if (chatCommand == "lookup" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() == 1) {
|
||||||
std::string query = "SELECT `id`, `name` FROM `Objects` WHERE `displayName` LIKE '%" + args[0] + "%' OR `name` LIKE '%" + args[0] + "%' OR `description` LIKE '%" + args[0] + "%'";
|
std::string query = "SELECT `id`, `name` FROM `Objects` WHERE `displayName` LIKE '%" + args[0] + "%' OR `name` LIKE '%" + args[0] + "%' OR `description` LIKE '%" + args[0] + "%'";
|
||||||
auto tables = CDClientDatabase::ExecuteQuery(query.c_str());
|
auto tables = CDClientDatabase::ExecuteQuery(query.c_str());
|
||||||
while (!tables.eof()) {
|
while (!tables.eof()) {
|
||||||
std::string message = std::to_string(tables.getIntField(0)) + " - " + tables.getStringField(1);
|
std::string message = std::to_string(tables.getIntField(0)) + " - " + tables.getStringField(1);
|
||||||
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(message, message.size()));
|
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(message, message.size()));
|
||||||
tables.nextRow();
|
tables.nextRow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "spawn" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() >= 1) {
|
if (chatCommand == "spawn" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() >= 1) {
|
||||||
ControllablePhysicsComponent* comp = static_cast<ControllablePhysicsComponent*>(entity->GetComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS));
|
ControllablePhysicsComponent* comp = static_cast<ControllablePhysicsComponent*>(entity->GetComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS));
|
||||||
if (!comp) return;
|
if (!comp) return;
|
||||||
|
|
||||||
uint32_t lot;
|
uint32_t lot;
|
||||||
|
|
||||||
if (!GeneralUtils::TryParse(args[0], lot))
|
if (!GeneralUtils::TryParse(args[0], lot))
|
||||||
{
|
{
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid lot.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid lot.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityInfo info;
|
EntityInfo info;
|
||||||
info.lot = lot;
|
info.lot = lot;
|
||||||
info.pos = comp->GetPosition();
|
info.pos = comp->GetPosition();
|
||||||
info.rot = comp->GetRotation();
|
info.rot = comp->GetRotation();
|
||||||
info.spawner = nullptr;
|
info.spawner = nullptr;
|
||||||
info.spawnerID = entity->GetObjectID();
|
info.spawnerID = entity->GetObjectID();
|
||||||
info.spawnerNodeID = 0;
|
info.spawnerNodeID = 0;
|
||||||
|
|
||||||
Entity* newEntity = EntityManager::Instance()->CreateEntity(info, nullptr);
|
Entity* newEntity = EntityManager::Instance()->CreateEntity(info, nullptr);
|
||||||
|
|
||||||
if (newEntity == nullptr) {
|
if (newEntity == nullptr) {
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Failed to spawn entity.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Failed to spawn entity.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityManager::Instance()->ConstructEntity(newEntity);
|
EntityManager::Instance()->ConstructEntity(newEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((chatCommand == "giveuscore") && args.size() == 1 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
if ((chatCommand == "giveuscore") && args.size() == 1 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
||||||
int32_t uscore;
|
int32_t uscore;
|
||||||
@ -1370,15 +1370,15 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
|
|
||||||
CharacterComponent* character = entity->GetComponent<CharacterComponent>();
|
CharacterComponent* character = entity->GetComponent<CharacterComponent>();
|
||||||
if (character) character->SetUScore(character->GetUScore() + uscore);
|
if (character) character->SetUScore(character->GetUScore() + uscore);
|
||||||
// LOOT_SOURCE_MODERATION should work but it doesn't. Relog to see uscore changes
|
// LOOT_SOURCE_MODERATION should work but it doesn't. Relog to see uscore changes
|
||||||
GameMessages::SendModifyLEGOScore(entity, entity->GetSystemAddress(), uscore, LOOT_SOURCE_MODERATION);
|
GameMessages::SendModifyLEGOScore(entity, entity->GetSystemAddress(), uscore, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "pos" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
if (chatCommand == "pos" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
||||||
const auto position = entity->GetPosition();
|
const auto position = entity->GetPosition();
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"<" + (GeneralUtils::to_u16string(position.x)) + u", " + (GeneralUtils::to_u16string(position.y)) + u", " + (GeneralUtils::to_u16string(position.z)) + u">");
|
ChatPackets::SendSystemMessage(sysAddr, u"<" + (GeneralUtils::to_u16string(position.x)) + u", " + (GeneralUtils::to_u16string(position.y)) + u", " + (GeneralUtils::to_u16string(position.z)) + u">");
|
||||||
|
|
||||||
std::cout << position.x << ", " << position.y << ", " << position.z << std::endl;
|
std::cout << position.x << ", " << position.y << ", " << position.z << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1401,9 +1401,9 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
GameMessages::SendPlayFXEffect(entity, 7074, u"create", "7074", LWOOBJID_EMPTY, 1.0f, 1.0f, true);
|
GameMessages::SendPlayFXEffect(entity, 7074, u"create", "7074", LWOOBJID_EMPTY, 1.0f, 1.0f, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "playrebuildfx" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
if (chatCommand == "playrebuildfx" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
||||||
GameMessages::SendPlayFXEffect(entity, 230, u"rebuild", "230", LWOOBJID_EMPTY, 1.0f, 1.0f, true);
|
GameMessages::SendPlayFXEffect(entity, 230, u"rebuild", "230", LWOOBJID_EMPTY, 1.0f, 1.0f, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((chatCommand == "freemoney" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) && args.size() == 1) {
|
if ((chatCommand == "freemoney" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) && args.size() == 1) {
|
||||||
int32_t money;
|
int32_t money;
|
||||||
@ -1415,7 +1415,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto* ch = entity->GetCharacter();
|
auto* ch = entity->GetCharacter();
|
||||||
ch->SetCoins(ch->GetCoins() + money, LOOT_SOURCE_MODERATION);
|
ch->SetCoins(ch->GetCoins() + money, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((chatCommand == "setcurrency") && args.size() == 1 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
if ((chatCommand == "setcurrency") && args.size() == 1 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
||||||
@ -1428,14 +1428,14 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto* ch = entity->GetCharacter();
|
auto* ch = entity->GetCharacter();
|
||||||
ch->SetCoins(money, LOOT_SOURCE_MODERATION);
|
ch->SetCoins(money, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow for this on even while not a GM, as it sometimes toggles incorrrectly.
|
// Allow for this on even while not a GM, as it sometimes toggles incorrrectly.
|
||||||
if (chatCommand == "gminvis" && entity->GetParentUser()->GetMaxGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER)
|
if (chatCommand == "gminvis" && entity->GetParentUser()->GetMaxGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER)
|
||||||
{
|
{
|
||||||
GameMessages::SendToggleGMInvis(entity->GetObjectID(), true, UNASSIGNED_SYSTEM_ADDRESS);
|
GameMessages::SendToggleGMInvis(entity->GetObjectID(), true, UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1455,7 +1455,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
{
|
{
|
||||||
destroyableComponent->SetIsGMImmune(state);
|
destroyableComponent->SetIsGMImmune(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1482,12 +1482,12 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
{
|
{
|
||||||
buffComponent->ApplyBuff(id, duration, entity->GetObjectID());
|
buffComponent->ApplyBuff(id, duration, entity->GetObjectID());
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((chatCommand == "testmap" && args.size() >= 1) && entity->GetGMLevel() >= GAME_MASTER_LEVEL_FORUM_MODERATOR) {
|
if ((chatCommand == "testmap" && args.size() >= 1) && entity->GetGMLevel() >= GAME_MASTER_LEVEL_FORUM_MODERATOR) {
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Requesting map change...");
|
ChatPackets::SendSystemMessage(sysAddr, u"Requesting map change...");
|
||||||
uint32_t reqZone;
|
uint32_t reqZone;
|
||||||
LWOCLONEID cloneId = 0;
|
LWOCLONEID cloneId = 0;
|
||||||
bool force = false;
|
bool force = false;
|
||||||
@ -1517,10 +1517,10 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto objid = entity->GetObjectID();
|
const auto objid = entity->GetObjectID();
|
||||||
|
|
||||||
if (force || CheckIfAccessibleZone(reqZone)) { // to prevent tomfoolery
|
if (force || CheckIfAccessibleZone(reqZone)) { // to prevent tomfoolery
|
||||||
bool darwin = true; //Putting this on true, as I'm sick of having to wait 3-4 seconds on a transfer while trying to quickly moderate properties
|
bool darwin = true; //Putting this on true, as I'm sick of having to wait 3-4 seconds on a transfer while trying to quickly moderate properties
|
||||||
|
|
||||||
Character* character = entity->GetCharacter();
|
Character* character = entity->GetCharacter();
|
||||||
if (character) {
|
if (character) {
|
||||||
std::string lowerName = character->GetName();
|
std::string lowerName = character->GetName();
|
||||||
@ -1538,12 +1538,12 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, reqZone, cloneId, false, [objid, darwin](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
|
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, reqZone, cloneId, false, [objid, darwin](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
|
||||||
auto* entity = EntityManager::Instance()->GetEntity(objid);
|
auto* entity = EntityManager::Instance()->GetEntity(objid);
|
||||||
|
|
||||||
if (entity == nullptr) {
|
if (entity == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float transferTime = 3.32999992370605f;
|
float transferTime = 3.32999992370605f;
|
||||||
if (darwin) transferTime = 0.0f;
|
if (darwin) transferTime = 0.0f;
|
||||||
@ -1565,15 +1565,15 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
|
|
||||||
WorldPackets::SendTransferToWorld(sysAddr, serverIP, serverPort, mythranShift);
|
WorldPackets::SendTransferToWorld(sysAddr, serverIP, serverPort, mythranShift);
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
std::string msg = "ZoneID not found or allowed: ";
|
std::string msg = "ZoneID not found or allowed: ";
|
||||||
msg.append(args[0]);
|
msg.append(args[0]);
|
||||||
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(msg, msg.size()));
|
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(msg, msg.size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "createprivate" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() >= 3)
|
if (chatCommand == "createprivate" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() >= 3)
|
||||||
{
|
{
|
||||||
@ -1596,7 +1596,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
const auto& password = args[2];
|
const auto& password = args[2];
|
||||||
|
|
||||||
ZoneInstanceManager::Instance()->CreatePrivateZone(Game::server, zone, clone, password);
|
ZoneInstanceManager::Instance()->CreatePrivateZone(Game::server, zone, clone, password);
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16("Sent request for private zone with password: " + password));
|
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16("Sent request for private zone with password: " + password));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -1671,7 +1671,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "triggerspawner" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() >= 1)
|
if (chatCommand == "triggerspawner" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() >= 1)
|
||||||
{
|
{
|
||||||
auto spawners = dZoneManager::Instance()->GetSpawnersByName(args[0]);
|
auto spawners = dZoneManager::Instance()->GetSpawnersByName(args[0]);
|
||||||
@ -1704,7 +1704,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
std::vector<LDFBaseData*> data {};
|
std::vector<LDFBaseData*> data {};
|
||||||
data.push_back(new LDFData<int32_t>(u"reforgedLOT", reforgedItem));
|
data.push_back(new LDFData<int32_t>(u"reforgedLOT", reforgedItem));
|
||||||
|
|
||||||
inventoryComponent->AddItem(baseItem, 1, INVALID, data);
|
inventoryComponent->AddItem(baseItem, 1, eLootSourceType::LOOT_SOURCE_MODERATION, eInventoryType::INVALID, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCommand == "crash" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_OPERATOR)
|
if (chatCommand == "crash" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_OPERATOR)
|
||||||
@ -1753,13 +1753,13 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
|
|
||||||
ChatPackets::SendSystemMessage(
|
ChatPackets::SendSystemMessage(
|
||||||
sysAddr,
|
sysAddr,
|
||||||
GeneralUtils::ASCIIToUTF16(Metrics::MetricVariableToString(variable)) +
|
GeneralUtils::ASCIIToUTF16(Metrics::MetricVariableToString(variable)) +
|
||||||
u": " +
|
u": " +
|
||||||
GeneralUtils::to_u16string(Metrics::ToMiliseconds(metric->average)) +
|
GeneralUtils::to_u16string(Metrics::ToMiliseconds(metric->average)) +
|
||||||
u"ms"
|
u"ms"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(
|
ChatPackets::SendSystemMessage(
|
||||||
sysAddr,
|
sysAddr,
|
||||||
u"Peak RSS: " + GeneralUtils::to_u16string((float) ((double) Metrics::GetPeakRSS() / 1.024e6)) +
|
u"Peak RSS: " + GeneralUtils::to_u16string((float) ((double) Metrics::GetPeakRSS() / 1.024e6)) +
|
||||||
@ -1806,11 +1806,11 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::u16string message = u"Ran loot drops looking for "
|
std::u16string message = u"Ran loot drops looking for "
|
||||||
+ GeneralUtils::to_u16string(targetLot)
|
+ GeneralUtils::to_u16string(targetLot)
|
||||||
+ u", "
|
+ u", "
|
||||||
+ GeneralUtils::to_u16string(loops)
|
+ GeneralUtils::to_u16string(loops)
|
||||||
+ u" times. It ran "
|
+ u" times. It ran "
|
||||||
+ GeneralUtils::to_u16string(totalRuns)
|
+ GeneralUtils::to_u16string(totalRuns)
|
||||||
+ u" times. Averaging out at "
|
+ u" times. Averaging out at "
|
||||||
+ GeneralUtils::to_u16string((float) totalRuns / loops);
|
+ GeneralUtils::to_u16string((float) totalRuns / loops);
|
||||||
|
|
||||||
@ -1841,7 +1841,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
auto closestDistance = 0.0f;
|
auto closestDistance = 0.0f;
|
||||||
|
|
||||||
const auto candidates = EntityManager::Instance()->GetEntitiesByComponent(component);
|
const auto candidates = EntityManager::Instance()->GetEntitiesByComponent(component);
|
||||||
|
|
||||||
for (auto* candidate : candidates)
|
for (auto* candidate : candidates)
|
||||||
{
|
{
|
||||||
if (candidate->GetLOT() == 1 || candidate->GetLOT() == 8092)
|
if (candidate->GetLOT() == 1 || candidate->GetLOT() == 8092)
|
||||||
@ -1853,16 +1853,16 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (closest == nullptr)
|
if (closest == nullptr)
|
||||||
{
|
{
|
||||||
closest = candidate;
|
closest = candidate;
|
||||||
|
|
||||||
closestDistance = NiPoint3::Distance(candidate->GetPosition(), reference);
|
closestDistance = NiPoint3::Distance(candidate->GetPosition(), reference);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto distance = NiPoint3::Distance(candidate->GetPosition(), reference);
|
const auto distance = NiPoint3::Distance(candidate->GetPosition(), reference);
|
||||||
|
|
||||||
if (distance < closestDistance)
|
if (distance < closestDistance)
|
||||||
@ -1889,7 +1889,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
header << info.name << " [" << std::to_string(info.id) << "]" << " " << std::to_string(closestDistance) << " " << std::to_string(closest->IsSleeping());
|
header << info.name << " [" << std::to_string(info.id) << "]" << " " << std::to_string(closestDistance) << " " << std::to_string(closest->IsSleeping());
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(header.str()));
|
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(header.str()));
|
||||||
|
|
||||||
for (const auto& pair : closest->GetComponents())
|
for (const auto& pair : closest->GetComponents())
|
||||||
{
|
{
|
||||||
auto id = pair.first;
|
auto id = pair.first;
|
||||||
@ -1902,7 +1902,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args.size() >= 2)
|
if (args.size() >= 2)
|
||||||
{
|
{
|
||||||
if (args[1] == "-m" && args.size() >= 3)
|
if (args[1] == "-m" && args.size() >= 3)
|
||||||
{
|
{
|
||||||
auto* movingPlatformComponent = closest->GetComponent<MovingPlatformComponent>();
|
auto* movingPlatformComponent = closest->GetComponent<MovingPlatformComponent>();
|
||||||
@ -1946,7 +1946,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
const auto postion = closest->GetPosition();
|
const auto postion = closest->GetPosition();
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(
|
ChatPackets::SendSystemMessage(
|
||||||
sysAddr,
|
sysAddr,
|
||||||
GeneralUtils::ASCIIToUTF16("< " + std::to_string(postion.x) + ", " + std::to_string(postion.y) + ", " + std::to_string(postion.z) + " >")
|
GeneralUtils::ASCIIToUTF16("< " + std::to_string(postion.x) + ", " + std::to_string(postion.y) + ", " + std::to_string(postion.z) + " >")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -2009,54 +2009,17 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SlashCommandHandler::CheckIfAccessibleZone(const unsigned int zoneID) {
|
bool SlashCommandHandler::CheckIfAccessibleZone(const unsigned int zoneID) {
|
||||||
switch (zoneID) {
|
//We're gonna go ahead and presume we've got the db loaded already:
|
||||||
case 98:
|
CDZoneTableTable * zoneTable = CDClientManager::Instance()->GetTable<CDZoneTableTable>("ZoneTable");
|
||||||
case 1000:
|
const CDZoneTable* zone = zoneTable->Query(zoneID);
|
||||||
case 1001:
|
if (zone != nullptr) {
|
||||||
|
std::string zonePath = "./res/maps/" + zone->zoneName;
|
||||||
case 1100:
|
std::transform(zonePath.begin(), zonePath.end(), zonePath.begin(), ::tolower);
|
||||||
case 1101:
|
std::ifstream f(zonePath.c_str());
|
||||||
case 1150:
|
return f.good();
|
||||||
case 1151:
|
} else {
|
||||||
case 1152:
|
return false;
|
||||||
|
|
||||||
case 1200:
|
|
||||||
case 1201:
|
|
||||||
|
|
||||||
case 1250:
|
|
||||||
case 1251:
|
|
||||||
case 1260:
|
|
||||||
|
|
||||||
case 1300:
|
|
||||||
case 1350:
|
|
||||||
case 1351:
|
|
||||||
|
|
||||||
case 1400:
|
|
||||||
case 1401:
|
|
||||||
case 1450:
|
|
||||||
case 1451:
|
|
||||||
|
|
||||||
case 1600:
|
|
||||||
case 1601:
|
|
||||||
case 1602:
|
|
||||||
case 1603:
|
|
||||||
case 1604:
|
|
||||||
|
|
||||||
case 1700:
|
|
||||||
case 1800:
|
|
||||||
case 1900:
|
|
||||||
case 2000:
|
|
||||||
|
|
||||||
case 58004:
|
|
||||||
case 58005:
|
|
||||||
case 58006:
|
|
||||||
return true;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlashCommandHandler::SendAnnouncement(const std::string& title, const std::string& message) {
|
void SlashCommandHandler::SendAnnouncement(const std::string& title, const std::string& message) {
|
||||||
@ -2076,7 +2039,7 @@ void SlashCommandHandler::SendAnnouncement(const std::string& title, const std::
|
|||||||
titleValue = nullptr;
|
titleValue = nullptr;
|
||||||
messageValue = nullptr;
|
messageValue = nullptr;
|
||||||
|
|
||||||
//Notify chat about it
|
//Notify chat about it
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
PacketUtils::WriteHeader(bitStream, CHAT_INTERNAL, MSG_CHAT_INTERNAL_ANNOUNCEMENT);
|
PacketUtils::WriteHeader(bitStream, CHAT_INTERNAL, MSG_CHAT_INTERNAL_ANNOUNCEMENT);
|
||||||
|
|
||||||
|
@ -7,10 +7,16 @@
|
|||||||
class AgFans : public CppScripts::Script
|
class AgFans : public CppScripts::Script
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void OnStartup(Entity* self);
|
void OnStartup(Entity* self) override;
|
||||||
void OnDie(Entity* self, Entity* killer);
|
void OnDie(Entity* self, Entity* killer) override;
|
||||||
void OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2,
|
void OnFireEventServerSide(
|
||||||
int32_t param3);
|
Entity *self,
|
||||||
|
Entity *sender,
|
||||||
|
std::string args,
|
||||||
|
int32_t param1,
|
||||||
|
int32_t param2,
|
||||||
|
int32_t param3
|
||||||
|
) override;
|
||||||
private:
|
private:
|
||||||
void ToggleFX(Entity* self, bool hit);
|
void ToggleFX(Entity* self, bool hit);
|
||||||
};
|
};
|
||||||
|
@ -32,7 +32,7 @@ void AmDropshipComputer::OnUse(Entity* self, Entity* user)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
inventoryComponent->AddItem(12323, 1);
|
inventoryComponent->AddItem(12323, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmDropshipComputer::OnDie(Entity* self, Entity* killer)
|
void AmDropshipComputer::OnDie(Entity* self, Entity* killer)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//I can feel my soul being torn apart with every script added to this monstrosity.
|
//I can feel my soul being torn apart with every script added to this monstrosity.
|
||||||
// skate fast eat trash
|
// skate fast eat trash
|
||||||
// do you think god stays in heaven because he too lives in fear of what he's created?
|
// do you think god stays in heaven because he too lives in fear of what he's created?
|
||||||
|
|
||||||
@ -274,6 +274,10 @@
|
|||||||
#include "AgSurvivalMech.h"
|
#include "AgSurvivalMech.h"
|
||||||
#include "AgSurvivalSpiderling.h"
|
#include "AgSurvivalSpiderling.h"
|
||||||
|
|
||||||
|
// Frostburgh Scripts
|
||||||
|
#include "RockHydrantBroken.h"
|
||||||
|
#include "WhFans.h"
|
||||||
|
|
||||||
//Big bad global bc this is a namespace and not a class:
|
//Big bad global bc this is a namespace and not a class:
|
||||||
InvalidScript* invalidToReturn = new InvalidScript();
|
InvalidScript* invalidToReturn = new InvalidScript();
|
||||||
std::map<std::string, CppScripts::Script*> m_Scripts;
|
std::map<std::string, CppScripts::Script*> m_Scripts;
|
||||||
@ -795,6 +799,12 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
|
|||||||
else if (scriptName == "scripts\\EquipmentScripts\\BuccaneerValiantShip.lua")
|
else if (scriptName == "scripts\\EquipmentScripts\\BuccaneerValiantShip.lua")
|
||||||
script = new BuccaneerValiantShip();
|
script = new BuccaneerValiantShip();
|
||||||
|
|
||||||
|
// FB
|
||||||
|
else if (scriptName == "scripts\\ai\\NS\\WH\\L_ROCKHYDRANT_BROKEN.lua")
|
||||||
|
script = new RockHydrantBroken();
|
||||||
|
else if (scriptName == "scripts\\ai\\NS\\L_NS_WH_FANS.lua")
|
||||||
|
script = new WhFans();
|
||||||
|
|
||||||
//Ignore these scripts:
|
//Ignore these scripts:
|
||||||
else if (scriptName == "scripts\\02_server\\Enemy\\General\\L_SUSPEND_LUA_AI.lua")
|
else if (scriptName == "scripts\\02_server\\Enemy\\General\\L_SUSPEND_LUA_AI.lua")
|
||||||
script = invalidToReturn;
|
script = invalidToReturn;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
|
|
||||||
void HydrantBroken::OnStartup(Entity* self)
|
void HydrantBroken::OnStartup(Entity* self)
|
||||||
{
|
{
|
||||||
self->AddTimer("playEffect", 1);
|
self->AddTimer("playEffect", 1);
|
||||||
|
|
||||||
@ -10,8 +10,6 @@ void HydrantBroken::OnStartup(Entity* self)
|
|||||||
|
|
||||||
const auto bouncers = EntityManager::Instance()->GetEntitiesInGroup(hydrant);
|
const auto bouncers = EntityManager::Instance()->GetEntitiesInGroup(hydrant);
|
||||||
|
|
||||||
Game::logger->Log("HydrantBroken", "Broken Hydrant spawned (%s)\n", hydrant.c_str());
|
|
||||||
|
|
||||||
for (auto* bouncer : bouncers)
|
for (auto* bouncer : bouncers)
|
||||||
{
|
{
|
||||||
self->SetVar<LWOOBJID>(u"bouncer", bouncer->GetObjectID());
|
self->SetVar<LWOOBJID>(u"bouncer", bouncer->GetObjectID());
|
||||||
@ -20,11 +18,11 @@ void HydrantBroken::OnStartup(Entity* self)
|
|||||||
|
|
||||||
GameMessages::SendNotifyObject(bouncer->GetObjectID(), self->GetObjectID(), u"enableCollision", UNASSIGNED_SYSTEM_ADDRESS);
|
GameMessages::SendNotifyObject(bouncer->GetObjectID(), self->GetObjectID(), u"enableCollision", UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
self->AddTimer("KillBroken", 25);
|
self->AddTimer("KillBroken", 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HydrantBroken::OnTimerDone(Entity* self, std::string timerName)
|
void HydrantBroken::OnTimerDone(Entity* self, std::string timerName)
|
||||||
{
|
{
|
||||||
if (timerName == "KillBroken")
|
if (timerName == "KillBroken")
|
||||||
{
|
{
|
||||||
|
@ -2,20 +2,18 @@
|
|||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
|
|
||||||
void HydrantSmashable::OnDie(Entity* self, Entity* killer)
|
void HydrantSmashable::OnDie(Entity* self, Entity* killer)
|
||||||
{
|
{
|
||||||
const auto hydrantName = self->GetVar<std::u16string>(u"hydrant");
|
const auto hydrantName = self->GetVar<std::u16string>(u"hydrant");
|
||||||
|
|
||||||
LDFBaseData* data = new LDFData<std::string>(u"hydrant", GeneralUtils::UTF16ToWTF8(hydrantName));
|
LDFBaseData* data = new LDFData<std::string>(u"hydrant", GeneralUtils::UTF16ToWTF8(hydrantName));
|
||||||
|
|
||||||
EntityInfo info {};
|
EntityInfo info {};
|
||||||
info.lot = 7328;
|
info.lot = HYDRANT_BROKEN;
|
||||||
info.pos = self->GetPosition();
|
info.pos = self->GetPosition();
|
||||||
info.rot = self->GetRotation();
|
info.rot = self->GetRotation();
|
||||||
info.settings = {data};
|
info.settings = {data};
|
||||||
info.spawnerID = self->GetSpawnerID();
|
info.spawnerID = self->GetSpawnerID();
|
||||||
|
|
||||||
Game::logger->Log("HydrantBroken", "Hydrant spawned (%s)\n", data->GetString().c_str());
|
|
||||||
|
|
||||||
auto* hydrant = EntityManager::Instance()->CreateEntity(info);
|
auto* hydrant = EntityManager::Instance()->CreateEntity(info);
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "CppScripts.h"
|
#include "CppScripts.h"
|
||||||
|
|
||||||
class HydrantSmashable : public CppScripts::Script
|
class HydrantSmashable : public CppScripts::Script
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void OnDie(Entity* self, Entity* killer) override;
|
void OnDie(Entity* self, Entity* killer) override;
|
||||||
|
private:
|
||||||
|
LOT HYDRANT_BROKEN = 7328;
|
||||||
};
|
};
|
@ -11,7 +11,7 @@ void NPCAddRemoveItem::OnMissionDialogueOK(Entity *self, Entity *target, int mis
|
|||||||
for (const auto& itemSetting : missionSetting.second) {
|
for (const auto& itemSetting : missionSetting.second) {
|
||||||
for (const auto& lot : itemSetting.items) {
|
for (const auto& lot : itemSetting.items) {
|
||||||
if (itemSetting.add && (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)) {
|
if (itemSetting.add && (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)) {
|
||||||
inventory->AddItem(lot, 1);
|
inventory->AddItem(lot, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
} else if (itemSetting.remove && (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE)) {
|
} else if (itemSetting.remove && (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE)) {
|
||||||
inventory->RemoveItem(lot, 1);
|
inventory->RemoveItem(lot, 1);
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,6 @@ void NjColeNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
inventoryComponent->AddItem(16644, 1);
|
inventoryComponent->AddItem(16644, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,6 @@ void NjScrollChestServer::OnUse(Entity *self, Entity *user) {
|
|||||||
playerInventory->RemoveItem(keyLOT, 1);
|
playerInventory->RemoveItem(keyLOT, 1);
|
||||||
|
|
||||||
// Reward the player with the item set
|
// Reward the player with the item set
|
||||||
playerInventory->AddItem(rewardItemLOT, 1);
|
playerInventory->AddItem(rewardItemLOT, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int miss
|
|||||||
{
|
{
|
||||||
if (inventoryComponent->GetLotCount(14378) == 0)
|
if (inventoryComponent->GetLotCount(14378) == 0)
|
||||||
{
|
{
|
||||||
inventoryComponent->AddItem(14378, 1);
|
inventoryComponent->AddItem(14378, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE)
|
else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE)
|
||||||
|
@ -9,7 +9,7 @@ void NpcPirateServer::OnMissionDialogueOK(Entity *self, Entity *target, int miss
|
|||||||
// Add or remove the lucky shovel based on whether the mission was completed or started
|
// Add or remove the lucky shovel based on whether the mission was completed or started
|
||||||
if ((missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)
|
if ((missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)
|
||||||
&& luckyShovel == nullptr) {
|
&& luckyShovel == nullptr) {
|
||||||
inventory->AddItem(14591, 1);
|
inventory->AddItem(14591, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
|
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
|
||||||
inventory->RemoveItem(14591, 1);
|
inventory->RemoveItem(14591, 1);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
|
|||||||
// For the daily we add the maelstrom vacuum if the player doesn't have it yet
|
// For the daily we add the maelstrom vacuum if the player doesn't have it yet
|
||||||
if (missionID == 1883 && (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)
|
if (missionID == 1883 && (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)
|
||||||
&& maelstromVacuum == nullptr) {
|
&& maelstromVacuum == nullptr) {
|
||||||
inventory->AddItem(maelstromVacuumLot, 1);
|
inventory->AddItem(maelstromVacuumLot, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
|
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
|
||||||
inventory->RemoveItem(maelstromVacuumLot, 1);
|
inventory->RemoveItem(maelstromVacuumLot, 1);
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ void NsConcertInstrument::EquipInstruments(Entity *self, Entity *player) {
|
|||||||
// Equip the left hand instrument
|
// Equip the left hand instrument
|
||||||
const auto leftInstrumentLot = instrumentLotLeft.find(GetInstrumentLot(self))->second;
|
const auto leftInstrumentLot = instrumentLotLeft.find(GetInstrumentLot(self))->second;
|
||||||
if (leftInstrumentLot != LOT_NULL) {
|
if (leftInstrumentLot != LOT_NULL) {
|
||||||
inventory->AddItem(leftInstrumentLot, 1, TEMP_ITEMS, {}, LWOOBJID_EMPTY, false);
|
inventory->AddItem(leftInstrumentLot, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||||
auto* leftInstrument = inventory->FindItemByLot(leftInstrumentLot, TEMP_ITEMS);
|
auto* leftInstrument = inventory->FindItemByLot(leftInstrumentLot, TEMP_ITEMS);
|
||||||
leftInstrument->Equip();
|
leftInstrument->Equip();
|
||||||
}
|
}
|
||||||
@ -203,7 +203,7 @@ void NsConcertInstrument::EquipInstruments(Entity *self, Entity *player) {
|
|||||||
// Equip the right hand instrument
|
// Equip the right hand instrument
|
||||||
const auto rightInstrumentLot = instrumentLotRight.find(GetInstrumentLot(self))->second;
|
const auto rightInstrumentLot = instrumentLotRight.find(GetInstrumentLot(self))->second;
|
||||||
if (rightInstrumentLot != LOT_NULL) {
|
if (rightInstrumentLot != LOT_NULL) {
|
||||||
inventory->AddItem(rightInstrumentLot, 1, TEMP_ITEMS, {}, LWOOBJID_EMPTY, false);
|
inventory->AddItem(rightInstrumentLot, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||||
auto* rightInstrument = inventory->FindItemByLot(rightInstrumentLot, TEMP_ITEMS);
|
auto* rightInstrument = inventory->FindItemByLot(rightInstrumentLot, TEMP_ITEMS);
|
||||||
rightInstrument->Equip();
|
rightInstrument->Equip();
|
||||||
}
|
}
|
||||||
|
@ -47,24 +47,29 @@ void NsTokenConsoleServer::OnUse(Entity* self, Entity* user)
|
|||||||
{
|
{
|
||||||
GameMessages::SendPlayNDAudioEmitter(self, UNASSIGNED_SYSTEM_ADDRESS, useSound);
|
GameMessages::SendPlayNDAudioEmitter(self, UNASSIGNED_SYSTEM_ADDRESS, useSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Player must be in faction to interact with this entity.
|
||||||
|
LOT tokenLOT = 0;
|
||||||
|
|
||||||
if (character->GetPlayerFlag(46))
|
if (character->GetPlayerFlag(46))
|
||||||
{
|
{
|
||||||
inventoryComponent->AddItem(8321, 5);
|
tokenLOT = 8321;
|
||||||
}
|
}
|
||||||
else if (character->GetPlayerFlag(47))
|
else if (character->GetPlayerFlag(47))
|
||||||
{
|
{
|
||||||
inventoryComponent->AddItem(8318, 5);
|
tokenLOT = 8318;
|
||||||
}
|
}
|
||||||
else if (character->GetPlayerFlag(48))
|
else if (character->GetPlayerFlag(48))
|
||||||
{
|
{
|
||||||
inventoryComponent->AddItem(8320, 5);
|
tokenLOT = 8320;
|
||||||
}
|
}
|
||||||
else if (character->GetPlayerFlag(49))
|
else if (character->GetPlayerFlag(49))
|
||||||
{
|
{
|
||||||
inventoryComponent->AddItem(8319, 5);
|
tokenLOT = 8319;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inventoryComponent->AddItem(tokenLOT, 5, eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
|
|
||||||
missionComponent->ForceProgressTaskType(863, 1, 1, false);
|
missionComponent->ForceProgressTaskType(863, 1, 1, false);
|
||||||
|
|
||||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
||||||
|
@ -29,7 +29,7 @@ void NtDukeServer::OnMissionDialogueOK(Entity *self, Entity *target, int mission
|
|||||||
auto lotCount = inventoryComponent->GetLotCount(m_SwordLot);
|
auto lotCount = inventoryComponent->GetLotCount(m_SwordLot);
|
||||||
|
|
||||||
if ((state == MissionState::MISSION_STATE_AVAILABLE || state == MissionState::MISSION_STATE_ACTIVE) && lotCount < 1) {
|
if ((state == MissionState::MISSION_STATE_AVAILABLE || state == MissionState::MISSION_STATE_ACTIVE) && lotCount < 1) {
|
||||||
inventoryComponent->AddItem(m_SwordLot, 1);
|
inventoryComponent->AddItem(m_SwordLot, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
} else if (state == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
|
} else if (state == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
|
||||||
inventoryComponent->RemoveItem(m_SwordLot, lotCount);
|
inventoryComponent->RemoveItem(m_SwordLot, lotCount);
|
||||||
}
|
}
|
||||||
|
45
dScripts/RockHydrantBroken.cpp
Normal file
45
dScripts/RockHydrantBroken.cpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#include "RockHydrantBroken.h"
|
||||||
|
#include "EntityManager.h"
|
||||||
|
#include "GameMessages.h"
|
||||||
|
|
||||||
|
void RockHydrantBroken::OnStartup(Entity* self)
|
||||||
|
{
|
||||||
|
self->AddTimer("playEffect", 1);
|
||||||
|
|
||||||
|
const auto hydrant = "hydrant" + self->GetVar<std::string>(u"hydrant");
|
||||||
|
|
||||||
|
const auto bouncers = EntityManager::Instance()->GetEntitiesInGroup(hydrant);
|
||||||
|
|
||||||
|
for (auto* bouncer : bouncers)
|
||||||
|
{
|
||||||
|
self->SetVar<LWOOBJID>(u"bouncer", bouncer->GetObjectID());
|
||||||
|
|
||||||
|
|
||||||
|
GameMessages::SendBouncerActiveStatus(bouncer->GetObjectID(), true, UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
|
|
||||||
|
GameMessages::SendNotifyObject(bouncer->GetObjectID(), self->GetObjectID(), u"enableCollision", UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
self->AddTimer("KillBroken", 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RockHydrantBroken::OnTimerDone(Entity* self, std::string timerName)
|
||||||
|
{
|
||||||
|
if (timerName == "KillBroken")
|
||||||
|
{
|
||||||
|
auto* bouncer = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"bouncer"));
|
||||||
|
|
||||||
|
if (bouncer != nullptr)
|
||||||
|
{
|
||||||
|
GameMessages::SendBouncerActiveStatus(bouncer->GetObjectID(), false, UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
|
|
||||||
|
GameMessages::SendNotifyObject(bouncer->GetObjectID(), self->GetObjectID(), u"disableCollision", UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
self->Kill();
|
||||||
|
}
|
||||||
|
else if (timerName == "playEffect")
|
||||||
|
{
|
||||||
|
GameMessages::SendPlayFXEffect(self->GetObjectID(), 4737, u"water", "water", LWOOBJID_EMPTY, 1, 1, true);
|
||||||
|
}
|
||||||
|
}
|
10
dScripts/RockHydrantBroken.h
Normal file
10
dScripts/RockHydrantBroken.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "CppScripts.h"
|
||||||
|
|
||||||
|
class RockHydrantBroken : public CppScripts::Script
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void OnStartup(Entity* self) override;
|
||||||
|
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||||
|
};
|
||||||
|
|
@ -1,24 +1,21 @@
|
|||||||
#include "RockHydrantSmashable.h"
|
#include "RockHydrantSmashable.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "SimplePhysicsComponent.h"
|
#include "GeneralUtils.h"
|
||||||
#include "Entity.h"
|
|
||||||
#include "GameMessages.h"
|
|
||||||
#include "Game.h"
|
|
||||||
#include "dLogger.h"
|
|
||||||
|
|
||||||
void RockHydrantSmashable::OnDie(Entity* self, Entity* killer) {
|
void RockHydrantSmashable::OnDie(Entity* self, Entity* killer)
|
||||||
SimplePhysicsComponent* physics = self->GetComponent<SimplePhysicsComponent>();
|
{
|
||||||
NiPoint3 pos = physics->GetPosition();
|
const auto hydrantName = self->GetVar<std::u16string>(u"hydrant");
|
||||||
|
|
||||||
EntityInfo info;
|
LDFBaseData* data = new LDFData<std::string>(u"hydrant", GeneralUtils::UTF16ToWTF8(hydrantName));
|
||||||
info.lot = 12293;
|
|
||||||
info.pos = pos;
|
EntityInfo info {};
|
||||||
info.spawner = nullptr;
|
info.lot = ROCK_HYDRANT_BROKEN;
|
||||||
|
info.pos = self->GetPosition();
|
||||||
|
info.rot = self->GetRotation();
|
||||||
|
info.settings = {data};
|
||||||
info.spawnerID = self->GetSpawnerID();
|
info.spawnerID = self->GetSpawnerID();
|
||||||
info.spawnerNodeID = 0;
|
|
||||||
|
|
||||||
Entity* newEntity = EntityManager::Instance()->CreateEntity(info, nullptr);
|
auto* hydrant = EntityManager::Instance()->CreateEntity(info);
|
||||||
if (newEntity) {
|
|
||||||
EntityManager::Instance()->ConstructEntity(newEntity);
|
EntityManager::Instance()->ConstructEntity(hydrant);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -5,5 +5,7 @@ class RockHydrantSmashable : public CppScripts::Script
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void OnDie(Entity* self, Entity* killer);
|
void OnDie(Entity* self, Entity* killer);
|
||||||
|
private:
|
||||||
|
LOT ROCK_HYDRANT_BROKEN = 12293;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ void SGCannon::StopGame(Entity *self, bool cancel) {
|
|||||||
auto* inventory = player->GetComponent<InventoryComponent>();
|
auto* inventory = player->GetComponent<InventoryComponent>();
|
||||||
if (inventory != nullptr) {
|
if (inventory != nullptr) {
|
||||||
for (const auto rewardLot : self->GetVar<std::vector<LOT>>(RewardsVariable)) {
|
for (const auto rewardLot : self->GetVar<std::vector<LOT>>(RewardsVariable)) {
|
||||||
inventory->AddItem(rewardLot, 1, eInventoryType::MODELS);
|
inventory->AddItem(rewardLot, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY, eInventoryType::MODELS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,15 +21,17 @@ void TokenConsoleServer::OnUse(Entity* self, Entity* user) {
|
|||||||
//figure out which faction the player belongs to:
|
//figure out which faction the player belongs to:
|
||||||
auto character = user->GetCharacter();
|
auto character = user->GetCharacter();
|
||||||
if (!character) return;
|
if (!character) return;
|
||||||
|
// At this point the player has to be in a faction.
|
||||||
|
LOT tokenLOT = 0;
|
||||||
if (character->GetPlayerFlag(ePlayerFlags::VENTURE_FACTION)) //venture
|
if (character->GetPlayerFlag(ePlayerFlags::VENTURE_FACTION)) //venture
|
||||||
inv->AddItem(8321, tokensToGive);
|
tokenLOT = 8321;
|
||||||
else if (character->GetPlayerFlag(ePlayerFlags::ASSEMBLY_FACTION)) //assembly
|
else if (character->GetPlayerFlag(ePlayerFlags::ASSEMBLY_FACTION)) //assembly
|
||||||
inv->AddItem(8318, tokensToGive);
|
tokenLOT = 8318;
|
||||||
else if (character->GetPlayerFlag(ePlayerFlags::PARADOX_FACTION)) //paradox
|
else if (character->GetPlayerFlag(ePlayerFlags::PARADOX_FACTION)) //paradox
|
||||||
inv->AddItem(8320, tokensToGive);
|
tokenLOT = 8320;
|
||||||
else if (character->GetPlayerFlag(ePlayerFlags::SENTINEL_FACTION)) //sentinel
|
else if (character->GetPlayerFlag(ePlayerFlags::SENTINEL_FACTION)) //sentinel
|
||||||
inv->AddItem(8319, tokensToGive);
|
tokenLOT = 8319;
|
||||||
|
inv->AddItem(tokenLOT, tokensToGive, eLootSourceType::LOOT_SOURCE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
||||||
|
@ -10,7 +10,7 @@ void VeBricksampleServer::OnUse(Entity *self, Entity *user) {
|
|||||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||||
|
|
||||||
if (loot && inventoryComponent != nullptr && inventoryComponent->GetLotCount(loot) == 0) {
|
if (loot && inventoryComponent != nullptr && inventoryComponent->GetLotCount(loot) == 0) {
|
||||||
inventoryComponent->AddItem(loot, 1);
|
inventoryComponent->AddItem(loot, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||||
|
|
||||||
for (auto* brickEntity : EntityManager::Instance()->GetEntitiesInGroup("Bricks")) {
|
for (auto* brickEntity : EntityManager::Instance()->GetEntitiesInGroup("Bricks")) {
|
||||||
GameMessages::SendNotifyClientObject(brickEntity->GetObjectID(), u"Pickedup");
|
GameMessages::SendNotifyClientObject(brickEntity->GetObjectID(), u"Pickedup");
|
||||||
|
@ -8,7 +8,7 @@ void VeMissionConsole::OnUse(Entity *self, Entity *user) {
|
|||||||
|
|
||||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||||
if (inventoryComponent != nullptr) {
|
if (inventoryComponent != nullptr) {
|
||||||
inventoryComponent->AddItem(12547, 1); // Add the panel required for pickup
|
inventoryComponent->AddItem(12547, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY); // Add the panel required for pickup
|
||||||
}
|
}
|
||||||
|
|
||||||
// The flag to set is 101<number>
|
// The flag to set is 101<number>
|
||||||
|
69
dScripts/WhFans.cpp
Normal file
69
dScripts/WhFans.cpp
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
#include "WhFans.h"
|
||||||
|
|
||||||
|
#include "RenderComponent.h"
|
||||||
|
|
||||||
|
void WhFans::OnStartup(Entity* self) {
|
||||||
|
self->SetVar<bool>(u"alive", true);
|
||||||
|
self->SetVar<bool>(u"on", false);
|
||||||
|
|
||||||
|
ToggleFX(self, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WhFans::ToggleFX(Entity* self, bool hit) {
|
||||||
|
std::string fanGroup;
|
||||||
|
const auto& groups = self->GetGroups();
|
||||||
|
if (!groups.empty()) {
|
||||||
|
fanGroup = groups[0];
|
||||||
|
} else {
|
||||||
|
fanGroup = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Entity*> fanVolumes = EntityManager::Instance()->GetEntitiesInGroup(fanGroup);
|
||||||
|
|
||||||
|
auto* renderComponent = self->GetComponent<RenderComponent>();
|
||||||
|
|
||||||
|
if (renderComponent == nullptr) return;
|
||||||
|
|
||||||
|
if (fanVolumes.size() == 0 || !self->GetVar<bool>(u"alive")) return;
|
||||||
|
|
||||||
|
if (self->GetVar<bool>(u"on")) {
|
||||||
|
GameMessages::SendPlayAnimation(self, u"fan-off");
|
||||||
|
|
||||||
|
renderComponent->StopEffect("fanOn");
|
||||||
|
self->SetVar<bool>(u"on", false);
|
||||||
|
|
||||||
|
for (Entity* volume : fanVolumes) {
|
||||||
|
auto volumePhys = volume->GetComponent<PhantomPhysicsComponent>();
|
||||||
|
if (!volumePhys) continue;
|
||||||
|
volumePhys->SetPhysicsEffectActive(false);
|
||||||
|
EntityManager::Instance()->SerializeEntity(volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!self->GetVar<bool>(u"on") && self->GetVar<bool>(u"alive")) {
|
||||||
|
GameMessages::SendPlayAnimation(self, u"fan-on");
|
||||||
|
|
||||||
|
self->SetVar<bool>(u"on", true);
|
||||||
|
|
||||||
|
for (Entity* volume : fanVolumes) {
|
||||||
|
auto volumePhys = volume->GetComponent<PhantomPhysicsComponent>();
|
||||||
|
if (!volumePhys) continue;
|
||||||
|
volumePhys->SetPhysicsEffectActive(true);
|
||||||
|
EntityManager::Instance()->SerializeEntity(volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WhFans::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2,
|
||||||
|
int32_t param3) {
|
||||||
|
if (args.length() == 0 || !self->GetVar<bool>(u"alive")) return;
|
||||||
|
|
||||||
|
if ((args == "turnOn" && self->GetVar<bool>(u"on")) || (args == "turnOff" && !self->GetVar<bool>(u"on"))) return;
|
||||||
|
ToggleFX(self, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WhFans::OnDie(Entity* self, Entity* killer) {
|
||||||
|
if (self->GetVar<bool>(u"on")) {
|
||||||
|
ToggleFX(self, true);
|
||||||
|
}
|
||||||
|
self->SetVar<bool>(u"alive", false);
|
||||||
|
}
|
23
dScripts/WhFans.h
Normal file
23
dScripts/WhFans.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "CppScripts.h"
|
||||||
|
#include "GameMessages.h"
|
||||||
|
#include "EntityManager.h"
|
||||||
|
#include "PhantomPhysicsComponent.h"
|
||||||
|
|
||||||
|
class WhFans : public CppScripts::Script
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void OnStartup(Entity* self) override;
|
||||||
|
void OnDie(Entity* self, Entity* killer) override;
|
||||||
|
void OnFireEventServerSide(
|
||||||
|
Entity *self,
|
||||||
|
Entity *sender,
|
||||||
|
std::string args,
|
||||||
|
int32_t param1,
|
||||||
|
int32_t param2,
|
||||||
|
int32_t param3
|
||||||
|
) override;
|
||||||
|
private:
|
||||||
|
void ToggleFX(Entity* self, bool hit);
|
||||||
|
};
|
||||||
|
|
@ -975,6 +975,8 @@ void HandlePacket(Packet* packet) {
|
|||||||
player->GetComponent<CharacterComponent>()->SetLastRocketConfig(u"");
|
player->GetComponent<CharacterComponent>()->SetLastRocketConfig(u"");
|
||||||
|
|
||||||
c->SetRetroactiveFlags();
|
c->SetRetroactiveFlags();
|
||||||
|
|
||||||
|
player->RetroactiveVaultSize();
|
||||||
|
|
||||||
player->GetCharacter()->SetTargetScene("");
|
player->GetCharacter()->SetTargetScene("");
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
UPDATE ComponentsRegistry SET component_id = 1901 WHERE id = 12916;
|
UPDATE ComponentsRegistry SET component_id = 1901 WHERE id = 12916 AND component_type = 39;
|
||||||
INSERT INTO ActivityRewards (objectTemplate, ActivityRewardIndex, activityRating, LootMatrixIndex, CurrencyIndex, ChallengeRating, description) VALUES (1901, 166, -1, 598, 1, 4, 'NT Foot Race');
|
INSERT INTO ActivityRewards (objectTemplate, ActivityRewardIndex, activityRating, LootMatrixIndex, CurrencyIndex, ChallengeRating, description) VALUES (1901, 166, -1, 598, 1, 4, 'NT Foot Race');
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
3
migrations/cdserver/4_nt_footrace_parrot.sql
Normal file
3
migrations/cdserver/4_nt_footrace_parrot.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
UPDATE ComponentsRegistry SET component_id = 12702 WHERE id = 12916 AND component_type = 2;
|
||||||
|
UPDATE ComponentsRegistry SET component_id = 6280 WHERE id = 12916 AND component_type = 3;
|
||||||
|
UPDATE ComponentsRegistry SET component_id = 1791 WHERE id = 12916 AND component_type = 7;
|
Loading…
Reference in New Issue
Block a user