temp. commit, more will come soon. crashes not yet fixed :/

This commit is contained in:
False.Genesis 2007-02-02 01:28:28 +00:00
parent 0f29e12f57
commit aa703e896f
9 changed files with 187 additions and 6 deletions

View File

@ -3,4 +3,4 @@
// EXECUTED EVERYTIME A WHISPER IS BEEING RECIEVED // EXECUTED EVERYTIME A WHISPER IS BEEING RECIEVED
// comment out the following line if you dont need it // comment out the following line if you dont need it
REPLY,0 No need to whisper me, i am not yet programmed for it! //REPLY,0 No need to whisper me, i am not yet programmed for it!

8
src/Client/HelperDefs.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef _HELPERDEFS_H
#define _HELPERDEFS_H
#define GUID_HIPART(x) (*(((uint32*)&(x))+1))
#define GUID_LOPART(x) (*((uint32*)&(x)))
#define MAKE_GUID(l, h) uint64( uint32(l) | ( uint64(h) << 32 ) )
#endif

14
src/Client/World/Item.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "WorldSession.h"
#include "UpdateFields.h"
#include "Item.h"
Item::Item()
{
_type |= TYPE_ITEM;
_typeid = TYPEID_ITEM;
_valuescount = ITEM_END;
_slot = 0;
//_bag = NULL; // not yet implemented
}

126
src/Client/World/Item.h Normal file
View File

@ -0,0 +1,126 @@
#ifndef _ITEM_H
#define _ITEM_H
#include "common.h"
#include "Object.h"
enum InventoryChangeFailure
{
EQUIP_ERR_OK = 0,
EQUIP_ERR_YOU_MUST_REACH_LEVEL_N = 1,
EQUIP_ERR_SKILL_ISNT_HIGH_ENOUGH = 2,
EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT = 3,
EQUIP_ERR_BAG_FULL = 4,
EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG = 5,
EQUIP_ERR_CANT_TRADE_EQUIP_BAGS = 6,
EQUIP_ERR_ONLY_AMMO_CAN_GO_HERE = 7,
EQUIP_ERR_NO_REQUIRED_PROFICIENCY = 8,
EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE = 9,
EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM = 10,
EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM2 = 11,
EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE2 = 12,
EQUIP_ERR_CANT_EQUIP_WITH_TWOHANDED = 13,
EQUIP_ERR_CANT_DUAL_WIELD = 14,
EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG = 15,
EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG2 = 16,
EQUIP_ERR_CANT_CARRY_MORE_OF_THIS = 17,
EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE3 = 18,
EQUIP_ERR_ITEM_CANT_STACK = 19,
EQUIP_ERR_ITEM_CANT_BE_EQUIPPED = 20,
EQUIP_ERR_ITEMS_CANT_BE_SWAPPED = 21,
EQUIP_ERR_SLOT_IS_EMPTY = 22,
EQUIP_ERR_ITEM_NOT_FOUND = 23,
EQUIP_ERR_CANT_DROP_SOULBOUND = 24,
EQUIP_ERR_OUT_OF_RANGE = 25,
EQUIP_ERR_TRIED_TO_SPLIT_MORE_THAN_COUNT = 26,
EQUIP_ERR_COULDNT_SPLIT_ITEMS = 27,
EQUIP_ERR_MISSING_REAGENT = 28,
EQUIP_ERR_NOT_ENOUGH_MONEY = 29,
EQUIP_ERR_NOT_A_BAG = 30,
EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS = 31,
EQUIP_ERR_DONT_OWN_THAT_ITEM = 32,
EQUIP_ERR_CAN_EQUIP_ONLY1_QUIVER = 33,
EQUIP_ERR_MUST_PURCHASE_THAT_BAG_SLOT = 34,
EQUIP_ERR_TOO_FAR_AWAY_FROM_BANK = 35,
EQUIP_ERR_ITEM_LOCKED = 36,
EQUIP_ERR_YOU_ARE_STUNNED = 37,
EQUIP_ERR_YOU_ARE_DEAD = 38,
EQUIP_ERR_CANT_DO_RIGHT_NOW = 39,
EQUIP_ERR_BAG_FULL2 = 40,
EQUIP_ERR_CAN_EQUIP_ONLY1_QUIVER2 = 41,
EQUIP_ERR_CAN_EQUIP_ONLY1_AMMOPOUCH = 42,
EQUIP_ERR_STACKABLE_CANT_BE_WRAPPED = 43,
EQUIP_ERR_EQUIPPED_CANT_BE_WRAPPED = 44,
EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED = 45,
EQUIP_ERR_BOUND_CANT_BE_WRAPPED = 46,
EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED = 47,
EQUIP_ERR_BAGS_CANT_BE_WRAPPED = 48,
EQUIP_ERR_ALREADY_LOOTED = 49,
EQUIP_ERR_INVENTORY_FULL = 50,
EQUIP_ERR_BANK_FULL = 51,
EQUIP_ERR_ITEM_IS_CURRENTLY_SOLD_OUT = 52,
EQUIP_ERR_BAG_FULL3 = 53,
EQUIP_ERR_ITEM_NOT_FOUND2 = 54,
EQUIP_ERR_ITEM_CANT_STACK2 = 55,
EQUIP_ERR_BAG_FULL4 = 56,
EQUIP_ERR_ITEM_SOLD_OUT = 57,
EQUIP_ERR_OBJECT_IS_BUSY = 58,
EQUIP_ERR_NONE = 59,
EQUIP_ERR_CANT_DO_IN_COMBAT = 60,
EQUIP_CANT_DO_WHILE_DISARMED = 61,
EQUIP_ERR_BAG_FULL6 = 62,
EQUIP_ITEM_RANK_NOT_ENOUGH = 63,
EQUIP_ITEM_REPUTATION_NOT_ENOUGH = 64,
EQUIP_MORE_THAN1_SPECIAL_BAG = 65
};
enum BuyFailure
{
BUY_ERR_CANT_FIND_ITEM = 0,
BUY_ERR_ITEM_ALREADY_SOLD = 1,
BUY_ERR_NOT_ENOUGHT_MONEY = 2,
BUY_ERR_SELLER_DONT_LIKE_YOU = 4,
BUY_ERR_DISTANCE_TOO_FAR = 5,
BUY_ERR_CANT_CARRY_MORE = 8,
BUY_ERR_LEVEL_REQUIRE = 11,
BUY_ERR_REPUTATION_REQUIRE = 12
};
enum SellFailure
{
SELL_ERR_CANT_FIND_ITEM = 1,
SELL_ERR_CANT_SELL_ITEM = 2,
SELL_ERR_CANT_FIND_VENDOR = 3
};
class Item : public Object
{
public:
Item();
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;
}*/
private:
uint8 _slot;
// Bag *_bag; // not yet implemented
// ItemProto *_proto; // not yet implemented.
// is it good to use a proto here?
};
#endif

