void CHARACTER::AddClMaterial(TItemPos tPos, BYTE bPos) { if (!isChangeLookOpened()) return; else if (bPos >= CL_WINDOW_MAX_MATERIALS) { if (bPos != 255) return; bPos = CheckClEmptyMaterialSlot(); if (bPos >= CL_WINDOW_MAX_MATERIALS) return; } LPITEM pkItem = GetItem(tPos); if (!pkItem) return; else if ((pkItem->GetCell() >= INVENTORY_MAX_NUM) || (tPos.IsBeltInventoryPosition())) return; else if (pkItem->IsEquipped()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[Transmutation] You cannot transmute an item while it is equipped.")); return; } else if ((pkItem->GetType() != ITEM_WEAPON) && (pkItem->GetType() != ITEM_ARMOR) && (pkItem->GetType() != ITEM_COSTUME)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[Transmutation] This item cannot be transmuted.")); return; } #ifdef __NEW_ARROW_SYSTEM__ else if ((pkItem->GetType() == ITEM_WEAPON) && ((pkItem->GetSubType() == WEAPON_ARROW) || (pkItem->GetSubType() == WEAPON_MOUNT_SPEAR) || (pkItem->GetSubType() == WEAPON_UNLIMITED_ARROW))) #else else if ((pkItem->GetType() == ITEM_WEAPON) && ((pkItem->GetSubType() == WEAPON_ARROW) || (pkItem->GetSubType() == WEAPON_MOUNT_SPEAR))) #endif { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[Transmutation] This item cannot be transmuted.")); return; } else if ((pkItem->GetType() == ITEM_ARMOR) && (pkItem->GetSubType() != ARMOR_BODY)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[Transmutation] This item cannot be transmuted.")); return; } #ifdef __WEAPON_COSTUME_SYSTEM__ else if ((pkItem->GetType() == ITEM_COSTUME) && (pkItem->GetSubType() != COSTUME_BODY) && (pkItem->GetSubType() != COSTUME_HAIR) && (pkItem->GetSubType() != COSTUME_WEAPON)) #else else if ((pkItem->GetType() == ITEM_COSTUME) && (pkItem->GetSubType() != COSTUME_BODY) && (pkItem->GetSubType() != COSTUME_HAIR)) #endif { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[Transmutation] This item cannot be transmuted.")); return; } #ifdef __SOULBINDING_SYSTEM__ else if ((pkItem->IsBind()) || (pkItem->IsUntilBind())) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[Transmutation] You can't add binded items.")); return; } #endif else if (pkItem->isLocked()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[Transmutation] You can't add locked items.")); return; } else if (pkItem->GetTransmutation() != 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[Transmutation] You can't add items which are transmuted yet.")); return; } LPITEM * pkItemMaterial; pkItemMaterial = GetClWindowMaterials(); if ((bPos == 1) && (!pkItemMaterial[0])) return; if (pkItemMaterial[bPos]) return; if (bPos == 1) { bool bStop = false; if (pkItemMaterial[0]->GetType() != pkItem->GetType()) bStop = true; else if (pkItemMaterial[0]->GetSubType() != pkItem->GetSubType()) bStop = true; else if (pkItemMaterial[0]->GetOriginalVnum() == pkItem->GetOriginalVnum()) bStop = true; else if (((IS_SET(pkItemMaterial[0]->GetAntiFlag(), ITEM_ANTIFLAG_FEMALE)) && (!IS_SET(pkItem->GetAntiFlag(), ITEM_ANTIFLAG_FEMALE))) || ((IS_SET(pkItemMaterial[0]->GetAntiFlag(), ITEM_ANTIFLAG_MALE)) && (!IS_SET(pkItem->GetAntiFlag(), ITEM_ANTIFLAG_MALE)))) bStop = true; else if ((pkItem->GetAntiFlag() & ITEM_ANTIFLAG_WARRIOR) && (!IS_SET(pkItemMaterial[0]->GetAntiFlag(), ITEM_ANTIFLAG_WARRIOR))) bStop = true; else if ((pkItem->GetAntiFlag() & ITEM_ANTIFLAG_ASSASSIN) && (!IS_SET(pkItemMaterial[0]->GetAntiFlag(), ITEM_ANTIFLAG_ASSASSIN))) bStop = true; else if ((pkItem->GetAntiFlag() & ITEM_ANTIFLAG_SHAMAN) && (!IS_SET(pkItemMaterial[0]->GetAntiFlag(), ITEM_ANTIFLAG_SHAMAN))) bStop = true; else if ((pkItem->GetAntiFlag() & ITEM_ANTIFLAG_SURA) && (!IS_SET(pkItemMaterial[0]->GetAntiFlag(), ITEM_ANTIFLAG_SURA))) bStop = true; else if ((pkItem->GetType() == ITEM_COSTUME && pkItemMaterial[0]->GetType() == ITEM_COSTUME) && ((pkItem->GetType() == ITEM_COSTUME && pkItem->GetSubType() == COSTUME_WEAPON) && (pkItemMaterial[0]->GetType() == ITEM_COSTUME && pkItemMaterial[0]->GetSubType() == COSTUME_WEAPON))) if (pkItem->GetValue(3) != pkItemMaterial[0]->GetValue(3)) bStop = true; if (bStop) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[Transmutation] You cannot submit this item.")); return; } } pkItemMaterial[bPos] = pkItem; pkItemMaterial[bPos]->Lock(true); TPacketChangeLook sPacket; sPacket.header = HEADER_GC_CL; sPacket.subheader = CL_SUBHEADER_ADD; sPacket.dwCost = 0; sPacket.bPos = bPos; sPacket.tPos = tPos; GetDesc()->Packet(&sPacket, sizeof(TPacketChangeLook)); }