Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/game/Object.h b/src/game/Object.h
- index 68f68be..6e2bff7 100644
- --- a/src/game/Object.h
- +++ b/src/game/Object.h
- @@ -356,6 +356,9 @@ class MANGOS_DLL_SPEC Object
- virtual bool HasQuest(uint32 /* quest_id */) const { return false; }
- virtual bool HasInvolvedQuest(uint32 /* quest_id */) const { return false; }
- +
- + //BountyHunter
- + Player* ToPlayer(){ if (GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Player*>(this); else return NULL; }
- protected:
- Object ( );
- diff --git a/src/game/Player.cpp b/src/game/Player.cpp
- index a03d970..90e80af 100644
- --- a/src/game/Player.cpp
- +++ b/src/game/Player.cpp
- @@ -1950,6 +1950,121 @@ void Player::RemoveFromWorld()
- Unit::RemoveFromWorld();
- }
- +//BountyHunter
- +void Player::SendBountyKill(Player *killer, Player *bounty)
- +{
- + if(killer->GetObjectGuid() == bounty->GetObjectGuid())
- + return;
- +
- + QueryResult *result = CharacterDatabase.PQuery("SELECT * FROM bounties WHERE guid='%u'", bounty->GetObjectGuid());
- +
- + if(!result)
- + return;
- +
- + Field * fields = result->Fetch();
- + switch(fields[2].GetUInt64())
- + { //TODO BountyHunter prices
- + case 1:
- + killer->SetMoney(killer->GetMoney() + (10 * 10000));
- + break;
- + case 2:
- + killer->SetMoney(killer->GetMoney() + (20 * 10000));
- + break;
- + case 3:
- + killer->SetMoney(killer->GetMoney() + (30 * 10000));
- + break;
- + case 4:
- + killer->SetMoney(killer->GetMoney() + (40 * 10000));
- + break;
- + }
- +
- + CharacterDatabase.PExecute("DELETE FROM bounties WHERE guid='%u'", bounty->GetObjectGuid());
- + alertServer(bounty->GetName(), 2);
- +}
- +
- +bool Player::passChecks(Player * pPlayer, const char * name)
- +{
- + Player * pBounty = sObjectAccessor.FindPlayerByName(name);
- + WorldSession * m_session = pPlayer->GetSession();
- +
- + if(!pBounty)
- + {
- + m_session->SendNotification("The player is offline or doesn't exist!");
- + return false;
- + }
- +
- + QueryResult *result = CharacterDatabase.PQuery("SELECT * FROM bounties WHERE guid ='%u'", pBounty->GetObjectGuid());
- +
- + if(result)
- + {
- + m_session->SendNotification("This player already has a bounty on them!");
- + return false;
- + }
- +
- + if(pPlayer->GetObjectGuid() == pBounty->GetObjectGuid())
- + {
- + m_session->SendNotification("You cannot set a bounty on yourself!");
- + return false;
- + }
- + return true;
- +}
- +
- +void Player::alertServer(const char * name, int msg)
- +{
- + std::string message;
- + if(msg == 1)
- + {
- + message = "A bounty has been placed on ";
- + message += name;
- + message += ". Kill them immediately to collect the reward!";
- + }
- + else if(msg == 2)
- + {
- + message = "The bounty on ";
- + message += name;
- + message += " has been collected!";
- + }
- + sWorld.SendServerMessage(SERVER_MSG_RESTART_TIME, message.c_str(), 0);
- +}
- +
- +bool Player::hasGold(Player * Player, uint32 required)
- +{
- + uint32 currentmoney = Player->GetMoney();
- + uint32 requiredmoney = (required * 10000);
- + if(currentmoney < requiredmoney)
- + {
- + WorldSession *m_session = Player->GetSession();
- + m_session->SendNotification("You don't have enough gold!");
- + return false;
- + }
- + Player->SetMoney(currentmoney - requiredmoney);
- + return true;
- +}
- +
- +void Player::flagPlayer(const char * name, int number)
- +{
- + Player * pBounty = sObjectAccessor.FindPlayerByName(name);
- + pBounty->SetPvP(true);
- + pBounty->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
- +
- + if(number == 1)
- + {
- + CharacterDatabase.PExecute("INSERT INTO bounties VALUES('%u', '20', '1')", pBounty->GetObjectGuid());
- + }
- + if(number == 2)
- + {
- + CharacterDatabase.PExecute("INSERT INTO bounties VALUES('%u', '40', '2')", pBounty->GetObjectGuid());
- + }
- + if(number == 3)
- + {
- + CharacterDatabase.PExecute("INSERT INTO bounties VALUES('%u', '100', '3')", pBounty->GetObjectGuid());
- + }
- + if(number == 4)
- + {
- + CharacterDatabase.PExecute("INSERT INTO bounties VALUES('%u', '200', '4')", pBounty->GetObjectGuid());
- + }
- +}
- +
- void Player::RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attacker )
- {
- float addRage;
- diff --git a/src/game/Player.h b/src/game/Player.h
- index d4ad9b2..f4e5f99 100644
- --- a/src/game/Player.h
- +++ b/src/game/Player.h
- @@ -1022,6 +1022,13 @@ class MANGOS_DLL_SPEC Player : public Unit
- void AddToWorld();
- void RemoveFromWorld();
- + //BountyHunter
- + void SendBountyKill(Player *killer, Player *bounty);
- + void alertServer(const char * name, int msg);
- + void flagPlayer(const char * name, int number);
- + bool hasGold(Player * Player, uint32 required);
- + bool passChecks(Player *pPlayer, const char * name);
- +
- bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0);
- bool TeleportTo(WorldLocation const &loc, uint32 options = 0)
- diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
- index 71e5685..bf3e23d 100644
- --- a/src/game/Unit.cpp
- +++ b/src/game/Unit.cpp
- @@ -672,6 +672,15 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
- {
- DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"DealDamage: victim just died");
- + //BountHunter
- + if (pVictim->GetTypeId() == TYPEID_PLAYER && this->GetTypeId() == TYPEID_PLAYER)
- + {
- + Player *killer = ToPlayer();
- + Player *bounty = pVictim->ToPlayer();
- +
- + killer->SendBountyKill(killer, bounty);
- + }
- +
- // find player: owner of controlled `this` or `this` itself maybe
- // for loot will be sued only if group_tap==NULL
- Player *player_tap = GetCharmerOrOwnerPlayerOrPlayerItself();
- diff --git a/src/game/Unit.h b/src/game/Unit.h
- index 7e742e8..9cf977a 100644
- --- a/src/game/Unit.h
- +++ b/src/game/Unit.h
- @@ -1097,7 +1097,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
- {
- return m_floatValues[UNIT_FIELD_BOUNDINGRADIUS];
- }
- -
- +
- DiminishingLevels GetDiminishing(DiminishingGroup group);
- void IncrDiminishing(DiminishingGroup group);
- void ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster, DiminishingLevels Level, int32 limitduration, bool isReflected);
- diff --git a/src/game/World.cpp b/src/game/World.cpp
- index 5eb6e03..9825125 100644
- --- a/src/game/World.cpp
- +++ b/src/game/World.cpp
- @@ -1290,7 +1290,7 @@ void World::SetInitialWorldSettings()
- sLog.outString( "Loading CreatureEventAI Scripts...");
- sEventAIMgr.LoadCreatureEventAI_Scripts();
- -
- +
- sLog.outString("Initializing Scripts...");
- switch(sScriptMgr.LoadScriptLibrary(MANGOS_SCRIPT_NAME))
- {
- @@ -1432,7 +1432,6 @@ void World::DetectDBCLang()
- sLog.outString("Using %s DBC Locale as default. All available DBC locales: %s",localeNames[m_defaultDbcLocale],availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str());
- sLog.outString();
- }
- -
- /// Update the World !
- void World::Update(uint32 diff)
- {
- @@ -1565,7 +1564,7 @@ void World::Update(uint32 diff)
- sTerrainMgr.Update(diff);
- }
- -/// Send a packet to all players (except self if mentioned)
- +// Send a packet to all players (except self if mentioned)
- void World::SendGlobalMessage(WorldPacket *packet, WorldSession *self, uint32 team)
- {
- SessionMap::const_iterator itr;
- diff --git a/src/game/World.h b/src/game/World.h
- index 840cf12..17fe997 100644
- --- a/src/game/World.h
- +++ b/src/game/World.h
- @@ -450,7 +450,7 @@ class World
- uint32 GetMaxQueuedSessionCount() const { return m_maxQueuedSessionCount; }
- uint32 GetMaxActiveSessionCount() const { return m_maxActiveSessionCount; }
- Player* FindPlayerInZone(uint32 zone);
- -
- +
- Weather* FindWeather(uint32 id) const;
- Weather* AddWeather(uint32 zone_id);
- void RemoveWeather(uint32 zone_id);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement