Advertisement
Guest User

container.cpp

a guest
Apr 26th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "container.h"
  3. #include "structures.h"
  4.  
  5. using namespace tibia::objects;
  6.  
  7. Container::Container(void) {
  8. }
  9.  
  10.  
  11. Container::Container(const tibia::structures::Container* container) {
  12.     this->container_ = container;
  13. }
  14.  
  15.  
  16. Container::~Container(void) {
  17. }
  18.  
  19.  
  20. UINT32 Container::getIndex() {
  21.     return this->container_->index;
  22. }
  23.  
  24.  
  25. char* Container::getName() {
  26.     if (this->container_->name.length > 0xF)
  27.         return (char *)this->container_->name.field.pointer;
  28.     return (char *)this->container_->name.field.buffer;
  29. }
  30.  
  31.  
  32. UINT32 Container::getSlotsCount() {
  33.     return this->container_->slotsCount;
  34. }
  35.  
  36.  
  37. UINT32 Container::getItemsCount() {
  38.         return this->container_->itemsCount;
  39. }
  40.  
  41.  
  42. Items Container::getItems() {
  43.     Items items;
  44.  
  45.     for (UINT32 i = 0; i < getItemsCount(); i++) {
  46.         ptrContainerItem item (new ContainerItem( (tibia::structures::ContainerItem *)(this->container_->itemsPtr +
  47.             i * sizeof(tibia::structures::ContainerItem))));
  48.         items.push_back(item);
  49.     }
  50.  
  51.     return items;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement