HammeR | Дата: Неділя, 05.12.2010, 19:59 | Сообщение # 1 |
Рыцарь
Группа: Пользователи
|
Code diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 0bb942e..339b5a1 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -1375,3 +1375,33 @@ Ra.IP = 0.0.0.0 Ra.Port = 3443 Ra.MinLevel = 3 Ra.Secure = 1 + +#################################################################################################################### +# PvP Token System +# +# PvPToken.Enable +# Enable/disable PvP Token system. +# Default: 1 (enabled) +# 0 (disabled) +# +# PvPToken.ItemID +# The item ID of the token that players will receive after killing an enemy. +# Default: 29434 (Badge of Justice) +# +# PvPToken.ItemCount +# The count amount of the ItemID +# Default: 1 +# +# PvPToken.MapRestriction +# The type of maps where players can receive the token +# Default: 4 - all maps +# 3 - battlegrounds only +# 2 - FFA areas only (both instanced and world arenas) +# 1 - battlegrounds and FFA areas only +# +################################################################################################################### + +PvPToken .Enable = 0 +PvPToken.ItemID = 29434 +PvPToken.ItemCount = 1 +PvPToken.MapRestriction = 4 diff --git a/src/game/Language.h b/src/game/Language.h index 823d6d5..938755b 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -848,7 +848,7 @@ enum MangosStrings // 10000-10999 // Use for custom patches 11000-11999 - + LANG_YOU_RECEIVE_TOKEN = 11050, // NOT RESERVED IDS 12000-1999999999 // `db_script_string` table index 2000000000-2000009999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID) // For other tables maybe 2000010000-2147483647 (max index) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 65c6ac0..34535df 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -21017,6 +21017,35 @@ void Player::ResummonPetTemporaryUnSummonedIfAny() m_temporaryUnsummonedPetNumber = 0; } +void Player::ReceiveToken() +{ + if(!sWorld.getConfig(CONFIG_PVP_TOKEN_ENABLE)) + return; + + uint8 MapRestriction = sWorld.getConfig(CONFIG_PVP_TOKEN_RESTRICTION); + + if( MapRestriction == 1 && !InBattleGround() && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) || + MapRestriction == 2 && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) || + MapRestriction == 3 && !InBattleGround()) + return; + + uint32 itemID = sWorld.getConfig(CONFIG_PVP_TOKEN_ITEMID); + uint32 itemCount = sWorld.getConfig(CONFIG_PVP_TOKEN_ITEMCOUNT); + + ItemPosCountVec dest; + uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemID, itemCount); + if( msg != EQUIP_ERR_OK ) // convert to possible store amount + { + SendEquipError( msg, NULL, NULL ); + return; + } + + Item* item = StoreNewItem( dest, itemID, true, Item::GenerateItemRandomPropertyId(itemID)); + SendNewItem(item,itemCount,true,false); + + ChatHandler(this).PSendSysMessage(LANG_YOU_RECEIVE_TOKEN); +} + bool Player::canSeeSpellClickOn(Creature const *c) const { if(!c->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_SPELLCLICK)) diff --git a/src/game/Player.h b/src/game/Player.h index a1ea792..158da81 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1950,7 +1950,9 @@ class MANGOS_DLL_SPEC Player : public Unit void ModifyHonorPoints( int32 value ); void ModifyArenaPoints( int32 value ); uint32 GetMaxPersonalArenaRatingRequirement(); - + + void ReceiveToken(); + //End of PvP System void SetDrunkValue(uint16 newDrunkValue, uint32 itemid=0); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 06d1533..98af84b 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -580,6 +580,11 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa player->RewardPlayerAndGroupAtKill(pVictim); player->ProcDamageAndSpell(pVictim, PROC_FLAG_KILL, PROC_FLAG_KILLED, PROC_EX_NONE, 0); + // PvP Token + int8 leveldiff = player->getLevel() - pVictim->getLevel(); + if(!pVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT) && leveldiff < 10) + player->ReceiveToken(); + WorldPacket data(SMSG_PARTYKILLLOG, (8+8)); //send event PARTY_KILL data << uint64(player->GetGUID()); //player with killing blow data << uint64(pVictim->GetGUID()); //victim diff --git a/src/game/World.cpp b/src/game/World.cpp index 3361b5e..c9a4ffb 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -954,6 +954,15 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_THREAT_RADIUS] = sConfig.GetIntDefault("ThreatRadius", 100); + /* PvP Token System */ + m_configs[CONFIG_PVP_TOKEN_ENABLE] = sConfig.GetBoolDefault("PvPToken.Enable", true); + m_configs[CONFIG_PVP_TOKEN_ITEMID] = sConfig.GetIntDefault("PvPToken.ItemID", 29434); + m_configs[CONFIG_PVP_TOKEN_ITEMCOUNT] = sConfig.GetIntDefault("PvPToken.ItemCount", 1); + m_configs[CONFIG_PVP_TOKEN_RESTRICTION] = sConfig.GetIntDefault("PvPToken.MapRestriction", 4); + + if(m_configs[CONFIG_PVP_TOKEN_ITEMCOUNT] <= 0) + m_configs[CONFIG_PVP_TOKEN_ENABLE] = 0; + // always use declined names in the russian client m_configs[CONFIG_DECLINED_NAMES_USED] = (m_configs[CONFIG_REALM_ZONE] == REALM_ZONE_RUSSIAN) ? true : sConfig.GetBoolDefault("DeclinedNames", false); diff --git a/src/game/World.h b/src/game/World.h index 977a440..f67cd72 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -199,6 +199,10 @@ enum WorldConfigs CONFIG_LISTEN_RANGE_SAY, CONFIG_LISTEN_RANGE_TEXTEMOTE, CONFIG_LISTEN_RANGE_YELL, + CONFIG_PVP_TOKEN_E NABLE, + CONFIG_PVP_TOKEN_ITEMID, + CONFIG_PVP_TOKEN_ITEMCOUNT, + CONFIG_PVP_TOKEN_RESTRIC TION, CONFIG_SKILL_MILLING, CONFIG_BATTLEGROUND_CAST_DESERTER, CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE, -- 1.6.3 .3
|
|
|
|