Converted MATERIAL defines to MaterialUseSlots enumeration

This commit is contained in:
Uleat 2013-10-27 08:01:37 -04:00
parent df47e17c8e
commit 0d5fc26841
20 changed files with 176 additions and 165 deletions

View File

@ -12,6 +12,7 @@ Uleat: Enforced naming standard on my recent changes (Sorry for any inconviencie
Uleat: Moved DeityTypes enumeration from eq_constants.h to deity.h (expanded utility of accessors, but are yet to be implemented)
Uleat: Changed ItemUseType to ItemInstTypes to better reflect the definition (also to free-up the namespace)
Uleat: Changed ItemClass to ItemClassTypes
Uleat: Converted MATERIAL defines to MaterialUseSlots enumeration - use of scripted 'Bracer' and 'Max' are deprecated
== 10/24/2013 ==
demonstar55: Fix some memory leaks in Mob::SpellOnTarget

View File

@ -1790,26 +1790,26 @@ int16 Inventory::CalcSlotFromMaterial(uint8 material)
{
switch(material)
{
case MATERIAL_HEAD:
case MaterialHead:
return SLOT_HEAD;
case MATERIAL_CHEST:
case MaterialChest:
return SLOT_CHEST;
case MATERIAL_ARMS:
case MaterialArms:
return SLOT_ARMS;
case MATERIAL_BRACER:
case MaterialWrist:
return SLOT_BRACER01; // there's 2 bracers, only one bracer material
case MATERIAL_HANDS:
case MaterialHands:
return SLOT_HANDS;
case MATERIAL_LEGS:
case MaterialLegs:
return SLOT_LEGS;
case MATERIAL_FEET:
case MaterialFeet:
return SLOT_FEET;
case MATERIAL_PRIMARY:
case MaterialPrimary:
return SLOT_PRIMARY;
case MATERIAL_SECONDARY:
case MaterialSecondary:
return SLOT_SECONDARY;
default:
return -1;
return SLOT_INVALID;
}
}
@ -1818,26 +1818,26 @@ uint8 Inventory::CalcMaterialFromSlot(int16 equipslot)
switch(equipslot)
{
case SLOT_HEAD:
return MATERIAL_HEAD;
return MaterialHead;
case SLOT_CHEST:
return MATERIAL_CHEST;
return MaterialChest;
case SLOT_ARMS:
return MATERIAL_ARMS;
return MaterialArms;
case SLOT_BRACER01:
case SLOT_BRACER02:
return MATERIAL_BRACER;
return MaterialWrist;
case SLOT_HANDS:
return MATERIAL_HANDS;
return MaterialHands;
case SLOT_LEGS:
return MATERIAL_LEGS;
return MaterialLegs;
case SLOT_FEET:
return MATERIAL_FEET;
return MaterialFeet;
case SLOT_PRIMARY:
return MATERIAL_PRIMARY;
return MaterialPrimary;
case SLOT_SECONDARY:
return MATERIAL_SECONDARY;
return MaterialSecondary;
default:
return 0xFF;
return _MaterialInvalid;
}
}

View File

@ -596,17 +596,24 @@ static const uint8 SkillDamageTypes[HIGHEST_SKILL+1] = {
/* FRENZY */ 74
};
// Indexing positions into item material arrays
#define MATERIAL_HEAD 0
#define MATERIAL_CHEST 1
#define MATERIAL_ARMS 2
#define MATERIAL_BRACER 3
#define MATERIAL_HANDS 4
#define MATERIAL_LEGS 5
#define MATERIAL_FEET 6
#define MATERIAL_PRIMARY 7
#define MATERIAL_SECONDARY 8
#define MAX_MATERIALS 9 //number of equipables
/*
** Material use slots
**
*/
enum MaterialUseSlots : uint8
{
MaterialHead = 0,
MaterialChest,
MaterialArms,
MaterialWrist,
MaterialHands,
MaterialLegs,
MaterialFeet,
MaterialPrimary,
MaterialSecondary,
_MaterialCount,
_MaterialInvalid = 255
};
// Used for worn NPC inventory tracking. NPCs don't use
// augments, so only the basic slots need to be kept track of.

View File

