diff options
| author | azazel <none@none> | 2010-08-23 22:58:32 +0600 |
|---|---|---|
| committer | azazel <none@none> | 2010-08-23 22:58:32 +0600 |
| commit | caa3a58213789e7f7349e700084213b5a60ec598 (patch) | |
| tree | e07ab9a15a69f7c9e28a0b6bd9af86af52e683cb /src/server/scripts | |
| parent | ad5c8cadf10fc73f7bf103e8eb50d18242014156 (diff) | |
Core:
* add Player::HasEnoughMoney methods to check, whether player has specified amount of money and use new methods where applicable
* fix some signed/unsigned warnings and some typos
--HG--
branch : trunk
Diffstat (limited to 'src/server/scripts')
7 files changed, 37 insertions, 37 deletions
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index ed0d0fd5ba3..61aed76f1a8 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -310,7 +310,7 @@ class boss_akilzon : public CreatureScript CallLighting_Timer = (12 + rand()%5)*1000; //totaly random timer. can't find any info on this } else CallLighting_Timer -= diff; - if (!isRaining && ElectricalStorm_Timer < 8000 + rand()%5000) + if (!isRaining && ElectricalStorm_Timer < uint32(8000 + rand() % 5000)) { SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f); isRaining = true; diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp index b1614946050..65677e5156d 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp @@ -248,7 +248,7 @@ public: if (Phase == FEEDING && pEmbraceTarget && pEmbraceTarget->isAlive()) { uiEmbraceTakenDamage += damage; - if (uiEmbraceTakenDamage > DUNGEON_MODE(DATA_EMBRACE_DMG, H_DATA_EMBRACE_DMG)) + if (uiEmbraceTakenDamage > (uint32) DUNGEON_MODE(DATA_EMBRACE_DMG, H_DATA_EMBRACE_DMG)) { Phase = NORMAL; uiPhaseTimer = 0; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp index 13e0b91dff9..ee3c89eac72 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp @@ -122,8 +122,8 @@ public: events.ScheduleEvent(EVENT_BERSERK, 5*60000); break; case EVENT_SUMMON: - for (uint32 i = 0; i < RAID_MODE(1,2); ++i) - DoSummon(MOB_ZOMBIE, PosSummon[rand()%3]); + for (int32 i = 0; i < RAID_MODE(1, 2); ++i) + DoSummon(MOB_ZOMBIE, PosSummon[rand() % 3]); events.ScheduleEvent(EVENT_SUMMON, 10000); break; } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp index 9c98646e604..54f7dc019f1 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp @@ -1151,12 +1151,12 @@ public: // Start encounter if (uiAction == 0) { - for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) - DoSummon(VEHICLE_SIEGE, PosSiege[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); - for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) - DoSummon(VEHICLE_CHOPPER, PosChopper[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); - for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) - DoSummon(VEHICLE_DEMOLISHER,PosDemolisher[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); + for (int32 i = 0; i < RAID_MODE(2, 5); ++i) + DoSummon(VEHICLE_SIEGE, PosSiege[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); + for (int32 i = 0; i < RAID_MODE(2, 5); ++i) + DoSummon(VEHICLE_CHOPPER, PosChopper[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); + for (int32 i = 0; i < RAID_MODE(2, 5); ++i) + DoSummon(VEHICLE_DEMOLISHER, PosDemolisher[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); return; } } diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 45b29900e7a..1227f41ca30 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -951,7 +951,7 @@ public: return; Event = EVENT_NULL; - for (uint32 i = 1; i <= MaxTimer[Phase]; ++i) + for (int32 i = 1; i <= MaxTimer[Phase]; ++i) { if (Timer[i]) // Event is enabled if (Timer[i] <= diff) diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index 6a7357b35cc..f27763c970e 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -185,17 +185,17 @@ there is no difference here (except that default text is chosen with `gameobject # formulas to calculate unlearning cost ###*/ -uint32 DoLearnCost(Player* /*pPlayer*/) //tailor, alchemy +int32 DoLearnCost(Player* /*pPlayer*/) //tailor, alchemy { return 200000; } -uint32 DoHighUnlearnCost(Player* /*pPlayer*/) //tailor, alchemy +int32 DoHighUnlearnCost(Player* /*pPlayer*/) //tailor, alchemy { return 1500000; } -uint32 DoMedUnlearnCost(Player* pPlayer) //blacksmith, leatherwork +int32 DoMedUnlearnCost(Player* pPlayer) //blacksmith, leatherwork { uint8 level = pPlayer->getLevel(); if (level < 51) @@ -206,7 +206,7 @@ uint32 DoMedUnlearnCost(Player* pPlayer) //blacksmith, leath return 1000000; } -uint32 DoLowUnlearnCost(Player* pPlayer) //blacksmith +int32 DoLowUnlearnCost(Player* pPlayer) //blacksmith { uint8 level = pPlayer->getLevel(); if (level < 66) @@ -412,7 +412,7 @@ public: break; //Learn Alchemy case GOSSIP_ACTION_INFO_DEF + 1: - if (!pPlayer->HasSpell(S_TRANSMUTE) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) + if (!pPlayer->HasSpell(S_TRANSMUTE) && pPlayer->HasEnoughMoney(DoLearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_LEARN_TRANSMUTE, true); pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); @@ -421,7 +421,7 @@ public: pPlayer->CLOSE_GOSSIP_MENU(); break; case GOSSIP_ACTION_INFO_DEF + 2: - if (!pPlayer->HasSpell(S_ELIXIR) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) + if (!pPlayer->HasSpell(S_ELIXIR) && pPlayer->HasEnoughMoney(DoLearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_LEARN_ELIXIR, true); pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); @@ -430,7 +430,7 @@ public: pPlayer->CLOSE_GOSSIP_MENU(); break; case GOSSIP_ACTION_INFO_DEF + 3: - if (!pPlayer->HasSpell(S_POTION) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) + if (!pPlayer->HasSpell(S_POTION) && pPlayer->HasEnoughMoney(DoLearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_LEARN_POTION, true); pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); @@ -440,7 +440,7 @@ public: break; //Unlearn Alchemy case GOSSIP_ACTION_INFO_DEF + 4: - if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + if (pPlayer->HasEnoughMoney(DoHighUnlearnCost(pPlayer))) { pCreature->CastSpell(pPlayer, S_UNLEARN_TRANSMUTE, true); pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); @@ -449,7 +449,7 @@ public: pPlayer->CLOSE_GOSSIP_MENU(); break; case GOSSIP_ACTION_INFO_DEF + 5: - if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + if (pPlayer->HasEnoughMoney(DoHighUnlearnCost(pPlayer))) { pCreature->CastSpell(pPlayer, S_UNLEARN_ELIXIR, true); pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); @@ -458,7 +458,7 @@ public: pPlayer->CLOSE_GOSSIP_MENU(); break; case GOSSIP_ACTION_INFO_DEF + 6: - if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + if (pPlayer->HasEnoughMoney(DoHighUnlearnCost(pPlayer))) { pCreature->CastSpell(pPlayer, S_UNLEARN_POTION, true); pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); @@ -650,7 +650,7 @@ public: } else if (EquippedOk(pPlayer,S_UNLEARN_WEAPON)) { - if (pPlayer->GetMoney() >= DoLowUnlearnCost(pPlayer)) + if (pPlayer->HasEnoughMoney(DoLowUnlearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_UNLEARN_WEAPON, true); ProfessionUnlearnSpells(pPlayer, S_UNLEARN_WEAPON); @@ -669,7 +669,7 @@ public: case GOSSIP_ACTION_INFO_DEF + 4: if (EquippedOk(pPlayer,S_UNLEARN_ARMOR)) { - if (pPlayer->GetMoney() >= DoLowUnlearnCost(pPlayer)) + if (pPlayer->HasEnoughMoney(DoLowUnlearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_UNLEARN_ARMOR, true); ProfessionUnlearnSpells(pPlayer, S_UNLEARN_ARMOR); @@ -698,7 +698,7 @@ public: case GOSSIP_ACTION_INFO_DEF + 8: if (EquippedOk(pPlayer,S_UNLEARN_HAMMER)) { - if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + if (pPlayer->HasEnoughMoney(DoMedUnlearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_UNLEARN_HAMMER, true); ProfessionUnlearnSpells(pPlayer, S_UNLEARN_HAMMER); @@ -712,7 +712,7 @@ public: case GOSSIP_ACTION_INFO_DEF + 9: if (EquippedOk(pPlayer,S_UNLEARN_AXE)) { - if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + if (pPlayer->HasEnoughMoney(DoMedUnlearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_UNLEARN_AXE, true); ProfessionUnlearnSpells(pPlayer, S_UNLEARN_AXE); @@ -726,7 +726,7 @@ public: case GOSSIP_ACTION_INFO_DEF + 10: if (EquippedOk(pPlayer,S_UNLEARN_SWORD)) { - if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + if (pPlayer->HasEnoughMoney(DoMedUnlearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_UNLEARN_SWORD, true); ProfessionUnlearnSpells(pPlayer, S_UNLEARN_SWORD); @@ -1012,7 +1012,7 @@ public: case GOSSIP_ACTION_INFO_DEF + 1: if (EquippedOk(pPlayer,S_UNLEARN_DRAGON)) { - if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + if (pPlayer->HasEnoughMoney(DoMedUnlearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_UNLEARN_DRAGON, true); ProfessionUnlearnSpells(pPlayer, S_UNLEARN_DRAGON); @@ -1026,7 +1026,7 @@ public: case GOSSIP_ACTION_INFO_DEF + 2: if (EquippedOk(pPlayer,S_UNLEARN_ELEMENTAL)) { - if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + if (pPlayer->HasEnoughMoney(DoMedUnlearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_UNLEARN_ELEMENTAL, true); ProfessionUnlearnSpells(pPlayer, S_UNLEARN_ELEMENTAL); @@ -1040,7 +1040,7 @@ public: case GOSSIP_ACTION_INFO_DEF + 3: if (EquippedOk(pPlayer,S_UNLEARN_TRIBAL)) { - if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + if (pPlayer->HasEnoughMoney(DoMedUnlearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_UNLEARN_TRIBAL, true); ProfessionUnlearnSpells(pPlayer, S_UNLEARN_TRIBAL); @@ -1166,7 +1166,7 @@ public: break; //Learn Tailor case GOSSIP_ACTION_INFO_DEF + 1: - if (!pPlayer->HasSpell(S_SPELLFIRE) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) + if (!pPlayer->HasSpell(S_SPELLFIRE) && pPlayer->HasEnoughMoney(DoLearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_LEARN_SPELLFIRE, true); pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); @@ -1175,7 +1175,7 @@ public: pPlayer->CLOSE_GOSSIP_MENU(); break; case GOSSIP_ACTION_INFO_DEF + 2: - if (!pPlayer->HasSpell(S_MOONCLOTH) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) + if (!pPlayer->HasSpell(S_MOONCLOTH) && pPlayer->HasEnoughMoney(DoLearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_LEARN_MOONCLOTH, true); pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); @@ -1184,7 +1184,7 @@ public: pPlayer->CLOSE_GOSSIP_MENU(); break; case GOSSIP_ACTION_INFO_DEF + 3: - if (!pPlayer->HasSpell(S_SHADOWEAVE) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) + if (!pPlayer->HasSpell(S_SHADOWEAVE) && pPlayer->HasEnoughMoney(DoLearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_LEARN_SHADOWEAVE, true); pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); @@ -1196,7 +1196,7 @@ public: case GOSSIP_ACTION_INFO_DEF + 4: if (EquippedOk(pPlayer,S_UNLEARN_SPELLFIRE)) { - if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + if (pPlayer->HasEnoughMoney(DoHighUnlearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_UNLEARN_SPELLFIRE, true); ProfessionUnlearnSpells(pPlayer, S_UNLEARN_SPELLFIRE); @@ -1210,7 +1210,7 @@ public: case GOSSIP_ACTION_INFO_DEF + 5: if (EquippedOk(pPlayer,S_UNLEARN_MOONCLOTH)) { - if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + if (pPlayer->HasEnoughMoney(DoHighUnlearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_UNLEARN_MOONCLOTH, true); ProfessionUnlearnSpells(pPlayer, S_UNLEARN_MOONCLOTH); @@ -1224,7 +1224,7 @@ public: case GOSSIP_ACTION_INFO_DEF + 6: if (EquippedOk(pPlayer,S_UNLEARN_SHADOWEAVE)) { - if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + if (pPlayer->HasEnoughMoney(DoHighUnlearnCost(pPlayer))) { pPlayer->CastSpell(pPlayer, S_UNLEARN_SHADOWEAVE, true); ProfessionUnlearnSpells(pPlayer, S_UNLEARN_SHADOWEAVE); diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index b5e472763ab..a1fd2700f89 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1314,7 +1314,7 @@ public: case GOSSIP_OPTION_LEARNDUALSPEC: if (pPlayer->GetSpecsCount() == 1 && !(pPlayer->getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL))) { - if (pPlayer->GetMoney() < 10000000) + if (!pPlayer->HasEnoughMoney(10000000)) { pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0); pPlayer->PlayerTalkClass->CloseGossip(); @@ -2582,7 +2582,7 @@ public: } if (doSwitch) { - if (pPlayer->GetMoney() < EXP_COST) + if (!pPlayer->HasEnoughMoney(EXP_COST)) pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0); else if (noXPGain) { |
