ManaPlus
Functions | Variables
PlayerInfo Namespace Reference

Functions

void triggerAttr (const AttributesT id, const int64_t old)
 
void triggerStat (const AttributesT id, const int old1, const int old2)
 
int64_t getAttribute64 (const AttributesT id)
 
int32_t getAttribute (const AttributesT id)
 
void setAttribute (const AttributesT id, const int64_t value, const Notify notify)
 
int getSkillLevel (const int id)
 
void setSkillLevel (const int id, const int value)
 
int getStatBase (const AttributesT id)
 
void setStatBase (const AttributesT id, const int value, const Notify notify)
 
int getStatMod (const AttributesT id)
 
void setStatMod (const AttributesT id, const int value, const Notify notify)
 
int getStatEffective (const AttributesT id)
 
const std::pair< int, int > getStatExperience (const AttributesT id)
 
InventorygetInventory ()
 
InventorygetStorageInventory ()
 
InventorygetCartInventory ()
 
void clearInventory ()
 
EquipmentgetEquipment ()
 
const ItemgetEquipment (const unsigned int slot)
 
void setEquipmentBackend (Equipment::Backend *const backend)
 
void equipItem (const Item *const item, const Sfx sfx)
 
void unequipItem (const Item *const item, const Sfx sfx)
 
void useItem (const Item *const item, const Sfx sfx)
 
void useEquipItem (const Item *const item, const int16_t useType, const Sfx sfx)
 
void useEquipItem2 (const Item *const item, const int16_t useType, const Sfx sfx)
 
void dropItem (const Item *const item, const int amount, const Sfx sfx)
 
void pickUpItem (const FloorItem *const item, const Sfx sfx)
 
void setBackend (const PlayerInfoBackend &backend)
 
void setCharId (const int charId)
 
int getCharId ()
 
Trading isTrading ()
 
void setTrading (const Trading trading)
 
void updateAttrs ()
 
void init ()
 
void deinit ()
 
void loadData ()
 
void clear ()
 
bool isTalking ()
 
void gameDestroyed ()
 
void stateChange (const StateT state)
 
static void saveProtectedItems ()
 
void protectItem (const int id)
 
void unprotectItem (const int id)
 
bool isItemProtected (const int id)
 
void setMercenary (MercenaryInfo *const info)
 
void setMercenaryBeing (Being *const being)
 
void setElemental (const BeingId id)
 
BeingId getElementalId ()
 
MercenaryInfogetMercenary ()
 
void setPet (PetInfo *const info)
 
void setPetBeing (Being *const being)
 
PetInfogetPet ()
 
BeingId getPetBeingId ()
 
void setHomunculus (HomunculusInfo *const info)
 
void setHomunculusBeing (Being *const being)
 
HomunculusInfogetHomunculus ()
 
BeingId getHomunculusId ()
 
BeingId getMercenaryId ()
 
void updateAttackAi (const BeingId targetId, const Keep keep)
 
std::string getRoomName ()
 
void setRoomName (const std::string &name)
 
bool isInRoom ()
 
void setGuildPositionFlags (const GuildPositionFlags::Type pos)
 
GuildPositionFlags::Type getGuildPositionFlags ()
 
void enableVending (const bool b)
 
bool isVending ()
 
void setServerLanguage (const int lang)
 
int getServerLanguage ()
 

Variables

PlayerInfoBackend mData
 
int mCharId = 0
 
InventorymInventory = 0
 
InventorymCartInventory = 0
 
MercenaryInfomMercenary = 0
 
HomunculusInfomHomunculus = 0
 
PetInfomPet = 0
 
std::string mRoomName
 
EquipmentmEquipment = 0
 
BeingId mPetBeingId = BeingId_zero
 
GuildPositionFlags::Type mGuildPositionFlags = GuildPositionFlags::None
 
BeingId mElementalId = BeingId_zero
 
Trading mTrading = Trading_false
 
bool mVending = false
 
int mLevelProgress = 0
 
int mServerLanguage = -1
 
std::set< int > mProtectedItems
 

Detailed Description

A database like namespace which holds global info about the localplayer

Function Documentation

◆ clear()

void PlayerInfo::clear ( )

Definition at line 452 of file playerinfo.cpp.

453 {
454  mData.mSkills.clear();
456 }
const BeingId BeingId_zero
Definition: beingid.h:30
PlayerInfoBackend mData
Definition: playerinfo.cpp:56
BeingId mPetBeingId
Definition: playerinfo.cpp:66

References BeingId_zero, mData, mPetBeingId, and PlayerInfoBackend::mSkills.

Referenced by mse::msevector< _Ty, _A >::clear(), Game::Game(), Client::gameClear(), PRAGMA45(), and SoundDB::unload().

◆ clearInventory()

void PlayerInfo::clearInventory ( )

Clears the player's inventory and equipment.

Definition at line 212 of file playerinfo.cpp.

213 {
214  if (mEquipment != nullptr)
215  mEquipment->clear();
216  if (mInventory != nullptr)
217  mInventory->clear();
218 }
void clear()
Definition: equipment.h:78
void clear()
Definition: inventory.cpp:238
Inventory * mInventory
Definition: playerinfo.cpp:59
Equipment * mEquipment
Definition: playerinfo.cpp:65

References Equipment::clear(), Inventory::clear(), mEquipment, and mInventory.

Referenced by deinit().

◆ deinit()

void PlayerInfo::deinit ( )

Definition at line 438 of file playerinfo.cpp.

439 {
440  clearInventory();
443 }
#define delete2(var)
Definition: delete2.h:25
MercenaryInfo * mMercenary
Definition: playerinfo.cpp:61
void clearInventory()
Definition: playerinfo.cpp:212

References BeingId_zero, clearInventory(), delete2, mMercenary, and mPetBeingId.

◆ dropItem()

void PlayerInfo::dropItem ( const Item *const  item,
const int  amount,
const Sfx  sfx 
)

Definition at line 354 of file playerinfo.cpp.

355 {
356  if (item != nullptr &&
357  mProtectedItems.find(item->getId()) == mProtectedItems.end())
358  {
359  if (sfx == Sfx_true)
361  if (inventoryHandler != nullptr)
362  inventoryHandler->dropItem(item, amount);
363  }
364 }
static void playSfx(const int item, const ItemSoundEvent::Type sound)
int getId() const
Definition: item.h:81
virtual void dropItem(const Item *const item, const int amount) const =0
Net::InventoryHandler * inventoryHandler
Definition: net.cpp:89
std::set< int > mProtectedItems
Definition: playerinfo.cpp:74
const bool Sfx_true
Definition: sfx.h:30

References ItemSoundEvent::DROP, Net::InventoryHandler::dropItem(), Item::getId(), inventoryHandler, mProtectedItems, ItemSoundManager::playSfx(), and Sfx_true.

Referenced by InventoryWindow::action(), DropShortcut::dropFirst(), DropShortcut::dropItem(), and ItemAmountWindow::finish().

◆ enableVending()

void PlayerInfo::enableVending ( const bool  b)

◆ equipItem()

void PlayerInfo::equipItem ( const Item *const  item,
const Sfx  sfx 
)

◆ gameDestroyed()

void PlayerInfo::gameDestroyed ( )

Definition at line 463 of file playerinfo.cpp.

464 {
468 }
Inventory * mCartInventory
Definition: playerinfo.cpp:60

References delete2, mCartInventory, mEquipment, and mInventory.

Referenced by Game::~Game().

◆ getAttribute()

int32_t PlayerInfo::getAttribute ( const AttributesT  id)

Definition at line 102 of file playerinfo.cpp.

103 {
104  const AtrIntMap::const_iterator it = mData.mAttributes.find(id);
105  if (it != mData.mAttributes.end())
106  return CAST_S32(it->second);
107  return 0;
108 }
#define CAST_S32
Definition: cast.h:30
AtrIntMap mAttributes
Definition: playerinfo.h:73

References CAST_S32, PlayerInfoBackend::mAttributes, and mData.

Referenced by ChangeDisplay::action(), ShopWindow::action(), TradeWindow::action(), LocalPlayer::attributeChanged(), DialogsManager::attributeChanged(), ChatWindow::attributeChanged(), KillStats::attributeChanged(), StatusWindow::attributeChanged(), Being::drawPlayerSpriteAt(), LocalPlayer::getLevel(), ShopWindow::giveList(), ActorManager::heal(), EAthena::PlayerHandler::increaseSkill(), TmwAthena::PlayerHandler::increaseSkill(), SpellManager::invoke(), InventoryWindow::mouseMoved(), MiniStatusWindow::mouseMoved(), EAthena::BuyingStoreRecv::processBuyingStoreItemsList(), EAthena::VendingRecv::processItemsList(), EAthena::MarketRecv::processMarketOpen(), EAthena::BuySellRecv::processNpcBuy(), TmwAthena::BuySellRecv::processNpcBuy(), TmwAthena::BuySellRecv::processNpcBuyResponse(), Ea::BuySellRecv::processNpcSell(), EAthena::PlayerRecv::processPlayerHeal(), Ea::PlayerRecv::processPlayerStatUpdate4(), KillStats::recalcStats(), EAthena::PlayerHandler::setStat(), TmwAthena::PlayerHandler::setStat(), ShopWindow::showList(), StatsPageBasic::StatsPageBasic(), StatusWindow::StatusWindow(), LocalPlayer::tryMagic(), ChangeDisplay::update(), KillStats::update(), SkillDialog::update(), StatusWindow::updateHPBar(), StatusWindow::updateJobBar(), StatusWindow::updateLevelLabel(), StatusWindow::updateMoneyBar(), StatusWindow::updateMPBar(), InventoryWindow::updateWeight(), StatusWindow::updateWeightBar(), and StatusWindow::updateXPBar().

◆ getAttribute64()

int64_t PlayerInfo::getAttribute64 ( const AttributesT  id)

Returns the value of the given attribute.

Definition at line 94 of file playerinfo.cpp.

95 {
96  const AtrIntMap::const_iterator it = mData.mAttributes.find(id);
97  if (it != mData.mAttributes.end())
98  return it->second;
99  return 0;
100 }

References PlayerInfoBackend::mAttributes, and mData.

Referenced by KillStats::action(), KillStats::gainXp(), KillStats::KillStats(), MiniStatusWindow::mouseMoved(), and StatusWindow::StatusWindow().

◆ getCartInventory()

Inventory * PlayerInfo::getCartInventory ( )

◆ getCharId()