@ -270,7 +270,7 @@ struct Spawn_Struct {
/*0225*/ uint32 equip_primary; // Equipment: Primary Visual
/*0229*/ uint32 equip_secondary; // Equipment: Secondary Visual
} equip;
/*0197*/ uint32 equipment[MAX_MATERIALS]; // Array elements correspond to struct equipment above
/*0197*/ uint32 equipment[_MaterialCount]; // Array elements correspond to struct equipment above
};
/*0233*/ float runspeed; // Speed when running
/*0036*/ uint8 afk; // 0=no, 1=afk
@ -316,7 +316,7 @@ union
/*0376*/ Color_Struct color_primary; // Color of primary item
/*0380*/ Color_Struct color_secondary; // Color of secondary item
} equipment_colors;
/*0348*/ Color_Struct colors[MAX_MATERIALS]; // Array elements correspond to struct equipment_colors above
/*0348*/ Color_Struct colors[_MaterialCount]; // Array elements correspond to struct equipment_colors above
};
/*0384*/ uint8 lfg; // 0=off, 1=lfg on
/*0385*/
@ -787,7 +787,7 @@ struct SuspendedMinion_Struct
/*002*/ uint32 HP;
/*006*/ uint32 Mana;
/*010*/ SpellBuff_Struct Buffs[BUFF_COUNT];
/*510*/ uint32 Items[MAX_MATERIALS];
/*510*/ uint32 Items[_MaterialCount];
/*546*/ char Name[64];
/*610*/
};
@ -892,9 +892,9 @@ struct PlayerProfile_Struct
/*0304*/ uint8 ability_time_minutes;
/*0305*/ uint8 ability_time_hours; //place holder
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
/*0312*/ uint32 item_material[MAX_MATERIALS]; // Item texture/material of worn/held items
/*0312*/ uint32 item_material[_MaterialCount]; // Item texture/material of worn/held items
/*0348*/ uint8 unknown0348[44];
/*0392*/ Color_Struct item_tint[MAX_MATERIALS];
/*0392*/ Color_Struct item_tint[_MaterialCount];
/*0428*/ AA_Array aa_array[MAX_PP_AA_ARRAY];
/*2348*/ float unknown2384; //seen ~128, ~47
/*2352*/ char servername[32]; // length probably not right
@ -2013,7 +2013,7 @@ struct Illusion_Struct { //size: 256 - SoF
/*092*/ uint32 drakkin_heritage; //
/*096*/ uint32 drakkin_tattoo; //
/*100*/ uint32 drakkin_details; //
/*104*/ uint32 armor_tint[MAX_MATERIALS]; //
/*104*/ uint32 armor_tint[_MaterialCount]; //
/*140*/ uint8 eyecolor1; // Field Not Identified in any Illusion Struct
/*141*/ uint8 eyecolor2; // Field Not Identified in any Illusion Struct
/*142*/ uint8 unknown138[114]; //
@ -3257,7 +3257,7 @@ struct DyeStruct
struct Color_Struct secondary; // or this
}
dyes;
struct Color_Struct dye[MAX_MATERIALS];
struct Color_Struct dye[_MaterialCount];
};
};

View File

@ -41,7 +41,7 @@ struct ExtendedProfile_Struct {
uint16 old_pet_hp;
uint16 old_pet_mana;
SpellBuff_Struct pet_buffs[BUFF_COUNT];
uint32 pet_items[MAX_MATERIALS];
uint32 pet_items[_MaterialCount];
char merc_name[64];
uint32 aa_effects;

View File

@ -717,7 +717,7 @@ ENCODE(OP_SendCharInfo) {
eq2->gender = emu->gender[r];
eq2->face = emu->face[r];
int k;
for(k = 0; k < MAX_MATERIALS; k++) {
for(k = 0; k < _MaterialCount; k++) {
eq2->equip[k].equip0 = emu->equip[r][k];
eq2->equip[k].equip1 = 0;
eq2->equip[k].equip2 = 0;
@ -2015,13 +2015,13 @@ ENCODE(OP_ZoneSpawns)
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MATERIAL_PRIMARY]);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary]);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MATERIAL_SECONDARY]);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialSecondary]);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);

View File

@ -335,7 +335,7 @@ ENCODE(OP_SendCharInfo) {
eq2->haircolor = emu->haircolor[r];
eq2->face = emu->face[r];
int k;
for(k = 0; k < MAX_MATERIALS; k++) {
for(k = 0; k < _MaterialCount; k++) {
eq2->equip[k].equip0 = emu->equip[r][k];
eq2->equip[k].equip1 = 0;
eq2->equip[k].itemid = 0;
@ -1216,11 +1216,11 @@ ENCODE(OP_ZoneSpawns) {
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MATERIAL_PRIMARY]);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary]);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MATERIAL_SECONDARY]);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialSecondary]);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
}

View File

@ -334,7 +334,7 @@ ENCODE(OP_SendCharInfo) {
eq2->haircolor = emu->haircolor[r];
eq2->face = emu->face[r];
int k;
for(k = 0; k < MAX_MATERIALS; k++) {
for(k = 0; k < _MaterialCount; k++) {
eq2->equip[k].equip0 = emu->equip[r][k];
eq2->equip[k].equip1 = 0;
eq2->equip[k].itemid = 0;

View File

@ -336,7 +336,7 @@ ENCODE(OP_SendCharInfo) {
eq2->haircolor = emu->haircolor[r];
eq2->face = emu->face[r];
int k;
for(k = 0; k < MAX_MATERIALS; k++) {
for(k = 0; k < _MaterialCount; k++) {
eq2->equip[k].equip0 = emu->equip[r][k];
eq2->equip[k].equip1 = 0;
eq2->equip[k].itemid = 0;
@ -1228,11 +1228,11 @@ ENCODE(OP_ZoneSpawns) {
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MATERIAL_PRIMARY]);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary]);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MATERIAL_SECONDARY]);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialSecondary]);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
}

View File

@ -197,11 +197,11 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
cs->cs_colors[char_num][material].color = color;
// the weapons are kept elsewhere
if ((material==MATERIAL_PRIMARY) || (material==MATERIAL_SECONDARY))
if ((material==MaterialPrimary) || (material==MaterialSecondary))
{
if(strlen(item->GetItem()->IDFile) > 2) {
uint32 idfile=atoi(&item->GetItem()->IDFile[2]);
if (material==MATERIAL_PRIMARY)
if (material==MaterialPrimary)
cs->primary[char_num]=idfile;
else
cs->secondary[char_num]=idfile;

View File

@ -1312,7 +1312,7 @@ void Mob::AI_Process() {
{
int myclass = GetClass();
//can only dual wield without a weapon if your a monk
if(GetSpecialAbility(SPECATK_INNATE_DW) || (GetEquipment(MATERIAL_SECONDARY) != 0 && GetLevel() > 29) || myclass == MONK || myclass == MONKGM) {
if(GetSpecialAbility(SPECATK_INNATE_DW) || (GetEquipment(MaterialSecondary) != 0 && GetLevel() > 29) || myclass == MONK || myclass == MONKGM) {
float DualWieldProbability = (GetSkill(DUAL_WIELD) + GetLevel()) / 400.0f;
if(MakeRandomFloat(0.0, 1.0) < DualWieldProbability)
{

View File

@ -4584,8 +4584,8 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MATERIAL_HANDS] = item->Material;
ns->spawn.colors[MATERIAL_HANDS].color = GetEquipmentColor(MATERIAL_HANDS);
ns->spawn.equipment[MaterialHands] = item->Material;
ns->spawn.colors[MaterialHands].color = GetEquipmentColor(MaterialHands);
}
}
@ -4593,8 +4593,8 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MATERIAL_HEAD] = item->Material;
ns->spawn.colors[MATERIAL_HEAD].color = GetEquipmentColor(MATERIAL_HEAD);
ns->spawn.equipment[MaterialHead] = item->Material;
ns->spawn.colors[MaterialHead].color = GetEquipmentColor(MaterialHead);
}
}
@ -4602,8 +4602,8 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MATERIAL_ARMS] = item->Material;
ns->spawn.colors[MATERIAL_ARMS].color = GetEquipmentColor(MATERIAL_ARMS);
ns->spawn.equipment[MaterialArms] = item->Material;
ns->spawn.colors[MaterialArms].color = GetEquipmentColor(MaterialArms);
}
}
@ -4611,8 +4611,8 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MATERIAL_BRACER] = item->Material;
ns->spawn.colors[MATERIAL_BRACER].color = GetEquipmentColor(MATERIAL_BRACER);
ns->spawn.equipment[MaterialWrist] = item->Material;
ns->spawn.colors[MaterialWrist].color = GetEquipmentColor(MaterialWrist);
}
}
@ -4620,8 +4620,8 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MATERIAL_BRACER] = item->Material;
ns->spawn.colors[MATERIAL_BRACER].color = GetEquipmentColor(MATERIAL_BRACER);
ns->spawn.equipment[MaterialWrist] = item->Material;
ns->spawn.colors[MaterialWrist].color = GetEquipmentColor(MaterialWrist);
}
}
@ -4629,8 +4629,8 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MATERIAL_CHEST] = item->Material;
ns->spawn.colors[MATERIAL_CHEST].color = GetEquipmentColor(MATERIAL_CHEST);
ns->spawn.equipment[MaterialChest] = item->Material;
ns->spawn.colors[MaterialChest].color = GetEquipmentColor(MaterialChest);
}
}
@ -4638,8 +4638,8 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MATERIAL_LEGS] = item->Material;
ns->spawn.colors[MATERIAL_LEGS].color = GetEquipmentColor(MATERIAL_LEGS);
ns->spawn.equipment[MaterialLegs] = item->Material;
ns->spawn.colors[MaterialLegs].color = GetEquipmentColor(MaterialLegs);
}
}
@ -4647,8 +4647,8 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MATERIAL_FEET] = item->Material;
ns->spawn.colors[MATERIAL_FEET].color = GetEquipmentColor(MATERIAL_FEET);
ns->spawn.equipment[MaterialFeet] = item->Material;
ns->spawn.colors[MaterialFeet].color = GetEquipmentColor(MaterialFeet);
}
}
@ -4657,8 +4657,8 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
item = inst->GetItem();
if(item) {
if(strlen(item->IDFile) > 2)
ns->spawn.equipment[MATERIAL_PRIMARY] = atoi(&item->IDFile[2]);
ns->spawn.colors[MATERIAL_PRIMARY].color = GetEquipmentColor(MATERIAL_PRIMARY);
ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]);
ns->spawn.colors[MaterialPrimary].color = GetEquipmentColor(MaterialPrimary);
}
}
@ -4667,8 +4667,8 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
item = inst->GetItem();
if(item) {
if(strlen(item->IDFile) > 2)
ns->spawn.equipment[MATERIAL_SECONDARY] = atoi(&item->IDFile[2]);
ns->spawn.colors[MATERIAL_SECONDARY].color = GetEquipmentColor(MATERIAL_SECONDARY);
ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]);
ns->spawn.colors[MaterialSecondary].color = GetEquipmentColor(MaterialSecondary);
}
}
}
@ -5431,8 +5431,8 @@ void Bot::BotRemoveEquipItem(int slot) {
if(materialFromSlot != 0xFF) {
equipment[slot] = 0; // npc has more than just material slots. Valid material should mean valid inventory index
SendWearChange(materialFromSlot);
if(materialFromSlot == MATERIAL_CHEST)
SendWearChange(MATERIAL_ARMS);
if(materialFromSlot == MaterialChest)
SendWearChange(MaterialArms);
}
}
}
@ -7981,7 +7981,7 @@ int Bot::GetMonkHandToHandDamage(void)
// Have a look to see if we have epic fists on
uint32 botWeaponId = INVALID_ID;
botWeaponId = CastToNPC()->GetEquipment(MATERIAL_HANDS);
botWeaponId = CastToNPC()->GetEquipment(MaterialHands);
if(botWeaponId == 10652) { //Monk Epic ID
return 9;
}

