Jump to content

lillecarl

Members
  • Posts

    893
  • Joined

  • Last visited

  • Donations

    0.00 GBP 

Posts posted by lillecarl

  1. I have a good training dummy. at this dummy players can also use finisher. and no rotation^^

    /*######
    ## npc_training_dummy
    ######*/
    #define OUT_OF_COMBAT_TIME 5000
    #define AFK_TIME 300000
    
    struct MANGOS_DLL_DECL npc_training_dummyAI : public Scripted_NoMovementAI
    {
       npc_training_dummyAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature)
       {
           Reset();
       }
    
       uint32 afk_timer;
       uint32 combat_timer;
    
       void Reset()
       {
           //m_creature->addUnitState(UNIT_STAT_STUNNED);
           combat_timer = 0;
           afk_timer = 0;
       }
    
       void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
       {
           combat_timer = 0;
       }
    
       void UpdateAI(const uint32 diff)
       {
           if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
           return;
    
           if (m_creature->GetHealthPercent() < 10.0f) // allow players using finishers
           m_creature->ModifyHealth(m_creature->GetMaxHealth());
    
           m_creature->SetTargetGuid(ObjectGuid()); // prevent from rotating
           combat_timer += diff;
           afk_timer += diff;
    
           if (combat_timer > OUT_OF_COMBAT_TIME || afk_timer > AFK_TIME)
           EnterEvadeMode();
       }
    };
    
    CreatureAI* GetAI_npc_training_dummy(Creature* pCreature)
    {
    return new npc_training_dummyAI(pCreature);
    }
    
    

    There are a problem here: If there are 2 players attacking, then one "leave" he will still be in combat, since the target dummy's combat timer will keep being zeroed

  2. Hey guys, im just looking for a way to remove a player from a creatures threatlist (remove not zero his threat) I'm using this iteration and would like to clear the player if he meets a few contidions.

               ThreatList const& tList = m_creature->getThreatManager().getThreatList();
               for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr)
    

    EDIT: Here is the entire code block:

               ThreatList const& tList = m_creature->getThreatManager().getThreatList();
               for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr)
               {
                   pTarget = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid());
                   Player *pPlayer = pTarget->ToPlayer();
                   if (say_timer >= 120000)
                   {
                       say_timer = 0;
                       ChatHandler(pPlayer).PSendSysMessage("%s[Training Dummy]%s To leave combat, move 25 yards from the dummy!",MSG_COLOR_MAGENTA,MSG_COLOR_WHITE);
                   }
    
                   if (pTarget && !pTarget->IsWithinDistInMap(m_creature,25,false) || !pTarget->IsWithinLOSInMap(m_creature))
                   {
                       if (pPlayer)
                       {
                           ChatHandler(pPlayer).PSendSysMessage("%s[Training Dummy%s Now you left combat!",MSG_COLOR_MAGENTA,MSG_COLOR_WHITE);
                           pPlayer->ClearInCombat();
                           pPlayer->CombatStop(true);
                           pPlayer->CombatStopWithPets(true);
                       }
                   }
    
    
                   pTarget = NULL;
               }
    

  3. Oh yeah i forgot about this. Maby if the "after part" should be processed by mangosd on each startup? It would indeed take alot of time, so maby putting in a configuration called "optimizedb" or something, because i pretty much dislike the idea of needing a external tool. Wouldnt that be the best solution you think? Then we might be able to put other optimizations to the mangos startup (in this config aswell) such as GUID reordering etc.. (When someone feels for doing that) I can only see pros about this, since the code wont really depend on anything else it will be easily maintained, and since it is a config if you want to database optimize on startup, you wont loose any speed to it really. Im just trying to help you brainstorm out a good idea, im sadly not good enough in programming to help you really, but i think writing it into mangos would be kick-***

  4. Ah, i get this now, lets say we create a C++ array and map it so it would look like the conditions table.

    then we fetch each and every current condition into the map, and with some einstein solution check for duplicates, remove all duplicates except one. Then we redirect all other entries to the only one left? and then when we have ran this loop for each and every row until there are no duplicates left, we make a loop that writes SQL queries into a text file? Hmmrmmm that might "not be as hard" as i trought (Far out of my knowledge but not that hard for someone with "real" programming skills, i guess)

  5. Oh yeah sorry, i just woke up.. Hmm never mind lets not talk about mysql queries solving this problem really... But if you want this tool to ever be written, you should indeed "prepare" the unknown writer for it as much as possible. Anyways, thank you for explaining so well! Hmm.... If you know exactly how the conversion can happen, then you can write a tiny CLI c++ tool only? Because i guess you have more knowledge about how it works that way =) But yeah i see now, each of the gossip_menu_option columns act as one row in the conditions table =) I cannot say more then good luck then :/ So good luck! :)

  6. Could you tell me all places in the DB where the conditions are stored at the moment? Would be quite useful (if im not out sailing atm :P)

    EDIT: If we just look at loot_template and gossip_menu_option, we see that their "condition lists" are not equal. If we could merge those lists together to one contition list, and extend the conditions table to 3 rows as gossip_menu_option has it. I think its doable in SQL by someone a lil smarter then me.

    Lets say we create a table called gossip_menu_option_temporary with the same condition layout as gossip_option and nothing else then that. Then we use SQL update commands to "port" the old "condition check id's" to new ones just using something like ** update temptablewhatever set cond_1 = 1 where cond_1 = 2 ** For all the different types of conditions in the gossip_option table. I might just be completely wrong tho

  7. Seems good enough:) Keep it up, but take your time! We dont wanna burn you out!:) Tell us if you need any help:)

    Edit: Did i get this correct? In the conditions table all conditions are stored and linked? So all actual condition data is stored in the conditions table? And then you "link" To the actual conditions via lets say gossip-options? For a start, just creste a wiki article(if im right about this)

  8. The easiest way would be to in either area updating or just the player update check if the player is on map 530, then hearthstone him or something. Or teleport him to the other side of the dark portal ^^, Maby you could even just disable the areatrigger =)

  9. The suggested layout for `conditions` would be

    (entry, type, val1, val2, linkedEntry)

    Negative link-entry is interpreted as "OR", positive link-entry is interpreted as "AND"

    Very good idea! Myself would have created another column for that (doh), i didnt pick everything up, but i think the idea is great! But yes indeed conversion from the current system would be "hard" id say it would be easier to "redo" everything xD

    How will it work with multiple and's and or's? As example

    If 1=1 || 2=2 && 3=3

    Would that be possible etc..?

×
×
  • 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