int PlayerInfo::getCharId ( )

Definition at line 386 of file playerinfo.cpp.

387 {
388  return mCharId;
389 }

References mCharId.

Referenced by EAthena::GuildHandler::leave(), and EAthena::GuildRecv::processGuildLeave2().

◆ getElementalId()

BeingId PlayerInfo::getElementalId ( )

Definition at line 544 of file playerinfo.cpp.

545 {
546  return mElementalId;
547 }
BeingId mElementalId
Definition: playerinfo.cpp:68

References mElementalId.

Referenced by Being::drawElementalSpriteAt().

◆ getEquipment() [1/2]

Equipment * PlayerInfo::getEquipment ( )

◆ getEquipment() [2/2]

const Item * PlayerInfo::getEquipment ( const unsigned int  slot)

Returns the player's equipment at the given slot.

Definition at line 225 of file playerinfo.cpp.

226 {
227  if (mEquipment != nullptr)
228  return mEquipment->getEquipment(slot);
229  return nullptr;
230 }
const Item * getEquipment(const int index) const
Definition: equipment.h:69

References Equipment::getEquipment(), and mEquipment.

◆ getGuildPositionFlags()

GuildPositionFlags::Type PlayerInfo::getGuildPositionFlags ( )

Definition at line 653 of file playerinfo.cpp.

654 {
655  return mGuildPositionFlags;
656 }
GuildPositionFlags::Type mGuildPositionFlags
Definition: playerinfo.cpp:67

References mGuildPositionFlags.

◆ getHomunculus()

HomunculusInfo * PlayerInfo::getHomunculus ( )

◆ getHomunculusId()

BeingId PlayerInfo::getHomunculusId ( )

◆ getInventory()

Inventory * PlayerInfo::getInventory ( )

Returns the player's inventory.

Definition at line 195 of file playerinfo.cpp.

196 {
197  return mInventory;
198 }

References mInventory.

Referenced by EquipmentWindow::action(), NpcDialog::action(), ShopWindow::action(), NpcDialog::addCraftItem(), LocalPlayer::changeEquipmentBeforeAttack(), Ea::EquipBackend::clear(), OutfitWindow::copyFromEquiped(), createGuiWindows(), ItemShortcutContainer::draw(), VirtShortcutContainer::draw(), OutfitWindow::draw(), DropShortcut::dropFirst(), DropShortcut::dropItem(), ItemShortcut::equipItem(), Ea::EquipBackend::getEquipment(), Actions::getItemByInvIndex(), ShopWindow::giveList(), LocalPlayer::imitateOutfit(), TradeWindow::initTrade(), MiniStatusWindow::MiniStatusWindow(), ItemShortcutContainer::mouseDragged(), VirtShortcutContainer::mouseDragged(), OutfitWindow::mouseDragged(), ItemShortcutContainer::mouseMoved(), VirtShortcutContainer::mouseMoved(), MiniStatusWindow::mouseMoved(), VirtShortcutContainer::mousePressed(), ItemContainer::mouseReleased(), ShopListBox::mouseReleased(), EquipmentWindow::mouseReleased(), EAthena::InventoryRecv::processBindItem(), EAthena::BuyingStoreRecv::processBuyingStoreDeleteItem(), EAthena::BuyingStoreRecv::processBuyingStoreItemsList(), EAthena::PetRecv::processEggsList(), EAthena::InventoryRecv::processInventoryEndContinue(), EAthena::InventoryRecv::processInventoryExpansionInfo(), EAthena::InventoryRecv::processInventoryStartContinue(), EAthena::InventoryRecv::processItemMoveFailed(), Ea::InventoryRecv::processItemUseResponse(), Ea::BuySellRecv::processNpcSell(), EAthena::InventoryRecv::processPlayerEquipment(), TmwAthena::InventoryRecv::processPlayerEquipment(), EAthena::InventoryRecv::processPlayerInsertCard(), EAthena::InventoryRecv::processPlayerInventory(), TmwAthena::InventoryRecv::processPlayerInventory(), EAthena::InventoryRecv::processPlayerInventoryAdd(), TmwAthena::InventoryRecv::processPlayerInventoryAdd(), EAthena::InventoryRecv::processPlayerInventoryRemove(), TmwAthena::InventoryRecv::processPlayerInventoryRemove(), EAthena::InventoryRecv::processPlayerInventoryRemove2(), EAthena::InventoryRecv::processPlayerInventoryUse(), TmwAthena::InventoryRecv::processPlayerInventoryUse(), EAthena::InventoryRecv::processPlayerItemRentalExpired(), EAthena::InventoryRecv::processPlayerRefine(), EAthena::InventoryRecv::processPlayerUseCard(), EAthena::Mail2Recv::processRemoveItemResult(), ShopWindow::processRequest(), EAthena::TradeRecv::processTradeItemAddResponse(), TmwAthena::TradeRecv::processTradeItemAddResponse(), NpcDialog::restoreVirtuals(), ItemShortcutContainer::safeDraw(), VirtShortcutContainer::safeDraw(), OutfitWindow::safeDraw(), BuyingStoreSellDialog::sellAction(), MailEditWindow::sendMail(), Ea::EquipBackend::setEquipment(), PopupMenu::showItemPopup(), ShopWindow::showList(), ShopWindow::sumAmount(), ItemShortcut::unequipItem(), OutfitWindow::unequipNotInOutfit(), StatusWindow::updateInvSlotsBar(), ItemShortcut::useItem(), OutfitWindow::wearOutfit(), and MiniStatusWindow::~MiniStatusWindow().

