Show
Ignore:
Timestamp:
11/19/08 13:36:49 (17 years ago)
Author:
yumileroy
Message:

[svn] Update trinityscript to SD2 rev 700. Source: scriptdev2. Patch provided by SLG.

Original author: megamage
Date: 2008-10-25 11:40:10-05:00

Location:
trunk/src/bindings/scripts/scripts/creature
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/bindings/scripts/scripts/creature/mob_event_ai.cpp

    r90 r109  
    524524        switch (type) 
    525525        { 
    526         case ACTION_T_SAY: 
    527             DoSay(GetEventAIText(param1), LANG_UNIVERSAL, pActionInvoker ? pActionInvoker : m_creature->getVictim()); 
    528             break; 
    529         case ACTION_T_YELL: 
    530             DoYell(GetEventAIText(param1), LANG_UNIVERSAL, pActionInvoker ? pActionInvoker : m_creature->getVictim()); 
    531             break; 
    532         case ACTION_T_TEXTEMOTE: 
    533             DoTextEmote(GetEventAIText(param1), pActionInvoker ? pActionInvoker : m_creature->getVictim()); 
     526        case ACTION_T_TEXT: 
     527            { 
     528                if (!param1) 
     529                    return; 
     530 
     531                uint32 temp = 0; 
     532 
     533                if (param2 && param3) 
     534                { 
     535                    switch( rand()%3 ) 
     536                    { 
     537                        case 0: temp = param1; break; 
     538                        case 2: temp = param2; break; 
     539                        case 3: temp = param3; break; 
     540                    } 
     541                }else if ( param2 && urand(0,1) ) 
     542                { 
     543                    temp = param2; 
     544                }else 
     545                { 
     546                    temp = param1; 
     547                } 
     548 
     549                if (temp) 
     550                { 
     551                    Unit* target = NULL; 
     552                    Unit* owner = NULL; 
     553 
     554                    if (pActionInvoker) 
     555                    { 
     556                        if (pActionInvoker->GetTypeId() == TYPEID_PLAYER) 
     557                            target = pActionInvoker; 
     558                        else if (owner = pActionInvoker->GetOwner()) 
     559                        { 
     560                            if (owner->GetTypeId() == TYPEID_PLAYER) 
     561                                target = owner; 
     562                        } 
     563                    } 
     564                    else if (target = m_creature->getVictim()) 
     565                    { 
     566                        if (target->GetTypeId() != TYPEID_PLAYER) 
     567                        { 
     568                            if (owner = target->GetOwner()) 
     569                            { 
     570                                if (owner->GetTypeId() == TYPEID_PLAYER) 
     571                                    target = owner; 
     572                            } 
     573                        } 
     574                    } 
     575 
     576                    DoScriptText(temp, m_creature, target); 
     577                } 
     578            } 
    534579            break; 
    535580        case ACTION_T_SOUND: 
     
    538583        case ACTION_T_EMOTE: 
    539584            m_creature->HandleEmoteCommand(param1); 
    540             break; 
    541         case ACTION_T_RANDOM_SAY: 
    542             { 
    543                 uint32 temp = GetRandActionParam(rnd, param1, param2, param3); 
    544  
    545                 if (temp != 0xffffffff) 
    546                     DoSay(GetEventAIText(temp), LANG_UNIVERSAL, pActionInvoker ? pActionInvoker : m_creature->getVictim()); 
    547             } 
    548             break; 
    549         case ACTION_T_RANDOM_YELL: 
    550             { 
    551                 uint32 temp = GetRandActionParam(rnd, param1, param2, param3); 
    552  
    553                 if (temp != 0xffffffff) 
    554                     DoYell(GetEventAIText(temp), LANG_UNIVERSAL, pActionInvoker ? pActionInvoker : m_creature->getVictim()); 
    555             } 
    556             break; 
    557         case ACTION_T_RANDOM_TEXTEMOTE: 
    558             { 
    559                 uint32 temp = GetRandActionParam(rnd, param1, param2, param3); 
    560  
    561                 if (temp != 0xffffffff) 
    562                     DoTextEmote(GetEventAIText(temp), pActionInvoker ? pActionInvoker : m_creature->getVictim()); 
    563             } 
    564585            break; 
    565586        case ACTION_T_RANDOM_SOUND: 
  • trunk/src/bindings/scripts/scripts/creature/mob_event_ai.h

    r90 r109  
    3131    EVENT_T_QUEST_ACCEPT            = 19,   //QuestID 
    3232    EVENT_T_QUEST_COMPLETE          = 20,   // 
    33      
     33 
    3434    EVENT_T_END, 
    3535}; 
     
    3838{ 
    3939    ACTION_T_NONE                   = 0,    //No action 
    40     ACTION_T_SAY                    = 1,    //TextId 
    41     ACTION_T_YELL                   = 2,    //TextId 
    42     ACTION_T_TEXTEMOTE              = 3,    //TextId 
     40    ACTION_T_TEXT                   = 1,    //-TextId1, optionally -TextId2, optionally -TextId3(if -TextId2 exist). If more than just -TextId1 is defined, randomize. Negative values. 
     41    ACTION_T_YELL                   = 2,    //UNUSED 
     42    ACTION_T_TEXTEMOTE              = 3,    //UNUSED 
    4343    ACTION_T_SOUND                  = 4,    //SoundId 
    4444    ACTION_T_EMOTE                  = 5,    //EmoteId 
    45     ACTION_T_RANDOM_SAY             = 6,    //TextId1, TextId2, TextId3 (-1 in any field means no output if randomed that field) 
    46     ACTION_T_RANDOM_YELL            = 7,    //TextId1, TextId2, TextId3 (-1 in any field means no output if randomed that field) 
    47     ACTION_T_RANDOM_TEXTEMOTE       = 8,    //TextId1, TextId2, TextId3 (-1 in any field means no output if randomed that field) 
     45    ACTION_T_RANDOM_SAY             = 6,    //UNUSED 
     46    ACTION_T_RANDOM_YELL            = 7,    //UNUSED 
     47    ACTION_T_RANDOM_TEXTEMOTE       = 8,    //UNUSED 
    4848    ACTION_T_RANDOM_SOUND           = 9,    //SoundId1, SoundId2, SoundId3 (-1 in any field means no output if randomed that field) 
    4949    ACTION_T_RANDOM_EMOTE           = 10,   //EmoteId1, EmoteId2, EmoteId3 (-1 in any field means no output if randomed that field) 
     
    209209 
    210210//Error prevention list 
    211 extern HM_NAMESPACE::hash_map<uint32, EventAI_CreatureError> EventAI_CreatureErrorPreventionList;  
     211extern HM_NAMESPACE::hash_map<uint32, EventAI_CreatureError> EventAI_CreatureErrorPreventionList; 
    212212 
    213213//Defines