Core/DB: Fix character creation in Player::SaveToDB.

And some misc comments/whitespaces
This commit is contained in:
kaelima
2011-11-26 01:53:44 +01:00
parent 754f6f29ac
commit a919265623
8 changed files with 16 additions and 15 deletions
+2 -2
View File
@@ -616,8 +616,8 @@ bool AuthSocket::_HandleLogonProof()
memcpy(proof.M2, sha.GetDigest(), 20); memcpy(proof.M2, sha.GetDigest(), 20);
proof.cmd = AUTH_LOGON_PROOF; proof.cmd = AUTH_LOGON_PROOF;
proof.error = 0; proof.error = 0;
proof.unk1 = 0x00800000; proof.unk1 = 0x00800000; // Accountflags. 0x01 = GM, 0x08 = Trial, 0x00800000 = Pro pass (arena tournament)
proof.unk2 = 0x00; proof.unk2 = 0x00; // SurveyId
proof.unk3 = 0x00; proof.unk3 = 0x00;
socket().send((char *)&proof, sizeof(proof)); socket().send((char *)&proof, sizeof(proof));
} }
@@ -68,10 +68,12 @@ void SmartWaypointMgr::LoadFromDB()
path = new WPPath; path = new WPPath;
last_id = 1; last_id = 1;
} }
if (last_id != id) if (last_id != id)
{ {
sLog->outErrorDb("SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id); sLog->outErrorDb("SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);
} }
last_id++; last_id++;
(*path)[id] = wp; (*path)[id] = wp;
+1 -1
View File
@@ -280,7 +280,6 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
uint8 spellFlags = itr->second.flags; uint8 spellFlags = itr->second.flags;
if (unit) if (unit)
{ {
if ((spellFlags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) || if ((spellFlags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) ||
(unit->GetTypeId() == TYPEID_UNIT && ((unit->ToCreature()->isPet() && spellFlags & SPELL_DISABLE_PET) || spellFlags & SPELL_DISABLE_CREATURE))) (unit->GetTypeId() == TYPEID_UNIT && ((unit->ToCreature()->isPet() && spellFlags & SPELL_DISABLE_PET) || spellFlags & SPELL_DISABLE_CREATURE)))
{ {
@@ -311,6 +310,7 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
} }
else if (spellFlags & SPELL_DISABLE_DEPRECATED_SPELL) // call not from spellcast else if (spellFlags & SPELL_DISABLE_DEPRECATED_SPELL) // call not from spellcast
return true; return true;
break; break;
} }
case DISABLE_TYPE_MAP: case DISABLE_TYPE_MAP:
+2 -6
View File
@@ -3088,7 +3088,8 @@ void Player::GiveLevel(uint8 level)
// Refer-A-Friend // Refer-A-Friend
if (GetSession()->GetRecruiterId()) if (GetSession()->GetRecruiterId())
if (level < sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL)) if (level < sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL))
if (level % 2 == 0) { if (level % 2 == 0)
{
++m_grantableLevels; ++m_grantableLevels;
if (!HasByteFlag(PLAYER_FIELD_BYTES, 1, 0x01)) if (!HasByteFlag(PLAYER_FIELD_BYTES, 1, 0x01))
@@ -18353,9 +18354,7 @@ void Player::SaveToDB(bool create /*=false*/)
// cache equipment... // cache equipment...
for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i) for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i)
ss << GetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + i) << ' '; ss << GetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + i) << ' ';
stmt->setString(index++, ss.str());
ss.str().clear();
// ...and bags for enum opcode // ...and bags for enum opcode
for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
{ {
@@ -18466,9 +18465,7 @@ void Player::SaveToDB(bool create /*=false*/)
// cache equipment... // cache equipment...
for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i) for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i)
ss << GetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + i) << ' '; ss << GetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + i) << ' ';
stmt->setString(index++, ss.str());
ss.str().clear();
// ...and bags for enum opcode // ...and bags for enum opcode
for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
{ {
@@ -22917,7 +22914,6 @@ bool Player::CanCaptureTowerPoint()
} }
uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const* newSkin) uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const* newSkin)
{ {
uint8 level = getLevel(); uint8 level = getLevel();
+2 -1
View File
@@ -774,7 +774,7 @@ enum PlayerChatTag
CHAT_TAG_AFK = 0x01, CHAT_TAG_AFK = 0x01,
CHAT_TAG_DND = 0x02, CHAT_TAG_DND = 0x02,
CHAT_TAG_GM = 0x04, CHAT_TAG_GM = 0x04,
CHAT_TAG_UNK = 0x08, // Probably battleground commentator CHAT_TAG_COM = 0x08, // Commentator
CHAT_TAG_DEV = 0x10, CHAT_TAG_DEV = 0x10,
}; };
@@ -2301,6 +2301,7 @@ class Player : public Unit, public GridObject<Player>
m_mover = target; m_mover = target;
m_mover->m_movedPlayer = this; m_mover->m_movedPlayer = this;
} }
void SetSeer(WorldObject* target) { m_seer = target; } void SetSeer(WorldObject* target) { m_seer = target; }
void SetViewpoint(WorldObject* target, bool apply); void SetViewpoint(WorldObject* target, bool apply);
WorldObject* GetViewpoint() const; WorldObject* GetViewpoint() const;
@@ -130,7 +130,7 @@ void PlayerSocial::SendSocialList(Player* player)
sSocialMgr->GetFriendInfo(player, itr->first, itr->second); sSocialMgr->GetFriendInfo(player, itr->first, itr->second);
data << uint64(itr->first); // player guid data << uint64(itr->first); // player guid
data << uint32(itr->second.Flags); // player flag (0x1-friend?, 0x2-ignored?, 0x4-muted?) data << uint32(itr->second.Flags); // player flag (0x1 = Friend, 0x2 = Ignored, 0x4 = Muted)
data << itr->second.Note; // string note data << itr->second.Note; // string note
if (itr->second.Flags & SOCIAL_FLAG_FRIEND) // if IsFriend() if (itr->second.Flags & SOCIAL_FLAG_FRIEND) // if IsFriend()
{ {
@@ -212,6 +212,7 @@ void ObjectAccessor::RemoveCorpse(Corpse* corpse)
} }
} }
else else
corpse->RemoveFromWorld(); corpse->RemoveFromWorld();
// Critical section // Critical section
@@ -292,6 +293,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia
// remove corpse from player_guid -> corpse map and from current map // remove corpse from player_guid -> corpse map and from current map
RemoveCorpse(corpse); RemoveCorpse(corpse);
// remove corpse from DB // remove corpse from DB
SQLTransaction trans = CharacterDatabase.BeginTransaction(); SQLTransaction trans = CharacterDatabase.BeginTransaction();
corpse->DeleteFromDB(trans); corpse->DeleteFromDB(trans);