* added the remaining base classes Object, Corpse, DynamicObject & WorldObject; added updating those classes
* there is still a problem/exception with UPDATETYPE_OUT_OF_RANGE_OBJECTS, need to fix this later. * 100% working objects system, now need to add functions to the objects. (made a start with Player/Unit::GetGender())
This commit is contained in:
parent
05ed66c21f
commit
605fbd2df5
14
src/Client/World/Bag.cpp
Normal file
14
src/Client/World/Bag.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "Bag.h"
|
||||
|
||||
Bag::Bag() : Item()
|
||||
{
|
||||
_type |= TYPE_CONTAINER;
|
||||
_typeid = TYPEID_CONTAINER;
|
||||
_valuescount = CONTAINER_END;
|
||||
_slot = 0;
|
||||
}
|
||||
|
||||
void Bag::Create(uint64 guid)
|
||||
{
|
||||
Item::Create(guid);
|
||||
}
|
||||
18
src/Client/World/Bag.h
Normal file
18
src/Client/World/Bag.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef _BAG_H
|
||||
#define _BAG_H
|
||||
|
||||
#include "common.h"
|
||||
#include "Item.h"
|
||||
|
||||
class Bag : public Item
|
||||
{
|
||||
public:
|
||||
Bag();
|
||||
void Create(uint64);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
14
src/Client/World/Corpse.cpp
Normal file
14
src/Client/World/Corpse.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "Corpse.h"
|
||||
|
||||
Corpse::Corpse()
|
||||
{
|
||||
_uint32values=NULL;
|
||||
_type=TYPE_CORPSE;
|
||||
_typeid=TYPEID_CORPSE;
|
||||
_valuescount=CORPSE_END;
|
||||
}
|
||||
|
||||
void Corpse::Create(uint64 guid)
|
||||
{
|
||||
Object::Create(guid);
|
||||
}
|
||||
16
src/Client/World/Corpse.h
Normal file
16
src/Client/World/Corpse.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef _CORPSE_H
|
||||
#define _CORPSE_H
|
||||
|
||||
#include "Object.h"
|
||||
|
||||
class Corpse : public WorldObject
|
||||
{
|
||||
public:
|
||||
Corpse();
|
||||
void Create(uint64);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
14
src/Client/World/DynamicObject.cpp
Normal file
14
src/Client/World/DynamicObject.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "DynamicObject.h"
|
||||
|
||||
DynamicObject::DynamicObject()
|
||||
{
|
||||
_uint32values=NULL;
|
||||
_type=TYPE_DYNAMICOBJECT;
|
||||
_typeid=TYPEID_DYNAMICOBJECT;
|
||||
_valuescount=DYNAMICOBJECT_END;
|
||||
}
|
||||
|
||||
void DynamicObject::Create(uint64 guid)
|
||||
{
|
||||
Object::Create(guid);
|
||||
}
|
||||
16
src/Client/World/DynamicObject.h
Normal file
16
src/Client/World/DynamicObject.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef _DYNAMICOBJECT_H
|
||||
#define _DYNAMICOBJECT_H
|
||||
|
||||
#include "Object.h"
|
||||
|
||||
class DynamicObject : public WorldObject
|
||||
{
|
||||
public:
|
||||
DynamicObject();
|
||||
void Create(uint64);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
14
src/Client/World/GameObject.cpp
Normal file
14
src/Client/World/GameObject.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "GameObject.h"
|
||||
|
||||
GameObject::GameObject()
|
||||
{
|
||||
_uint32values=NULL;
|
||||
_type=TYPE_GAMEOBJECT;
|
||||
_typeid=TYPEID_GAMEOBJECT;
|
||||
_valuescount=GAMEOBJECT_END;
|
||||
}
|
||||
|
||||
void GameObject::Create(uint64 guid)
|
||||
{
|
||||
Object::Create(guid);
|
||||
}
|
||||
16
src/Client/World/GameObject.h
Normal file
16
src/Client/World/GameObject.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef _GAMEOBJECT_H
|
||||
#define _GAMEOBJECT_H
|
||||
|
||||
#include "Object.h"
|
||||
|
||||
class GameObject : public WorldObject
|
||||
{
|
||||
public:
|
||||
GameObject();
|
||||
void Create(uint64);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -2,6 +2,7 @@
|
||||
#include "UpdateFields.h"
|
||||
|
||||
#include "Item.h"
|
||||
#include "Bag.h"
|
||||
|
||||
void WorldSession::_HandleItemQuerySingleResponseOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
#include "common.h"
|
||||
#include "Object.h"
|
||||
|
||||
class Bag;
|
||||
|
||||
enum InventoryChangeFailure
|
||||
{
|
||||
EQUIP_ERR_OK = 0,
|
||||
@ -395,21 +397,14 @@ public:
|
||||
void Create(uint64);
|
||||
uint8 GetSlot(void) { return _slot; }
|
||||
void SetSlot(uint8 nr) { _slot = nr; }
|
||||
//void SetProto(ItemProto *proto) { _proto = proto; }
|
||||
//ItemProto *GetProto(void) { return _proto; }
|
||||
uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
|
||||
uint32 GetCount() const { return GetUInt32Value (ITEM_FIELD_STACK_COUNT); }
|
||||
//void SetBag(Bag *b) { _bag = b; }
|
||||
//void GetBag(Bag *b) { _bag = b; }
|
||||
//bool IsInBag() const { return _bag != NULL; }
|
||||
/*bool Item::IsEquipped() const
|
||||
{
|
||||
return !IsInBag() && _slot < EQUIPMENT_SLOT_END;
|
||||
}*/
|
||||
Bag *GetBag(void) { return _bag; }
|
||||
bool IsInBag() const { return _bag != NULL; }
|
||||
|
||||
private:
|
||||
protected:
|
||||
uint8 _slot;
|
||||
// Bag *_bag; // not yet implemented
|
||||
Bag *_bag; // not yet implemented
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
#include "common.h"
|
||||
#include "Item.h"
|
||||
#include "ObjMgr.h"
|
||||
|
||||
ObjMgr::~ObjMgr()
|
||||
@ -18,8 +16,11 @@ void ObjMgr::Remove(uint64 guid)
|
||||
{
|
||||
for(ObjectList::iterator i = _obj.begin(); i!=_obj.end(); i++)
|
||||
if((*i)->GetGUID() == guid)
|
||||
{
|
||||
_obj.erase(i);
|
||||
delete *i;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -4,8 +4,6 @@
|
||||
#include "common.h"
|
||||
#include <list>
|
||||
#include "Object.h"
|
||||
#include "Player.h"
|
||||
#include "Unit.h"
|
||||
#include "Item.h"
|
||||
|
||||
typedef std::vector<ItemProto*> ItemProtoList;
|
||||
|
||||
@ -8,7 +8,7 @@ Object::Object()
|
||||
_uint32values=NULL;
|
||||
_type=TYPE_OBJECT;
|
||||
_typeid=TYPEID_OBJECT;
|
||||
_valuescount=0;
|
||||
_valuescount=0; // base class. this value will be set by derived classes
|
||||
}
|
||||
|
||||
Object::~Object()
|
||||
|
||||
@ -6,6 +6,139 @@
|
||||
#include "SysDefs.h"
|
||||
#include "Unit.h"
|
||||
|
||||
#define PLAYER_SLOT_START 0
|
||||
|
||||
#define EQUIPMENT_SLOT_START 0
|
||||
#define EQUIPMENT_SLOT_HEAD 0
|
||||
#define EQUIPMENT_SLOT_NECK 1
|
||||
#define EQUIPMENT_SLOT_SHOULDERS 2
|
||||
#define EQUIPMENT_SLOT_BODY 3
|
||||
#define EQUIPMENT_SLOT_CHEST 4
|
||||
#define EQUIPMENT_SLOT_WAIST 5
|
||||
#define EQUIPMENT_SLOT_LEGS 6
|
||||
#define EQUIPMENT_SLOT_FEET 7
|
||||
#define EQUIPMENT_SLOT_WRISTS 8
|
||||
#define EQUIPMENT_SLOT_HANDS 9
|
||||
#define EQUIPMENT_SLOT_FINGER1 10
|
||||
#define EQUIPMENT_SLOT_FINGER2 11
|
||||
#define EQUIPMENT_SLOT_TRINKET1 12
|
||||
#define EQUIPMENT_SLOT_TRINKET2 13
|
||||
#define EQUIPMENT_SLOT_BACK 14
|
||||
#define EQUIPMENT_SLOT_MAINHAND 15
|
||||
#define EQUIPMENT_SLOT_OFFHAND 16
|
||||
#define EQUIPMENT_SLOT_RANGED 17
|
||||
#define EQUIPMENT_SLOT_TABARD 18
|
||||
#define EQUIPMENT_SLOT_END 19
|
||||
|
||||
#define INVENTORY_SLOT_BAG_0 255
|
||||
#define INVENTORY_SLOT_BAG_START 19
|
||||
#define INVENTORY_SLOT_BAG_1 19
|
||||
#define INVENTORY_SLOT_BAG_2 20
|
||||
#define INVENTORY_SLOT_BAG_3 21
|
||||
#define INVENTORY_SLOT_BAG_4 22
|
||||
#define INVENTORY_SLOT_BAG_END 23
|
||||
|
||||
#define INVENTORY_SLOT_ITEM_START 23
|
||||
#define INVENTORY_SLOT_ITEM_1 23
|
||||
#define INVENTORY_SLOT_ITEM_2 24
|
||||
#define INVENTORY_SLOT_ITEM_3 25
|
||||
#define INVENTORY_SLOT_ITEM_4 26
|
||||
#define INVENTORY_SLOT_ITEM_5 27
|
||||
#define INVENTORY_SLOT_ITEM_6 28
|
||||
#define INVENTORY_SLOT_ITEM_7 29
|
||||
#define INVENTORY_SLOT_ITEM_8 30
|
||||
#define INVENTORY_SLOT_ITEM_9 31
|
||||
#define INVENTORY_SLOT_ITEM_10 32
|
||||
#define INVENTORY_SLOT_ITEM_11 33
|
||||
#define INVENTORY_SLOT_ITEM_12 34
|
||||
#define INVENTORY_SLOT_ITEM_13 35
|
||||
#define INVENTORY_SLOT_ITEM_14 36
|
||||
#define INVENTORY_SLOT_ITEM_15 37
|
||||
#define INVENTORY_SLOT_ITEM_16 38
|
||||
#define INVENTORY_SLOT_ITEM_END 39
|
||||
|
||||
#define BANK_SLOT_ITEM_START 39
|
||||
#define BANK_SLOT_ITEM_1 39
|
||||
#define BANK_SLOT_ITEM_2 40
|
||||
#define BANK_SLOT_ITEM_3 41
|
||||
#define BANK_SLOT_ITEM_4 42
|
||||
#define BANK_SLOT_ITEM_5 43
|
||||
#define BANK_SLOT_ITEM_6 44
|
||||
#define BANK_SLOT_ITEM_7 45
|
||||
#define BANK_SLOT_ITEM_8 46
|
||||
#define BANK_SLOT_ITEM_9 47
|
||||
#define BANK_SLOT_ITEM_10 48
|
||||
#define BANK_SLOT_ITEM_11 49
|
||||
#define BANK_SLOT_ITEM_12 50
|
||||
#define BANK_SLOT_ITEM_13 51
|
||||
#define BANK_SLOT_ITEM_14 52
|
||||
#define BANK_SLOT_ITEM_15 53
|
||||
#define BANK_SLOT_ITEM_16 54
|
||||
#define BANK_SLOT_ITEM_17 55
|
||||
#define BANK_SLOT_ITEM_18 56
|
||||
#define BANK_SLOT_ITEM_19 57
|
||||
#define BANK_SLOT_ITEM_20 58
|
||||
#define BANK_SLOT_ITEM_21 59
|
||||
#define BANK_SLOT_ITEM_22 60
|
||||
#define BANK_SLOT_ITEM_23 61
|
||||
#define BANK_SLOT_ITEM_24 62
|
||||
#define BANK_SLOT_ITEM_END 63
|
||||
|
||||
#define BANK_SLOT_BAG_START 63
|
||||
#define BANK_SLOT_BAG_1 63
|
||||
#define BANK_SLOT_BAG_2 64
|
||||
#define BANK_SLOT_BAG_3 65
|
||||
#define BANK_SLOT_BAG_4 66
|
||||
#define BANK_SLOT_BAG_5 67
|
||||
#define BANK_SLOT_BAG_6 68
|
||||
#define BANK_SLOT_BAG_END 69
|
||||
|
||||
// strored in m_buybackitems
|
||||
#define BUYBACK_SLOT_START 69
|
||||
#define BUYBACK_SLOT_1 69
|
||||
#define BUYBACK_SLOT_2 70
|
||||
#define BUYBACK_SLOT_3 71
|
||||
#define BUYBACK_SLOT_4 72
|
||||
#define BUYBACK_SLOT_5 73
|
||||
#define BUYBACK_SLOT_6 74
|
||||
#define BUYBACK_SLOT_7 75
|
||||
#define BUYBACK_SLOT_8 76
|
||||
#define BUYBACK_SLOT_9 77
|
||||
#define BUYBACK_SLOT_10 78
|
||||
#define BUYBACK_SLOT_11 79
|
||||
#define BUYBACK_SLOT_12 80
|
||||
#define BUYBACK_SLOT_END 81
|
||||
|
||||
#define KEYRING_SLOT_START 81
|
||||
#define KEYRING_SLOT_END 97
|
||||
|
||||
// last+1 slot for item stored (in any way in player m_items data)
|
||||
#define PLAYER_SLOT_END 97
|
||||
#define PLAYER_SLOTS_COUNT (PLAYER_SLOT_END - PLAYER_SLOT_START)
|
||||
|
||||
#define TRADE_SLOT_COUNT 7
|
||||
#define TRADE_SLOT_TRADED_COUNT 6
|
||||
#define TRADE_SLOT_NONTRADED 6
|
||||
|
||||
enum MovementFlags
|
||||
{
|
||||
MOVEMENTFLAG_FORWARD = 0x1,
|
||||
MOVEMENTFLAG_BACKWARD = 0x2,
|
||||
MOVEMENTFLAG_STRAFE_LEFT = 0x4,
|
||||
MOVEMENTFLAG_STRAFE_RIGHT = 0x8,
|
||||
MOVEMENTFLAG_LEFT = 0x10,
|
||||
MOVEMENTFLAG_RIGHT = 0x20,
|
||||
MOVEMENTFLAG_PITCH_UP = 0x40,
|
||||
MOVEMENTFLAG_PITCH_DOWN = 0x80,
|
||||
|
||||
MOVEMENTFLAG_WALK = 0x100,
|
||||
MOVEMENTFLAG_JUMPING = 0x2000,
|
||||
MOVEMENTFLAG_FALLING = 0x4000,
|
||||
MOVEMENTFLAG_SWIMMING = 0x200000,
|
||||
MOVEMENTFLAG_ONTRANSPORT = 0x2000000,
|
||||
MOVEMENTFLAG_SPLINE = 0x4000000
|
||||
};
|
||||
|
||||
struct PlayerEnumItem
|
||||
{
|
||||
uint32 displayId;
|
||||
@ -47,6 +180,7 @@ class Player : public Unit
|
||||
public:
|
||||
Player();
|
||||
void Create(uint64);
|
||||
uint8 GetGender() { return GetUInt32Value(PLAYER_BYTES_3); }
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@ -8,3 +8,14 @@ Unit::Unit() : WorldObject()
|
||||
_valuescount = UNIT_END;
|
||||
}
|
||||
|
||||
void Unit::Create(uint64 guid)
|
||||
{
|
||||
Object::Create(guid);
|
||||
}
|
||||
|
||||
uint8 Unit::GetGender(void)
|
||||
{
|
||||
uint32 temp = GetUInt32Value(UNIT_FIELD_BYTES_0);
|
||||
return ((uint8*)&temp)[2];
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@ class Unit : public WorldObject
|
||||
{
|
||||
public:
|
||||
Unit();
|
||||
void Create(uint64);
|
||||
uint8 GetGender(void);
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
@ -5,6 +5,10 @@
|
||||
#include "UpdateFields.h"
|
||||
#include "Object.h"
|
||||
#include "Unit.h"
|
||||
#include "Bag.h"
|
||||
#include "GameObject.h"
|
||||
#include "Corpse.h"
|
||||
#include "DynamicObject.h"
|
||||
#include "ObjMgr.h"
|
||||
#include "UpdateMask.h"
|
||||
|
||||
@ -90,7 +94,13 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
|
||||
objmgr.Add(item);
|
||||
break;
|
||||
}
|
||||
//case TYPEID_CONTAINER: // not yet handled
|
||||
case TYPEID_CONTAINER:
|
||||
{
|
||||
Bag *bag = new Bag();
|
||||
bag->Create(uguid);
|
||||
objmgr.Add(bag);
|
||||
break;
|
||||
}
|
||||
case TYPEID_UNIT:
|
||||
{
|
||||
Unit *unit = new Unit();
|
||||
@ -105,6 +115,27 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
|
||||
objmgr.Add(player);
|
||||
break;
|
||||
}
|
||||
case TYPEID_GAMEOBJECT:
|
||||
{
|
||||
GameObject *go = new GameObject();
|
||||
go->Create(uguid);
|
||||
objmgr.Add(go);
|
||||
break;
|
||||
}
|
||||
case TYPEID_CORPSE:
|
||||
{
|
||||
Corpse *corpse = new Corpse();
|
||||
corpse->Create(uguid);
|
||||
objmgr.Add(corpse);
|
||||
break;
|
||||
}
|
||||
case TYPEID_DYNAMICOBJECT:
|
||||
{
|
||||
DynamicObject *dobj = new DynamicObject();
|
||||
dobj->Create(uguid);
|
||||
objmgr.Add(dobj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this->_MovementUpdate(objtypeid, uguid, recvPacket);
|
||||
|
||||
@ -253,6 +253,12 @@
|
||||
<Filter
|
||||
Name="World"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\Client\World\Bag.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\World\Bag.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\World\CacheHandler.cpp">
|
||||
</File>
|
||||
@ -268,6 +274,24 @@
|
||||
<File
|
||||
RelativePath=".\Client\World\CMSGConstructor.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\World\Corpse.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\World\Corpse.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\World\DynamicObject.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\World\DynamicObject.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\World\GameObject.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\World\GameObject.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\World\Item.cpp">
|
||||
</File>
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define SETBIT(var,bit) ( (var)|=(1<<(bit)) );
|
||||
#define UNSETBIT(var,bit) ( (var)&=(~(1<<(bit))) );
|
||||
#define HASBIT(var,bit) ( (var)&(1<<(bit)) );
|
||||
|
||||
void printchex(std::string,bool);
|
||||
void printchex(char *in, uint32 len, bool);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user