◆ getMercenary()

MercenaryInfo * PlayerInfo::getMercenary ( )

Definition at line 549 of file playerinfo.cpp.

550 {
551  return mMercenary;
552 }

References mMercenary.

Referenced by EAthena::BeingRecv::createBeing2(), and Being::drawMercenarySpriteAt().

◆ getMercenaryId()

BeingId PlayerInfo::getMercenaryId ( )

◆ getPet()

PetInfo * PlayerInfo::getPet ( )

Definition at line 576 of file playerinfo.cpp.

577 {
578  return mPet;
579 }
PetInfo * mPet
Definition: playerinfo.cpp:63

References mPet.

Referenced by EAthena::PetRecv::processPetData(), EAthena::PetRecv::processPetStatus(), and BeingPopup::show().

◆ getPetBeingId()

BeingId PlayerInfo::getPetBeingId ( )

Definition at line 581 of file playerinfo.cpp.

582 {
583  return mPetBeingId;
584 }

References mPetBeingId.

Referenced by EAthena::BeingRecv::createBeing2(), and Actions::getPet().

◆ getRoomName()

std::string PlayerInfo::getRoomName ( )

Definition at line 633 of file playerinfo.cpp.

634 {
635  return mRoomName;
636 }
std::string mRoomName
Definition: playerinfo.cpp:64

References mRoomName.

Referenced by ChatWindow::joinRoom().

◆ getServerLanguage()

int PlayerInfo::getServerLanguage ( )

Definition at line 677 of file playerinfo.cpp.

678 {
679  return mServerLanguage;
680 }
int mServerLanguage
Definition: playerinfo.cpp:73

References mServerLanguage.

Referenced by getServerLang().

◆ getSkillLevel()

int PlayerInfo::getSkillLevel ( const int  id)

◆ getStatBase()

int PlayerInfo::getStatBase ( const AttributesT  id)

Returns the base value of the given stat.

Definition at line 135 of file playerinfo.cpp.

136 {
137  const StatMap::const_iterator it = mData.mStats.find(id);
138  if (it != mData.mStats.end())
139  return it->second.base;
140  return 0;
141 }

References mData, and PlayerInfoBackend::mStats.

Referenced by ChangeDisplay::action(), Being::drawElementalSpriteAt(), Being::drawHomunculusSpriteAt(), Being::drawMercenarySpriteAt(), Ea::PlayerRecv::processPlayerStatUpdate4(), and AttrDisplay::update().

◆ getStatEffective()

int PlayerInfo::getStatEffective ( const AttributesT  id)

Returns the current effective value of the given stat. Effective is base

  • mod

Definition at line 167 of file playerinfo.cpp.

168 {
169  const StatMap::const_iterator it = mData.mStats.find(id);
170  if (it != mData.mStats.end())
171  return it->second.base + it->second.mod;
172  return 0;
173 }

References mData, and PlayerInfoBackend::mStats.

Referenced by Ea::PlayerHandler::canUseMagic().

◆ getStatExperience()

const std::pair< int, int > PlayerInfo::getStatExperience ( const AttributesT  id)

Returns the experience of the given stat.

Definition at line 175 of file playerinfo.cpp.

176 {
177  const StatMap::const_iterator it = mData.mStats.find(id);
178  int a;
179  int b;
180  if (it != mData.mStats.end())
181  {
182  a = it->second.exp;
183  b = it->second.expNeed;
184  }
185  else
186  {
187  a = 0;
188  b = 0;
189  }
190  return std::pair<int, int>(a, b);
191 }

References mData, and PlayerInfoBackend::mStats.

Referenced by StatusWindow::updateProgressBar().

◆ getStatMod()

int PlayerInfo::getStatMod ( const AttributesT  id)

Returns the modifier for the given stat.

Definition at line 151 of file playerinfo.cpp.

152 {
153  const StatMap::const_iterator it = mData.mStats.find(id);
154  if (it != mData.mStats.end())
155  return it->second.mod;
156  return 0;
157 }

References mData, and PlayerInfoBackend::mStats.

Referenced by AttrDisplay::update().

◆ getStorageInventory()

Inventory * PlayerInfo::getStorageInventory ( )

Definition at line 200 of file playerinfo.cpp.

201 {
202  if (inventoryHandler != nullptr)
203  return inventoryHandler->getStorage();
204  return nullptr;
205 }
virtual Inventory * getStorage() const =0

References Net::InventoryHandler::getStorage(), and inventoryHandler.

Referenced by Actions::getItemByInvIndex(), and ItemContainer::mouseReleased().

◆ init()

void PlayerInfo::init ( )

Initializes some internals.

Definition at line 434 of file playerinfo.cpp.

435 {
436 }

Referenced by Client::gameInit(), Dirs::initLocalDataDir(), and PRAGMA45().

◆ isInRoom()

bool PlayerInfo::isInRoom ( )

Definition at line 643 of file playerinfo.cpp.

644 {
645  return !mRoomName.empty();
646 }

References mRoomName.

Referenced by InputManager::updateConditionMask().

◆ isItemProtected()

bool PlayerInfo::isItemProtected ( const int  id)

◆ isTalking()

bool PlayerInfo::isTalking ( )

Definition at line 458 of file playerinfo.cpp.

459 {
461 }
static bool isStorageActive()
static bool isActive()
Definition: npcdialog.h:191

References NpcDialog::isActive(), and InventoryWindow::isStorageActive().

◆ isTrading()

Trading PlayerInfo::isTrading ( )

Returns true if the player is involved in a trade at the moment, false otherwise.

Definition at line 391 of file playerinfo.cpp.

392 {
393  return mTrading;
394 }
Trading mTrading
Definition: playerinfo.cpp:70

References mTrading.

Referenced by ShopWindow::processRequest(), and Ea::TradeRecv::processTradeRequestContinue().

◆ isVending()

bool PlayerInfo::isVending ( )

Definition at line 663 of file playerinfo.cpp.

664 {
665  return mVending;
666 }

References mVending.

Referenced by InputManager::updateConditionMask().

◆ loadData()

void PlayerInfo::loadData ( )

Definition at line 445 of file playerinfo.cpp.

446 {
447  mProtectedItems.clear();
449  serverConfig.getStringValue("protectedItems"), ',');
450 }
std::string getStringValue(const std::string &key) const
Configuration serverConfig
void splitToIntSet(std::set< int > &tokens, const std::string &text, const char separator)

References Configuration::getStringValue(), mProtectedItems, serverConfig, and splitToIntSet().

Referenced by Client::stateConnectServer1().

◆ pickUpItem()

void PlayerInfo::pickUpItem ( const FloorItem *const  item,
const Sfx  sfx 
)

Definition at line 366 of file playerinfo.cpp.

367 {
368  if (sfx == Sfx_true)
370  if (playerHandler != nullptr)
371  playerHandler->pickUp(item);
372 }
virtual void pickUp(const FloorItem *const floorItem) const =0
Net::PlayerHandler * playerHandler
Definition: net.cpp:96

References ItemSoundEvent::PICKUP, Net::PlayerHandler::pickUp(), playerHandler, ItemSoundManager::playSfx(), and Sfx_true.

Referenced by LocalPlayer::pickUp().

◆ protectItem()

void PlayerInfo::protectItem ( const int  id)

Definition at line 503 of file playerinfo.cpp.

504 {
505  mProtectedItems.insert(id);
507 }
static void saveProtectedItems()
Definition: playerinfo.cpp:484

References mProtectedItems, and saveProtectedItems().

◆ saveProtectedItems()

static void PlayerInfo::saveProtectedItems ( )
static

Definition at line 484 of file playerinfo.cpp.

485 {
486  std::string str;
487  std::set<int>::const_iterator it = mProtectedItems.begin();
488  std::set<int>::const_iterator it_end = mProtectedItems.end();
489  if (it != it_end)
490  {
491  str.append(toString(*it));
492  ++ it;
493  }
494  while (it != it_end)
495  {
496  str.append(",").append(toString(*it));
497  ++ it;
498  }
499  serverConfig.setValue("protectedItems", str);
501 }
void setValue(const std::string &key, const std::string &value)
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774

References mProtectedItems, serverConfig, Configuration::setValue(), Catch::toString(), and Configuration::write().

Referenced by protectItem(), and unprotectItem().

◆ setAttribute()

void PlayerInfo::setAttribute ( const AttributesT  id,
const int64_t  value,
const Notify  notify 
)

◆ setBackend()

void PlayerInfo::setBackend ( const PlayerInfoBackend backend)

Changes the internal PlayerInfoBackend reference;

Definition at line 376 of file playerinfo.cpp.

377 {
378  mData = backend;
379 }

References mData.

Referenced by EAthena::CharServerRecv::processCharMapInfo(), and TmwAthena::CharServerRecv::processCharMapInfo().

◆ setCharId()

void PlayerInfo::setCharId ( const int  charId)

Definition at line 381 of file playerinfo.cpp.

382 {
383  mCharId = charId;
384 }

References mCharId.

Referenced by EAthena::CharServerRecv::processCharMapInfo(), and TmwAthena::CharServerRecv::processCharMapInfo().

◆ setElemental()

void PlayerInfo::setElemental ( const BeingId  id)

Definition at line 539 of file playerinfo.cpp.

540 {
541  mElementalId = id;
542 }

References mElementalId.

Referenced by EAthena::ElementalRecv::processElementalInfo().

◆ setEquipmentBackend()

void PlayerInfo::setEquipmentBackend ( Equipment::Backend *const  backend)

Definition at line 232 of file playerinfo.cpp.

233 {
234  if (mEquipment != nullptr)
235  mEquipment->setBackend(backend);
236 }
void setBackend(Backend *const backend)
Definition: equipment.h:88

References mEquipment, and Equipment::setBackend().

◆ setGuildPositionFlags()

void PlayerInfo::setGuildPositionFlags ( const GuildPositionFlags::Type  pos)

Definition at line 648 of file playerinfo.cpp.

649 {
650  mGuildPositionFlags = pos;
651 }

References mGuildPositionFlags.

Referenced by EAthena::GuildRecv::processGuildPositionInfo().

◆ setHomunculus()

void PlayerInfo::setHomunculus ( HomunculusInfo *const  info)

