ManaPlus
Static Public Member Functions
ItemColorManager Class Reference

#include <itemcolormanager.h>

Static Public Member Functions

static ItemColor getColorFromCards (const int *const cards)
 
static ItemColor getColorFromCards (const CardsList &cards)
 

Detailed Description

Definition at line 31 of file itemcolormanager.h.

Member Function Documentation

◆ getColorFromCards() [1/2]

ItemColor ItemColorManager::getColorFromCards ( const CardsList cards)
static

Definition at line 55 of file itemcolormanager.cpp.

56 {
57  return getColorFromCards(&cards.cards[0]);
58 }
static ItemColor getColorFromCards(const int *const cards)
int cards[4]
Definition: cardslist.h:68

References CardsList::cards, and getColorFromCards().

◆ getColorFromCards() [2/2]

ItemColor ItemColorManager::getColorFromCards ( const int *const  cards)
static

Definition at line 32 of file itemcolormanager.cpp.

33 {
34  if (cards == nullptr)
35  return ItemColor_one;
36  if (cards[0] == CARD0_FORGE ||
37  cards[0] == CARD0_CREATE ||
38  cards[0] == CARD0_PET)
39  {
40  return ItemColor_one;
41  }
42  for (int f = 0; f < maxCards; f ++)
43  {
44  const int id = cards[f];
45  if (id == 0)
46  continue;
47  const ItemInfo &info = ItemDB::get(id);
48  const ItemColor &color = info.getCardColor();
49  if (color != ItemColor_zero)
50  return color;
51  }
52  return ItemColor_one;
53 }
#define CARD0_CREATE
Definition: cards.h:29
#define maxCards
Definition: cards.h:25
#define CARD0_PET
Definition: cards.h:30
#define CARD0_FORGE
Definition: cards.h:28
const ItemColor ItemColor_one
Definition: itemcolor.h:30
uint16_t ItemColor
Definition: itemcolor.h:30
const ItemColor ItemColor_zero
Definition: itemcolor.h:30
bool info(InputEvent &event)
Definition: commands.cpp:57
const ItemInfo & get(const int id)
Definition: itemdb.cpp:792

References CARD0_CREATE, CARD0_FORGE, CARD0_PET, ItemDB::get(), Actions::info(), ItemColor_one, ItemColor_zero, and maxCards.

Referenced by getColorFromCards(), ItemLinkHandler::handleItemLink(), EAthena::Mail2Recv::processAddItemResult(), EAthena::InventoryRecv::processEquipmentContinue(), EAthena::InventoryRecv::processInventoryContinue(), EAthena::ItemRecv::processItemDropped2(), EAthena::VendingRecv::processItemsList(), EAthena::ItemRecv::processItemVisible2(), EAthena::InventoryRecv::processPlayerCartAdd(), EAthena::InventoryRecv::processPlayerCartEquip(), EAthena::InventoryRecv::processPlayerCartItems(), EAthena::InventoryRecv::processPlayerEquipment(), EAthena::InventoryRecv::processPlayerInventory(), EAthena::InventoryRecv::processPlayerInventoryAdd(), EAthena::InventoryRecv::processPlayerStorage(), EAthena::InventoryRecv::processPlayerStorageAdd(), EAthena::InventoryRecv::processPlayerStorageEquip(), EAthena::Mail2Recv::processReadMail(), EAthena::MailRecv::processReadMail(), EAthena::TradeRecv::processTradeItemAdd(), BrowserBoxTools::replaceLinkCommands(), Being::setHairTempSprite(), Being::setSpriteCards(), Being::setTempSprite(), and Item::updateColor().


The documentation for this class was generated from the following files: