Jump to content

[PATCH] Add SCRIPT_COMMAND_SEND_TAXI_PATH


Guest klark20

Recommended Posts

* What bug does the patch fix? What features does the patch add?

Support taxi path in gossip_scripts

* For which repository revision was the patch created?

11387

* 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.

Schmoozerd

    From c7940b0ba28748a2a5f4927387f9fe9e359481a2 Mon Sep 17 00:00:00 2001
   From: Schmoozerd <[email protected]>
   Date: Wed, 20 Apr 2011 19:52:21 +0200
   Subject: [PATCH] Add SCRIPT_COMMAND_SEND_TAXI_PATH

   ---
    doc/script_commands.txt |    8 +++-----
    src/game/Map.cpp        |   13 +++++++++++++
    src/game/ScriptMgr.cpp  |   14 ++++++++++++++
    src/game/ScriptMgr.h    |    7 +++++++
    4 files changed, 37 insertions(+), 5 deletions(-)

   diff --git a/doc/script_commands.txt b/doc/script_commands.txt
   index 0630f73..2e9dfb6 100644
   --- a/doc/script_commands.txt
   +++ b/doc/script_commands.txt
   @@ -219,8 +219,6 @@ spell_scripts
                                                * data_flags =  flag_original_source_as_target  = 0x02
                                                                flag_buddy_as_target            = 0x04 (When this flag is not set, buddy will be the attacker when buddy is defined)

   -
   -
   -
   -
   -
   +27 SCRIPT_COMMAND_SEND_TAXI_PATH            source or target must be Player, source preferred
   +                                            * datalong = taxi path id
   +                                            * datalong2 = spell id
   diff --git a/src/game/Map.cpp b/src/game/Map.cpp
   index 4984293..bcf03ce 100644
   --- a/src/game/Map.cpp
   +++ b/src/game/Map.cpp
   @@ -2869,6 +2869,19 @@ void Map::ScriptsProcess()
                    sLog.outError("SCRIPT_COMMAND_ATTACK_START (script id %u) unexpected error, attacker or victim could not be found, no action.", step.script->id);
                    break;
                }
   +            case SCRIPT_COMMAND_SEND_TAXI_PATH:
   +            {
   +                if ((!source || !source->isType(TYPEMASK_PLAYER)) && (!target || !target->isType(TYPEMASK_PLAYER)))
   +                {
   +                    sLog.outError("SCRIPT_COMMAND_SEND_TAXI_PATH (script id %u) call for not fitting source (type %u) or target (type %u)", step.script->id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0);
   +                    break;
   +                }
   +
   +                Player* player = source && source->isType(TYPEMASK_PLAYER) ? (Player*)source : (Player*)target;
   +
   +                player->ActivateTaxiPathTo(step.script->sendTaxiPath.taxiPathId, step.script->sendTaxiPath.spellId);
   +                break;
   +            }
                default:
                    sLog.outError("Unknown SCRIPT_COMMAND_ %u called for script id %u.",step.script->command, step.script->id);
                    break;
   diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp
   index ef0ec43..a58d11c 100644
   --- a/src/game/ScriptMgr.cpp
   +++ b/src/game/ScriptMgr.cpp
   @@ -533,6 +533,20 @@ void ScriptMgr::LoadScripts(ScriptMapMap& scripts, const char* tablename)
                    }
                    break;
                }
   +            case SCRIPT_COMMAND_SEND_TAXI_PATH:
   +            {
   +                if (!sTaxiPathStore.LookupEntry(tmp.sendTaxiPath.taxiPathId))
   +                {
   +                    sLog.outErrorDb("Table `%s` has datalong = %u in SCRIPT_COMMAND_SEND_TAXI_PATH for script id %u, but this taxi path does not exist.", tablename, tmp.sendTaxiPath.taxiPathId, tmp.id);
   +                    continue;
   +                }
   +                if (tmp.sendTaxiPath.spellId  && !sSpellStore.LookupEntry(tmp.sendTaxiPath.spellId))
   +                {
   +                    sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_SEND_TAXI_PATH for script id %u, but this spell does not exist.", tablename, tmp.sendTaxiPath.spellId, tmp.id);
   +                    continue;
   +                }
   +                break;
   +            }
            }

            if (scripts.find(tmp.id) == scripts.end())
   diff --git a/src/game/ScriptMgr.h b/src/game/ScriptMgr.h
   index a67d935..0598b24 100644
   --- a/src/game/ScriptMgr.h
   +++ b/src/game/ScriptMgr.h
   @@ -92,6 +92,7 @@ enum eScriptCommand
                                                                // datalong2=creature entry, datalong3=search radius
        SCRIPT_COMMAND_ATTACK_START             = 26,           // source = Creature (or WorldObject when creature entry are defined), target = Player
                                                                // datalong2 = creature entry (searching for a buddy, closest to source), datalong3 = creature search radius
   +    SCRIPT_COMMAND_SEND_TAXI_PATH           = 27,           // datalong = taxi path id, datalong2 = spell id (source or target must be player)
    };

    #define MAX_TEXT_ID 4                                       // used for SCRIPT_COMMAND_TALK
   @@ -286,6 +287,12 @@ struct ScriptInfo

            struct
            {
   +            uint32 taxiPathId;                              // datalong
   +            uint32 spellId;                                 // datalong2
   +        } sendTaxiPath;
   +
   +        struct
   +        {
                uint32 data[9];
            } raw;
        };
   -- 
   1.7.3.1.msysgit.0



Test for NPC Afrasastrasz

INSERT IGNORE INTO gossip_scripts (id, delay, command, datalong, datalong2, datalong3, datalong4, data_flags, dataint, dataint2, x, y, z, o, comments) VALUES
(95630, 0, 27, 881, 5, 0, 0, 0, 0, 0, 0,0,0,0, 'Taxi path 881'),
(95631, 0, 27, 882, 5, 0, 0, 0, 0, 0, 0,0,0,0, 'Taxi path 882');

UPDATE gossip_menu_option SET action_menu_id=-1, action_script_id=95630 WHERE menu_id=9563 AND id=0;
UPDATE gossip_menu_option SET action_menu_id=-1, action_script_id=95631 WHERE menu_id=9563 AND id=1;
UPDATE creature_template SET ScriptName='' WHERE entry=27575;

Link to comment
Share on other sites

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