This commit is contained in:
vsab
2014-05-10 18:30:52 +00:00
15 changed files with 271 additions and 33 deletions
+75 -5
View File
@@ -4565,6 +4565,49 @@ void Bot::SetLevel(uint8 in_level, bool command) {
}
}
int32 Bot::GetEquipmentMaterial(uint8 material_slot) const
{
if // for primary and secondary we need the model, not the material
(
material_slot == MaterialPrimary ||
material_slot == MaterialSecondary
)
{
uint8 inventorySlot = Inventory::CalcSlotFromMaterial(material_slot);
const ItemInst* inst = m_inv.GetItem(inventorySlot);
if (inst != nullptr)
{
if (RuleB(Inventory,UseAugOrnamentations) && inst->HasOrnamentation())
{
const ItemInst* ornament = inst->GetOrnamentation();
if (strlen(ornament->GetItem()->IDFile) > 2)
{
return atoi(&ornament->GetItem()->IDFile[2]);
}
}
else
{
if (strlen(inst->GetItem()->IDFile) > 2)
{
return atoi(&inst->GetItem()->IDFile[2]);
}
else //may as well try this, since were going to 0 anyways
{
return inst->GetItem()->Material;
}
}
}
}
else
{
const Item_Struct *item = database.GetItem(GetEquipment(material_slot));
if (item!=nullptr) return item->Material;
}
return 0;
}
void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(ns) {
Mob::FillSpawnStruct(ns, ForWho);
@@ -4665,24 +4708,51 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
ns->spawn.colors[MaterialFeet].color = GetEquipmentColor(MaterialFeet);
}
}
inst = GetBotItem(SLOT_PRIMARY);
if(inst) {
item = inst->GetItem();
if(item) {
if(strlen(item->IDFile) > 2)
if(item)
{
if (RuleB(Inventory,UseAugOrnamentations) && inst->HasOrnamentation())
{
const ItemInst* ornament = inst->GetOrnamentation();
if (strlen(ornament->GetItem()->IDFile) > 2)
{
ns->spawn.equipment[MaterialPrimary]= atoi(&ornament->GetItem()->IDFile[2]);
ns->spawn.colors[MaterialPrimary].color = GetEquipmentColor(MaterialPrimary);
}
}
else
{
item = inst->GetItem();
if (strlen(item->IDFile) > 2)
ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]);
ns->spawn.colors[MaterialPrimary].color = GetEquipmentColor(MaterialPrimary);
}
}
}
inst = GetBotItem(SLOT_SECONDARY);
if(inst) {
item = inst->GetItem();
if(item) {
if(strlen(item->IDFile) > 2)
if(item)
{
if (RuleB(Inventory,UseAugOrnamentations) && inst->HasOrnamentation())
{
const ItemInst* ornament = inst->GetOrnamentation();
if (strlen(ornament->GetItem()->IDFile) > 2)
{
ns->spawn.equipment[MaterialSecondary]= atoi(&ornament->GetItem()->IDFile[2]);
ns->spawn.colors[MaterialSecondary].color = GetEquipmentColor(MaterialSecondary);
}
}
else
{
item = inst->GetItem();
if (strlen(item->IDFile) > 2)
ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]);
ns->spawn.colors[MaterialSecondary].color = GetEquipmentColor(MaterialSecondary);
}
}
}
}
+1
View File
@@ -332,6 +332,7 @@ public:
void EquipBot(std::string* errorMessage);
bool CheckLoreConflict(const Item_Struct* item);
uint32 GetEquipmentColor(uint8 material_slot) const;
int32 GetEquipmentMaterial(uint8 material_slot) const;
// Static Class Methods
static void SaveBotGroup(Group* botGroup, std::string botGroupName, std::string* errorMessage);
+27 -5
View File
@@ -1908,14 +1908,36 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
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[MaterialPrimary] = atoi(&item->IDFile[2]);
if (RuleB(Inventory,UseAugOrnamentations) && inst->HasOrnamentation())
{
const ItemInst* ornament = inst->GetOrnamentation();
if (strlen(ornament->GetItem()->IDFile) > 2)
{
ns->spawn.equipment[MaterialPrimary]= atoi(&ornament->GetItem()->IDFile[2]);
}
}
else
{
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)) {
item = inst->GetItem();
if (strlen(item->IDFile) > 2)
if (RuleB(Inventory,UseAugOrnamentations) && inst->HasOrnamentation())
{
const ItemInst* ornament = inst->GetOrnamentation();
if (strlen(ornament->GetItem()->IDFile) > 2)
{
ns->spawn.equipment[MaterialPrimary]= atoi(&ornament->GetItem()->IDFile[2]);
}
}
else
{
item = inst->GetItem();
if (strlen(item->IDFile) > 2)
ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]);
}
}
//these two may be related to ns->spawn.texture
+1
View File
@@ -806,6 +806,7 @@ public:
void SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type);
bool IsValidSlot(uint32 slot);
bool IsBankSlot(uint32 slot);
int32 GetEquipmentMaterial(uint8 material_slot) const;
inline bool IsTrader() const { return(Trader); }
inline bool IsBuyer() const { return(Buyer); }
+9 -1
View File
@@ -4707,7 +4707,15 @@ 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);
c->Message(0, " IDF: %s Size: %i Weight: %i icon_id: %i Price: %i", item->IDFile, item->Size, item->Weight, item->Icon, item->Price);
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);
}
else
{
c->Message(0, " IDF: %s Size: %i Weight: %i icon_id: %i Price: %i", item->IDFile, item->Size, item->Weight, item->Icon, item->Price);
}
if (c->Admin() >= 200)
c->Message(0, "MinStatus: %i", item->MinStatus);
if (item->ItemClass==ItemClassBook)
+44
View File
@@ -1886,6 +1886,50 @@ void Client::DyeArmor(DyeStruct* dye){
Save();
}
int32 Client::GetEquipmentMaterial(uint8 material_slot) const
{
if // for primary and secondary we need the model, not the material
(
material_slot == MaterialPrimary ||
material_slot == MaterialSecondary
)
{
uint8 inventorySlot = Inventory::CalcSlotFromMaterial(material_slot);
const ItemInst* inst = m_inv.GetItem(inventorySlot);
if (inst != nullptr)
{
if (inst->HasOrnamentation())
{
const ItemInst* ornament = inst->GetOrnamentation();
if (strlen(ornament->GetItem()->IDFile) > 2)
{
return atoi(&ornament->GetItem()->IDFile[2]);
}
}
else
{
if (strlen(inst->GetItem()->IDFile) > 2)
{
return atoi(&inst->GetItem()->IDFile[2]);
}
else //may as well try this, since were going to 0 anyways
{
return inst->GetItem()->Material;
}
}
}
}
else
{
const Item_Struct *item = database.GetItem(GetEquipment(material_slot));
if (item!=nullptr) return item->Material;
}
return 0;
}
/*bool Client::DecreaseByItemType(uint32 type, uint8 amt) {
const Item_Struct* TempItem = 0;
ItemInst* ins;
+1 -3
View File
@@ -2577,9 +2577,7 @@ void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color)
int32 Mob::GetEquipmentMaterial(uint8 material_slot) const
{
const Item_Struct *item;
item = database.GetItem(GetEquipment(material_slot));
const Item_Struct *item = database.GetItem(GetEquipment(material_slot));
if(item != 0)
{
if // for primary and secondary we need the model, not the material