Definition at line 586 of file playerinfo.cpp.

587 {
588  delete mHomunculus;
589  mHomunculus = info;
590 }
bool info(InputEvent &event)
Definition: commands.cpp:57

References Actions::info(), and mHomunculus.

Referenced by EAthena::HomunculusRecv::processHomunculusData().

◆ setHomunculusBeing()

void PlayerInfo::setHomunculusBeing ( Being *const  being)

Definition at line 592 of file playerinfo.cpp.

593 {
594  if (being == nullptr ||
595  mHomunculus == nullptr)
596  {
597  return;
598  }
599  being->setName(mHomunculus->name);
600  being->setOwner(localPlayer);
601 }
void setOwner(Being *const owner)
Definition: being.h:911
void setName(const std::string &name)
Definition: being.cpp:1136
LocalPlayer * localPlayer
std::string name

References localPlayer, mHomunculus, HomunculusInfo::name, Being::setName(), and Being::setOwner().

Referenced by EAthena::HomunculusRecv::processHomunculusData(), EAthena::HomunculusRecv::processHomunculusInfo1(), EAthena::HomunculusRecv::processHomunculusInfo2(), and EAthena::HomunculusRecv::processHomunculusInfo3().

◆ setMercenary()

void PlayerInfo::setMercenary ( MercenaryInfo *const  info)

Definition at line 520 of file playerinfo.cpp.

521 {
522  delete mMercenary;
523  mMercenary = info;
524 }

References Actions::info(), and mMercenary.

Referenced by EAthena::MercenaryRecv::handleMercenaryMessage(), and EAthena::MercenaryRecv::processMercenaryInfo().

◆ setMercenaryBeing()

void PlayerInfo::setMercenaryBeing ( Being *const  being)

Definition at line 526 of file playerinfo.cpp.

527 {
528  if (being == nullptr ||
529  mMercenary == nullptr)
530  {
531  return;
532  }
533  being->setName(mMercenary->name);
534  being->setOwner(localPlayer);
535  being->setLevel(mMercenary->level);
537 }
void setLevel(const int n)
Definition: being.h:601
void setAttackRange(const int range)
Definition: being.h:843
std::string name
Definition: mercenaryinfo.h:41

References MercenaryInfo::level, localPlayer, mMercenary, MercenaryInfo::name, MercenaryInfo::range, Being::setAttackRange(), Being::setLevel(), Being::setName(), and Being::setOwner().

Referenced by EAthena::BeingRecv::createBeing2(), and EAthena::MercenaryRecv::processMercenaryInfo().

◆ setPet()

void PlayerInfo::setPet ( PetInfo *const  info)

Definition at line 554 of file playerinfo.cpp.

555 {
556  delete mPet;
557  mPet = info;
558 }

References Actions::info(), and mPet.

Referenced by EAthena::PetRecv::processPetData(), and EAthena::PetHandler::returnToEgg().

◆ setPetBeing()

void PlayerInfo::setPetBeing ( Being *const  being)

Definition at line 560 of file playerinfo.cpp.

561 {
562  if (being != nullptr)
563  mPetBeingId = being->getId();
564  else
566  if (being == nullptr ||
567  mPet == nullptr)
568  {
569  return;
570  }
571  being->setName(mPet->name);
572  being->setOwner(localPlayer);
573  being->setLevel(mPet->level);
574 }
BeingId getId() const
Definition: actorsprite.h:64
int level
Definition: petinfo.h:49
std::string name
Definition: petinfo.h:47

References BeingId_zero, ActorSprite::getId(), PetInfo::level, localPlayer, mPet, mPetBeingId, PetInfo::name, Being::setLevel(), Being::setName(), and Being::setOwner().

Referenced by EAthena::BeingRecv::createBeing2(), and EAthena::PetRecv::processPetData().

◆ setRoomName()

void PlayerInfo::setRoomName ( const std::string &  name)

◆ setServerLanguage()

void PlayerInfo::setServerLanguage ( const int  lang)

Definition at line 668 of file playerinfo.cpp.

669 {
670  if (lang != mServerLanguage)
671  {
672  mServerLanguage = lang;
674  }
675 }
static void loadDictionaryLang()

References TranslationManager::loadDictionaryLang(), and mServerLanguage.

Referenced by EAthena::BeingRecv::processBeingAttrs().

◆ setSkillLevel()

void PlayerInfo::setSkillLevel ( const int  id,
const int  value 
)

◆ setStatBase()

void PlayerInfo::setStatBase ( const AttributesT  id,
const int  value,
const Notify  notify 
)

◆ setStatMod()

void PlayerInfo::setStatMod ( const AttributesT  id,
const int  value,
const Notify  notify 
)

◆ setTrading()

void PlayerInfo::setTrading ( const Trading  trading)

◆ stateChange()

void PlayerInfo::stateChange ( const StateT  state)

Definition at line 470 of file playerinfo.cpp.

471 {
472  if (state == State::GAME)
473  {
474  if (mInventory == nullptr)
475  {
478  mEquipment = new Equipment;
480  }
481  }
482 }
unsigned int fixedInventorySize
Definition: settings.h:148
@ GAME
Definition: state.h:49
Settings settings
Definition: settings.cpp:32

References InventoryType::Cart, DragDropSource::Equipment, Settings::fixedInventorySize, State::GAME, DragDropSource::Inventory, InventoryType::Inventory, mCartInventory, mEquipment, mInventory, and settings.

