Started with MyCharacter class, added handling of spells opcode, more to come.
This commit is contained in:
parent
06942daea6
commit
17e6692007
@ -22,28 +22,42 @@ void Player::Create(uint64 guid)
|
|||||||
Object::Create(guid);
|
Object::Create(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MyCharacter::MyCharacter()
|
||||||
/*void PlayerSettings::SetSpells(WorldPacket &data)
|
|
||||||
{
|
{
|
||||||
if (!init)
|
_castingSpell = false;
|
||||||
return;
|
|
||||||
|
|
||||||
uint8 unk;
|
|
||||||
uint16 numSpells;
|
|
||||||
|
|
||||||
data >> unk >> numSpells;
|
|
||||||
|
|
||||||
logdetail("Got %d spells", numSpells);
|
|
||||||
|
|
||||||
// TODO: Finish implenting this
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerSettings::CastSpell(uint32 spellId, uint64 target)
|
void MyCharacter::SetActionButtons(WorldPacket &data)
|
||||||
{
|
{
|
||||||
if (castingSpell || !init)
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCharacter::SetSpells(WorldPacket &data)
|
||||||
|
{
|
||||||
|
uint8 unk;
|
||||||
|
uint16 spellid,spellslot,count;
|
||||||
|
data >> unk >> count;
|
||||||
|
logdebug("Got initial spells list, %u spells.",count);
|
||||||
|
for(uint16 i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
data >> spellid >> spellslot;
|
||||||
|
logdebug("Initial Spell: id=%u slot=%u",spellid,spellslot);
|
||||||
|
|
||||||
|
spell _spell;
|
||||||
|
_spell.spellId = spellid;
|
||||||
|
_spell.spellSlot = spellslot;
|
||||||
|
|
||||||
|
_spells.push_back(_spell);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCharacter::CastSpell(uint32 spellId, uint64 target)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
if (_castingSpell)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
castingSpell = !castingSpell;
|
_castingSpell = !_castingSpell;
|
||||||
|
|
||||||
WorldPacket packet;
|
WorldPacket packet;
|
||||||
packet.SetOpcode(CMSG_CAST_SPELL);
|
packet.SetOpcode(CMSG_CAST_SPELL);
|
||||||
@ -52,13 +66,12 @@ void PlayerSettings::CastSpell(uint32 spellId, uint64 target)
|
|||||||
// Damn packed guid stuff! xD
|
// Damn packed guid stuff! xD
|
||||||
|
|
||||||
_worldSession->SendWorldPacket(packet);
|
_worldSession->SendWorldPacket(packet);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerSettings::HandleCastResultOpcode(WorldPacket &packet)
|
void MyCharacter::HandleCastResultOpcode(WorldPacket &packet)
|
||||||
{
|
{
|
||||||
if (!init)
|
/*
|
||||||
return;
|
|
||||||
|
|
||||||
uint32 spellId;
|
uint32 spellId;
|
||||||
uint8 statusFail;
|
uint8 statusFail;
|
||||||
uint8 failProblem;
|
uint8 failProblem;
|
||||||
@ -66,7 +79,7 @@ void PlayerSettings::HandleCastResultOpcode(WorldPacket &packet)
|
|||||||
|
|
||||||
packet >> spellId >> statusFail;
|
packet >> spellId >> statusFail;
|
||||||
|
|
||||||
castingSpell = false;
|
_castingSpell = false;
|
||||||
|
|
||||||
sprintf(l, "Received cast result opcode. Spell = %d, statusFail = %d", spellId, statusFail);
|
sprintf(l, "Received cast result opcode. Spell = %d, statusFail = %d", spellId, statusFail);
|
||||||
|
|
||||||
@ -78,4 +91,5 @@ void PlayerSettings::HandleCastResultOpcode(WorldPacket &packet)
|
|||||||
|
|
||||||
|
|
||||||
//logdetail(l);
|
//logdetail(l);
|
||||||
}*/
|
*/
|
||||||
|
}
|
||||||
@ -195,13 +195,21 @@ class MyCharacter : public Player
|
|||||||
public:
|
public:
|
||||||
MyCharacter();
|
MyCharacter();
|
||||||
|
|
||||||
/*void SetActionButtons(WorldPacket &data);
|
void SetActionButtons(WorldPacket &data);
|
||||||
void SetSpells(WorldPacket &data);
|
void SetSpells(WorldPacket &data);
|
||||||
void CastSpell(uint32 spellId, uint64 target);
|
void CastSpell(uint32 spellId, uint64 target);
|
||||||
void HandleCastResultOpcode(WorldPacket &packet);*/
|
void HandleCastResultOpcode(WorldPacket &packet);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool _castingSpell;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint16 spellId;
|
||||||
|
uint16 spellSlot;
|
||||||
|
} spell;
|
||||||
|
|
||||||
|
std::vector<spell> _spells;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@ WorldSession::WorldSession(PseuInstance *in)
|
|||||||
_myGUID=0; // i dont have a guid yet
|
_myGUID=0; // i dont have a guid yet
|
||||||
plrNameCache.ReadFromFile(); // load names/guids of known players
|
plrNameCache.ReadFromFile(); // load names/guids of known players
|
||||||
ItemProtoCache_InsertDataToSession(this);
|
ItemProtoCache_InsertDataToSession(this);
|
||||||
|
myCharacter = new MyCharacter();
|
||||||
_deleteme = false;
|
_deleteme = false;
|
||||||
_channels = new Channel(this);
|
_channels = new Channel(this);
|
||||||
// _playerSettings->Init(this);
|
// _playerSettings->Init(this);
|
||||||
@ -636,15 +637,6 @@ void WorldSession::_HandleCastResultOpcode(WorldPacket& recvPacket)
|
|||||||
|
|
||||||
void WorldSession::_HandleInitialSpellsOpcode(WorldPacket& recvPacket)
|
void WorldSession::_HandleInitialSpellsOpcode(WorldPacket& recvPacket)
|
||||||
{
|
{
|
||||||
uint8 unk;
|
myCharacter->SetSpells(recvPacket);
|
||||||
uint16 spellid,spellslot,count;
|
|
||||||
recvPacket >> unk >> count;
|
|
||||||
logdebug("Got initial spells list, %u spells.",count);
|
|
||||||
for(uint16 i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
recvPacket >> spellid >> spellslot;
|
|
||||||
logdebug("Initial Spell: id=%u slot=%u",spellid,spellslot);
|
|
||||||
// these data need to be added to MyCharacter later
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -63,6 +63,7 @@ public:
|
|||||||
void SendSetSelection(uint64);
|
void SendSetSelection(uint64);
|
||||||
|
|
||||||
PlayerNameCache plrNameCache;
|
PlayerNameCache plrNameCache;
|
||||||
|
MyCharacter *myCharacter;
|
||||||
ObjMgr objmgr;
|
ObjMgr objmgr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user