Added the initial references for two new dictionaries - EmuConstants and EQLimits..more to come.

This commit is contained in:
Uleat
2014-07-16 21:23:16 -04:00
parent b7e36feeeb
commit d7c2d6108f
42 changed files with 1323 additions and 662 deletions
+61 -50
View File
@@ -1867,52 +1867,57 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
// (update: i think pp should do it, as this holds LoY dye - plus, this is ugly code with Inventory!)
const Item_Struct* item = nullptr;
const ItemInst* inst = nullptr;
if ((inst = m_inv[SLOT_HANDS]) && inst->IsType(ItemClassCommon)) {
if ((inst = m_inv[MainHands]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MaterialHands] = item->Material;
ns->spawn.colors[MaterialHands].color = GetEquipmentColor(MaterialHands);
}
if ((inst = m_inv[SLOT_HEAD]) && inst->IsType(ItemClassCommon)) {
if ((inst = m_inv[MainHead]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MaterialHead] = item->Material;
ns->spawn.colors[MaterialHead].color = GetEquipmentColor(MaterialHead);
}
if ((inst = m_inv[SLOT_ARMS]) && inst->IsType(ItemClassCommon)) {
if ((inst = m_inv[MainArms]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MaterialArms] = item->Material;
ns->spawn.colors[MaterialArms].color = GetEquipmentColor(MaterialArms);
}
if ((inst = m_inv[SLOT_BRACER01]) && inst->IsType(ItemClassCommon)) {
if ((inst = m_inv[MainWrist1]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MaterialWrist]= item->Material;
ns->spawn.colors[MaterialWrist].color = GetEquipmentColor(MaterialWrist);
}
/*
// non-live behavior
if ((inst = m_inv[SLOT_BRACER02]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MaterialWrist]= item->Material;
ns->spawn.colors[MaterialWrist].color = GetEquipmentColor(MaterialWrist);
}
if ((inst = m_inv[SLOT_CHEST]) && inst->IsType(ItemClassCommon)) {
*/
if ((inst = m_inv[MainChest]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MaterialChest] = item->Material;
ns->spawn.colors[MaterialChest].color = GetEquipmentColor(MaterialChest);
}
if ((inst = m_inv[SLOT_LEGS]) && inst->IsType(ItemClassCommon)) {
if ((inst = m_inv[MainLegs]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MaterialLegs] = item->Material;
ns->spawn.colors[MaterialLegs].color = GetEquipmentColor(MaterialLegs);
}
if ((inst = m_inv[SLOT_FEET]) && inst->IsType(ItemClassCommon)) {
if ((inst = m_inv[MainFeet]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
ns->spawn.equipment[MaterialFeet] = item->Material;
ns->spawn.colors[MaterialFeet].color = GetEquipmentColor(MaterialFeet);
}
if ((inst = m_inv[SLOT_PRIMARY]) && inst->IsType(ItemClassCommon)) {
if ((inst = m_inv[MainPrimary]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
if (strlen(item->IDFile) > 2)
ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]);
}
if ((inst = m_inv[SLOT_SECONDARY]) && inst->IsType(ItemClassCommon)) {
if ((inst = m_inv[MainSecondary]) && inst->IsType(ItemClassCommon)) {
item = inst->GetItem();
if (strlen(item->IDFile) > 2)
ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]);
@@ -2624,7 +2629,7 @@ bool Client::BindWound(Mob* bindmob, bool start, bool fail){
if(!bindwound_timer.Enabled()) {
//make sure we actually have a bandage... and consume it.
int16 bslot = m_inv.HasItemByUse(ItemTypeBandage, 1, invWhereWorn|invWherePersonal);
if(bslot == SLOT_INVALID) {
if (bslot == INVALID_INDEX) {
bind_out->type = 3;
QueuePacket(outapp);
bind_out->type = 7; //this is the wrong message, dont know the right one.
@@ -2775,28 +2780,31 @@ bool Client::BindWound(Mob* bindmob, bool start, bool fail){
return true;
}
void Client::SetMaterial(int16 in_slot, uint32 item_id){
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)
if (in_slot==MainHead)
m_pp.item_material[MaterialHead] = item->Material;
else if (in_slot==SLOT_CHEST)
else if (in_slot==MainChest)
m_pp.item_material[MaterialChest] = item->Material;
else if (in_slot==SLOT_ARMS)
else if (in_slot==MainArms)
m_pp.item_material[MaterialArms] = item->Material;
else if (in_slot==SLOT_BRACER01)
else if (in_slot==MainWrist1)
m_pp.item_material[MaterialWrist] = item->Material;
/*
// non-live behavior
else if (in_slot==SLOT_BRACER02)
m_pp.item_material[MaterialWrist] = item->Material;
else if (in_slot==SLOT_HANDS)
*/
else if (in_slot==MainHands)
m_pp.item_material[MaterialHands] = item->Material;
else if (in_slot==SLOT_LEGS)
else if (in_slot==MainLegs)
m_pp.item_material[MaterialLegs] = item->Material;
else if (in_slot==SLOT_FEET)
else if (in_slot==MainFeet)
m_pp.item_material[MaterialFeet] = item->Material;
else if (in_slot==SLOT_PRIMARY)
m_pp.item_material[MaterialPrimary] = atoi(item->IDFile+2);
else if (in_slot==SLOT_SECONDARY)
else if (in_slot==MainPrimary)
m_pp.item_material[MaterialPrimary] = atoi(item->IDFile+2);
else if (in_slot==MainSecondary)
m_pp.item_material[MaterialSecondary] = atoi(item->IDFile+2);
}
}
@@ -3118,25 +3126,28 @@ 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)
if (in_slot==MainHead)
m_pp.item_tint[MaterialHead].color=color.color;
else if (in_slot==SLOT_ARMS)
else if (in_slot==MainArms)
m_pp.item_tint[MaterialArms].color=color.color;
else if (in_slot==SLOT_BRACER01)
else if (in_slot==MainWrist1)
m_pp.item_tint[MaterialWrist].color=color.color;
/*
// non-live behavior
else if (in_slot==SLOT_BRACER02)
m_pp.item_tint[MaterialWrist].color=color.color;
else if (in_slot==SLOT_HANDS)
*/
else if (in_slot==MainHands)
m_pp.item_tint[MaterialHands].color=color.color;
else if (in_slot==SLOT_PRIMARY)
else if (in_slot==MainPrimary)
m_pp.item_tint[MaterialPrimary].color=color.color;
else if (in_slot==SLOT_SECONDARY)
else if (in_slot==MainSecondary)
m_pp.item_tint[MaterialSecondary].color=color.color;
else if (in_slot==SLOT_CHEST)
else if (in_slot==MainChest)
m_pp.item_tint[MaterialChest].color=color.color;
else if (in_slot==SLOT_LEGS)
else if (in_slot==MainLegs)
m_pp.item_tint[MaterialLegs].color=color.color;
else if (in_slot==SLOT_FEET)
else if (in_slot==MainFeet)
m_pp.item_tint[MaterialFeet].color=color.color;
}
@@ -3202,57 +3213,57 @@ void Client::LinkDead()
}
uint8 Client::SlotConvert(uint8 slot,bool bracer){
uint8 slot2=0;
uint8 slot2=0; // why are we returning MainCharm instead of INVALID_INDEX? (must be a pre-charm segment...)
if(bracer)
return SLOT_BRACER02;
return MainWrist2;
switch(slot){
case MaterialHead:
slot2=SLOT_HEAD;
slot2=MainHead;
break;
case MaterialChest:
slot2=SLOT_CHEST;
slot2=MainChest;
break;
case MaterialArms:
slot2=SLOT_ARMS;
slot2=MainArms;
break;
case MaterialWrist:
slot2=SLOT_BRACER01;
slot2=MainWrist1;
break;
case MaterialHands:
slot2=SLOT_HANDS;
slot2=MainHands;
break;
case MaterialLegs:
slot2=SLOT_LEGS;
slot2=MainLegs;
break;
case MaterialFeet:
slot2=SLOT_FEET;
slot2=MainFeet;
break;
}
return slot2;
}
uint8 Client::SlotConvert2(uint8 slot){
uint8 slot2=0;
uint8 slot2=0; // same as above...
switch(slot){
case SLOT_HEAD:
case MainHead:
slot2=MaterialHead;
break;
case SLOT_CHEST:
case MainChest:
slot2=MaterialChest;
break;
case SLOT_ARMS:
case MainArms:
slot2=MaterialArms;
break;
case SLOT_BRACER01:
case MainWrist1:
slot2=MaterialWrist;
break;
case SLOT_HANDS:
case MainHands:
slot2=MaterialHands;
break;
case SLOT_LEGS:
case MainLegs:
slot2=MaterialLegs;
break;
case SLOT_FEET:
case MainFeet:
slot2=MaterialFeet;
break;
}
@@ -4900,7 +4911,7 @@ void Client::ShowSkillsWindow()
if(GetSkill(it->second) > 0 || MaxSkill(it->second) > 0) {
WindowText += it->first;
// line up the values
for (int j = 0; j < MAX_AUGMENT_SLOTS; j++)
for (int j = 0; j < EmuConstants::ITEM_COMMON_SIZE; j++)
WindowText += "&nbsp;";
WindowText += itoa(this->GetSkill(it->second));
if (MaxSkill(it->second) > 0) {
@@ -7854,7 +7865,7 @@ void Client::TryItemTick(int slot)
//Only look at augs in main inventory
if(slot > 21) { return; }
for(int x = 0; x < MAX_AUGMENT_SLOTS; ++x)
for (int x = 0; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
{
ItemInst * a_inst = inst->GetAugment(x);
if(!a_inst) { continue; }
@@ -7911,7 +7922,7 @@ void Client::TryItemTimer(int slot)
return;
}
for(int x = 0; x < MAX_AUGMENT_SLOTS; ++x)
for (int x = 0; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
{
ItemInst * a_inst = inst->GetAugment(x);
if(!a_inst) {