Referenced by Client::loadData().

◆ triggerAttr()

void PlayerInfo::triggerAttr ( const AttributesT  id,
const int64_t  old 
)

Definition at line 78 of file playerinfo.cpp.

80 {
82  mData.mAttributes.find(id)->second);
83 }
static void distributeEvent(const AttributesT id, const int64_t oldVal, const int64_t newVal)

References AttributeListener::distributeEvent(), PlayerInfoBackend::mAttributes, and mData.

Referenced by setAttribute().

◆ triggerStat()

void PlayerInfo::triggerStat ( const AttributesT  id,
const int  old1,
const int  old2 
)

Definition at line 85 of file playerinfo.cpp.

88 {
89  StatListener::distributeEvent(id, old1, old2);
90 }
static void distributeEvent(const AttributesT id, const int oldVal1, const int oldVal2)

References StatListener::distributeEvent().

Referenced by setStatBase(), and setStatMod().

◆ unequipItem()

void PlayerInfo::unequipItem ( const Item *const  item,
const Sfx  sfx 
)

◆ unprotectItem()

void PlayerInfo::unprotectItem ( const int  id)

Definition at line 509 of file playerinfo.cpp.

510 {
511  mProtectedItems.erase(id);
513 }

References mProtectedItems, and saveProtectedItems().

◆ updateAttackAi()

void PlayerInfo::updateAttackAi ( const BeingId  targetId,
const Keep  keep 
)

Definition at line 618 of file playerinfo.cpp.

620 {
621  if (mMercenary != nullptr &&
622  mercenaryHandler != nullptr)
623  {
624  mercenaryHandler->attack(targetId, keep);
625  }
626  if (mHomunculus != nullptr &&
627  homunculusHandler != nullptr)
628  {
629  homunculusHandler->attack(targetId, keep);
630  }
631 }
virtual void attack(const BeingId targetId, const Keep keep) const =0
virtual void attack(const BeingId targetId, const Keep keep) const =0
Net::HomunculusHandler * homunculusHandler
Definition: net.cpp:112
Net::MercenaryHandler * mercenaryHandler
Definition: net.cpp:118

References Net::HomunculusHandler::attack(), Net::MercenaryHandler::attack(), homunculusHandler, mercenaryHandler, mHomunculus, and mMercenary.

Referenced by LocalPlayer::attack().

◆ updateAttrs()

void PlayerInfo::updateAttrs ( )

Definition at line 420 of file playerinfo.cpp.

References Attributes::HOMUN_ATK, Attributes::HOMUN_ATTACK_DELAY, Attributes::HOMUN_ATTACK_SPEED, Attributes::MERC_ATK, Attributes::MERC_ATTACK_DELAY, Attributes::MERC_ATTACK_SPEED, Attributes::PLAYER_ATK, Attributes::PLAYER_ATTACK_DELAY, Attributes::PLAYER_ATTACK_SPEED, and updateAttackStat.

Referenced by EAthena::HomunculusRecv::processHomunculusInfo1(), EAthena::HomunculusRecv::processHomunculusInfo2(), EAthena::HomunculusRecv::processHomunculusInfo3(), EAthena::MercenaryRecv::processMercenaryInfo(), EAthena::PlayerRecv::processPlayerStatUpdate5(), TmwAthena::PlayerRecv::processPlayerStatUpdate5(), EAthena::PlayerHandler::setStat(), and TmwAthena::PlayerHandler::setStat().

◆ useEquipItem()

void PlayerInfo::useEquipItem ( const Item *const  item,
const int16_t  useType,
const Sfx  sfx 
)

Definition at line 262 of file playerinfo.cpp.

265 {
266  if (item != nullptr)
267  {
268  if (item->getType() == ItemType::Card)
269  {
270  if (mProtectedItems.find(item->getId()) == mProtectedItems.end())
271  {
272  if (inventoryHandler != nullptr)
273  inventoryHandler->useCard(item);
274  if (sfx == Sfx_true)
276  }
277  }
278  else if (item->isEquipment() == Equipm_true)
279  {
280  if (item->isEquipped() == Equipped_true)
281  {
282  if (sfx == Sfx_true)
284  if (inventoryHandler != nullptr)
286  }
287  else
288  {
289  if (sfx == Sfx_true)
291  if (inventoryHandler != nullptr)
293  }
294  }
295  else
296  {
297  if (mProtectedItems.find(item->getId()) == mProtectedItems.end())
298  {
299  if (inventoryHandler != nullptr)
300  {
301  if (useType == 0)
302  inventoryHandler->useItem(item);
303  else
304  inventoryHandler->useItem(item, useType);
305  }
306  if (sfx == Sfx_true)
308  }
309  }
310  }
311 }
Equipm isEquipment() const
Definition: item.h:117
Equipped isEquipped() const
Definition: item.h:129
ItemTypeT getType() const
Definition: item.h:225
virtual void useCard(const Item *const item)=0
virtual void useItem(const Item *const item) const =0
const bool Equipm_true
Definition: equipm.h:30
const bool Equipped_true
Definition: equipped.h:30
@ Card
Definition: itemtype.h:35

