aboutsummaryrefslogtreecommitdiff
path: root/src/game/PetitionsHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/PetitionsHandler.cpp')
-rw-r--r--src/game/PetitionsHandler.cpp41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp
index 7ae368140c7..19457caa048 100644
--- a/src/game/PetitionsHandler.cpp
+++ b/src/game/PetitionsHandler.cpp
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
- * Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,7 +28,6 @@
#include "Opcodes.h"
#include "Guild.h"
#include "ArenaTeam.h"
-#include "MapManager.h"
#include "GossipDef.h"
#include "SocialMgr.h"
@@ -83,7 +82,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
sLog.outDebug("Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str());
// prevent cheating
- Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guidNPC,UNIT_NPC_FLAG_PETITIONER);
+ Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guidNPC,UNIT_NPC_FLAG_PETITIONER);
if (!pCreature)
{
sLog.outDebug("WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC));
@@ -92,7 +91,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
uint32 charterid = 0;
uint32 cost = 0;
@@ -199,9 +198,9 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
if(!charter)
return;
- charter->SetUInt32Value(ITEM_FIELD_ENCHANTMENT, charter->GetGUIDLow());
- // ITEM_FIELD_ENCHANTMENT is guild/arenateam id
- // ITEM_FIELD_ENCHANTMENT+1 is current signatures count (showed on item)
+ charter->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1, charter->GetGUIDLow());
+ // ITEM_FIELD_ENCHANTMENT_1_1 is guild/arenateam id
+ // ITEM_FIELD_ENCHANTMENT_1_1+1 is current signatures count (showed on item)
charter->SetState(ITEM_CHANGED, _player);
_player->SendNewItem(charter, 1, true, false);
@@ -255,7 +254,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
QueryResult *result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", petitionguid_low);
if(!result)
{
- sLog.outError("any petition on server...");
+ sLog.outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName());
return;
}
Field *fields = result->Fetch();
@@ -280,10 +279,10 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
data << petitionguid_low; // guild guid (in Trinity always same as GUID_LOPART(petitionguid)
data << signs; // sign's count
- for(uint8 i = 1; i <= signs; i++)
+ for(uint8 i = 1; i <= signs; ++i)
{
- Field *fields = result->Fetch();
- uint64 plguid = fields[0].GetUInt64();
+ Field *fields2 = result->Fetch();
+ uint64 plguid = fields2[0].GetUInt64();
data << plguid; // Player GUID
data << (uint32)0; // there 0 ...
@@ -463,7 +462,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
if(!result)
{
- sLog.outError("any petition on server...");
+ sLog.outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName());
return;
}
@@ -565,7 +564,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
// update signs count on charter, required testing...
//Item *item = _player->GetItemByGuid(petitionguid));
//if(item)
- // item->SetUInt32Value(ITEM_FIELD_ENCHANTMENT+1, signs);
+ // item->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1+1, signs);
// update for owner if online
if(Player *owner = objmgr.GetPlayer(ownerguid))
@@ -691,10 +690,10 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
data << GUID_LOPART(petitionguid); // guild guid (in Trinity always same as GUID_LOPART(petition guid)
data << signs; // sign's count
- for(uint8 i = 1; i <= signs; i++)
+ for(uint8 i = 1; i <= signs; ++i)
{
- Field *fields = result->Fetch();
- uint64 plguid = fields[0].GetUInt64();
+ Field *fields2 = result->Fetch();
+ plguid = fields2[0].GetUInt64();
data << plguid; // Player GUID
data << (uint32)0; // there 0 ...
@@ -827,7 +826,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
if(type == 9) // create guild
{
Guild* guild = new Guild;
- if(!guild->create(_player->GetGUID(), name))
+ if(!guild->create(_player, name))
{
delete guild;
delete result;
@@ -907,7 +906,7 @@ void WorldSession::HandlePetitionShowListOpcode(WorldPacket & recv_data)
void WorldSession::SendPetitionShowList(uint64 guid)
{
- Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_PETITIONER);
+ Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_PETITIONER);
if (!pCreature)
{
sLog.outDebug("WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
@@ -916,7 +915,7 @@ void WorldSession::SendPetitionShowList(uint64 guid)
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
uint8 count = 0;
if(pCreature->isTabardDesigner())
@@ -960,7 +959,7 @@ void WorldSession::SendPetitionShowList(uint64 guid)
data << uint32(5); // unknown
data << uint32(5); // required signs?
}
- //for(uint8 i = 0; i < count; i++)
+ //for(uint8 i = 0; i < count; ++i)
//{
// data << uint32(i); // index
// data << uint32(GUILD_CHARTER); // charter entry