Added two rules to toggle ornamentations on/off or specify the augtype value

This commit is contained in:
ricardocampos23 2014-04-18 22:31:02 +01:00
parent fcaa52e0c3
commit 5fa1db4c21
11 changed files with 8285 additions and 13 deletions

View File

@ -24,6 +24,7 @@
#include "races.h"
#include "shareddb.h"
#include "classes.h"
#include "../common/rulesys.h"
#include <limits.h>
@ -402,13 +403,14 @@ void ItemInst::PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id)
bool ItemInst::HasOrnamentation() const
{
if(!RuleB(Inventory,UseAugOrnamentations)) return false;
const ItemInst *item;
for (int i = 0; i < MAX_AUGMENT_SLOTS; ++i)
{
uint32 id = 0;
if ((item = GetItem(i)) != nullptr)
{
if (item->GetItem()->AugType == 524288)return true;
if (item->GetItem()->AugType == RuleI(Inventory,AugOrnamentationType))return true;
}
}
return false;
@ -416,12 +418,13 @@ bool ItemInst::HasOrnamentation() const
ItemInst* ItemInst::GetOrnamentation() const
{
if(!RuleB(Inventory,UseAugOrnamentations)) return nullptr;
if (m_item->ItemClass == ItemClassCommon)
{
ItemInst *item;
for (int i = 0; i < MAX_AUGMENT_SLOTS; ++i)
{
if ((item = GetItem(i)) != nullptr && item->GetItem()->AugType == 524288) return item;
if ((item = GetItem(i)) != nullptr && item->GetItem()->AugType == RuleI(Inventory,AugOrnamentationType)) return item;
}
}
return nullptr;

View File

@ -4928,7 +4928,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
// Moofta: if the item has an aug of type 20 (ornamentation) then we use the ID file of that when serializing.
// the only thing we should probably worry about is generating a wear change packet to all cl;ients in zone if someone adds a type 20 aug.
if (inst && inst->HasOrnamentation()) //instance is not null and does have an ornament aug (slot 20)
if (RuleB(Inventory,UseAugOrnamentations) && inst && inst->HasOrnamentation()) //instance is not null and does have an ornament aug (slot 20)
{
ItemInst* ornamentation = inst->GetOrnamentation();
if (ornamentation) //paranoid!

View File

@ -3121,7 +3121,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
// Moofta: if the item has an aug of type 20 (ornamentation) then we use the ID file of that when serializing.
// the only thing we should probably worry about is generating a wear change packet to all cl;ients in zone if someone adds a type 20 aug.
if (inst && inst->HasOrnamentation()) //instance is not null and does have an ornament aug (slot 20)
if (RuleB(Inventory,UseAugOrnamentations) && inst && inst->HasOrnamentation()) //instance is not null and does have an ornament aug (slot 20)
{
ItemInst* ornamentation = inst->GetOrnamentation();
if (ornamentation) //paranoid!

View File

@ -2439,7 +2439,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
// Moofta: if the item has an aug of type 20/524288 (ornamentation) then we use the ID file of that when serializing.
// the only thing we should probably worry about is generating a wear change packet to all cl;ients in zone if someone adds a type 20 aug.
if (inst && inst->HasOrnamentation()) //instance is not null and does have an ornament aug (slot 20)
if (RuleB(Inventory,UseAugOrnamentations) && inst && inst->HasOrnamentation()) //instance is not null and does have an ornament aug (slot 20)
{
ItemInst* ornamentation = inst->GetOrnamentation();
if (ornamentation) //paranoid!

View File

@ -3532,7 +3532,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
// Moofta: if the item has an aug of type 20 (ornamentation) then we use the ID file of that when serializing.
// the only thing we should probably worry about is generating a wear change packet to all clients in zone if someone adds a type 20 aug.
if (inst && inst->HasOrnamentation()) //instance is not null and does have an ornament aug (slot 20)
if (RuleB(Inventory,UseAugOrnamentations) && inst && inst->HasOrnamentation()) //instance is not null and does have an ornament aug (slot 20)
{
ItemInst* ornamentation = inst->GetOrnamentation();
if (ornamentation) //paranoid!

View File

@ -551,6 +551,8 @@ RULE_CATEGORY( Inventory )
RULE_BOOL ( Inventory, EnforceAugmentRestriction, true) // Forces augment slot restrictions
RULE_BOOL ( Inventory, EnforceAugmentUsability, true) // Forces augmented item usability
RULE_BOOL ( Inventory, EnforceAugmentWear, true) // Forces augment wear slot validation
RULE_BOOL ( Inventory, UseAugOrnamentations, true) // Allows use of augment ornamentations
RULE_INT(Inventory,AugOrnamentationType,524288) // Custom servers can override default value (slot 20/524288)
RULE_CATEGORY_END()
#undef RULE_CATEGORY

View File

@ -202,7 +202,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
if (strlen(item->GetItem()->IDFile) > 2)
{
uint32 idfile = 0;
if (item->HasOrnamentation())
if (RuleB(Inventory,UseAugOrnamentations) && item->HasOrnamentation())
{
ItemInst* ornament = item->GetOrnamentation();
if (strlen(ornament->GetItem()->IDFile) > 2)

View File

@ -4578,7 +4578,7 @@ int32 Bot::GetEquipmentMaterial(uint8 material_slot) const
const ItemInst* inst = m_inv.GetItem(inventorySlot);
if (inst != nullptr)
{
if (inst->HasOrnamentation())
if (RuleB(Inventory,UseAugOrnamentations) && inst->HasOrnamentation())
{
const ItemInst* ornament = inst->GetOrnamentation();
if (strlen(ornament->GetItem()->IDFile) > 2)
@ -4714,7 +4714,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
item = inst->GetItem();
if(item)
{
if (inst->HasOrnamentation())
if (RuleB(Inventory,UseAugOrnamentations) && inst->HasOrnamentation())
{
const ItemInst* ornament = inst->GetOrnamentation();
if (strlen(ornament->GetItem()->IDFile) > 2)
@ -4738,7 +4738,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
item = inst->GetItem();
if(item)
{
if (inst->HasOrnamentation())
if (RuleB(Inventory,UseAugOrnamentations) && inst->HasOrnamentation())
{
const ItemInst* ornament = inst->GetOrnamentation();
if (strlen(ornament->GetItem()->IDFile) > 2)

View File

@ -1907,7 +1907,7 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
ns->spawn.colors[MaterialFeet].color = GetEquipmentColor(MaterialFeet);
}
if ((inst = m_inv[SLOT_PRIMARY]) && inst->IsType(ItemClassCommon)) {
if (inst->HasOrnamentation())
if (RuleB(Inventory,UseAugOrnamentations) && inst->HasOrnamentation())
{
const ItemInst* ornament = inst->GetOrnamentation();
if (strlen(ornament->GetItem()->IDFile) > 2)
@ -1923,7 +1923,7 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
}
}
if ((inst = m_inv[SLOT_SECONDARY]) && inst->IsType(ItemClassCommon)) {
if (inst->HasOrnamentation())
if (RuleB(Inventory,UseAugOrnamentations) && inst->HasOrnamentation())
{
const ItemInst* ornament = inst->GetOrnamentation();
if (strlen(ornament->GetItem()->IDFile) > 2)

8267
zone/client.cpp.orig Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4707,7 +4707,7 @@ void command_iteminfo(Client *c, const Seperator *sep)
const Item_Struct* item = inst->GetItem();
c->Message(0, "ID: %i Name: %s", item->ID, item->Name);
c->Message(0, " Lore: %s ND: %i NS: %i Type: %i", (item->LoreFlag) ? "true":"false", item->NoDrop, item->NoRent, item->ItemClass);
if(inst->HasOrnamentation())
if(RuleB(Inventory,UseAugOrnamentations) && inst->HasOrnamentation())
{
c->Message(0, " IDF: %s Size: %i Weight: %i icon_id: %i Price: %i", inst->GetOrnamentation()->GetItem()->IDFile, item->Size, item->Weight, item->Icon, item->Price);
}