Jump to content

kid 10

Members
  • Posts

    13
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

kid 10's Achievements

Member

Member (2/3)

0

Reputation

  1. https://github.com/kid10/mangos/commits/Vehicles Nothing special, but it is a start.
  2. What features does the patch add? Implements SummonedMovementInform() in WaypointMovementGenerator to script summoned creatures waypoints. For which repository revision was the patch created? 11338 Is there a thread in the bug report section or at lighthouse? I don't know. Who has been writing this patch? Me diff --git a/src/game/Player.cpp b/src/game/Player.cpp diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index c1c06e6..e1bb026 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -40,6 +40,7 @@ alter table creature_movement add `wpguid` int(11) default '0'; #include "WaypointManager.h" #include "WorldPacket.h" #include "ScriptMgr.h" +#include "TemporarySummon.h" #include @@ -300,6 +301,15 @@ void WaypointMovementGenerator::MovementInform(Creature &creature) { if (creature.AI()) creature.AI()->MovementInform(WAYPOINT_MOTION_TYPE, i_currentNode); + + if (creature.IsTemporarySummon()) + { + TemporarySummon* pSummon = (TemporarySummon*)(&creature); + if (pSummon->GetSummonerGuid().IsCreature()) + if(Creature* pSummoner = creature.GetMap()->GetCreature(pSummon->GetSummonerGuid())) + if (pSummoner->AI()) + pSummoner->AI()->SummonedMovementInform(&creature, WAYPOINT_MOTION_TYPE, i_currentNode); + } } bool WaypointMovementGenerator::GetResetPosition(Creature&, float& x, float& y, float& z)
  3. /bump It's time to implement this important feature.
  4. I think "unitTarget->CastSpell(unitTarget, roll_chance_i(50) ? 24714 : 24715, true);" should work too, and makes it easier to read.
  5. What features does the patch add? It adds the possibility to send castflags with castspell() into the spell class. This has the advantage that we can use castspell() with more than one option, an example for an later option would be CAST_IGNORE_POWER or CAST_OUT_OF_RANGE. Unfortunately, I had to remove vladimir's template trap, because the trap catched the castflags constants and didn't let them convert into uint32. * For which repository revision was the patch created? MaNGOS r10974 * Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread. No * Who has been writing this patch? Please include either forum user names or email addresses. Me, kid 10 <[email protected]> Patch: - Part 1 (to make the important functions with castflags compatible) http://pastebin.com/T77ZY7x6 - Part 2 (triggered true / false replaced with castflags constants) http://pastebin.com/0KGsN0ky Feedback, ideas and improvements are welcome. =D
  6. Hi community, I noticed that the "power calculation" in CreatureAI::CanCastSpell() isn't complete. For example "mana percent calculation" is missing, we get wrong cast-result "CAST_OK" when creature haven't enough mana. http://www.wowhead.com/spells?filter=cr=2;crs=1;crv=0 I wrote a patch which could solve the problem, but probably there is a better way to solve it. --- a/src/game/CreatureAI.cpp +++ b/src/game/CreatureAI.cpp @@ -46,7 +46,7 @@ CanCastResult CreatureAI::CanCastSpell(U return CAST_FAIL_STATE; // Check for power (also done by Spell::CheckCast()) - if (m_creature->GetPower((Powers)pSpell->powerType) < pSpell->manaCost) + if (m_creature->GetPower((Powers)pSpell->powerType) < (uint32)Spell::CalculatePowerCost(pSpell, m_creature)) return CAST_FAIL_POWER; } --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -1386,7 +1386,7 @@ bool CreatureEventAI::CanCast(Unit* Targ return false; //Check for power - if (!Triggered && m_creature->GetPower((Powers)Spell->powerType) < Spell->manaCost) + if (!Triggered && m_creature->GetPower((Powers)Spell->powerType) < (uint32)Spell::CalculatePowerCost(Spell, m_creature)) return false; SpellRangeEntry const *TempRange = NULL; --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2633,7 +2633,7 @@ void Spell::prepare(SpellCastTargets con } // Fill cost data - m_powerCost = CalculatePowerCost(); + m_powerCost = CalculatePowerCost(m_spellInfo, m_caster, this, m_CastItem); SpellCastResult result = CheckCast(true); if(result != SPELL_CAST_OK && !IsAutoRepeat()) //always cast autorepeat dummy for triggering @@ -5615,69 +5615,70 @@ SpellCastResult Spell::CheckRange(bool s return SPELL_CAST_OK; } -int32 Spell::CalculatePowerCost() +int32 Spell::CalculatePowerCost(SpellEntry const* spellInfo, Unit* caster, Spell const* spell, Item* castItem) { // item cast not used power - if (m_CastItem) + if (castItem) return 0; // Spell drain all exist power on cast (Only paladin lay of Hands) - if (m_spellInfo->AttributesEx & SPELL_ATTR_EX_DRAIN_ALL_POWER) + if (spellInfo->AttributesEx & SPELL_ATTR_EX_DRAIN_ALL_POWER) { // If power type - health drain all - if (m_spellInfo->powerType == POWER_HEALTH) - return m_caster->GetHealth(); + if (spellInfo->powerType == POWER_HEALTH) + return caster->GetHealth(); // Else drain all power - if (m_spellInfo->powerType < MAX_POWERS) - return m_caster->GetPower(Powers(m_spellInfo->powerType)); - sLog.outError("Spell::CalculateManaCost: Unknown power type '%d' in spell %d", m_spellInfo->powerType, m_spellInfo->Id); + if (spellInfo->powerType < MAX_POWERS) + return caster->GetPower(Powers(spellInfo->powerType)); + sLog.outError("Spell::CalculateManaCost: Unknown power type '%d' in spell %d", spellInfo->powerType, spellInfo->Id); return 0; } // Base powerCost - int32 powerCost = m_spellInfo->manaCost; + int32 powerCost = spellInfo->manaCost; // PCT cost from total amount - if (m_spellInfo->ManaCostPercentage) + if (spellInfo->ManaCostPercentage) { - switch (m_spellInfo->powerType) + switch (spellInfo->powerType) { // health as power used case POWER_HEALTH: - powerCost += m_spellInfo->ManaCostPercentage * m_caster->GetCreateHealth() / 100; + powerCost += spellInfo->ManaCostPercentage * caster->GetCreateHealth() / 100; break; case POWER_MANA: - powerCost += m_spellInfo->ManaCostPercentage * m_caster->GetCreateMana() / 100; + powerCost += spellInfo->ManaCostPercentage * caster->GetCreateMana() / 100; break; case POWER_RAGE: case POWER_FOCUS: case POWER_ENERGY: case POWER_HAPPINESS: - powerCost += m_spellInfo->ManaCostPercentage * m_caster->GetMaxPower(Powers(m_spellInfo->powerType)) / 100; + powerCost += spellInfo->ManaCostPercentage * caster->GetMaxPower(Powers(spellInfo->powerType)) / 100; break; case POWER_RUNE: case POWER_RUNIC_POWER: DEBUG_LOG("Spell::CalculateManaCost: Not implemented yet!"); break; default: - sLog.outError("Spell::CalculateManaCost: Unknown power type '%d' in spell %d", m_spellInfo->powerType, m_spellInfo->Id); + sLog.outError("Spell::CalculateManaCost: Unknown power type '%d' in spell %d", spellInfo->powerType, spellInfo->Id); return 0; } } - SpellSchools school = GetFirstSchoolInMask(m_spellSchoolMask); + SpellSchools school = GetFirstSchoolInMask(GetSpellSchoolMask(spellInfo)); // Flat mod from caster auras by spell school - powerCost += m_caster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + school); + powerCost += caster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + school); // Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost) - if ( m_spellInfo->AttributesEx4 & SPELL_ATTR_EX4_SPELL_VS_EXTEND_COST ) - powerCost += m_caster->GetAttackTime(OFF_ATTACK) / 100; + if (spellInfo->AttributesEx4 & SPELL_ATTR_EX4_SPELL_VS_EXTEND_COST) + powerCost += caster->GetAttackTime(OFF_ATTACK) / 100; // Apply cost mod by spell - if(Player* modOwner = m_caster->GetSpellModOwner()) - modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, powerCost, this); + if (spell) + if (Player* modOwner = caster->GetSpellModOwner()) + modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COST, powerCost, spell); - if(m_spellInfo->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION) - powerCost = int32(powerCost/ (1.117f * m_spellInfo->spellLevel / m_caster->getLevel() -0.1327f)); + if (spellInfo->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION) + powerCost = int32(powerCost/ (1.117f * spellInfo->spellLevel / caster->getLevel() -0.1327f)); // PCT mod from user auras by school - powerCost = int32(powerCost * (1.0f + m_caster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + school))); + powerCost = int32(powerCost * (1.0f + caster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + school))); if (powerCost < 0) powerCost = 0; return powerCost; --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -374,7 +374,7 @@ class Spell SpellCastResult CheckCasterAuras() const; int32 CalculateDamage(SpellEffectIndex i, Unit* target) { return m_caster->CalculateSpellDamage(target, m_spellInfo, i, &m_currentBasePoints[i]); } - int32 CalculatePowerCost(); + static int32 CalculatePowerCost(SpellEntry const* spellInfo, Unit* caster, Spell const* spell = NULL, Item* castItem = NULL); bool HaveTargetsForEffect(SpellEffectIndex effect) const; void Delayed(); Greetings from austria kid 10
  7. We get the information from client, see HandleMovementOpcodes() function in MovementHandler.cpp. There we get movementInfo: MovementInfo movementInfo; recv_data >> guid.ReadAsPacked(); recv_data >> movementInfo; Then we can check: if (movementInfo.HasMovementFlag(MOVEFLAG_ONTRANSPORT)) And later: // if we boarded a transport, add us to it if (plMover && !plMover->GetTransport()) { // elevators also cause the client to send MOVEFLAG_ONTRANSPORT - just unmount if the guid can be found in the transport list for (MapManager::TransportSet::const_iterator iter = sMapMgr.m_Transports.begin(); iter != sMapMgr.m_Transports.end(); ++iter) { if ((*iter)->GetObjectGuid() == movementInfo.GetTransportGuid()) { plMover->SetTransport(*iter); (*iter)->AddPlayerPassenger(plMover); break; } } } And still later: plMover->m_movementInfo = movementInfo;
  8. - Lost code added >.< ._. - Possible crash fixed Revision 10246: Patch: http://pastebin.com/MT64VDN5 SQL: http://pastebin.com/HQm412de Lost code diff: --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -270,6 +270,12 @@ void Object::BuildMovementUpdate(ByteBuf /*if (((Creature*)unit)->hasUnitState(UNIT_STAT_MOVING)) unit->m_movementInfo.SetMovementFlags(MOVEFLAG_FORWARD);*/ + if (unit->GetTransport()) + { + unit->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT); + unit->m_movementInfo.SetTransportData(unit->GetTransport()->GetGUID(), unit->GetTransOffsetX(), unit->GetTransOffsetY(), unit->GetTransOffsetZ(), unit->GetTransOffsetO(), 0, 0); + } + if (((Creature*)unit)->canFly()) { // (ok) most seem to have this Possible crash fixed diff: --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -469,7 +469,7 @@ void Transport::TeleportTransport(uint32 (*itr)->RemoveFromWorld(); (*itr)->SetMap(newMap); - newMap->CreatureRelocation(*itr, GetPositionX() + x, GetPositionY() + y, GetPositionZ() + z, (*itr)->GetOrientation()); + //newMap->CreatureRelocation(*itr, GetPositionX() + x, GetPositionY() + y, GetPositionZ() + z, (*itr)->GetOrientation()); newMap->Add(*itr); } SetMap(newMap);
  9. What exactly did you do? I don't know why it shouldn't work with skybreaker and orgrims hammer, I can't test this now, because my wotlk client is broken. --- At the moment, npcs position updated in transports update() function, I don't know wheter it is right. I think in this case, movement and npc gossip wouldn't work, because position is constantly updated, and gossip menu will close on position change. It is also possible to update the global npc position not (only at transport teleport), then it is like player on transports works, and npc movement on transport would be possible I think. But npc gossip would still not work, because we get the message that the creature is too far away to interact with him. I must create a function, which calculate the distance between two objects on transport (with object transport position). And then - I think, npc gossip will be possible on transports too. Maybe someone can help to find the best way.
  10. I have rewritten the patch. - Now npc transport coordinates stored in creature table - Transport functions in player class moved to unit class - Many code improvements Revision 10246: Patch: http://pastebin.com/a4vnHNqG SQL: http://pastebin.com/HQm412de
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use