Jump to content

illustri

Members
  • Posts

    25
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Everything posted by illustri

  1. for anyone else also wondering: DK tp is dependent on quests, and therefore database controlled, if you search in database forums you will find the answer, but since its not intuitive, ill just tell you what others have done is create a custom quest that awards tp, for example i just added this to the dk intro quest: UPDATE quest_template SET BonusTalents = 46 WHERE entry = 12593; this awards you the 46 tps you would have had to go through the dk quest chain to get, and you can instant lvl up or whatever and skip the quest chain hope this helps others, but remember tp's awarded to dks are quest and therefore database related, not core
  2. heres the diff against 8757 working for me -------------------------- src/game/ThreatManager.cpp -------------------------- index 11b5604..650861c 100644 @@ -220,8 +220,11 @@ void ThreatContainer::clearReferences() // Return the HostileReference of NULL, if not found HostileReference* ThreatContainer::getReferenceByTarget(Unit* pVictim) { HostileReference* result = NULL; + if(!pVictim) + return NULL; + uint64 guid = pVictim->GetGUID(); for(std::list<HostileReference*>::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i) { if((*i)->getUnitGuid() == guid) @@ -350,9 +353,9 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile //============================================================ //=================== ThreatManager ========================== //============================================================ -ThreatManager::ThreatManager(Unit* owner) : iCurrentVictim(NULL), iOwner(owner) +ThreatManager::ThreatManager(Unit* owner) : iCurrentVictim(NULL), iOwner(owner), iUpdateTimer(THREAT_UPDATE_INTERVAL) { } //============================================================ @@ -361,8 +364,9 @@ void ThreatManager::clearReferences() { iThreatContainer.clearReferences(); iThreatOfflineContainer.clearReferences(); iCurrentVictim = NULL; + iUpdateTimer = THREAT_UPDATE_INTERVAL; } //============================================================ @@ -460,8 +464,12 @@ void ThreatManager::tauntFadeOut(Unit *pTaunter) //============================================================ void ThreatManager::setCurrentVictim(HostileReference* pHostileReference) { + if (pHostileReference && pHostileReference != iCurrentVictim) + { + iOwner->SendChangeCurrentVictimOpcode(pHostileReference); + } iCurrentVictim = pHostileReference; } //============================================================ @@ -505,11 +513,25 @@ void ThreatManager::ProcessThreatEvent(ThreatRefStatusChangeEvent* threatRefStat { setCurrentVictim(NULL); setDirty(true); } + iOwner->SendRemoveFromThreatListOpcode(hostileReference); if(hostileReference->isOnline()) iThreatContainer.remove(hostileReference); else iThreatOfflineContainer.remove(hostileReference); break; } } + +bool ThreatManager::isNeedUpdateToClient(uint32 time) +{ + if (isThreatListEmpty()) + return false; + if (time >= iUpdateTimer) + { + iUpdateTimer = THREAT_UPDATE_INTERVAL; + return true; + } + iUpdateTimer -= time; + return false; +} --------------------------- src/game/ThreatManager.h --------------------------- index 7c8cf23..dc32898 100644 @@ -32,8 +32,10 @@ class Unit; class Creature; class ThreatManager; struct SpellEntry; +#define THREAT_UPDATE_INTERVAL 1 * IN_MILISECONDS // Server should send threat update to client periodically each second + //============================================================== // Class to calculate the real threat based class ThreatCalcHelper @@ -185,8 +187,10 @@ class MANGOS_DLL_SPEC ThreatManager bool isThreatListEmpty() { return iThreatContainer.empty();} void processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent); + bool isNeedUpdateToClient(uint32 time); + HostileReference* getCurrentVictim() { return iCurrentVictim; } Unit* getOwner() { return iOwner; } @@ -207,8 +211,9 @@ class MANGOS_DLL_SPEC ThreatManager ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; } private: HostileReference* iCurrentVictim; Unit* iOwner; + uint32 iUpdateTimer; ThreatContainer iThreatContainer; ThreatContainer iThreatOfflineContainer; }; ------------------------------ src/game/Unit.cpp ------------------------------ index ac5f15d..e8d3833 100644 @@ -205,8 +205,11 @@ void Unit::Update( uint32 p_time ) for(AuraList::const_iterator itr = m_deletedAuras.begin(); itr != m_deletedAuras.begin(); ++itr) delete *itr; m_deletedAuras.clear(); + if (CanHaveThreatList() && getThreatManager().isNeedUpdateToClient(p_time)) + SendThreatListUpdate(); + // update combat timer only for players and pets if (isInCombat() && (GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->isPet() || ((Creature*)this)->isCharmed())) { // Check UNIT_STAT_MELEE_ATTACKING or UNIT_STAT_CHASE (without UNIT_STAT_FOLLOW in this case) so pets can reach far away @@ -10290,8 +10293,10 @@ void Unit::AddThreat(Unit* pVictim, float threat /*= 0.0f*/, bool crit /*= false //====================================================================== void Unit::DeleteThreatList() { + if(CanHaveThreatList() && !m_ThreatManager.isThreatListEmpty()) + SendClearThreatListOpcode(); m_ThreatManager.clearReferences(); } //====================================================================== @@ -12628,8 +12633,9 @@ void Unit::KnockBackFrom(Unit* target, float horizintalSpeed, float verticalSpee NearTeleportTo(fx, fy, fz, GetOrientation(), this == target); } } + float Unit::GetCombatRatingReduction(CombatRating cr) const { if (GetTypeId() == TYPEID_PLAYER) return ((Player const*)this)->GetRatingBonusValue(cr); @@ -12650,4 +12656,58 @@ uint32 Unit::GetCombatRatingDamageReduction(CombatRating cr, float rate, float c if (percent > cap) percent = cap; return uint32 (percent * damage / 100.0f); } + +void Unit::SendThreatListUpdate() +{ + if (uint32 count = getThreatManager().getThreatList().size()) + { + sLog.outDebug( "WORLD: Send SMSG_THREAT_UPDATE Message" ); + WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8); + data.append(GetPackGUID()); + data << uint32(count); + std::list<HostileReference*>& tlist = getThreatManager().getThreatList(); + for (std::list<HostileReference*>::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr) + { + data.appendPackGUID((*itr)->getUnitGuid()); + data << uint32((*itr)->getThreat()); + } + SendMessageToSet(&data, false); + } +} + +void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference) +{ + if (uint32 count = getThreatManager().getThreatList().size()) + { + sLog.outDebug( "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message" ); + WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8); + data.append(GetPackGUID()); + data.appendPackGUID(pHostileReference->getUnitGuid()); + data << uint32(count); + std::list<HostileReference*>& tlist = getThreatManager().getThreatList(); + for (std::list<HostileReference*>::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr) + { + data.appendPackGUID((*itr)->getUnitGuid()); + data << uint32((*itr)->getThreat()); + } + SendMessageToSet(&data, false); + } +} + +void Unit::SendClearThreatListOpcode() +{ + sLog.outDebug( "WORLD: Send SMSG_THREAT_CLEAR Message" ); + WorldPacket data(SMSG_THREAT_CLEAR, 8); + data.append(GetPackGUID()); + SendMessageToSet(&data, false); +} + +void Unit::SendRemoveFromThreatListOpcode(HostileReference* pHostileReference) +{ + sLog.outDebug( "WORLD: Send SMSG_THREAT_REMOVE Message" ); + WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8); + data.append(GetPackGUID()); + data.appendPackGUID(pHostileReference->getUnitGuid()); + SendMessageToSet(&data, false); +} ------------------------------- src/game/Unit.h ------------------------------- index b481c37..900a60d 100644 @@ -1154,8 +1154,13 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, MonsterMovementFlags flags, uint32 Time, Player* player = NULL); void SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, MonsterMovementFlags flags); + void SendChangeCurrentVictimOpcode(HostileReference* pHostileReference); + void SendClearThreatListOpcode(); + void SendRemoveFromThreatListOpcode(HostileReference* pHostileReference); + void SendThreatListUpdate(); + void BuildHeartBeatMsg( WorldPacket *data ) const; virtual void MoveOutOfRange(Player &) { };
  3. working perfectly as intended on build 8600+ if this is added to master wouldn't correct threat coefficients be easier to fix?
  4. crash due to summoning bots from a different map than master is a known bug, but i don't know how to fix it patches are applied using "git apply filename"... patch needs to be in your revision folder
  5. @Runsttren here is a patch rewriting all class ai to style in rogue and warrior note: this is just a straight conversion, builds fine but actual cast orders tweaking may be required http://pastebin.ca/1595330 enjoy
  6. here is a fix for rogue behavior i've made on latest playerbot http://pastebin.com/m1d61798 changed: - "m_bot->Attack(m_targetCombat, false)" is required for rogue to cast opening move before melee combat - additional cycles for dofirstcombatmaneuver for rogue - conditions for melee combatmovement simplified, i think thats was stopping rogue initial movement
  7. on rogue combat movement, the first /point calls dofirstcombatmaneuver() as expected, but immediately after it seems the bot loses its target, i think m_targetcombat must have been cleared somewhere before another call of docombatmaneuver for warrior the charge movement from relocate() is working, however the charge spell is not actually being cast if you notice, this was the same problem i ran into ai->CastSpell(CHARGE,*pTarget) seems to be skipped or interrupted because there is no animation, and no stun effect, and in debug there is no record of charge cast the way i got it somewhat working was to call castspell(charge) intially, return, and on next aiupdate call relocate(), that was the only way charge was cast at all
  8. for warrior this was the only way i was able to get charge working: float x,y,z; [b]if[/b] (targetDist[b]>=[/b][color=#009999]8.0f[/color] [b]&&[/b] targetDist[b]<=[/b][color=#009999]25.0f[/color]) { pTarget[b]->[/b]GetPosition(x,y,z); [b]if[/b] (m_bot[b]->[/b]HasAura(BATTLE_STANCE, [color=#009999]0[/color])) { [b]if[/b] (CHARGE[b]>[/b][color=#009999]0[/color] [b]&&[/b] ai[b]->[/b]CastSpell(CHARGE)) [b]return[/b]; m_bot[b]->[/b]Relocate(x,y,z); } [b]else[/b] { ai[b]->[/b]CastSpell(BATTLE_STANCE, [b]*[/b]m_bot); [b]return[/b]; } } [b]if[/b] (targetDist[b]>[/b]ATTACK_DISTANCE) { ai[b]->[/b]DoCombatMovement(); [b]return[/b]; } the problem is there is no check for spell success, so that even on charge fail the relocate function is called...
  9. @Runsttren very possible, i'm just beginning to learn distributed programming and git in particular, i probably didn't include a commit or something thanks for the help and your efforts also, its a great learning project *update* i've compiled from playerbot master but the bot behavior has not been as expected: - rogue enters stealth but makes no movement toward target - warrior casts charge but its location is not updated (probably due to missing relocate() in my pastebin patch) -working as intended are range/casters stopping on spellcast, though i'd prefer them not moving while in pve at all (as it is now they resume following master on spell cooldown) i'll continue playing around and forking from master, but if anyone has a different experience please let me know
  10. here is the patch against playerbot master http://pastebin.com/m5dc29604 includes rogue cheapshot and warrior charge opener implementation
  11. @Runsttren thank you for looking over my changes, i appreciate your input especially since i have little experience coding other than as a side interest i'll keep your points a & b in mind as i play around more... here was my initial reasoning for moving the docombatmovement: i wanted to limit movements of casting classes: mage, lock, priest for example... so as soon as they were in combat and in range of action they begin casting spells instead of moving everytime master moved -- which was my experience when docombatmovement was called in playerbotai for all bots, also i would be able to specify hybrid class movement based on spell sequence, for example paladin, druid, shaman casting group healing spells doesn't need to chase a target while healing on your second question about the changes in docombatmovement... i have to admit i haven't tested that completely, i merely looked at the movechase function and saw i could enter in a distance value, certainly it doesn't seem to account for terrain either, and i can forsee a bot moving into the ground or a wall because of it, i'll work on that too on other news i think i've had some success implementing warrior charge and rogue cheapshot opener, can see it on my repository at: http://github.com/illustri/mangos/commits/illustri , i'll try to make a patch against playerbot soon
  12. heres a snip of my warrior charge opener attempt: void PlayerbotWarriorAI::DoNextCombatManeuver(Unit *pTarget) { PlayerbotAI* ai = GetAI(); if (!ai) return; // Damage Attacks Player *m_bot = GetPlayerBot(); Unit* pVictim = pTarget->getVictim(); m_bot->SetInFront(pTarget); float targetDist = m_bot->GetDistance(pTarget), x, y, z; ai->MovementClear(); m_bot->Attack(pTarget, true); if (targetDist>=8.0f && targetDist<=25.0f) { pTarget->GetPosition(x,y,z); if (!m_bot->HasAura(BATTLE_STANCE, 0)) ai->CastSpell(BATTLE_STANCE, *m_bot); if(CHARGE > 0) ai->CastSpell (CHARGE) return; } what works: bot casts charge on target if in range, or moves within range then casts what doesn't: bot location is not updated so what happens is spell is cast successfully, with animation and effect on mob, but bot has not moved from coord where charge was initialized.. i've tried calling playerbotai::MovementUpdate() to try refreshing position but no change thought: how is spell (charge) handled in mangos, does it require another function like relocate() or monstermove() to work?
  13. @runsttren et all i believe i have worked out the implementation of rogue opening maneuver, but it requires some significant changes to the way combat and movement is handled in playerbotai here is a patch against the latest playerbot http://pastebin.com/m39da6cc in this patch: - moved function call playerbotai::Docombatmovement to each class specfic function (for example playerbotrogueai::Donextcombatmaneuver) - implemented bot initializing attack your target when you whisper to it "attack" - rogue opening maneuver: bot cast stealth, moves to combat range, then casts cheapshot im still working on other maneuvers, please test if you want
  14. @Runsttren i don't mind at all, but i'm afraid at the moment my code is far from working as intended.. as previously posted I got the rogue bot to stealth up to the mob but I can't seem to get it to cast cheapshot before it is attacked, im still working it out as for warrior charge, the bot casts charge but does not update its position, i think i might have to use a hack such as calling relocate() to actually put the bot next to the mob i'll keep updating on my progress
  15. i've been trying to implement the rogue bot beginning combat with a cheapshot, heres what i have so far: void PlayerbotRogueAI::DoNextCombatManeuver(Unit *pTarget) { if( !pTarget ) return; PlayerbotAI* ai = GetAI(); if (!ai) return; ai->SetInFront( pTarget ); Player *m_bot = GetPlayerBot(); Unit* pVictim = pTarget->getVictim(); float targetDist = m_bot->GetDistance( pTarget ); if (targetDist>ATTACK_DISTANCE) { m_bot->Attack(pTarget, false); ai->DoCombatMovement(); //<-- this function call is moved here from playerbotai::Donextcombatmaneuver return; } //rogue stealth cheapshot opener if (CHEAP_SHOT>0 && ai->GetEnergyAmount()>=60) ai->CastSpell(CHEAP_SHOT); m_bot->Attack(pTarget, true); ... void PlayerbotRogueAI::DoNonCombatActions() { Player * m_bot = GetPlayerBot(); if (!m_bot) return; //roguebot casts stealth when not in combat, so can start stealth requiring ability in combat if (STEALTH>0 && !m_bot->HasAura( STEALTH, 0 )) GetAI()->CastSpell(STEALTH, *m_bot); what happens so far: the bot moves to melee range of a mob, but does no action (gives botout: SMSG_CAST_FAILED) seems like ai->CastSpell(CHEAP_SHOT); is failing for some reason anyone interest can take a look at my changelog at http://github.com/illustri/mangos/commits/illustri and see where im going
  16. @beleko you mean "mangos_command_bot.sql"? here it is
  17. first of all, excellent job those who worked on playerbot, collinsp, rrtn, winslow, xeqt... if i miss anyone else please forgive me i've been trying my hand at some programming, i really have no background to start with but this has been a great learning experience heres my limited tinkering with playerbot: git://github.com/illustri/mangos.git illustri http://github.com/illustri/mangos/commits/illustri its based on winslow's repository with some removed/added features, my documentation is poor atm but ill work on it right now im trying to implement class specific openers, like warrior charge or rogue cheapshot if anyones interested please take a look, i initially started this for myself but i thought others might benefit from my efforts
  18. for chathandler conflict i resolved it manually, here is my diff edit: sorry i pasted wrong portion of diff... I've not experienced problems with bot quest turn in on my build
  19. Thanks XEQT, built successfully, testing now
  20. new build error with mangos 8463: i think it has to do with changes in master to worldsession.cpp anybody have a fix for it?
  21. ApoC 's patch seems to fix the 1hp bug on original patch, using 8451 mangos revision
  22. HiddenDweller thanks for the effort, the player 1hp regen bug still persists on my build 8277
  23. zhenya' i tried your fix for 7847-master (not 0-12) i get this:
  24. looks like commit 7847 causes merge conflicts with patrik774's version of patch, anyone able to resolve?
  25. i can confirm patch works on build 7280 for me, hopefully will be added to master thanks
×
×
  • 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