diff options
-rw-r--r-- | src/bindings/scripts/scripts/world/npcs_special.cpp | 17 | ||||
-rw-r--r-- | src/game/Group.cpp | 4 | ||||
-rw-r--r-- | src/game/MovementHandler.cpp | 58 | ||||
-rw-r--r-- | src/game/Pet.cpp | 21 | ||||
-rw-r--r-- | src/game/Player.cpp | 8 | ||||
-rw-r--r-- | src/game/SpellAuraEffects.cpp | 6 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 4 | ||||
-rw-r--r-- | src/game/Unit.cpp | 4 | ||||
-rw-r--r-- | src/trinityrealm/AuthSocket.cpp | 3 |
9 files changed, 70 insertions, 55 deletions
diff --git a/src/bindings/scripts/scripts/world/npcs_special.cpp b/src/bindings/scripts/scripts/world/npcs_special.cpp index 9a2b9b48604..3b712af1320 100644 --- a/src/bindings/scripts/scripts/world/npcs_special.cpp +++ b/src/bindings/scripts/scripts/world/npcs_special.cpp @@ -1556,7 +1556,7 @@ CreatureAI* GetAI_npc_winter_reveler(Creature* pCreature) #define SPELL_DEADLY_POISON 34655 //Venomous Snake #define SPELL_CRIPPLING_POISON 3409 //Viper -#define VENOMOUS_SNAKE_TIMER 1200 +#define VENOMOUS_SNAKE_TIMER 1500 #define VIPER_TIMER 3000 #define C_VIPER 19921 @@ -1585,13 +1585,6 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI else IsViper = false; - //We have to reload the states from db for summoned guardians - CreatureBaseStats const* stats = CreatureBaseStats::GetBaseStats(m_creature->getLevel(), Info->unit_class); - m_creature->SetMaxHealth(stats->GenerateHealth(Info)); - m_creature->SetHealth(stats->GenerateMana(Info)); - m_creature->SetStatFloatValue(UNIT_FIELD_MINDAMAGE, Info->mindmg); - m_creature->SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, Info->maxdmg); - //Add delta to make them not all hit the same time uint32 delta = (rand() % 7) * 100; m_creature->SetStatFloatValue(UNIT_FIELD_BASEATTACKTIME, Info->baseattacktime + delta); @@ -1657,7 +1650,7 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI } else //Venomous Snake { - if (urand(0,9) < 8) //80% chance to cast + if (urand(0,2) == 0) //33% chance to cast DoCast(m_creature->getVictim(), SPELL_DEADLY_POISON); SpellTimer = VENOMOUS_SNAKE_TIMER + (rand() %5)*100; } @@ -1843,10 +1836,10 @@ struct TRINITY_DLL_DECL npc_ebon_gargoyleAI : CasterAI // Fly Away me->AddUnitMovementFlag(MOVEMENTFLAG_FLY_MODE|MOVEMENTFLAG_ASCEND|MOVEMENTFLAG_FLYING); - me->SetSpeed(MOVE_FLIGHT, 0.75f, true);
+ me->SetSpeed(MOVE_FLIGHT, 0.75f, true); me->SetSpeed(MOVE_RUN, 0.75f, true); - float x = me->GetPositionX() + 20 * cos(me->GetOrientation());
- float y = me->GetPositionY() + 20 * sin(me->GetOrientation());
+ float x = me->GetPositionX() + 20 * cos(me->GetOrientation()); + float y = me->GetPositionY() + 20 * sin(me->GetOrientation()); float z = me->GetPositionZ() + 40; me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MovePoint(0, x, y, z); diff --git a/src/game/Group.cpp b/src/game/Group.cpp index a1585acd41b..b2db3ed46a2 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -1499,7 +1499,9 @@ void Group::SetDungeonDifficulty(Difficulty difficulty) continue; player->SetDungeonDifficulty(difficulty); player->SendDungeonDifficulty(true); - //send player to recall positio nis a dungeon (to avoid an exploit) + // Send player to recall position is a dungeon (to avoid an exploit) + if (sMapStore.LookupEntry(player->GetMap()->IsDungeon())) + player->TeleportTo(player->m_recallMap, player->m_recallX, player->m_recallY, player->m_recallZ, player->m_recallO); } } diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 53d36436142..def605bc8c7 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -307,10 +307,10 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) } if (!mover->GetTransport() && !mover->GetVehicle()) - {
- GameObject *go = mover->GetMap()->GetGameObject(movementInfo.t_guid);
- if (!go || go->GetGoType() != GAMEOBJECT_TYPE_TRANSPORT)
- movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT;
+ { + GameObject *go = mover->GetMap()->GetGameObject(movementInfo.t_guid); + if (!go || go->GetGoType() != GAMEOBJECT_TYPE_TRANSPORT) + movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT; } } else if (plMover && plMover->GetTransport()) // if we were on a transport, leave @@ -358,18 +358,18 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) plMover->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); plMover->UpdateFallInformationIfNeed(movementInfo, opcode); - // If on vehicle, update carried players
- if (Vehicle *vehicle=plMover->GetVehicleKit())
- {
- if (plMover->IsVehicle())
- {
- for (int i=0; i < 8; ++i)
- {
- if (Unit *passenger = vehicle->GetPassenger(i))
- if (passenger != NULL && passenger->GetTypeId() == TYPEID_PLAYER)
- ((Player*)passenger)->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
- }
- }
+ // If on vehicle, update carried players + if (Vehicle *vehicle=plMover->GetVehicleKit()) + { + if (plMover->IsVehicle()) + { + for (int i=0; i < 8; ++i) + { + if (Unit *passenger = vehicle->GetPassenger(i)) + if (passenger != NULL && passenger->GetTypeId() == TYPEID_PLAYER) + ((Player*)passenger)->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); + } + } } if (movementInfo.z < -500.0f) @@ -506,20 +506,18 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data) uint64 guid; recv_data >> guid; - if(guid == GetPlayer()->m_mover->GetGUID()) - return; - - if(Unit *mover = ObjectAccessor::GetUnit(*GetPlayer(), guid)) - { - GetPlayer()->SetMover(mover); - if(mover != GetPlayer() && mover->canFly()) - { - WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12); - data.append(mover->GetPackGUID()); - data << uint32(0); - SendPacket(&data); - } - } + if(GetPlayer()->IsInWorld()) + if(Unit *mover = ObjectAccessor::GetUnit(*GetPlayer(), guid)) + { + GetPlayer()->SetMover(mover); + if(mover != GetPlayer() && mover->canFly()) + { + WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12); + data.append(mover->GetPackGUID()); + data << uint32(0); + SendPacket(&data); + } + } else { sLog.outError("HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " and should be " UI64FMTD, guid, _player->m_mover->GetGUID()); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 5fe6a64932d..261eca21701 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -498,7 +498,10 @@ void Pet::setDeathState(DeathState s) // overwrite virtual void Pet::Update(uint32 diff) { - if(m_removed) // pet already removed, just wait in remove queue, no updates + if (m_removed) // pet already removed, just wait in remove queue, no updates + return; + + if (m_loading) return; switch( m_deathState ) @@ -969,6 +972,22 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 4 + petlevel)); break; } + case 19833: //Snake Trap - Venomous Snake + { + SetCreateHealth(uint32(107 * (petlevel - 40) * 0.025f)); + SetCreateMana(0); + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float((petlevel / 2) - 25)); + SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float((petlevel / 2) - 18)); + break; + } + case 19921: //Snake Trap - Viper + { + SetCreateHealth(uint32(107 * (petlevel - 40) * 0.025f)); + SetCreateMana(0); + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel / 2 - 10)); + SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel / 2)); + break; + } case 31216: // Mirror Image { SetBonusDamage(int32(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FROST) * 0.33f)); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index ce57dce8020..732ec29ff0b 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17052,15 +17052,11 @@ void Player::SaveToDB() sLog.outDebug("The value of player %s at save: ", m_name.c_str()); outDebugValues(); - CharacterDatabase.BeginTransaction(); - - CharacterDatabase.PExecute("DELETE FROM characters WHERE guid = '%u'",GetGUIDLow()); - std::string sql_name = m_name; CharacterDatabase.escape_string(sql_name); std::ostringstream ss; - ss << "INSERT INTO characters (guid,account,name,race,class,gender,level,xp,money,playerBytes,playerBytes2,playerFlags," + ss << "REPLACE INTO characters (guid,account,name,race,class,gender,level,xp,money,playerBytes,playerBytes2,playerFlags," "map, instance_id, dungeon_difficulty, position_x, position_y, position_z, orientation, data, " "taximask, online, cinematic, " "totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, " @@ -17152,6 +17148,8 @@ void Player::SaveToDB() ss << uint32(m_activeSpec); ss << ")"; + CharacterDatabase.BeginTransaction(); + CharacterDatabase.Execute( ss.str().c_str() ); if (m_mailsUpdated) //save mails only when needed diff --git a/src/game/SpellAuraEffects.cpp b/src/game/SpellAuraEffects.cpp index 5373f2aa75c..d9efa1771ed 100644 --- a/src/game/SpellAuraEffects.cpp +++ b/src/game/SpellAuraEffects.cpp @@ -4756,7 +4756,7 @@ void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const * aurApp, return; for (int i = 0; i < MAX_ATTACK; ++i) - if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i))) + if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i), true)) ((Player*)target)->_ApplyWeaponDependentAuraCritMod(pItem,WeaponAttackType(i),this,apply); // mods must be applied base at equipped weapon class and subclass comparison @@ -5077,7 +5077,7 @@ void AuraEffect::HandleModDamageDone(AuraApplication const * aurApp, uint8 mode, if(target->GetTypeId() == TYPEID_PLAYER) { for (int i = 0; i < MAX_ATTACK; ++i) - if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i))) + if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i), true)) ((Player*)target)->_ApplyWeaponDependentAuraDamageMod(pItem,WeaponAttackType(i),this,apply); } @@ -5164,7 +5164,7 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const * aurApp, uint if(target->GetTypeId() == TYPEID_PLAYER) { for (int i = 0; i < MAX_ATTACK; ++i) - if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i))) + if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i), true)) ((Player*)target)->_ApplyWeaponDependentAuraDamageMod(pItem,WeaponAttackType(i),this,apply); } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 7f13e49a73d..2a7a45bfbee 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -639,6 +639,10 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) // Eviscerate and Envenom Bonus Damage (item set effect) if (m_caster->HasAura(SPELL_EVISCERATE_AND_ENVENOM_BONUS_DAMAGE_37169)) damage += combo*40; + + // Apply spell mods + if (Player* modOwner = m_caster->GetSpellModOwner()) + modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, damage); } } break; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index efa51337008..3e918396c0e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -10046,7 +10046,7 @@ int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask) DoneAdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetAmount() / 100.0f); } - return DoneAdvertisedBenefit; + return DoneAdvertisedBenefit > 0 ? DoneAdvertisedBenefit : 0; } int32 Unit::SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVictim) @@ -10066,7 +10066,7 @@ int32 Unit::SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVic if (((*i)->GetMiscValue() & schoolMask) != 0) TakenAdvertisedBenefit += (*i)->GetAmount(); - return TakenAdvertisedBenefit; + return TakenAdvertisedBenefit > 0 ? TakenAdvertisedBenefit : 0; } bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const diff --git a/src/trinityrealm/AuthSocket.cpp b/src/trinityrealm/AuthSocket.cpp index ee71c523816..bc788426a8a 100644 --- a/src/trinityrealm/AuthSocket.cpp +++ b/src/trinityrealm/AuthSocket.cpp @@ -297,7 +297,8 @@ void AuthSocket::OnRead() ///- Report unknown commands in the debug log if (i == AUTH_TOTAL_COMMANDS) { - DEBUG_LOG("[Auth] got unknown packet %u", (uint32)_cmd); + DEBUG_LOG("[Auth] got unknown packet from '%s:%d'", GetRemoteAddress().c_str(), GetRemotePort()); + SetCloseAndDelete(); return; } } |