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
+5 -2
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;
+1 -1
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!
+1 -1
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!
+1 -1
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!
+1 -1
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!
+2
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