Jump to content

marxy

Members
  • Posts

    3
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

About marxy

  • Birthday 01/01/1

marxy's Achievements

Newbie

Newbie (1/3)

0

Reputation

  1. pet leveltstas table changed mabye someone have little sql for it to?
  2. first get mangos core files then go to dbcenums.cpp and change cap to 255 #ifndef DBCENUMS_H #define DBCENUMS_H // Client expected level limitation, like as used in DBC item max levels for "until max player level" // use as default max player level, must be fit max level for used client // also see MAX_LEVEL and STRONG_MAX_LEVEL define #define DEFAULT_MAX_LEVEL 255 // client supported max level for player/pets/etc. Avoid overflow or client stability affected. // also see GT_MAX_LEVEL define #define MAX_LEVEL 255
  3. marxy

    scripts

    hy there im wanted to know mabye anyone is intrested about some scripts from trinity but my question is is it possible to convert it to mangos? and mabye anyone can help me out?tinity and mangos is kinda same so its easyer to convert im tring to do it with my little skills but just cant handle it...thanks # HG changeset patch # User KalCorp # Date 1285959945 14400 # Branch trunk # Node ID e3c7b2025ab364c8c201d0bd52e4f1482a44f5ea # Parent c5ed4381633d342cc4179e5034bf4c5dd5623e00 VAS.Balance v1.04.07 diff -r c5ed4381633d -r e3c7b2025ab3 src/server/game/Scripting/ScriptLoader.cpp --- a/src/server/game/Scripting/ScriptLoader.cpp Fri Oct 01 15:05:45 2010 -0400 +++ b/src/server/game/Scripting/ScriptLoader.cpp Fri Oct 01 15:05:45 2010 -0400 @@ -18,6 +18,8 @@ #include "ScriptPCH.h" #include "ScriptLoader.h" +//VAS.AutoBalance +void AddSC_VAS_AutoBalance(); //examples void AddSC_example_creature(); @@ -1151,6 +1153,6 @@ { #ifdef SCRIPTS /* This is where custom scripts should be added. */ - + AddSC_VAS_AutoBalance(); #endif } diff -r c5ed4381633d -r e3c7b2025ab3 src/server/scripts/Custom/CMakeLists.txt --- a/src/server/scripts/Custom/CMakeLists.txt Fri Oct 01 15:05:45 2010 -0400 +++ b/src/server/scripts/Custom/CMakeLists.txt Fri Oct 01 15:05:45 2010 -0400 @@ -1,5 +1,6 @@ set(scripts_STAT_SRCS ${scripts_STAT_SRCS} + Custom/VAS_AutoBalance.cpp ) message(" -> Prepared: Custom") diff -r c5ed4381633d -r e3c7b2025ab3 src/server/scripts/Custom/VAS_AutoBalance.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/server/scripts/Custom/VAS_AutoBalance.cpp Fri Oct 01 15:05:45 2010 -0400 @@ -0,0 +1,846 @@ +/* + * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * Copyright (C) 1985-2010 {VAS} KalCorp <http://vasserver.dyndns.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 the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* ScriptData +SDName: VAS.AutoBalance +SD%Complete: 50 +SDComment:By KalCorp +SDCategory: Script VAS +EndScriptData */ + + +#include "ScriptPCH.h" +#include "Configuration/Config.h" +#include "MapManager.h" +#include "Map.h" + + + float VAS_version = 1.04f; + int VAS_Sub_version = 07; + + int Creature_Update_Timer = 60; + int AutoInstance = 1; + int PlayerChangeNotify = 1; + int VasDebug = 1; + int DebugByID = 0; + float Config_xPlayer = 1.0f; + float Min_D_Mod = 0.10f; + float Min_HP_Mod = 0.20f; + + float VAS_Script_Hook_VersionNeeded = 1.01f; + + + float VAS_Hook_Version_Installed = 0.0f; + bool VAS_Hook_Check = false; + + std::string VAS_AutoBalance_Color = "cffFF8000"; + + + struct sVASCreatureInfo + { + uint32 CoolDown; + int LastPlayerCount; + float damagemod; + }; + static std::map<uint32, sVASCreatureInfo> VASCreatureInfo; + +inline const char * const BoolToString(bool b) +{ + return b ? "true" : "false"; +} + +bool VAS_AutoBalance_CheckID(std::string VASCheckNameString,int VASCheckID) + { + std::string map_str; + std::stringstream map_ss; + map_ss.str(VASCheckNameString); + while (std::getline(map_ss, map_str, ',')) + { + std::stringstream ss2(map_str); + int map_num = -1; + ss2 >> map_num; + if (map_num >= 0) + { + if (map_num == VASCheckID) + return true; + } + } + return false; + } + +bool VAS_AutoBalance_CheckINIMaps(std::string pMapIdString,int VASmapid) + { + std::string map_str; + std::stringstream map_ss; + map_ss.str(pMapIdString); + while (std::getline(map_ss, map_str, ',')) + { + std::stringstream ss2(map_str); + int map_num = -1; + ss2 >> map_num; + if (map_num >= 0) + { + if (map_num == VASmapid) + return true; + } + } + return false; + } + +class VAS_AutoBalance_WorldScript : public WorldScript +{ + public: + VAS_AutoBalance_WorldScript() + : WorldScript("VAS_AutoBalance_WorldScript") + { + } + + void OnConfigLoad(bool /*reload*/) + { + if (Config_xPlayer <= 0) + return; + + if (VasDebug >= 3) + sLog.outString("### VAS_AutoBalance_WorldScript - OnConfigLoad"); + } + + void OnStartup() + { + if (Config_xPlayer <= 0) + return; + + if (VasDebug >= 3) + sLog.outString("### VAS_AutoBalance_WorldScript - OnStartup" ); + } + + + void SetInitialWorldSettings() + { + + // Added so you can not compile without needed VAS_Script_Hooks! + VAS_Hook_Version_Installed = sScriptMgr.VAS_Script_Hooks(); + + sLog.outString("----------------------------------------------------"); + sLog.outString(" Powered by {VAS} AutoBalance v%4.2f.%u ",VAS_version,VAS_Sub_version); + sLog.outString("----------------------------------------------------"); + + VasDebug = sConfig.GetIntDefault("VAS.AutoBalance.Debug",1); + DebugByID = sConfig.GetIntDefault("VAS.AutoBalance.DebugByID",0); + Creature_Update_Timer = sConfig.GetFloatDefault("VAS.AutoBalance.Creature.Update.Timer",60); + AutoInstance = sConfig.GetIntDefault("VAS.AutoBalance.AutoInstance",1); + PlayerChangeNotify = sConfig.GetIntDefault("VAS.AutoBalance.PlayerChangeNotify",1); + Config_xPlayer = sConfig.GetFloatDefault("VAS.AutoBalance.XPlayer",1.0f); + Min_D_Mod = sConfig.GetFloatDefault("Min.D.Mod",0.10f); + Min_HP_Mod = sConfig.GetFloatDefault("Min.HP.Mod",0.20f); + + + if (VAS_Hook_Version_Installed >= VAS_Script_Hook_VersionNeeded) + { + sLog.outString(" VAS_Script_Hooks v%4.2f Found",VAS_Hook_Version_Installed); + } + else + { + sLog.outString(" VAS_Script_Hooks v%4.2f Found",VAS_Hook_Version_Installed); + sLog.outString(" This Mod needs %4.2f+ to run correctly!",VAS_Script_Hook_VersionNeeded); + Config_xPlayer = 0; + } + + + if (Config_xPlayer >= 1) + { + sLog.outString(" xPlayer = %4.1f ", Config_xPlayer); + sLog.outString(" AutoInstance = %u ", AutoInstance); + sLog.outString(" PlayerChangeNotify = %u ", PlayerChangeNotify); + + sLog.outString(" Min.D.Mod = %4.2f ", Min_D_Mod); + sLog.outString(" Min.HP.Mod = %4.2f ", Min_HP_Mod); + + sLog.outString(" VasDebug = %u ", VasDebug); + + // VasDebug From 0 to 4 + if (VasDebug <= 0) + { + VasDebug = 0; + sLog.outString(" VasDebug reset back to 0. Set from 0 to 4"); + } + if (VasDebug >= 5) + { + VasDebug = 4; + sLog.outString(" VasDebug reset back to 3. Set from 0 to 4"); + } + + sLog.outString(" DebugByID = %u", DebugByID); + sLog.outString(" Creature_Update_Timer = %u", Creature_Update_Timer); + + // Do not let Creature_Update_Timer go below 5 sec's + if (Creature_Update_Timer <= 4) + { + Creature_Update_Timer = 5; + sLog.outString(" Creature_Update_Timer reset back to 5. Should be lower that that!"); + } + + VAS_AutoBalance_Color = sConfig.GetStringDefault("VAS.AutoBalance.Color", "cffFF8000"); + sLog.outString(" VAS.AutoBalance.Color = %s", VAS_AutoBalance_Color.c_str()); + + } + else + sLog.outString(" VAS Auto-Balance is Disabled - xPlayer is set to 0 \\n"); + + sLog.outString("----------------------------------------------------\\n"); + } + +}; + + + +class VAS_AutoBalance_PlayerScript : public PlayerScript +{ + public: + VAS_AutoBalance_PlayerScript() + : PlayerScript("VAS_AutoBalance_PlayerScript") + { + } + + void OnLogin(Player *Player) + { + + if (Config_xPlayer <= 0) + return; + + if (VasDebug >= 3) + sLog.outString("### VAS_AutoBalance_PlayerScript - OnLogin Player=%s", Player->GetName()); + + ChatHandler chH = ChatHandler(Player); + if (Config_xPlayer >= 1) + { + chH.PSendSysMessage("\\n|%s----------------------------------------------------|r",VAS_AutoBalance_Color.c_str()); + chH.PSendSysMessage("|%s Powered by {VAS}AutoBalance v%4.2f.%u |r ",VAS_AutoBalance_Color.c_str(),VAS_version,VAS_Sub_version); + if (AutoInstance >= 1) + chH.PSendSysMessage("|%s Auto Instance is Active |r",VAS_AutoBalance_Color.c_str()); + else + chH.PSendSysMessage("|%s Set for %4.1f Players|r ",VAS_AutoBalance_Color.c_str(),Config_xPlayer); + chH.PSendSysMessage("|%s----------------------------------------------------|r \\n",VAS_AutoBalance_Color.c_str()); + } + } +}; + +class VAS_AutoBalance_UnitScript : public UnitScript +{ + public: + VAS_AutoBalance_UnitScript() + : UnitScript("VAS_AutoBalance_UnitScript") + { + } + + uint32 DealDamage(Unit* AttackerUnit, Unit *pVictim,uint32 damage,DamageEffectType damagetype) + { + if (Config_xPlayer <= 0) + return damage; + + if (AttackerUnit->GetMap()->IsDungeon() && pVictim->GetMap()->IsDungeon()) + if (AttackerUnit->GetTypeId() != TYPEID_PLAYER) + { + if (VasDebug >= 3) + sLog.outString("### VAS_AutoBalance_UnitScript - VAS_Unit_DealDamage Attacker=%s Victim=%s Start Damage=%u",AttackerUnit->GetName(),pVictim->GetName(),damage); + damage = VAS_Modifer_DealDamage(AttackerUnit,damage); + if (VasDebug >= 3) + sLog.outString("### VAS_AutoBalance_UnitScript - VAS_Unit_DealDamage Attacker=%s Victim=%s End Damage=%u",AttackerUnit->GetName(),pVictim->GetName(),damage); + } + return damage; + } + + void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType, bool crit) + { + if (Config_xPlayer <= 0) + return; + + if (damageInfo->attacker->GetMap()->IsDungeon() && damageInfo->target->GetMap()->IsDungeon() || damageInfo->attacker->GetMap()->IsBattleground() && damageInfo->target->GetMap()->IsBattleground()) + if (damageInfo->attacker->GetTypeId() != TYPEID_PLAYER) + { + if (VasDebug >= 3) + sLog.outString("### VAS_AutoBalance_UnitScript - CalculateSpellDamageTaken Attacker=%s Victim=%s Start Damage=%u",damageInfo->attacker->GetName(),damageInfo->target->GetName(),damageInfo->damage); + + float damagemod = VASCreatureInfo[damageInfo->attacker->GetGUID()].damagemod; + if (damagemod <= 0) + damagemod =1.0f; + + damageInfo->damage *= damagemod; + + if (VasDebug >= 3) + sLog.outString("### VAS_AutoBalance_UnitScript - CalculateSpellDamageTaken Attacker=%s Victim=%s End Damage=%u",damageInfo->attacker->GetName(),damageInfo->target->GetName(),damageInfo->damage); + } + return; + } + + void CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *damageInfo, WeaponAttackType attackType) + { + if (Config_xPlayer <= 0) + return; + + if (damageInfo->attacker->GetMap()->IsDungeon() && damageInfo->target->GetMap()->IsDungeon() || damageInfo->attacker->GetMap()->IsBattleground() && damageInfo->target->GetMap()->IsBattleground()) + if (damageInfo->attacker->GetTypeId() != TYPEID_PLAYER) + { + if (VasDebug >= 3) + sLog.outString("### VAS_AutoBalance_UnitScript - CalculateMeleeDamage Attacker=%s Victim=%s Start Damage=%u",damageInfo->attacker->GetName(),damageInfo->target->GetName(),damageInfo->damage); + + float damagemod = VASCreatureInfo[damageInfo->attacker->GetGUID()].damagemod; + if (damagemod <= 0) + damagemod =1.0f; + + damageInfo->damage *= damagemod; + + if (VasDebug >= 3) + sLog.outString("### VAS_AutoBalance_UnitScript - CalculateMeleeDamage Attacker=%s Victim=%s End Damage=%u",damageInfo->attacker->GetName(),damageInfo->target->GetName(),damageInfo->damage); + } + return; + } + + uint32 VAS_Modifer_DealDamage(Unit* AttackerUnit,uint32 damage) + { + + float damagemod = VASCreatureInfo[AttackerUnit->GetGUID()].damagemod; + + if (damagemod <= 0) + damagemod =1.0f; + + return damage*damagemod; + + } + +}; + + +class VAS_AutoBalance_AllMapScript : public AllMapScript +{ + + public: + VAS_AutoBalance_AllMapScript() + : AllMapScript("VAS_AutoBalance_AllMapScript") + { + } + + void OnPlayerEnterAll(Map* map, Player* player) + { + + if (Config_xPlayer <= 0) + return; + + + int VasMapID = player->GetMapId(); + int VAS_PlayersInMap = map->GetPlayersCountExceptGMs(); + Difficulty VAS_MAPDifficulty = player->GetDifficulty(map); + ChatHandler chH = ChatHandler(player); + + bool IsHeroic = player->GetMap()->IsHeroic(); + bool IsRaid = player->GetMap()->IsRaid(); + bool IsRegularDifficulty = player->GetMap()->IsRegularDifficulty(); + bool IsRaidOrHeroicDungeon = player->GetMap()->IsRaidOrHeroicDungeon(); + bool IsNonRaidDungeon = player->GetMap()->IsNonRaidDungeon(); + + std::string sMapDifficulty="N/A"; + + if (!player->GetMap()->IsDungeon()) + switch(player->GetDifficulty(player->GetMap()->IsHeroic())) + { + case REGULAR_DIFFICULTY: + sMapDifficulty="REGULAR_DIFFICULTY"; + break; + sMapDifficulty="N/A"; + } + + if (player->GetMap()->IsDungeon()) + switch(player->GetDungeonDifficulty()) + { + case DUNGEON_DIFFICULTY_NORMAL: + sMapDifficulty="DUNGEON_DIFFICULTY_NORMAL"; + break; + case DUNGEON_DIFFICULTY_HEROIC: + sMapDifficulty="DUNGEON_DIFFICULTY_HEROIC"; + break; + case DUNGEON_DIFFICULTY_EPIC: + sMapDifficulty="DUNGEON_DIFFICULTY_EPIC"; + break; + sMapDifficulty="N/A"; + } + + if (player->GetMap()->IsRaid()) + switch(player->GetRaidDifficulty()) + { + case RAID_DIFFICULTY_10MAN_NORMAL: + sMapDifficulty="RAID_DIFFICULTY_10MAN_NORMAL"; + break; + case RAID_DIFFICULTY_25MAN_NORMAL: + sMapDifficulty="RAID_DIFFICULTY_25MAN_NORMAL"; + break; + case RAID_DIFFICULTY_10MAN_HEROIC: + sMapDifficulty="RAID_DIFFICULTY_10MAN_HEROIC"; + break; + case RAID_DIFFICULTY_25MAN_HEROIC: + sMapDifficulty="RAID_DIFFICULTY_25MAN_HEROIC"; + break; + sMapDifficulty="N/A"; + } + + uint32 maxPlayers = ((InstanceMap*)sMapMgr.FindMap(player->GetMapId(), player->GetInstanceId()))->GetMaxPlayers(); + + + if (VasDebug >= 2) + { + sLog.outString("----------------------------------------------------"); + sLog.outString("## VAS_AutoBalance_AllMapScript - OnPlayerEnterAll"); + sLog.outString("## For InsatanceID %u",map->GetInstanceId()); + sLog.outString("## IsDungeon= %u",map->GetEntry()->IsDungeon()); + sLog.outString("## For Map %u",VasMapID); + sLog.outString("## PlayersInMap %u",VAS_PlayersInMap); + sLog.outString("## MapDifficulty %s",sMapDifficulty.c_str()); + sLog.outString("## pDifficulty %u",uint32(player->GetDifficulty(player->GetMap()->IsHeroic()))); + sLog.outString("## pGetDungeonDifficulty %u",uint32(player->GetDungeonDifficulty())); + sLog.outString("## pGetRaidDifficulty %u",uint32(player->GetRaidDifficulty())); + sLog.outString("## maxPlayers %u",maxPlayers); + sLog.outString("## IsHeroic=%s IsRaid=%s IsRegularDifficulty=%s IsRaidOrHeroicDungeon=%s IsNonRaidDungeon=%s",BoolToString(IsHeroic),BoolToString(IsRaid),BoolToString(IsRegularDifficulty),BoolToString(IsRaidOrHeroicDungeon),BoolToString(IsNonRaidDungeon)); + sLog.outString("----------------------------------------------------\\n"); + } + + if (PlayerChangeNotify >= 1) + if ((map->GetEntry()->IsDungeon()) && !player->isGameMaster() ) + { + Map::PlayerList const &PlayerList = map->GetPlayers(); + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) + if (Player* pPlr = itr->getSource()) + { + ChatHandler chH = ChatHandler(pPlr); + chH.PSendSysMessage("|cffFF0000 [VAS-AutoBalance]|r|%s %s entered the Instance %s.|r \\n|%s Auto setting player count to %u |r",VAS_AutoBalance_Color.c_str(),player->GetName(),map->GetMapName(),VAS_AutoBalance_Color.c_str(),VAS_PlayersInMap); + } + } + + } + + + void OnPlayerLeaveAll(Map* map, Player* player) + { + if (Config_xPlayer <= 0) + return; + + if (VasDebug >= 3) + sLog.outString("#### VAS_AutoBalance_AllMapScript - OnPlayerLeaveAll map=%s player=%S", map->GetMapName(),player->GetName()); + + int VasMapID = player->GetMapId(); + int VAS_PlayersInMap = map->GetPlayersCountExceptGMs(); + Difficulty VAS_MAPDifficulty = player->GetDifficulty(map); + + if (VAS_PlayersInMap >= 1) + VAS_PlayersInMap -= 1; + + if (VAS_PlayersInMap >=1) + { + ChatHandler chH = ChatHandler(player); + + if (VasDebug >= 2) + { + sLog.outString("----------------------------------------------------"); + sLog.outString("## VAS_AutoBalance_AllMapScript - OnPlayerLeaveAll"); + sLog.outString("## For InsatanceID %u",map->GetInstanceId()); + sLog.outString("## IsDungeon= %u",map->GetEntry()->IsDungeon()); + sLog.outString("## For Map %u",VasMapID); + sLog.outString("## PlayersInMap %u",VAS_PlayersInMap); + sLog.outString("----------------------------------------------------\\n"); + } + + if (PlayerChangeNotify >= 1) + if ((map->GetEntry()->IsDungeon()) && !player->isGameMaster() ) + { + Map::PlayerList const &PlayerList = map->GetPlayers(); + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) + if (Player* pPlr = itr->getSource()) + { + ChatHandler chH = ChatHandler(pPlr); + chH.PSendSysMessage("|cffFF0000 [VAS-AutoBalance]|r|%s %s left the Instance %s.|r \\n|%s Auto setting player count to %u |r",VAS_AutoBalance_Color.c_str(),player->GetName(),map->GetMapName(),VAS_AutoBalance_Color.c_str(),VAS_PlayersInMap); + } + } + } + } +}; + + + +class VAS_AutoBalance_WorldMapScript : public WorldMapScript +{ + + public: + VAS_AutoBalance_WorldMapScript() + : WorldMapScript("VAS_AutoBalance_WorldMapScript",0) + { + } + + void OnPlayerEnter(Map* map, Player* player) + { + if (Config_xPlayer <= 0) + return; + + if (VasDebug >= 3) + sLog.outString("### VAS_AutoBalance_WorldMapScript - OnPlayerEnter Map=%s player=%s",map->GetMapName(),player->GetName()); + } + + void OnPlayerLeave(Map* map, Player* player) + { + if (Config_xPlayer <= 0) + return; + + if (VasDebug >= 3) + sLog.outString("### VAS_AutoBalance_WorldMapScript - OnPlayerLeave Map=%s player=%s",map->GetMapName(),player->GetName()); + } + +}; + + +class VAS_AutoBalance_AllCreatureScript : public AllCreatureScript +{ + public: + VAS_AutoBalance_AllCreatureScript() + : AllCreatureScript("VAS_AutoBalance_AllCreatureScript") + { + } + + + void Creature_SelectLevel(const CreatureInfo *cinfo, Creature* creature) + { + if (Config_xPlayer <= 0) + return; + + if (creature->GetMap()->IsDungeon()) + { + VAS_Modifer_Health_Mana(creature); + if (VasDebug >= 4) + sLog.outString("### VAS_AutoBalance_VASScript - VAS_Creature_SelectLevel InstanceID=%u Creature=%s",creature->GetInstanceId(),cinfo->Name); + } + } + + void OnAllCreatureUpdate(Creature* creature, uint32 diff) + { + if (Config_xPlayer <= 0) + return; + + if (VASCreatureInfo[creature->GetGUID()].CoolDown <= diff) + { + VASCreatureInfo[creature->GetGUID()].CoolDown = 0; + if (creature->GetMap()->IsDungeon() || creature->GetMap()->IsBattleground()) + VAS_Modifer_Health_Mana(creature); + VASCreatureInfo[creature->GetGUID()].CoolDown = Creature_Update_Timer * IN_MILLISECONDS; + } + else + VASCreatureInfo[creature->GetGUID()].CoolDown -= diff; + } + + void VAS_Modifer_Health_Mana(Creature* creature) + { + + Player* cplayer ; + + float Xplayer = Config_xPlayer; + if (Xplayer <= 0) + return; + + uint32 PlayersInCreaturesInstance = 0; + Map::PlayerList const &PlayerList = creature->GetMap()->GetPlayers(); + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) + if (Player* pPlr = itr->getSource()) + if ((pPlr->GetInstanceId() == creature->GetInstanceId()) && !pPlr->isGameMaster()) + { + PlayersInCreaturesInstance += 1; + cplayer = pPlr; + } + + + + if (AutoInstance >= 1) + { + Xplayer = PlayersInCreaturesInstance; + VASCreatureInfo[creature->GetGUID()].LastPlayerCount = Xplayer; + if (Xplayer <= 0) + return; + } + + CreatureInfo const *cinfo = creature->GetCreatureInfo(); + int VASEntry = cinfo->Entry; + + uint8 minlevel = std::min(cinfo->maxlevel, cinfo->minlevel); + uint8 maxlevel = std::max(cinfo->maxlevel, cinfo->minlevel); + uint8 level = minlevel == maxlevel ? minlevel : urand(minlevel, maxlevel); + creature->SetLevel(level); + + CreatureBaseStats const* stats = sObjectMgr.GetCreatureBaseStats(level, cinfo->unit_class); + + float healthmod = 1.0f; + uint32 basehp = stats->GenerateHealth(cinfo); + uint32 VASbasehp = (basehp * healthmod); + + float VAShealthmod = healthmod; + float VAS_Modifer = 1.0; + float VAS_Modifer2 = 1.0; + int VasMapID = creature->GetMapId(); + bool VAS_Changed = false; + Min_D_Mod = 0.10f; + Min_HP_Mod = 0.30f; + float VAS_Group_Modifer = 1.0f; + float VAS_Damage_Modifer = 1.0f; + char *const VASName = cinfo->Name; + + + // VAS SOLO - By MobID + if (VAS_AutoBalance_CheckID(sConfig.GetStringDefault("VAS.AutoBalance.40.Name", ""),VASEntry) && ( (40-Xplayer) > 0 )) + {VAS_Modifer =40; + if ((VasDebug >= 3) && (DebugByID == VASEntry)) + sLog.outString("### VAS-AutoBalance - NPC ID=%u Found in VAS-AutoBalance.40.Name",VasMapID); + VAS_Changed = true;} + if (VAS_AutoBalance_CheckID(sConfig.GetStringDefault("VAS.AutoBalance.25.Name", ""),VASEntry) && ( (25-Xplayer) > 0 )) + {VAS_Modifer = 25; + if ((VasDebug >= 3) && (DebugByID == VASEntry)) + sLog.outString("### VAS-AutoBalance - NPC ID=%u Found in VAS-AutoBalance.25.Name",VasMapID); + VAS_Changed = true;} + if (VAS_AutoBalance_CheckID(sConfig.GetStringDefault("VAS.AutoBalance.20.Name", ""),VASEntry) && ( (20-Xplayer) > 0 )) + {VAS_Modifer = 20; + if ((VasDebug >= 3) && (DebugByID == VASEntry)) + sLog.outString("### VAS-AutoBalance - NPC ID=%u Found in VAS-AutoBalance.20.Name",VasMapID); + VAS_Changed = true;} + if (VAS_AutoBalance_CheckID(sConfig.GetStringDefault("VAS.AutoBalance.10.Name", ""),VASEntry) && ( (10-Xplayer) > 0 )) + {VAS_Modifer = 10; + if ((VasDebug >= 3) && (DebugByID == VASEntry)) + sLog.outString("### VAS-AutoBalance - NPC ID=%u Found in VAS-AutoBalance.10.Name",VasMapID); + VAS_Changed = true;} + if (VAS_AutoBalance_CheckID(sConfig.GetStringDefault("VAS.AutoBalance.5.Name", ""),VASEntry) && ( (5-Xplayer) > 0 )) + {VAS_Modifer = 5; + if ((VasDebug >= 3) && (DebugByID == VASEntry)) + sLog.outString("### VAS-AutoBalance - NPC ID=%u Found in VAS-AutoBalance.5.Name",VasMapID); + VAS_Changed = true;} + if (VAS_AutoBalance_CheckID(sConfig.GetStringDefault("VAS.AutoBalance.2.Name", ""),VASEntry) && ( (2-Xplayer) > 0 )) + {VAS_Modifer = 2; + if ((VasDebug >= 3) && (DebugByID == VASEntry)) + sLog.outString("### VAS-AutoBalance - NPC ID=%u Found in VAS-AutoBalance.2.Name",VasMapID); + VAS_Changed = true;} + + // VAS SOLO - Map 0,1 and 530 ( World Mobs ) + if ((VasMapID == 0 || VasMapID == 1 || VasMapID == 530 ) && (basehp*healthmod) > 200001) + {VAS_Modifer = 40; + if ((VasDebug >= 3) && (DebugByID == VASEntry)) + sLog.outString("### VAS-AutoBalance - Map 0,1,530 and HP > 200000 setting to 40 group"); + VAS_Changed = true;} + if ((VasMapID == 0 || VasMapID == 1 || VasMapID == 530 ) && (basehp*healthmod) > 140001 && (basehp*healthmod) <= 200000) + {VAS_Modifer = 25; + if ((VasDebug >= 3) && (DebugByID == VASEntry)) + sLog.outString("### VAS-AutoBalance - Map 0,1,530 and HP > 140001 & < 200000 setting to 25 group"); + VAS_Changed = true;} + if ((VasMapID == 0 || VasMapID == 1 || VasMapID == 530 ) && (basehp*healthmod) > 100001 && (basehp*healthmod) <= 140000) + {VAS_Modifer = 20; + if ((VasDebug >= 3) && (DebugByID == VASEntry)) + sLog.outString("### VAS-AutoBalance - Map 0,1,530 and HP > 100001 & < 140000 setting to 20 group"); + VAS_Changed = true;} + if ((VasMapID == 0 || VasMapID == 1 || VasMapID == 530 ) && (basehp*healthmod) > 40001 && (basehp*healthmod) <= 100000) + {VAS_Modifer = 10; + if ((VasDebug >= 3) && (DebugByID == VASEntry)) + sLog.outString("### VAS-AutoBalance - Map 0,1,530 and HP > 40001 & < 100000 setting to 10 group"); + VAS_Changed = true;} + if ((VasMapID == 0 || VasMapID == 1 || VasMapID == 530 ) && (basehp*healthmod) > 20001 && (basehp*healthmod) <= 40000) + {VAS_Modifer = 5; + if ((VasDebug >= 3) && (DebugByID == VASEntry)) + sLog.outString("### VAS-AutoBalance - Map 0,1,530 and HP > 20001 & < 40000 setting to 5 group"); + VAS_Changed = true;} + + // VAS SOLO - Everything else! + if (!VAS_Changed) + { + if ( ((basehp*healthmod)) >= 20001 && ((basehp*healthmod)) <= 30000 && ( (2-Xplayer) > 0 )) + VAS_Modifer = 2; + if ( ((basehp*healthmod)) >= 30001 && ((basehp*healthmod)) <= 40000 && ( (3-Xplayer) > 0 )) + VAS_Modifer = 3; + if ( ((basehp*healthmod)) >= 40001 && ((basehp*healthmod)) <= 50000 && ( (4-Xplayer) > 0 )) + VAS_Modifer = 4; + if ( ((basehp*healthmod)) >= 50001 && ((basehp*healthmod)) <= 60000 && ( (5-Xplayer) > 0 )) + VAS_Modifer =5; + if ( ((basehp*healthmod)) >= 60001 && ((basehp*healthmod)) <= 70000 && ( (6-Xplayer) > 0 )) + VAS_Modifer = 6; + if ( ((basehp*healthmod)) >= 70001 && ((basehp*healthmod)) <= 80000 && ( (7-Xplayer) > 0 )) + VAS_Modifer = 7; + if ( ((basehp*healthmod)) >= 80001 && ((basehp*healthmod)) <= 90000 && ( (8-Xplayer) > 0 )) + VAS_Modifer = 8; + if ( ((basehp*healthmod)) >= 90001 && ((basehp*healthmod)) <= 100000 && ( (9-Xplayer) > 0 )) + VAS_Modifer = 9; + if ( ((basehp*healthmod)) >= 100001 && ( (10-Xplayer) > 0 ) ) + VAS_Modifer = 10; + + if ((VasDebug >= 3) && (DebugByID == VASEntry)) + sLog.outString("### VAS-AutoBalance - Not Found in Maps or by ID setting Modifer to %f by Base HP",VAS_Modifer); + } + + + bool IsDungeon = creature->GetMap()->IsDungeon(); + bool IsHeroic = creature->GetMap()->IsHeroic(); + bool IsRaid = creature->GetMap()->IsRaid(); + bool IsRegularDifficulty = creature->GetMap()->IsRegularDifficulty(); + bool IsRaidOrHeroicDungeon = creature->GetMap()->IsRaidOrHeroicDungeon(); + bool IsNonRaidDungeon = creature->GetMap()->IsNonRaidDungeon(); + + std::string sMapDifficulty="N/A"; + + uint32 MaxPlayers = 5; + + if (IsDungeon) + { + VAS_Modifer = ((InstanceMap*)sMapMgr.FindMap(creature->GetMapId(), creature->GetInstanceId()))->GetMaxPlayers(); + MaxPlayers = VAS_Modifer; + + switch(cplayer->GetDungeonDifficulty()) + { + case DUNGEON_DIFFICULTY_NORMAL: + sMapDifficulty="DUNGEON_DIFFICULTY_NORMAL"; + Min_HP_Mod *= 0.75; + Min_D_Mod *= 0.75; + break; + case DUNGEON_DIFFICULTY_HEROIC: + sMapDifficulty="DUNGEON_DIFFICULTY_HEROIC"; + break; + case DUNGEON_DIFFICULTY_EPIC: + sMapDifficulty="DUNGEON_DIFFICULTY_EPIC"; + break; + } + + if (IsRaid) + switch(cplayer->GetRaidDifficulty()) + { + case RAID_DIFFICULTY_10MAN_NORMAL: + sMapDifficulty="RAID_DIFFICULTY_10MAN_NORMAL"; + Min_HP_Mod *= 0.75; + Min_D_Mod *= 0.75; + break; + case RAID_DIFFICULTY_25MAN_NORMAL: + sMapDifficulty="RAID_DIFFICULTY_25MAN_NORMAL"; + Min_HP_Mod *= 0.75; + Min_D_Mod *= 0.75; + break; + case RAID_DIFFICULTY_10MAN_HEROIC: + sMapDifficulty="RAID_DIFFICULTY_10MAN_HEROIC"; + break; + case RAID_DIFFICULTY_25MAN_HEROIC: + sMapDifficulty="RAID_DIFFICULTY_25MAN_HEROIC"; + break; + } + + } + else + switch(cplayer->GetDifficulty(creature->GetMap()->IsHeroic())) + { + case REGULAR_DIFFICULTY: + sMapDifficulty="REGULAR_DIFFICULTY"; + break; + } + + VAS_Modifer2 = VAS_Modifer; + VAS_Modifer *= VAS_Group_Modifer; + + if (VAS_Modifer <= 0) + VAS_Modifer = 1; + + healthmod = ((1/VAS_Modifer) * Xplayer); + + // Can not be loser then Min_D_Mod + if ( healthmod <= Min_HP_Mod ) + healthmod = Min_HP_Mod; + + // Allow more then normal ? + if (healthmod >= 1.0 ) + healthmod =1.0f; + + + uint32 health = uint32(basehp * healthmod); + + if (health <= 0) + { + if ((VasDebug >= 1) ) + sLog.outString("# ERROR VAS-AutoBalance - Mob=%s Health %u <=0 setting to 1",health,VASName); + health =1; + } + + + if ((VasDebug >= 2) && (DebugByID == VASEntry)) + if ( VASbasehp != health) + { + sLog.outString("## VAS-AutoBalance MobID=%u VasMapID=%u VASName=%s GUID=%u PlayersInCreaturesInstance=%u",VASEntry,VasMapID, VASName,creature->GetGUID(),PlayersInCreaturesInstance); + sLog.outString("## VAS-AutoBalance sMapDifficulty=%s Health=%u / %u Xplayer=%4.2f healthmod=%4.2f / %4.2f VAS_Modifer=%4.2f VAS_Group_Modifer=%4.2f",sMapDifficulty.c_str(),VASbasehp,health,Xplayer,VAShealthmod,healthmod,VAS_Modifer,VAS_Group_Modifer); + sLog.outString("## VAS-AutoBalance maxPlayers=%u IsHeroic=%s IsRaid=%s IsRegularDifficulty=%s IsRaidOrHeroicDungeon=%s IsNonRaidDungeon=%s",MaxPlayers,BoolToString(IsHeroic),BoolToString(IsRaid),BoolToString(IsRegularDifficulty),BoolToString(IsRaidOrHeroicDungeon),BoolToString(IsNonRaidDungeon)); + } + + creature->SetCreateHealth(health); + creature->SetMaxHealth(health); + if (health > VASbasehp) + creature->SetHealth(health); + creature->ResetPlayerDamageReq(); + + uint32 mana = stats->GenerateMana(cinfo); + uint32 vasmana = mana; + + if (Xplayer >= 1) + { + mana = ((mana/VAS_Modifer) * Xplayer); + if ((VasDebug >= 2) && (DebugByID == VASEntry)) + if ( VASbasehp != health) + sLog.outString("## VAS-AutoBalance mana %u / %u",vasmana,mana); + } + + + creature->SetCreateMana(mana); + creature->SetMaxPower(POWER_MANA, mana); + creature->SetPower(POWER_MANA, mana); + + + creature->SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)health); + creature->SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, (float)mana); + + VAS_Modifer2 *= VAS_Damage_Modifer; + float damagemod = ((1/VAS_Modifer2) * Xplayer); + + // Can not be less then Min_D_Mod + if ( damagemod <= Min_D_Mod ) + damagemod = Min_D_Mod; + + // Allow more then normal ? + if (damagemod >= 1.0 ) + damagemod =1.0f; + + VASCreatureInfo[creature->GetGUID()].damagemod = damagemod; + + } + +}; + + + +void AddSC_VAS_AutoBalance() +{ + new VAS_AutoBalance_WorldScript; + new VAS_AutoBalance_PlayerScript; + new VAS_AutoBalance_UnitScript; +// new VAS_AutoBalance_CreatureScript; + new VAS_AutoBalance_AllCreatureScript; + new VAS_AutoBalance_AllMapScript; + new VAS_AutoBalance_WorldMapScript; +// new VAS_AutoBalance_InstanceMapScript; +// new VAS_AutoBalance_BattlegroundMapScript; +} diff -r c5ed4381633d -r e3c7b2025ab3 src/server/worldserver/worldserver.conf.dist --- a/src/server/worldserver/worldserver.conf.dist Fri Oct 01 15:05:45 2010 -0400 +++ b/src/server/worldserver/worldserver.conf.dist Fri Oct 01 15:05:45 2010 -0400 @@ -2083,3 +2083,73 @@ LevelReq.Auction = 1 LevelReq.Mail = 1 DungeonFinder.Enable = 0 + + +############################################################################### +# VAS-AutoBalance Mod +# +# VAS.AutoBalance.XPlayer +# Set Server to level of Solo mode. +# Set to 0 to Disable VAS-SOLO Mod. +# Example: VAS.SOLO.XPlayer = 1 Should set everything for a 1 player game. Setting to 2,3..10+ should set everything to 2,3 or 10+ group. +# Default set to 1 +# +# VAS.AutoBalance.AutoInstance +# Set instances to Auto change XPlayer depending on players in it. Default = 1 (1=on,0=OFF) +# +# VAS.AutoBalance.PlayerChangeNotify +# Sets Auto Notifications to all users in Instance that player multiplier has changed. Default = 1 (1=on,0=OFF) +# +# VAS.AutoBalance.Creature.Update.Timer +# Sets the Timer to update creatures in Instances when AutoInstance is on. Default is 60 secs. Do NOT set to LOW! +# +# VAS.AutoBalance Debug Information +# 0 = None +# 1 = Errors only +# 2 = Errors, Basic Information +# 3 = All +# Default VAS.SOLO.Debug = 1 +# +# VAS.AutoBalance.DebugByID +# Set NPC ID to just Debug it.# Default = 0 +# +# VAS.AutoBalance.Color +# in game Color of information for mod Default = cffFF8000 +# cffFF0000=red,cff000000=black,cffFFFF00=Yellow,cff0000FF=Blue,cffC0C0C0=Grey,cffFF8000=Orange,cff00FF40=Green,cff800000=Brown,cffC400C4=Violette +# +# +# Min.HP.Mod and Min.D.Mod +# Min Mod setting for HP or damage HPDefault 0.20 Damage 0.10 +# +# Sets MapID to group they belong to. All 5 group maps should go in VAS.SOLO.5.MapIDs, 10 man groups into VAS.SOLO.10.MapIDs and so on. +# Example: VAS.SOLO.20.MapIDs = "30,309,509" +# +# VAS.AutoBalance.XX.Name +# Sets MobIDs to group they belong to. All 5 man mobs should go in VAS.SOLO.5.Name, 10 man groups into VAS.SOLO.10.Name and so on. +# Example: VAS.SOLO.10.Name = "15689,15550,16152,17521,17225,16028,29324,31099 +# +################################################################################ + +VAS.AutoBalance.XPlayer = 1 +VAS.AutoBalance.AutoInstance = 1 +VAS.AutoBalance.Debug = 1 +VAS.AutoBalance.DebugByID = 0 +VAS.AutoBalance.PlayerChangeNotify = 1 +VAS.AutoBalance.Creature.Update.Timer = 30 +VAS.AutoBalance.Color = cffFF8000 + +Min.HP.Mod = 0.20 +Min.D.Mod = 0.10 + +VAS.AutoBalance.5.MapIDs = "33,34,36,43,47,48,70,90,109,129,189,209,230,289,329,349,389,429,540,542,543,545,546,547,552,553,554,555,556,557,558,560,585,576,574,575601,619,600,604,650,602,599,449,450,489,559,562,269" +VAS.AutoBalance.10.MapIDs = "229,532,568,615,603,529,566" +VAS.AutoBalance.20.MapIDs = "30,309,509" +VAS.AutoBalance.25.MapIDs = "534,544,548,550,564,565,580" +VAS.AutoBalance.40.MapIDs = "249,409,469,531,533" + +VAS.AutoBalance.40.Name = "11583,16441,30057,13020,15589,14435,18192,14889,14888,14887,14890,15302,15818,15742,15741,15740,18338" +VAS.AutoBalance.25.Name = "22997,21966,21965,21964,21806,21215,21845,19728,12397,17711,18256,18192," +VAS.AutoBalance.10.Name = "15689,15550,16152,17521,17225,16028,29324,31099" +VAS.AutoBalance.5.Name = "15203,15204,15205,15305,6109,26801,30508,26799,30495,26803,30497,27859,27249" +VAS.AutoBalance.2.Name = "25549,24558,25574,24559,25556,25557,25578,24561,25555,24555,25541,24553,25550,24554,24552,25564,15931,29373" + another one # HG changeset patch # User KalCorp # Date 1286244413 14400 # Branch trunk # Node ID 2e58cd1f1ae63d9c55aa564492553e92ca9a263c # Parent d4bf6638ce72042fb7b976983f07e17f84769c49 VAS Randomizer v1.00 diff -r d4bf6638ce72 -r 2e58cd1f1ae6 src/server/game/Scripting/ScriptLoader.cpp --- a/src/server/game/Scripting/ScriptLoader.cpp Fri Oct 01 15:05:45 2010 -0400 +++ b/src/server/game/Scripting/ScriptLoader.cpp Mon Oct 04 22:06:53 2010 -0400 @@ -18,6 +18,8 @@ #include "ScriptLoader.h" +void AddSC_VAS_Randomizer(); + //examples void AddSC_example_creature(); void AddSC_example_escort(); @@ -1148,6 +1150,6 @@ { #ifdef SCRIPTS /* This is where custom scripts should be added. */ - + AddSC_VAS_Randomizer(); #endif } diff -r d4bf6638ce72 -r 2e58cd1f1ae6 src/server/scripts/Custom/CMakeLists.txt --- a/src/server/scripts/Custom/CMakeLists.txt Fri Oct 01 15:05:45 2010 -0400 +++ b/src/server/scripts/Custom/CMakeLists.txt Mon Oct 04 22:06:53 2010 -0400 @@ -1,5 +1,6 @@ set(scripts_STAT_SRCS ${scripts_STAT_SRCS} + Custom/VAS_Randomizer.cpp ) message(" -> Prepared: Custom") diff -r d4bf6638ce72 -r 2e58cd1f1ae6 src/server/scripts/Custom/VAS_Randomizer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/server/scripts/Custom/VAS_Randomizer.cpp Mon Oct 04 22:06:53 2010 -0400 @@ -0,0 +1,217 @@ +#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "Configuration/Config.h" + + +float VAS_version = 1.00f; + +float VAS_Script_Hook_VersionNeeded = 1.02f; +float VAS_Hook_Version_Installed = 0.0f; +bool VAS_Hook_Check = false; +int VasDebug = 1; +std::string VAS_Randomizer_Color = "cffFF8000"; + + + struct sVASCreatureInfo + { + uint32 CoolDown; + int LastPlayerCount; + float damagemod; + }; + static std::map<uint32, sVASCreatureInfo> VASCreatureInfo; + + +class VAS_Randomizer_WorldScript : public WorldScript +{ + public: + VAS_Randomizer_WorldScript() + : WorldScript("VAS_Randomizer_WorldScript") + { + } + + void SetInitialWorldSettings() + { + // Added so you can not compile without needed VAS_Script_Hooks! + VAS_Hook_Version_Installed = sScriptMgr.VAS_Script_Hooks(); + + sLog.outString("----------------------------------------------------"); + sLog.outString(" Powered by {VAS} Randomizer v%4.2f ",VAS_version); + sLog.outString("----------------------------------------------------"); + + VasDebug = sConfig.GetIntDefault("VAS.Randomizer.Debug",1); + + if (VAS_Hook_Version_Installed >= VAS_Script_Hook_VersionNeeded) + { + sLog.outString(" VAS_Script_Hooks v%4.2f Found",VAS_Hook_Version_Installed); + } + else + { + sLog.outString(" VAS_Script_Hooks v%4.2f Found",VAS_Hook_Version_Installed); + sLog.outString(" This Mod needs %4.2f+ to run correctly!",VAS_Script_Hook_VersionNeeded); + } + + sLog.outString("----------------------------------------------------\\n"); + } +}; + +class VAS_Randomizer_AllCreatureScript : public AllCreatureScript +{ + public: + VAS_Randomizer_AllCreatureScript() + : AllCreatureScript("VAS_Randomizer_AllCreatureScript") + { + } + + + void Creature_SelectLevel(const CreatureInfo *cinfo, Creature* creature) + { + + float scale = 1.0; + + if (creature->GetCreatureType() == CREATURE_TYPE_CRITTER) + { + scale = rand()%100; + scale = 0.50 + (scale/100); + } + else + { + scale = rand()%30; + scale = 0.85 + (scale/100); + } + + creature->SetFloatValue(OBJECT_FIELD_SCALE_X,creature->GetFloatValue(OBJECT_FIELD_SCALE_X)*scale); + VAS_Modifer_Health_Mana(creature, scale); + + } + + void VAS_Modifer_Health_Mana(Creature* creature, float VAS_Modifer) + { + + CreatureInfo const *cinfo = creature->GetCreatureInfo(); + int VASEntry = cinfo->Entry; + + uint8 minlevel = std::min(cinfo->maxlevel, cinfo->minlevel); + uint8 maxlevel = std::max(cinfo->maxlevel, cinfo->minlevel); + uint8 level = minlevel == maxlevel ? minlevel : urand(minlevel, maxlevel); + creature->SetLevel(level); + + CreatureBaseStats const* stats = sObjectMgr.GetCreatureBaseStats(level, cinfo->unit_class); + + float healthmod = 1.0f; + uint32 basehp = stats->GenerateHealth(cinfo); + + float VAShealthmod = healthmod; + char *const VASName = cinfo->Name; + + healthmod *= VAS_Modifer; + + if (healthmod <= 0 ) + healthmod =1.0f; + + uint32 health = uint32(basehp * healthmod); + + if (health <= 0) + health =1; + + + creature->SetCreateHealth(health); + creature->SetMaxHealth(health); + + creature->ResetPlayerDamageReq(); + + uint32 mana = stats->GenerateMana(cinfo); + + mana *= VAS_Modifer; + + creature->SetCreateMana(mana); + creature->SetMaxPower(POWER_MANA, mana); + creature->SetPower(POWER_MANA, mana); + + creature->SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)health); + creature->SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, (float)mana); + + float damagemod = 1*VAS_Modifer; + + VASCreatureInfo[creature->GetGUID()].damagemod = damagemod; + } +}; + +class VAS_Randomizer_PlayerScript : public PlayerScript +{ + public: + VAS_Randomizer_PlayerScript() + : PlayerScript("VAS_Randomizer_PlayerScript") + { + } + + void OnLogin(Player *Player) + { + ChatHandler chH = ChatHandler(Player); + chH.PSendSysMessage("\\n|%s----------------------------------------------------|r",VAS_Randomizer_Color.c_str()); + chH.PSendSysMessage("|%s Powered by {VAS} Randomizer v%4.2f |r ",VAS_Randomizer_Color.c_str(),VAS_version); + chH.PSendSysMessage("|%s----------------------------------------------------|r \\n",VAS_Randomizer_Color.c_str()); + } +}; + + +class VAS_Randomizer_UnitScript : public UnitScript +{ + public: + VAS_Randomizer_UnitScript() + : UnitScript("VAS_Randomizer_UnitScript") + { + } + + void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType, bool crit) + { + + if (damageInfo->attacker->GetMap()->IsDungeon() && damageInfo->target->GetMap()->IsDungeon() || damageInfo->attacker->GetMap()->IsBattleground() && damageInfo->target->GetMap()->IsBattleground()) + if (damageInfo->attacker->GetTypeId() != TYPEID_PLAYER) + { + float damagemod = VASCreatureInfo[damageInfo->attacker->GetGUID()].damagemod; + if (damagemod <= 0) + damagemod =1.0f; + damageInfo->damage *= damagemod; + } + return; + } + + void CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *damageInfo, WeaponAttackType attackType) + { + + if (damageInfo->attacker->GetMap()->IsDungeon() && damageInfo->target->GetMap()->IsDungeon() || damageInfo->attacker->GetMap()->IsBattleground() && damageInfo->target->GetMap()->IsBattleground()) + if (damageInfo->attacker->GetTypeId() != TYPEID_PLAYER) + { + float damagemod = VASCreatureInfo[damageInfo->attacker->GetGUID()].damagemod; + if (damagemod <= 0) + damagemod =1.0f; + damageInfo->damage *= damagemod; + } + return; + } + + uint32 VAS_Modifer_DealDamage(Unit* AttackerUnit,uint32 damage) + { + + float damagemod = VASCreatureInfo[AttackerUnit->GetGUID()].damagemod; + + if (damagemod <= 0) + damagemod =1.0f; + + return damage*damagemod; + + } + +}; + + + +void AddSC_VAS_Randomizer() +{ + new VAS_Randomizer_WorldScript; + new VAS_Randomizer_AllCreatureScript; + new VAS_Randomizer_UnitScript; +} + + +
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use