diff options
Diffstat (limited to 'src')
| -rwxr-xr-x | src/server/game/AI/CoreAI/PetAI.cpp | 16 | ||||
| -rwxr-xr-x | src/server/game/AI/CoreAI/PetAI.h | 2 | ||||
| -rw-r--r-- | src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 23 | ||||
| -rw-r--r-- | src/server/game/Battlefield/Zones/BattlefieldWG.h | 109 | ||||
| -rwxr-xr-x | src/server/game/Battlegrounds/Battleground.cpp | 29 | ||||
| -rwxr-xr-x | src/server/game/Entities/GameObject/GameObject.cpp | 1 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 10 | ||||
| -rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 2 | ||||
| -rwxr-xr-x | src/server/game/Globals/ObjectMgr.h | 2 | ||||
| -rw-r--r-- | src/server/game/Handlers/CharacterHandler.cpp | 4 | ||||
| -rwxr-xr-x | src/server/game/Spells/Spell.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 4 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_modify.cpp | 29 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_item.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/World/npcs_special.cpp | 2 | ||||
| -rwxr-xr-x | src/server/shared/Utilities/Util.cpp | 31 | ||||
| -rwxr-xr-x | src/server/shared/Utilities/Util.h | 2 |
17 files changed, 115 insertions, 155 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 99cf1cda4fc..6802c109401 100755 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -71,6 +71,8 @@ void PetAI::_stopAttack() } me->AttackStop(); + me->InterruptNonMeleeSpells(false); + me->SendMeleeAttackStop(); // Should stop pet's attack button from flashing me->GetCharmInfo()->SetIsCommandAttack(false); HandleReturnMovement(); } @@ -89,7 +91,8 @@ void PetAI::UpdateAI(const uint32 diff) m_updateAlliesTimer -= diff; // me->getVictim() can't be used for check in case stop fighting, me->getVictim() clear at Unit death etc. - if (me->getVictim()) + // Must also check if victim is alive + if (me->getVictim() && me->getVictim()->isAlive()) { // is only necessary to stop casting, the pet must not exit combat if (me->getVictim()->HasBreakableByDamageCrowdControlAura(me)) @@ -121,10 +124,16 @@ void PetAI::UpdateAI(const uint32 diff) if (nextTarget) AttackStart(nextTarget); else + { + me->GetCharmInfo()->SetIsCommandAttack(false); HandleReturnMovement(); + } } else + { + me->GetCharmInfo()->SetIsCommandAttack(false); HandleReturnMovement(); + } } else if (owner && !me->HasUnitState(UNIT_STATE_FOLLOW)) // no charm info and no victim HandleReturnMovement(); @@ -301,7 +310,7 @@ void PetAI::KilledUnit(Unit* victim) // Can't use _stopAttack() because that activates movement handlers and ignores // next target selection me->AttackStop(); - me->GetCharmInfo()->SetIsCommandAttack(false); + me->InterruptNonMeleeSpells(false); me->SendMeleeAttackStop(); // Stops the pet's 'Attack' button from flashing Unit* nextTarget = SelectNextTarget(); @@ -309,7 +318,10 @@ void PetAI::KilledUnit(Unit* victim) if (nextTarget) AttackStart(nextTarget); else + { + me->GetCharmInfo()->SetIsCommandAttack(false); HandleReturnMovement(); // Return + } } void PetAI::AttackStart(Unit* target) diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h index 8e5311fa000..d7f1dca3fbf 100755 --- a/src/server/game/AI/CoreAI/PetAI.h +++ b/src/server/game/AI/CoreAI/PetAI.h @@ -32,8 +32,6 @@ class PetAI : public CreatureAI explicit PetAI(Creature* c); void EnterEvadeMode(); - void JustDied(Unit* /*who*/) { _stopAttack(); } - void UpdateAI(const uint32); static int Permissible(const Creature*); diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 119880bae8d..59dc6761583 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -188,29 +188,6 @@ bool BattlefieldWG::SetupBattlefield() go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]); } - // Spawn banners in the keep - for (uint8 i = 0; i < WG_KEEPGAMEOBJECT_MAX; i++) - { - if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryHorde, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) - { - go->SetRespawnTime(GetDefenderTeam()? RESPAWN_ONE_DAY : RESPAWN_IMMEDIATELY); - m_KeepGameObject[1].insert(go); - } - if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryAlliance, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) - { - go->SetRespawnTime(GetDefenderTeam()? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); - m_KeepGameObject[0].insert(go); - } - } - - // Show defender banner in keep - for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr) - (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); - - // Hide attackant banner in keep - for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr) - (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); - UpdateCounterVehicle(true); return true; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 323f7f2b13d..49ea25a5e04 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -440,10 +440,9 @@ uint32 const VehNumWorldState[] = { 3680, 3490 }; uint32 const MaxVehNumWorldState[] = { 3681, 3491 }; uint32 const ClockWorldState[] = { 3781, 4354 }; uint32 const WintergraspFaction[] = { 1732, 1735, 35 }; -float const WintergraspStalkerPos[] = { 0, 0, 0, 0 }; +float const WintergraspStalkerPos[] = { 4948.985f, 2937.789f, 550.5172f, 1.815142f }; uint8 const WG_MAX_OBJ = 32; -uint8 const WG_KEEPGAMEOBJECT_MAX = 44; uint8 const WG_MAX_TURRET = 15; uint8 const WG_MAX_KEEP_NPC = 39; uint8 const WG_MAX_OUTSIDE_NPC = 14; @@ -580,6 +579,19 @@ struct WintergraspBuildingSpawnData uint32 nameId; }; +struct WintergraspRebuildableBuildingData +{ + uint32 entry; + uint64 Guid; + uint32 WorldState; + float x; + float y; + float z; + float o; + uint32 type; + uint32 nameId; +}; + const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = { // Wall (Not spawned in db) @@ -628,99 +640,6 @@ const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = { GO_WINTERGRASP_VAULT_GATE, 3773, 5397.11f, 2841.54f, 425.899f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST, 0 }, }; - -// ********************************************************* -// **********Keep Element(GameObject,Creature)************** -// ********************************************************* - -// Keep gameobject -// 192488 : 10 in sql, 19 in header -// 192501 : 12 in sql, 17 in header -// 192416 : 1 in sql, 33 in header -// 192374 : 1 in sql, 1 in header -// 192375 : 1 in sql, 1 in header -// 192336 : 1 in sql, 1 in header -// 192255 : 1 in sql, 1 in header -// 192269 : 1 in sql, 7 in header -// 192254 : 1 in sql, 1 in header -// 192349 : 1 in sql, 1 in header -// 192366 : 1 in sql, 3 in header -// 192367 : 1 in sql, 1 in header -// 192364 : 1 in sql, 1 in header -// 192370 : 1 in sql, 1 in header -// 192369 : 1 in sql, 1 in header -// 192368 : 1 in sql, 1 in header -// 192362 : 1 in sql, 1 in header -// 192363 : 1 in sql, 1 in header -// 192379 : 1 in sql, 1 in header -// 192378 : 1 in sql, 1 in header -// 192355 : 1 in sql, 1 in header -// 192354 : 1 in sql, 1 in header -// 192358 : 1 in sql, 1 in header -// 192359 : 1 in sql, 1 in header -// 192338 : 1 in sql, 1 in header -// 192339 : 1 in sql, 1 in header -// 192284 : 1 in sql, 1 in header -// 192285 : 1 in sql, 1 in header -// 192371 : 1 in sql, 1 in header -// 192372 : 1 in sql, 1 in header -// 192373 : 1 in sql, 1 in header -// 192360 : 1 in sql, 1 in header -// 192361 : 1 in sql, 1 in header -// 192356 : 1 in sql, 1 in header -// 192352 : 1 in sql, 1 in header -// 192353 : 1 in sql, 1 in header -// 192357 : 1 in sql, 1 in header -// 192350 : 1 in sql, 1 in header -// 192351 : 1 in sql, 1 in header -const WintergraspObjectPositionData WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = -{ - { 5262.540039f, 3047.949951f, 432.054993f, 3.106650f, 192488, 192501 }, // Flag on tower - { 5272.939941f, 2976.550049f, 444.492004f, 3.124120f, 192374, 192416 }, // Flag on Wall Intersect - { 5235.189941f, 2941.899902f, 444.278015f, 1.588250f, 192375, 192416 }, // Flag on Wall Intersect - { 5163.129883f, 2952.590088f, 433.502991f, 1.535890f, 192488, 192501 }, // Flag on tower - { 5145.109863f, 2935.000000f, 433.385986f, 3.141590f, 192488, 192501 }, // Flag on tower - { 5158.810059f, 2883.129883f, 431.618011f, 3.141590f, 192488, 192416 }, // Flag on wall - { 5154.490234f, 2862.149902f, 445.011993f, 3.141590f, 192336, 192416 }, // Flag on Wall Intersect - { 5154.520020f, 2853.310059f, 409.183014f, 3.141590f, 192255, 192269 }, // Flag on the floor - { 5154.459961f, 2828.939941f, 409.188995f, 3.141590f, 192254, 192269 }, // Flag on the floor - { 5155.310059f, 2820.739990f, 444.979004f, -3.13286f, 192349, 192416 }, // Flag on wall intersect - { 5160.339844f, 2798.610107f, 430.769012f, 3.141590f, 192488, 192416 }, // Flag on wall - { 5146.040039f, 2747.209961f, 433.584015f, 3.071770f, 192488, 192501 }, // Flag on tower - { 5163.779785f, 2729.679932f, 433.394012f, -1.58825f, 192488, 192501 }, // Flag on tower - { 5236.270020f, 2739.459961f, 444.992004f, -1.59698f, 192366, 192416 }, // Flag on wall intersect - { 5271.799805f, 2704.870117f, 445.183014f, -3.13286f, 192367, 192416 }, // Flag on wall intersect - { 5260.819824f, 2631.800049f, 433.324005f, 3.054330f, 192488, 192501 }, // Flag on tower - { 5278.379883f, 2613.830078f, 433.408997f, -1.58825f, 192488, 192501 }, // Flag on tower - { 5350.879883f, 2622.719971f, 444.686005f, -1.57080f, 192364, 192416 }, // Flag on wall intersect - { 5392.270020f, 2639.739990f, 435.330994f, 1.509710f, 192370, 192416 }, // Flag on wall intersect - { 5350.950195f, 2640.360107f, 435.407990f, 1.570800f, 192369, 192416 }, // Flag on wall intersect - { 5289.459961f, 2704.679932f, 435.875000f, -0.01745f, 192368, 192416 }, // Flag on wall intersect - { 5322.120117f, 2763.610107f, 444.973999f, -1.55334f, 192362, 192416 }, // Flag on wall intersect - { 5363.609863f, 2763.389893f, 445.023987f, -1.54462f, 192363, 192416 }, // Flag on wall intersect - { 5363.419922f, 2781.030029f, 435.763000f, 1.570800f, 192379, 192416 }, // Flag on wall intersect - { 5322.020020f, 2781.129883f, 435.811005f, 1.570800f, 192378, 192416 }, // Flag on wall intersect - { 5288.919922f, 2820.219971f, 435.721008f, 0.017452f, 192355, 192416 }, // Flag on wall intersect - { 5288.410156f, 2861.790039f, 435.721008f, 0.017452f, 192354, 192416 }, // Flag on wall intersect - { 5322.229980f, 2899.429932f, 435.808014f, -1.58825f, 192358, 192416 }, // Flag on wall intersect - { 5364.350098f, 2899.399902f, 435.838989f, -1.57080f, 192359, 192416 }, // Flag on wall intersect - { 5397.759766f, 2873.080078f, 455.460999f, 3.106650f, 192338, 192416 }, // Flag on keep - { 5397.390137f, 2809.330078f, 455.343994f, 3.106650f, 192339, 192416 }, // Flag on keep - { 5372.479980f, 2862.500000f, 409.049011f, 3.141590f, 192284, 192269 }, // Flag on floor - { 5371.490234f, 2820.800049f, 409.177002f, 3.141590f, 192285, 192269 }, // Flag on floor - { 5364.290039f, 2916.939941f, 445.330994f, 1.579520f, 192371, 192416 }, // Flag on wall intersect - { 5322.859863f, 2916.949951f, 445.153992f, 1.562070f, 192372, 192416 }, // Flag on wall intersect - { 5290.350098f, 2976.560059f, 435.221008f, 0.017452f, 192373, 192416 }, // Flag on wall intersect - { 5352.370117f, 3037.090088f, 435.252014f, -1.57080f, 192360, 192416 }, // Flag on wall intersect - { 5392.649902f, 3037.110107f, 433.713013f, -1.52716f, 192361, 192416 }, // Flag on wall intersect - { 5237.069824f, 2757.030029f, 435.795990f, 1.518440f, 192356, 192416 }, // Flag on wall intersect - { 5173.020020f, 2820.929932f, 435.720001f, 0.017452f, 192352, 192416 }, // Flag on wall intersect - { 5172.109863f, 2862.570068f, 435.721008f, 0.017452f, 192353, 192416 }, // Flag on wall intersect - { 5235.339844f, 2924.340088f, 435.040009f, -1.57080f, 192357, 192416 }, // Flag on wall intersect - { 5270.689941f, 2861.780029f, 445.058014f, -3.11539f, 192350, 192416 }, // Flag on wall intersect - { 5271.279785f, 2820.159912f, 445.200989f, -3.13286f, 192351, 192416 } // Flag on wall intersect -}; - const Position WGTurret[WG_MAX_TURRET] = { { 5391.19f, 3060.8f, 419.616f, 1.69557f }, diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 1b303760095..699445f8ccc 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -530,20 +530,23 @@ inline void Battleground::_ProcessJoin(uint32 diff) player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION); player->ResetAllPowers(); - // remove auras with duration lower than 30s - Unit::AuraApplicationMap & auraMap = player->GetAppliedAuras(); - for (Unit::AuraApplicationMap::iterator iter = auraMap.begin(); iter != auraMap.end();) + if (!player->isGameMaster()) { - AuraApplication * aurApp = iter->second; - Aura* aura = aurApp->GetBase(); - if (!aura->IsPermanent() - && aura->GetDuration() <= 30*IN_MILLISECONDS - && aurApp->IsPositive() - && (!(aura->GetSpellInfo()->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)) - && (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY))) - player->RemoveAura(iter); - else - ++iter; + // remove auras with duration lower than 30s + Unit::AuraApplicationMap & auraMap = player->GetAppliedAuras(); + for (Unit::AuraApplicationMap::iterator iter = auraMap.begin(); iter != auraMap.end();) + { + AuraApplication * aurApp = iter->second; + Aura* aura = aurApp->GetBase(); + if (!aura->IsPermanent() + && aura->GetDuration() <= 30*IN_MILLISECONDS + && aurApp->IsPositive() + && (!(aura->GetSpellInfo()->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)) + && (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY))) + player->RemoveAura(iter); + else + ++iter; + } } } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 5a5e4c5c848..d152dc5642f 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -217,6 +217,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa SetDisplayId(goinfo->displayId); + m_model = GameObjectModel::Create(*this); // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3 SetGoType(GameobjectTypes(goinfo->type)); SetGoState(go_state); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index ddd52ff352f..9a0b21194cd 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1564,6 +1564,16 @@ void Player::Update(uint32 p_time) // check every second if (now > m_Last_tick + 1) UpdateSoulboundTradeItems(); + + // If mute expired, remove it from the DB + if (GetSession()->m_muteTime && GetSession()->m_muteTime < now) + { + GetSession()->m_muteTime = 0; + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); + stmt->setInt64(0, 0); // Set the mute time to 0 + stmt->setUInt32(1, GetSession()->GetAccountId()); + LoginDatabase.Execute(stmt); + } if (!m_timedquests.empty()) { diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 669f89a1b8d..3945d3b76fe 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -7565,7 +7565,7 @@ SpellScriptsBounds ObjectMgr::GetSpellScriptsBounds(uint32 spell_id) } // this allows calculating base reputations to offline players, just by race and class -int32 ObjectMgr::GetBaseReputation(FactionEntry const* factionEntry, uint8 race, uint8 playerClass) +int32 ObjectMgr::GetBaseReputationOff(FactionEntry const* factionEntry, uint8 race, uint8 playerClass) { if (!factionEntry) return 0; diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index e727b9724e5..61094d60c55 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -743,7 +743,7 @@ class ObjectMgr return NULL; } - int32 GetBaseReputation(FactionEntry const* factionEntry, uint8 race, uint8 playerClass); + int32 GetBaseReputationOff(FactionEntry const* factionEntry, uint8 race, uint8 playerClass); RepSpilloverTemplate const* GetRepSpilloverTemplate(uint32 factionId) const { diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index a37362ce7bc..77d1c05abf2 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -2122,10 +2122,10 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) FactionEntry const* factionEntry = sFactionStore.LookupEntry(oldReputation); // old base reputation - int32 oldBaseRep = sObjectMgr->GetBaseReputation(factionEntry, oldRace, playerClass); + int32 oldBaseRep = sObjectMgr->GetBaseReputationOff(factionEntry, oldRace, playerClass); // new base reputation - int32 newBaseRep = sObjectMgr->GetBaseReputation(sFactionStore.LookupEntry(newReputation), race, playerClass); + int32 newBaseRep = sObjectMgr->GetBaseReputationOff(sFactionStore.LookupEntry(newReputation), race, playerClass); // final reputation shouldnt change int32 FinalRep = oldDBRep + oldBaseRep; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index c092776bc14..04a371ba776 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5655,7 +5655,7 @@ SpellCastResult Spell::CheckCasterAuras() const break; } } - if (foundNotStun) + if (foundNotStun && m_spellInfo->Id != 22812) prevented_reason = SPELL_FAILED_STUNNED; } else diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index ab6c2b1df8b..eb5c26a1c71 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3514,6 +3514,10 @@ void SpellMgr::LoadDbcDataCorrections() case 71085: // Mana Void (periodic aura) spellInfo->DurationIndex = 9; // 30 seconds (missing) break; + case 72015: // Frostbolt Volley (only heroic) + case 72016: // Frostbolt Volley (only heroic) + spellInfo->EffectRadiusIndex[2] = EFFECT_RADIUS_40_YARDS; + break; case 70936: // Summon Suppressor (needs target selection script) spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; spellInfo->EffectImplicitTargetB[0] = 0; diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index f527d7fb275..c370c70a94a 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -1003,15 +1003,19 @@ public: if (handler->HasLowerSecurity(target, 0)) return false; - int32 addmoney = atoi((char*)args); + int64 moneyToAdd = 0; + if (strchr(args, 'g') || strchr(args, 's') || strchr(args, 'c')) + moneyToAdd = MoneyStringToMoney(std::string(args)); + else + moneyToAdd = atol(args); - uint64 moneyuser = target->GetMoney(); + uint64 targetMoney = target->GetMoney(); - if (addmoney < 0) + if (moneyToAdd < 0) { - int64 newmoney = int32(moneyuser) + addmoney; + int64 newmoney = int64(targetMoney) + moneyToAdd; - sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney); + sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_MONEY), uint32(targetMoney), int32(moneyToAdd), uint32(newmoney)); if (newmoney <= 0) { handler->PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, handler->GetNameLink(target).c_str()); @@ -1025,25 +1029,26 @@ public: if (newmoney > MAX_MONEY_AMOUNT) newmoney = MAX_MONEY_AMOUNT; - handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(addmoney), handler->GetNameLink(target).c_str()); + handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, uint32(abs(moneyToAdd)), handler->GetNameLink(target).c_str()); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, handler->GetNameLink().c_str(), abs(addmoney)); + (ChatHandler(target)).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, handler->GetNameLink().c_str(), uint32(abs(moneyToAdd))); target->SetMoney(newmoney); } } else { - handler->PSendSysMessage(LANG_YOU_GIVE_MONEY, uint32(addmoney), handler->GetNameLink(target).c_str()); + handler->PSendSysMessage(LANG_YOU_GIVE_MONEY, uint32(moneyToAdd), handler->GetNameLink(target).c_str()); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), uint32(addmoney)); + (ChatHandler(target)).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), uint32(moneyToAdd)); - if (addmoney >=MAX_MONEY_AMOUNT) + if (moneyToAdd >= MAX_MONEY_AMOUNT) target->SetMoney(MAX_MONEY_AMOUNT); else - target->ModifyMoney(int64(addmoney)); + target->ModifyMoney(moneyToAdd); } - sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), moneyuser, uint32(addmoney), target->GetMoney()); + sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), uint32(targetMoney), nt32(moneyToAdd), uint32(target->GetMoney())); + return true; } diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 0508d95a60b..ef810b50b6f 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1844,7 +1844,7 @@ class spell_item_unusual_compass : public SpellScriptLoader { Unit* caster = GetCaster(); caster->SetOrientation(frand(0.0f, 62832.0f) / 10000.0f); - caster->SendMovementFlagUpdate(); + caster->SendMovementFlagUpdate(true); } void Register() diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 3e3e18b1c80..f689d2f29ac 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -2121,8 +2121,6 @@ class npc_shadowfiend : public CreatureScript if (Unit* owner = me->ToTempSummon()->GetSummoner()) if (owner->HasAura(GLYPH_OF_SHADOWFIEND)) owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true); - - PetAI::JustDied(killer); } }; diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index 0897c8814ab..b3176beb50b 100755 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -150,6 +150,37 @@ std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly) return ss.str(); } +int64 MoneyStringToMoney(const std::string& moneyString) +{ + int64 money = 0; + + if (!(std::count(moneyString.begin(), moneyString.end(), 'g') == 1 || + std::count(moneyString.begin(), moneyString.end(), 's') == 1 || + std::count(moneyString.begin(), moneyString.end(), 'c') == 1)) + return 0; // Bad format + + Tokenizer tokens(moneyString, ' '); + for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr) + { + std::string tokenString(*itr); + uint32 gCount = std::count(tokenString.begin(), tokenString.end(), 'g'); + uint32 sCount = std::count(tokenString.begin(), tokenString.end(), 's'); + uint32 cCount = std::count(tokenString.begin(), tokenString.end(), 'c'); + if (gCount + sCount + cCount != 1) + return 0; + + uint64 amount = atol(*itr); + if (gCount == 1) + money += amount * 100 * 100; + else if (sCount == 1) + money += amount * 100; + else if (cCount == 1) + money += amount; + } + + return money; +} + uint32 TimeStringToSecs(const std::string& timestring) { uint32 secs = 0; diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index f84e5155bb1..949fa67008f 100755 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -66,6 +66,8 @@ private: void stripLineInvisibleChars(std::string &src); +int64 MoneyStringToMoney(const std::string& moneyString); + std::string secsToTimeString(uint64 timeInSecs, bool shortText = false, bool hoursOnly = false); uint32 TimeStringToSecs(const std::string& timestring); std::string TimeToTimestampStr(time_t t); |