View File

@ -1858,53 +1858,53 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
const ItemInst* inst = nullptr;
if ((inst = m_inv[SLOT_HANDS]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MATERIAL_HANDS] = item->Material;
ns->spawn.colors[MATERIAL_HANDS].color = GetEquipmentColor(MATERIAL_HANDS);
ns->spawn.equipment[MaterialHands] = item->Material;
ns->spawn.colors[MaterialHands].color = GetEquipmentColor(MaterialHands);
}
if ((inst = m_inv[SLOT_HEAD]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MATERIAL_HEAD] = item->Material;
ns->spawn.colors[MATERIAL_HEAD].color = GetEquipmentColor(MATERIAL_HEAD);
ns->spawn.equipment[MaterialHead] = item->Material;
ns->spawn.colors[MaterialHead].color = GetEquipmentColor(MaterialHead);
}
if ((inst = m_inv[SLOT_ARMS]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MATERIAL_ARMS] = item->Material;
ns->spawn.colors[MATERIAL_ARMS].color = GetEquipmentColor(MATERIAL_ARMS);
ns->spawn.equipment[MaterialArms] = item->Material;
ns->spawn.colors[MaterialArms].color = GetEquipmentColor(MaterialArms);
}
if ((inst = m_inv[SLOT_BRACER01]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MATERIAL_BRACER]= item->Material;
ns->spawn.colors[MATERIAL_BRACER].color = GetEquipmentColor(MATERIAL_BRACER);
ns->spawn.equipment[MaterialWrist]= item->Material;
ns->spawn.colors[MaterialWrist].color = GetEquipmentColor(MaterialWrist);
}
if ((inst = m_inv[SLOT_BRACER02]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MATERIAL_BRACER]= item->Material;
ns->spawn.colors[MATERIAL_BRACER].color = GetEquipmentColor(MATERIAL_BRACER);
ns->spawn.equipment[MaterialWrist]= item->Material;
ns->spawn.colors[MaterialWrist].color = GetEquipmentColor(MaterialWrist);
}
if ((inst = m_inv[SLOT_CHEST]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MATERIAL_CHEST] = item->Material;
ns->spawn.colors[MATERIAL_CHEST].color = GetEquipmentColor(MATERIAL_CHEST);
ns->spawn.equipment[MaterialChest] = item->Material;
ns->spawn.colors[MaterialChest].color = GetEquipmentColor(MaterialChest);
}
if ((inst = m_inv[SLOT_LEGS]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MATERIAL_LEGS] = item->Material;
ns->spawn.colors[MATERIAL_LEGS].color = GetEquipmentColor(MATERIAL_LEGS);
ns->spawn.equipment[MaterialLegs] = item->Material;
ns->spawn.colors[MaterialLegs].color = GetEquipmentColor(MaterialLegs);
}
if ((inst = m_inv[SLOT_FEET]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MATERIAL_FEET] = item->Material;
ns->spawn.colors[MATERIAL_FEET].color = GetEquipmentColor(MATERIAL_FEET);
ns->spawn.equipment[MaterialFeet] = item->Material;
ns->spawn.colors[MaterialFeet].color = GetEquipmentColor(MaterialFeet);
}
if ((inst = m_inv[SLOT_PRIMARY]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
if (strlen(item->IDFile) > 2)
ns->spawn.equipment[MATERIAL_PRIMARY] = atoi(&item->IDFile[2]);
ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]);
}
if ((inst = m_inv[SLOT_SECONDARY]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
if (strlen(item->IDFile) > 2)
ns->spawn.equipment[MATERIAL_SECONDARY] = atoi(&item->IDFile[2]);
ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]);
}
//these two may be related to ns->spawn.texture
@ -2762,25 +2762,25 @@ void Client::SetMaterial(int16 in_slot, uint32 item_id){
const Item_Struct* item = database.GetItem(item_id);
if (item && (item->ItemClass==ItemClassCommon)) {
if (in_slot==SLOT_HEAD)
m_pp.item_material[MATERIAL_HEAD] = item->Material;
m_pp.item_material[MaterialHead] = item->Material;
else if (in_slot==SLOT_CHEST)
m_pp.item_material[MATERIAL_CHEST] = item->Material;
m_pp.item_material[MaterialChest] = item->Material;
else if (in_slot==SLOT_ARMS)
m_pp.item_material[MATERIAL_ARMS] = item->Material;
m_pp.item_material[MaterialArms] = item->Material;
else if (in_slot==SLOT_BRACER01)
m_pp.item_material[MATERIAL_BRACER] = item->Material;
m_pp.item_material[MaterialWrist] = item->Material;
else if (in_slot==SLOT_BRACER02)
m_pp.item_material[MATERIAL_BRACER] = item->Material;
m_pp.item_material[MaterialWrist] = item->Material;
else if (in_slot==SLOT_HANDS)
m_pp.item_material[MATERIAL_HANDS] = item->Material;
m_pp.item_material[MaterialHands] = item->Material;
else if (in_slot==SLOT_LEGS)
m_pp.item_material[MATERIAL_LEGS] = item->Material;
m_pp.item_material[MaterialLegs] = item->Material;
else if (in_slot==SLOT_FEET)
m_pp.item_material[MATERIAL_FEET] = item->Material;
m_pp.item_material[MaterialFeet] = item->Material;
else if (in_slot==SLOT_PRIMARY)
m_pp.item_material[MATERIAL_PRIMARY] = atoi(item->IDFile+2);
m_pp.item_material[MaterialPrimary] = atoi(item->IDFile+2);
else if (in_slot==SLOT_SECONDARY)
m_pp.item_material[MATERIAL_SECONDARY] = atoi(item->IDFile+2);
m_pp.item_material[MaterialSecondary] = atoi(item->IDFile+2);
}
}
@ -2963,25 +2963,25 @@ void Client::SetTint(int16 in_slot, uint32 color) {
// Still need to reconcile bracer01 versus bracer02
void Client::SetTint(int16 in_slot, Color_Struct& color) {
if (in_slot==SLOT_HEAD)
m_pp.item_tint[MATERIAL_HEAD].color=color.color;
m_pp.item_tint[MaterialHead].color=color.color;
else if (in_slot==SLOT_ARMS)
m_pp.item_tint[MATERIAL_ARMS].color=color.color;
m_pp.item_tint[MaterialArms].color=color.color;
else if (in_slot==SLOT_BRACER01)
m_pp.item_tint[MATERIAL_BRACER].color=color.color;
m_pp.item_tint[MaterialWrist].color=color.color;
else if (in_slot==SLOT_BRACER02)
m_pp.item_tint[MATERIAL_BRACER].color=color.color;
m_pp.item_tint[MaterialWrist].color=color.color;
else if (in_slot==SLOT_HANDS)
m_pp.item_tint[MATERIAL_HANDS].color=color.color;
m_pp.item_tint[MaterialHands].color=color.color;
else if (in_slot==SLOT_PRIMARY)
m_pp.item_tint[MATERIAL_PRIMARY].color=color.color;
m_pp.item_tint[MaterialPrimary].color=color.color;
else if (in_slot==SLOT_SECONDARY)
m_pp.item_tint[MATERIAL_SECONDARY].color=color.color;
m_pp.item_tint[MaterialSecondary].color=color.color;
else if (in_slot==SLOT_CHEST)
m_pp.item_tint[MATERIAL_CHEST].color=color.color;
m_pp.item_tint[MaterialChest].color=color.color;
else if (in_slot==SLOT_LEGS)
m_pp.item_tint[MATERIAL_LEGS].color=color.color;
m_pp.item_tint[MaterialLegs].color=color.color;
else if (in_slot==SLOT_FEET)
m_pp.item_tint[MATERIAL_FEET].color=color.color;
m_pp.item_tint[MaterialFeet].color=color.color;
}
void Client::SetHideMe(bool flag)
@ -3050,25 +3050,25 @@ uint8 Client::SlotConvert(uint8 slot,bool bracer){
if(bracer)
return SLOT_BRACER02;
switch(slot){
case MATERIAL_HEAD:
case MaterialHead:
slot2=SLOT_HEAD;
break;
case MATERIAL_CHEST:
case MaterialChest:
slot2=SLOT_CHEST;
break;
case MATERIAL_ARMS:
case MaterialArms:
slot2=SLOT_ARMS;
break;
case MATERIAL_BRACER:
case MaterialWrist:
slot2=SLOT_BRACER01;
break;
case MATERIAL_HANDS:
case MaterialHands:
slot2=SLOT_HANDS;
break;
case MATERIAL_LEGS:
case MaterialLegs:
slot2=SLOT_LEGS;
break;
case MATERIAL_FEET:
case MaterialFeet:
slot2=SLOT_FEET;
break;
}
@ -3079,25 +3079,25 @@ uint8 Client::SlotConvert2(uint8 slot){
uint8 slot2=0;
switch(slot){
case SLOT_HEAD:
slot2=MATERIAL_HEAD;
slot2=MaterialHead;
break;
case SLOT_CHEST:
slot2=MATERIAL_CHEST;
slot2=MaterialChest;
break;
case SLOT_ARMS:
slot2=MATERIAL_ARMS;
slot2=MaterialArms;
break;
case SLOT_BRACER01:
slot2=MATERIAL_BRACER;
slot2=MaterialWrist;
break;
case SLOT_HANDS:
slot2=MATERIAL_HANDS;
slot2=MaterialHands;
break;
case SLOT_LEGS:
slot2=MATERIAL_LEGS;
slot2=MaterialLegs;
break;
case SLOT_FEET:
slot2=MATERIAL_FEET;
slot2=MaterialFeet;
break;
}
return slot2;
@ -6122,7 +6122,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid
made_npc->drakkin_details = GetDrakkinDetails();
made_npc->d_meele_texture1 = GetEquipmentMaterial(7);
made_npc->d_meele_texture2 = GetEquipmentMaterial(8);
for (int i = 0; i < MAX_MATERIALS; i++) {
for (int i = 0; i < _MaterialCount; i++) {
made_npc->armor_tint[i] = GetEquipmentColor(i);
}
made_npc->loottable_id = 0;

View File

@ -278,7 +278,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
if (item2->Proc.Effect != 0)
CastToMob()->AddProcToWeapon(item2->Proc.Effect, true);
eslot = MATERIAL_PRIMARY;
eslot = MaterialPrimary;
}
else if (foundslot == SLOT_SECONDARY
&& (GetOwner() != nullptr || (GetLevel() >= 13 && MakeRandomInt(0,99) < NPC_DW_CHANCE) || (item2->Damage==0)) &&
@ -288,28 +288,28 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
if (item2->Proc.Effect!=0)
CastToMob()->AddProcToWeapon(item2->Proc.Effect, true);
eslot = MATERIAL_SECONDARY;
eslot = MaterialSecondary;
}
else if (foundslot == SLOT_HEAD) {
eslot = MATERIAL_HEAD;
eslot = MaterialHead;
}
else if (foundslot == SLOT_CHEST) {
eslot = MATERIAL_CHEST;
eslot = MaterialChest;
}
else if (foundslot == SLOT_ARMS) {
eslot = MATERIAL_ARMS;
eslot = MaterialArms;
}
else if (foundslot == SLOT_BRACER01 || foundslot == SLOT_BRACER02) {
eslot = MATERIAL_BRACER;
eslot = MaterialWrist;
}
else if (foundslot == SLOT_HANDS) {
eslot = MATERIAL_HANDS;
eslot = MaterialHands;
}
else if (foundslot == SLOT_LEGS) {
eslot = MATERIAL_LEGS;
eslot = MaterialLegs;
}
else if (foundslot == SLOT_FEET) {
eslot = MATERIAL_FEET;
eslot = MaterialFeet;
}
/*

View File

@ -1323,16 +1323,19 @@ luabind::scope lua_register_material() {
return luabind::class_<Materials>("Material")
.enum_("constants")
[
luabind::value("Head", MATERIAL_HEAD),
luabind::value("Chest", MATERIAL_CHEST),
luabind::value("Arms", MATERIAL_ARMS),
luabind::value("Bracer", MATERIAL_BRACER),
luabind::value("Hands", MATERIAL_HANDS),
luabind::value("Legs", MATERIAL_LEGS),
luabind::value("Feet", MATERIAL_FEET),
luabind::value("Primary", MATERIAL_PRIMARY),
luabind::value("Secondary", MATERIAL_SECONDARY),
luabind::value("Max", MAX_MATERIALS)
luabind::value("Head", static_cast<int>(MaterialHead)),
luabind::value("Chest", static_cast<int>(MaterialChest)),
luabind::value("Arms", static_cast<int>(MaterialArms)),
luabind::value("Bracer", static_cast<int>(MaterialWrist)), // deprecated
luabind::value("Wrist", static_cast<int>(MaterialWrist)),
luabind::value("Hands", static_cast<int>(MaterialHands)),
luabind::value("Legs", static_cast<int>(MaterialLegs)),
luabind::value("Feet", static_cast<int>(MaterialFeet)),
luabind::value("Primary", static_cast<int>(MaterialPrimary)),
luabind::value("Secondary", static_cast<int>(MaterialSecondary)),
luabind::value("Max", static_cast<int>(_MaterialCount)), // deprecated
luabind::value("Count", static_cast<int>(_MaterialCount)),
luabind::value("Invalid", static_cast<int>(_MaterialInvalid))
];
}

View File

@ -72,7 +72,7 @@ Mob::Mob(const char* in_name,
uint32 in_drakkin_heritage,
uint32 in_drakkin_tattoo,
uint32 in_drakkin_details,
uint32 in_armor_tint[MAX_MATERIALS],
uint32 in_armor_tint[_MaterialCount],
uint8 in_aa_title,
uint8 in_see_invis, // see through invis/ivu
@ -238,7 +238,7 @@ Mob::Mob(const char* in_name,
SkillProcs[j].base_spellID = SPELL_UNKNOWN;
}
for (i = 0; i < MAX_MATERIALS; i++)
for (i = 0; i < _MaterialCount; i++)
{
if (in_armor_tint)
{
@ -945,7 +945,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName));
for(i = 0; i < MAX_MATERIALS; i++)
for(i = 0; i < _MaterialCount; i++)
{
ns->spawn.equipment[i] = GetEquipmentMaterial(i);
if (armor_tint[i])
@ -2556,8 +2556,8 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const
{
if // for primary and secondary we need the model, not the material
(
material_slot == MATERIAL_PRIMARY ||
material_slot == MATERIAL_SECONDARY
material_slot == MaterialPrimary ||
material_slot == MaterialSecondary
)
{
if(strlen(item->IDFile) > 2)

View File

@ -84,7 +84,7 @@ public:
uint32 in_drakkin_heritage,
uint32 in_drakkin_tattoo,
uint32 in_drakkin_details,
uint32 in_armor_tint[MAX_MATERIALS],
uint32 in_armor_tint[_MaterialCount],
uint8 in_aa_title,
uint8 in_see_invis, // see through invis
uint8 in_see_invis_undead, // see through invis vs. undead
@ -289,7 +289,7 @@ public:
inline uint8 GetDrakkinHeritage() const { return drakkin_heritage; }
inline uint8 GetDrakkinTattoo() const { return drakkin_tattoo; }
inline uint8 GetDrakkinDetails() const { return drakkin_details; }
inline uint32 GetArmorTint(uint8 i) const { return armor_tint[(i < MAX_MATERIALS) ? i : 0]; }
inline uint32 GetArmorTint(uint8 i) const { return armor_tint[(i < _MaterialCount) ? i : 0]; }
inline uint8 GetClass() const { return class_; }
inline uint8 GetLevel() const { return level; }
inline const char* GetName() const { return name; }
@ -1022,7 +1022,7 @@ protected:
uint32 drakkin_heritage;
uint32 drakkin_tattoo;
uint32 drakkin_details;
uint32 armor_tint[MAX_MATERIALS];
uint32 armor_tint[_MaterialCount];
uint8 aa_title;

View File

@ -1198,7 +1198,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
int32 NPC::GetEquipmentMaterial(uint8 material_slot) const
{
if (material_slot >= MAX_MATERIALS)
if (material_slot >= _MaterialCount)
return 0;
int inv_slot = Inventory::CalcSlotFromMaterial(material_slot);
@ -1206,13 +1206,13 @@ int32 NPC::GetEquipmentMaterial(uint8 material_slot) const
return 0;
if(equipment[inv_slot] == 0) {
switch(material_slot) {
case MATERIAL_HEAD:
case MaterialHead:
return helmtexture;
case MATERIAL_CHEST:
case MaterialChest:
return texture;
case MATERIAL_PRIMARY:
case MaterialPrimary:
return d_meele_texture1;
case MATERIAL_SECONDARY:
case MaterialSecondary:
return d_meele_texture2;
default:
//they have nothing in the slot, and its not a special slot... they get nothing.

View File

@ -1197,7 +1197,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
{
if ((at_row = mysql_fetch_row(at_result)))
{
for (i = 0; i < MAX_MATERIALS; i++)
for (i = 0; i < _MaterialCount; i++)
{
tmpNPCType->armor_tint[i] = atoi(at_row[i * 3]) << 16;
tmpNPCType->armor_tint[i] |= atoi(at_row[i * 3 + 1]) << 8;
@ -1230,7 +1230,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
if (armor_tint_id == 0)
{
for (i = 1; i < MAX_MATERIALS; i++)
for (i = 1; i < _MaterialCount; i++)
{
tmpNPCType->armor_tint[i] = tmpNPCType->armor_tint[0];
}
@ -1508,7 +1508,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client
{
if ((at_row = mysql_fetch_row(at_result)))
{
for (i = 0; i < MAX_MATERIALS; i++)
for (i = 0; i < _MaterialCount; i++)
{
tmpNPCType->armor_tint[i] = atoi(at_row[i * 3]) << 16;
tmpNPCType->armor_tint[i] |= atoi(at_row[i * 3 + 1]) << 8;
@ -1541,7 +1541,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client
if (armor_tint_id == 0)
{
for (i = 1; i < MAX_MATERIALS; i++)
for (i = 1; i < _MaterialCount; i++)
{
tmpNPCType->armor_tint[i] = tmpNPCType->armor_tint[0];
}

View File

@ -85,7 +85,7 @@ struct NPCType
uint32 drakkin_heritage;
uint32 drakkin_tattoo;
uint32 drakkin_details;
uint32 armor_tint[MAX_MATERIALS];
uint32 armor_tint[_MaterialCount];
uint32 min_dmg;
uint32 max_dmg;
int16 attack_count;