* added script to support /me-like emotes (scriptname is "me")
* changed the permission system: now a script cant be used as game command f no permission is explicitly set
* implemented threadsafe CLI queue to solve crashes with short-intervalled events that ran on 2 threads
* fixed name return at "getitemprotovalue" script
* iplemented DrawObject class and a Mgr for those objects; they will ease object drawing once implemented. the Mgr works under control of the GUI thread and is threadsafe.
* implemented auto-loading of SCP files if a name-tag is present somewhere in the file ("#dbname=...") and no explicit db name was passed to "loadscp" script.
* changed internal ObjMgr storage to std::map (instead of list) for faster access
* fixed call of "_enterworld" script
* fixed handling of MyCharacter(), which could cause crashes after newly changes
* fixed GetFileList() func in tools.cpp (this fixes also related "lgetfiles" script func). now it will only parse files, not directories. might still need some fixing for linux.
67 lines
1.4 KiB
C++
67 lines
1.4 KiB
C++
#include <vector>
|
|
#include <fstream>
|
|
#include "common.h"
|
|
#include "PseuWoW.h"
|
|
#include "Opcodes.h"
|
|
#include "SharedDefines.h"
|
|
#include "Player.h"
|
|
#include "DefScript/DefScript.h"
|
|
#include "WorldSession.h"
|
|
|
|
|
|
Player::Player() : Unit()
|
|
{
|
|
_type = TYPE_PLAYER;
|
|
_typeid = TYPEID_PLAYER;
|
|
_valuescount = PLAYER_END;
|
|
}
|
|
|
|
void Player::Create(uint64 guid)
|
|
{
|
|
Object::Create(guid);
|
|
}
|
|
|
|
MyCharacter::MyCharacter() : Player()
|
|
{
|
|
DEBUG(logdebug("MyCharacter() constructor, this=0x%x",this));
|
|
SetTarget(0);
|
|
}
|
|
|
|
MyCharacter::~MyCharacter()
|
|
{
|
|
DEBUG(logdebug("~MyCharacter() destructor, this=0x%X guid="I64FMT,this,GetGUID())); // this _could_ crash if Player::Create(guid) wasnt called before!
|
|
}
|
|
|
|
void MyCharacter::SetActionButtons(WorldPacket &data)
|
|
{
|
|
|
|
}
|
|
|
|
void MyCharacter::AddSpell(uint32 spellid, uint16 spellslot)
|
|
{
|
|
SpellBookEntry _spell;
|
|
_spell.id = spellid;
|
|
_spell.slot = spellslot;
|
|
|
|
_spells.push_back(_spell);
|
|
}
|
|
|
|
void MyCharacter::RemoveSpell(uint32 spellid)
|
|
{
|
|
for(std::vector<SpellBookEntry>::iterator i=_spells.begin(); i != _spells.end(); i++)
|
|
if(i->id == spellid)
|
|
{
|
|
_spells.erase(i);
|
|
break;
|
|
}
|
|
}
|
|
|
|
uint16 MyCharacter::GetSpellSlot(uint32 spellid)
|
|
{
|
|
for(std::vector<SpellBookEntry>::iterator i=_spells.begin(); i != _spells.end(); i++)
|
|
if(i->id == spellid)
|
|
return i->slot;
|
|
return 0;
|
|
}
|
|
|
|
|