diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/bindings/scripts/scripts/world/npcs_special.cpp | 11 | ||||
| -rw-r--r-- | src/game/Group.cpp | 4 | ||||
| -rw-r--r-- | src/game/MovementHandler.cpp | 26 | ||||
| -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, 51 insertions, 36 deletions
diff --git a/src/bindings/scripts/scripts/world/npcs_special.cpp b/src/bindings/scripts/scripts/world/npcs_special.cpp index 7908e2989f1..375848da9e8 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;              } 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 da0387f8d1b..d4388f3c7a4 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -488,20 +488,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 94d4387f8e7..7ea674f7f2c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17016,15 +17016,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, " @@ -17116,6 +17112,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 1492d586943..53e066514df 100644 --- a/src/game/SpellAuraEffects.cpp +++ b/src/game/SpellAuraEffects.cpp @@ -4755,7 +4755,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 @@ -5076,7 +5076,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);      } @@ -5163,7 +5163,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 24c2ded7321..47e47d1f119 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 95360052238..b09e414e4ff 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -10018,7 +10018,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) @@ -10038,7 +10038,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;          }      }  | 