View File

@ -17,6 +17,23 @@ Object::~Object()
if(_uint32values) if(_uint32values)
delete [] _uint32values; delete [] _uint32values;
} }
void Object::_InitValues()
{
_uint32values = new uint32[ _valuescount ];
memset(_uint32values, 0, _valuescount*sizeof(uint32));
}
void Object::_Create( uint64 guid )
{
if(!_uint32values)
_InitValues();
SetUInt32Value( OBJECT_FIELD_GUID, GUID_LOPART(guid) );
SetUInt32Value( OBJECT_FIELD_GUID+1, GUID_HIPART(guid) );
SetUInt32Value( OBJECT_FIELD_TYPE, _type );
}
WorldObject::WorldObject() WorldObject::WorldObject()
{ {
@ -31,4 +48,5 @@ void WorldObject::SetPosition(float x, float y, float z, float o, uint16 _map)
_z = z; _z = z;
_o = o; _o = o;
_m = _map; _m = _map;
} }

View File

@ -65,14 +65,20 @@ public:
{ {
_floatvalues[ index ] = value; _floatvalues[ index ] = value;
} }
inline void SetUInt32Value( uint16 index, float value )
{
_uint32values[ index ] = value;
}
protected: protected:
~Object(); ~Object();
void _Create(uint64 guid);
void _InitValues(void);
uint16 _valuescount; uint16 _valuescount;
union union
{ {
uint8 *_uint32values; uint32 *_uint32values;
float *_floatvalues; float *_floatvalues;
}; };
uint8 _type; uint8 _type;
@ -88,7 +94,6 @@ public:
inline float GetY(void) { return _y; } inline float GetY(void) { return _y; }
inline float GetZ(void) { return _z; } inline float GetZ(void) { return _z; }
inline float GetO(void) { return _o; } inline float GetO(void) { return _o; }
protected: protected:
float _x,_y,_z,_o; // coords, orientation float _x,_y,_z,_o; // coords, orientation
uint16 _m; // map uint16 _m; // map

View File

@ -159,6 +159,9 @@
<File <File
RelativePath=".\Client\DefScriptInterface.cpp"> RelativePath=".\Client\DefScriptInterface.cpp">
</File> </File>
<File
RelativePath=".\Client\HelperDefs.h">
</File>
<File <File
RelativePath=".\Client\log.cpp"> RelativePath=".\Client\log.cpp">
</File> </File>
@ -266,6 +269,12 @@
<File <File
RelativePath=".\Client\World\CMSGConstructor.cpp"> RelativePath=".\Client\World\CMSGConstructor.cpp">
</File> </File>
<File
RelativePath=".\Client\World\Item.cpp">
</File>
<File
RelativePath=".\Client\World\Item.h">
</File>
<File <File
RelativePath=".\Client\World\Object.cpp"> RelativePath=".\Client\World\Object.cpp">
</File> </File>

View File

@ -24,7 +24,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="dep/include" AdditionalIncludeDirectories="dep/include;Client"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -75,7 +75,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="3" Optimization="3"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="dep/include" AdditionalIncludeDirectories="dep/include;Client"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="2" RuntimeLibrary="2"

View File

@ -24,6 +24,7 @@
#include "SysDefs.h" #include "SysDefs.h"
#include "DebugStuff.h" #include "DebugStuff.h"
#include "HelperDefs.h"
#include "tools.h" #include "tools.h"
#endif #endif