*Update to Trinity 843.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-01-12 11:02:18 -06:00
37 changed files with 1492 additions and 142 deletions
+1
View File
@@ -1638,6 +1638,7 @@ void Creature::setDeathState(DeathState s)
{
SetUInt64Value (UNIT_FIELD_TARGET,0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
SetUInt32Value(UNIT_NPC_FLAGS, 0);
setActive(false);
if(!isPet() && GetCreatureInfo()->SkinLootId)
if ( LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId) )
+7 -1
View File
@@ -862,6 +862,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
missingItem = at->requiredItem2;
uint32 missingKey = 0;
uint32 missingHeroicQuest = 0;
if(GetPlayer()->GetDifficulty() == DIFFICULTY_HEROIC)
{
if(at->heroicKey)
@@ -872,19 +873,24 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
}
else if(at->heroicKey2 && !GetPlayer()->HasItemCount(at->heroicKey2, 1))
missingKey = at->heroicKey2;
if(at->heroicQuest && !GetPlayer()->GetQuestRewardStatus(at->heroicQuest))
missingHeroicQuest = at->heroicQuest;
}
uint32 missingQuest = 0;
if(at->requiredQuest && !GetPlayer()->GetQuestRewardStatus(at->requiredQuest))
missingQuest = at->requiredQuest;
if(missingLevel || missingItem || missingKey || missingQuest)
if(missingLevel || missingItem || missingKey || missingQuest || missingHeroicQuest)
{
// TODO: all this is probably wrong
if(missingItem)
SendAreaTriggerMessage(GetTrinityString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, objmgr.GetItemPrototype(missingItem)->Name1);
else if(missingKey)
GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, DIFFICULTY_HEROIC);
else if(missingHeroicQuest)
SendAreaTriggerMessage(at->heroicQuestFailedText.c_str());
else if(missingQuest)
SendAreaTriggerMessage(at->requiredFailedText.c_str());
else if(missingLevel)
+1 -1
View File
@@ -1649,7 +1649,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y,
UpdateGroundPositionZ(x,y,z);
}
void WorldObject::GetClosePointAt(float &x, float &y, float &z, float dist, float angle)
void WorldObject::GetGroundPoint(float &x, float &y, float &z, float dist, float angle)
{
angle += GetOrientation();
x += dist * cos(angle);
+3 -3
View File
@@ -395,11 +395,11 @@ class TRINITY_DLL_SPEC WorldObject : public Object
// angle calculated from current orientation
GetNearPoint(NULL,x,y,z,size,distance2d,GetOrientation() + angle);
}
void GetClosePointAt(float &x, float &y, float &z, float dist, float angle);
void GetClosePoint(float &x, float &y, float &z, float dist, float angle)
void GetGroundPoint(float &x, float &y, float &z, float dist, float angle);
void GetGroundPointAroundUnit(float &x, float &y, float &z, float dist, float angle)
{
GetPosition(x, y, z);
GetClosePointAt(x, y, z, dist, angle);
GetGroundPoint(x, y, z, dist, angle);
}
void GetContactPoint( const WorldObject* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const
{
+26 -15
View File
@@ -5179,9 +5179,9 @@ void ObjectMgr::LoadAreaTriggerTeleports()
uint32 count = 0;
// 0 1 2 3 4 5 6 7 8 9 10 11 12
QueryResult *result = WorldDatabase.Query("SELECT id, required_level, required_item, required_item2, heroic_key, heroic_key2, required_quest_done, required_failed_text, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
if( !result )
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13
QueryResult *result = WorldDatabase.Query("SELECT id, required_level, required_item, required_item2, heroic_key, heroic_key2, heroic_required_quest_done, heroic_required_failed_quest_text, required_quest_done, required_failed_text, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
if( !result )
{
barGoLink bar( 1 );
@@ -5207,18 +5207,20 @@ void ObjectMgr::LoadAreaTriggerTeleports()
AreaTrigger at;
at.requiredLevel = fields[1].GetUInt8();
at.requiredItem = fields[2].GetUInt32();
at.requiredItem2 = fields[3].GetUInt32();
at.heroicKey = fields[4].GetUInt32();
at.heroicKey2 = fields[5].GetUInt32();
at.requiredQuest = fields[6].GetUInt32();
at.requiredFailedText = fields[7].GetCppString();
at.target_mapId = fields[8].GetUInt32();
at.target_X = fields[9].GetFloat();
at.target_Y = fields[10].GetFloat();
at.target_Z = fields[11].GetFloat();
at.target_Orientation = fields[12].GetFloat();
at.requiredLevel = fields[1].GetUInt8();
at.requiredItem = fields[2].GetUInt32();
at.requiredItem2 = fields[3].GetUInt32();
at.heroicKey = fields[4].GetUInt32();
at.heroicKey2 = fields[5].GetUInt32();
at.heroicQuest = fields[6].GetUInt32();
at.heroicQuestFailedText = fields[7].GetCppString();
at.requiredQuest = fields[8].GetUInt32();
at.requiredFailedText = fields[9].GetCppString();
at.target_mapId = fields[10].GetUInt32();
at.target_X = fields[11].GetFloat();
at.target_Y = fields[12].GetFloat();
at.target_Z = fields[13].GetFloat();
at.target_Orientation = fields[14].GetFloat();
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
if(!atEntry)
@@ -5266,6 +5268,15 @@ void ObjectMgr::LoadAreaTriggerTeleports()
}
}
if(at.heroicQuest)
{
if(!mQuestTemplates[at.heroicQuest])
{
sLog.outErrorDb("Required Heroic Quest %u not exist for trigger %u, remove heroic quest done requirement.",at.heroicQuest,Trigger_ID);
at.heroicQuest = 0;
}
}
if(at.requiredQuest)
{
if(!mQuestTemplates[at.requiredQuest])
+2
View File
@@ -107,6 +107,8 @@ struct AreaTrigger
uint32 requiredItem2;
uint32 heroicKey;
uint32 heroicKey2;
uint32 heroicQuest;
std::string heroicQuestFailedText;
uint32 requiredQuest;
std::string requiredFailedText;
uint32 target_mapId;
+3 -3
View File
@@ -1857,7 +1857,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
default: angle = rand_norm()*2*M_PI; break;
}
m_caster->GetClosePoint(x, y, z, dist, angle);
m_caster->GetGroundPointAroundUnit(x, y, z, dist, angle);
m_targets.setDestination(x, y, z); // do not know if has ground visual
}break;
@@ -1903,7 +1903,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
default: angle = rand_norm()*2*M_PI; break;
}
target->GetClosePoint(x, y, z, dist, angle);
target->GetGroundPointAroundUnit(x, y, z, dist, angle);
m_targets.setDestination(x, y, z); // do not know if has ground visual
}break;
@@ -1940,7 +1940,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
x = m_targets.m_destX;
y = m_targets.m_destY;
z = m_targets.m_destZ;
m_caster->GetClosePointAt(x, y, z, dist, angle);
m_caster->GetGroundPoint(x, y, z, dist, angle);
m_targets.setDestination(x, y, z); // do not know if has ground visual
}break;
+3 -4
View File
@@ -690,11 +690,10 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
}
}
if(m_originalCaster)
damage = m_originalCaster->SpellDamageBonus(unitTarget, m_spellInfo, damage, SPELL_DIRECT_DAMAGE);
if(m_originalCaster && damage > 0)
damage = m_originalCaster->SpellDamageBonus(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE);
if(damage > 0)
m_damage += damage;
m_damage += damage;
}
}
+1
View File
@@ -1284,6 +1284,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool
if(!spellInfo_1->SpellFamilyName)
{
if(!spellInfo_1->SpellIconID
|| spellInfo_1->SpellIconID == 1
|| spellInfo_1->SpellIconID != spellInfo_2->SpellIconID)
return false;
}
+9 -2
View File
@@ -36,6 +36,8 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
// always do a packet check
CHECK_PACKET_SIZE(recv_data, 4*4+1+2*4);
uint32 map;
float x, y, z;
std::string ticketText = "";
std::string ticketText2 = "";
GM_Ticket *ticket = new GM_Ticket;
@@ -43,7 +45,12 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
WorldPacket data(SMSG_GMTICKET_CREATE, 4);
// recv Data
recv_data >> ticketText;
//TODO: Add map coordinates to tickets.
recv_data >> map;
recv_data >> x;
recv_data >> y;
recv_data >> z;
recv_data >> ticketText;
// get additional data, rarely used
recv_data >> ticketText2;
@@ -180,4 +187,4 @@ void WorldSession::HandleGMTicketSystemStatusOpcode( WorldPacket & /*recv_data*/
// Send Packet
SendPacket(&data);
}
}
+19 -14
View File
@@ -108,11 +108,12 @@ void TicketMgr::DeleteGMTicketPermanently(uint64 ticketGuid)
void TicketMgr::LoadGMTickets()
{
InitTicketID();
// Delete all out of object holder
GM_TicketList.clear();
QueryResult *result = CharacterDatabase.Query( "SELECT `guid`, `playerGuid`, `name`, `message`, `timestamp`, `closed`, `assignedto`, `comment` FROM `gm_tickets` WHERE `closed` = '0'" );
GM_Ticket *ticket;
if(!result)
return;
@@ -168,18 +169,19 @@ void TicketMgr::RemoveGMTicketByPlayer(uint64 playerGuid, uint64 GMguid)
void TicketMgr::SaveGMTicket(GM_Ticket* ticket)
{
std::string msg = ticket->message;
CharacterDatabase.escape_string(msg);
std::stringstream ss;
ss << "REPLACE INTO `gm_tickets` (`guid`, `playerGuid`, `name`, `message`, `timestamp`, `closed`, `assignedto`, `comment`) VALUES(\"";
ss << ticket->guid << "\", \"";
ss << ticket->playerGuid << "\", \"";
ss << ticket->name << "\", \"";
ss << ticket->message << "\", \"" ;
ss << ticket->timestamp << "\", \"";
ss << ticket->closed << "\", \"";
ss << ticket->assignedToGM << "\", \"";
ss << ticket->comment << "\");";
CharacterDatabase.BeginTransaction();
ss << "REPLACE INTO `gm_tickets` (`guid`, `playerGuid`, `name`, `message`, `timestamp`, `closed`, `assignedto`, `comment`) VALUES('";
ss << ticket->guid << "', '";
ss << ticket->playerGuid << "', '";
ss << ticket->name << "', '";
ss << msg << "', '" ;
ss << ticket->timestamp << "', '";
ss << ticket->closed << "', '";
ss << ticket->assignedToGM << "', '";
ss << ticket->comment << "');";
CharacterDatabase.BeginTransaction();
CharacterDatabase.Execute(ss.str().c_str());
CharacterDatabase.CommitTransaction();
@@ -190,7 +192,7 @@ void TicketMgr::UpdateGMTicket(GM_Ticket *ticket)
SaveGMTicket(ticket);
}
uint64 TicketMgr::GenerateTicketID()
void TicketMgr::InitTicketID()
{
QueryResult *result = CharacterDatabase.Query("SELECT MAX(guid) FROM gm_tickets");
if(result)
@@ -198,6 +200,9 @@ uint64 TicketMgr::GenerateTicketID()
m_ticketid = result->Fetch()[0].GetUInt64() + 1;
delete result;
}
}
uint64 TicketMgr::GenerateTicketID()
{
return ++m_ticketid;
}
}
+1
View File
@@ -61,6 +61,7 @@ class TicketMgr
void SaveGMTicket(GM_Ticket* ticket);
uint64 GenerateTicketID();
void InitTicketID();
GM_Ticket* GetGMTicket(uint64 ticketGuid);
GM_Ticket* GetGMTicketByPlayer(uint64 playerGuid);
GM_Ticket* GetGMTicketByName(const char *name);