References ItemType::Card, ItemSoundEvent::EQUIP, Net::InventoryHandler::equipItem(), Equipm_true, Equipped_true, Item::getId(), Item::getType(), inventoryHandler, Item::isEquipment(), Item::isEquipped(), mProtectedItems, ItemSoundManager::playSfx(), Sfx_true, ItemSoundEvent::UNEQUIP, Net::InventoryHandler::unequipItem(), ItemSoundEvent::USE, ItemSoundEvent::USECARD, Net::InventoryHandler::useCard(), and Net::InventoryHandler::useItem().

Referenced by InventoryWindow::action(), InventoryWindow::mouseClicked(), and ItemShortcut::useItem().

◆ useEquipItem2()

void PlayerInfo::useEquipItem2 ( const Item *const  item,
const int16_t  useType,
const Sfx  sfx 
)

Definition at line 313 of file playerinfo.cpp.

316 {
317  if (item != nullptr)
318  {
319  if (item->isEquipment() == Equipm_false)
320  {
321  if (item->isEquipped() == Equipped_true)
322  {
323  if (sfx == Sfx_true)
325  if (inventoryHandler != nullptr)
327  }
328  else
329  {
330  if (sfx == Sfx_true)
332  if (inventoryHandler != nullptr)
334  }
335  }
336  else
337  {
338  if (mProtectedItems.find(item->getId()) == mProtectedItems.end())
339  {
340  if (sfx == Sfx_true)
342  if (inventoryHandler != nullptr)
343  {
344  if (useType == 0)
345  inventoryHandler->useItem(item);
346  else
347  inventoryHandler->useItem(item, useType);
348  }
349  }
350  }
351  }
352 }
const bool Equipm_false
Definition: equipm.h:30

References ItemSoundEvent::EQUIP, Net::InventoryHandler::equipItem(), Equipm_false, Equipped_true, Item::getId(), inventoryHandler, Item::isEquipment(), Item::isEquipped(), mProtectedItems, ItemSoundManager::playSfx(), Sfx_true, ItemSoundEvent::UNEQUIP, Net::InventoryHandler::unequipItem(), ItemSoundEvent::USE, and Net::InventoryHandler::useItem().

Referenced by InventoryWindow::action().

◆ useItem()

void PlayerInfo::useItem ( const Item *const  item,
const Sfx  sfx 
)

Definition at line 254 of file playerinfo.cpp.

255 {
256  if (sfx == Sfx_true)
258  if (inventoryHandler != nullptr)
259  inventoryHandler->useItem(item);
260 }

References inventoryHandler, ItemSoundManager::playSfx(), Sfx_true, ItemSoundEvent::USE, and Net::InventoryHandler::useItem().

Variable Documentation

◆ mCartInventory

Inventory* PlayerInfo::mCartInventory = 0

Definition at line 60 of file playerinfo.cpp.

Referenced by gameDestroyed(), getCartInventory(), and stateChange().

◆ mCharId

int PlayerInfo::mCharId = 0

Definition at line 57 of file playerinfo.cpp.

Referenced by getCharId(), and setCharId().

◆ mData

PlayerInfoBackend PlayerInfo::mData

◆ mElementalId

BeingId PlayerInfo::mElementalId = BeingId_zero

Definition at line 68 of file playerinfo.cpp.

Referenced by getElementalId(), and setElemental().

◆ mEquipment

Equipment* PlayerInfo::mEquipment = 0

◆ mGuildPositionFlags

GuildPositionFlags::Type PlayerInfo::mGuildPositionFlags = GuildPositionFlags::None

Definition at line 67 of file playerinfo.cpp.

Referenced by getGuildPositionFlags(), and setGuildPositionFlags().

◆ mHomunculus

HomunculusInfo* PlayerInfo::mHomunculus = 0

◆ mInventory

Inventory* PlayerInfo::mInventory = 0

Definition at line 59 of file playerinfo.cpp.

Referenced by clearInventory(), gameDestroyed(), getInventory(), and stateChange().

◆ mLevelProgress

int PlayerInfo::mLevelProgress = 0

Definition at line 72 of file playerinfo.cpp.

◆ mMercenary

MercenaryInfo* PlayerInfo::mMercenary = 0

◆ mPet

PetInfo* PlayerInfo::mPet = 0

Definition at line 63 of file playerinfo.cpp.

Referenced by getPet(), setPet(), and setPetBeing().

◆ mPetBeingId

BeingId PlayerInfo::mPetBeingId = BeingId_zero

Definition at line 66 of file playerinfo.cpp.

Referenced by clear(), deinit(), getPetBeingId(), and setPetBeing().

◆ mProtectedItems

std::set<int> PlayerInfo::mProtectedItems

◆ mRoomName

std::string PlayerInfo::mRoomName

Definition at line 64 of file playerinfo.cpp.

Referenced by getRoomName(), isInRoom(), and setRoomName().

◆ mServerLanguage

int PlayerInfo::mServerLanguage = -1

Definition at line 73 of file playerinfo.cpp.

Referenced by getServerLanguage(), and setServerLanguage().

◆ mTrading

Trading PlayerInfo::mTrading = Trading_false

Definition at line 70 of file playerinfo.cpp.

Referenced by isTrading(), and setTrading().

◆ mVending

bool PlayerInfo::mVending = false

Definition at line 71 of file playerinfo.cpp.

Referenced by enableVending(), and isVending().