aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorn0n4m3 <none@none>2010-01-13 19:11:46 +0300
committern0n4m3 <none@none>2010-01-13 19:11:46 +0300
commitf7ad3aefc8e63e87c29d5e9c169210f4e7e80ac8 (patch)
tree7418fd8e76d498bb754b3b92b981743e20199f98 /src
parentedeb6bf284e9f7ab501f6c3273221dbf02d60084 (diff)
Removed all my commits for today, this is hack? really? okey
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/world/npcs_special.cpp11
-rw-r--r--src/game/Group.cpp4
-rw-r--r--src/game/MovementHandler.cpp26
-rw-r--r--src/game/Pet.cpp21
-rw-r--r--src/game/Player.cpp8
-rw-r--r--src/game/SpellAuraEffects.cpp6
-rw-r--r--src/game/SpellEffects.cpp4
-rw-r--r--src/game/Unit.cpp4
-rw-r--r--src/trinityrealm/AuthSocket.cpp3
9 files changed, 36 insertions, 51 deletions
diff --git a/src/bindings/scripts/scripts/world/npcs_special.cpp b/src/bindings/scripts/scripts/world/npcs_special.cpp
index 375848da9e8..7908e2989f1 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 1500
+#define VENOMOUS_SNAKE_TIMER 1200
#define VIPER_TIMER 3000
#define C_VIPER 19921
@@ -1585,6 +1585,13 @@ 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);
@@ -1650,7 +1657,7 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI
}
else //Venomous Snake
{
- if (urand(0,2) == 0) //33% chance to cast
+ if (urand(0,9) < 8) //80% 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 b2db3ed46a2..a1585acd41b 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp
@@ -1499,9 +1499,7 @@ void Group::SetDungeonDifficulty(Difficulty difficulty)
continue;
player->SetDungeonDifficulty(difficulty);
player->SendDungeonDifficulty(true);
- // 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);
+ //send player to recall positio nis a dungeon (to avoid an exploit)
}
}
diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp
index d4388f3c7a4..da0387f8d1b 100644
--- a/src/game/MovementHandler.cpp
+++ b/src/game/MovementHandler.cpp
@@ -488,18 +488,20 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data)
uint64 guid;
recv_data >> guid;
- 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);
- }
- }
+ 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);
+ }
+ }
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 261eca21701..5fe6a64932d 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -498,10 +498,7 @@ 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
- return;
-
- if (m_loading)
+ if(m_removed) // pet already removed, just wait in remove queue, no updates
return;
switch( m_deathState )
@@ -972,22 +969,6 @@ 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 7ea674f7f2c..94d4387f8e7 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -17016,11 +17016,15 @@ 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 << "REPLACE INTO characters (guid,account,name,race,class,gender,level,xp,money,playerBytes,playerBytes2,playerFlags,"
+ ss << "INSERT 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, "
@@ -17112,8 +17116,6 @@ 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 53e066514df..1492d586943 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), true))
+ if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i)))
((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), true))
+ if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i)))
((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), true))
+ if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i)))
((Player*)target)->_ApplyWeaponDependentAuraDamageMod(pItem,WeaponAttackType(i),this,apply);
}
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 47e47d1f119..24c2ded7321 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -639,10 +639,6 @@ 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 b09e414e4ff..95360052238 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 > 0 ? DoneAdvertisedBenefit : 0;
+ return DoneAdvertisedBenefit;
}
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 > 0 ? TakenAdvertisedBenefit : 0;
+ return TakenAdvertisedBenefit;
}
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 bc788426a8a..ee71c523816 100644
--- a/src/trinityrealm/AuthSocket.cpp
+++ b/src/trinityrealm/AuthSocket.cpp
@@ -297,8 +297,7 @@ void AuthSocket::OnRead()
///- Report unknown commands in the debug log
if (i == AUTH_TOTAL_COMMANDS)
{
- DEBUG_LOG("[Auth] got unknown packet from '%s:%d'", GetRemoteAddress().c_str(), GetRemotePort());
- SetCloseAndDelete();
+ DEBUG_LOG("[Auth] got unknown packet %u", (uint32)_cmd);
return;
}
}