PDA

Просмотр полной версии : [GO]ulduar_teleport.cpp


griffonheart
17.01.2010, 18:46
Телепорт ульдуара:
1) На русском (взято из соседней темы (http://ytdb.ru/showthread.php?t=916))
2) Переделан под ГО (а не хак-кричер)

#include "precompiled.h"
#include "def_ulduar.h"

/*
The teleporter appears to be active and stable.

- Expedition Base Camp
- Formation Grounds
- Colossal Forge
- Scrapyard
- Antechamber of Ulduar
- Shattered Walkway
- Conservatory of Life
- Spark of Imagination
- Prison of Yogg-Saron
*/

#define BASE_CAMP 200
#define GROUNDS 201
#define FORGE 202
#define SCRAPYARD 203
#define ANTECHAMBER 204
#define WALKWAY 205
#define CONSERVATORY 206
#define SPARK 207
#define PRISON 208

/*######
## go_ulduar_teleporter (194569)
######*/

bool GOHello_go_ulduar_teleporter(Player* pPlayer, GameObject* pGo)
{
ScriptedInstance *pInstance = (ScriptedInstance *) pGo->GetInstanceData();
if(!pInstance)
return false;

pPlayer->ADD_GOSSIP_ITEM(0, "Переместиться в Главный лагерь экспедиции", GOSSIP_SENDER_MAIN, BASE_CAMP);
if(pInstance->GetData(TYPE_LEVIATHAN_TP))
{
pPlayer->ADD_GOSSIP_ITEM(0, "Переместиться на Плац", GOSSIP_SENDER_MAIN, GROUNDS);
if(pInstance->GetData(TYPE_FLAME_LEVIATHAN) == DONE)
{
pPlayer->ADD_GOSSIP_ITEM(0, "Переместиться в Гигантскую кузню", GOSSIP_SENDER_MAIN, FORGE);
if(pInstance->GetData(TYPE_XT002_TP))
{
pPlayer->ADD_GOSSIP_ITEM(0, "Переместиться на Мусорную свалку", GOSSIP_SENDER_MAIN, SCRAPYARD);
if(pInstance->GetData(TYPE_XT002) == DONE)
{
pPlayer->ADD_GOSSIP_ITEM(0, "Переместиться в Вестибюль", GOSSIP_SENDER_MAIN, ANTECHAMBER);
if(pInstance->GetData(TYPE_KOLOGARN) == DONE)
{
pPlayer->ADD_GOSSIP_ITEM(0, "Переместиться в Разрушенную аллею", GOSSIP_SENDER_MAIN, WALKWAY);
if(pInstance->GetData(TYPE_AURIAYA) == DONE)
{
pPlayer->ADD_GOSSIP_ITEM(0, "Переместиться в Консерваторию", GOSSIP_SENDER_MAIN, CONSERVATORY);
if(pInstance->GetData(TYPE_MIMIRON_TP))
{
pPlayer->ADD_GOSSIP_ITEM(0, "Переместиться в зал Искры воображения", GOSSIP_SENDER_MAIN, SPARK);
if(pInstance->GetData(TYPE_VEZAX) == DONE)
pPlayer->ADD_GOSSIP_ITEM(0, "Переместиться в тюрьму Йогг-Сарона", GOSSIP_SENDER_MAIN, PRISON);
}
}
}
}
}
}
}
pPlayer->SEND_GOSSIP_MENU(14424, pGo->GetGUID());

return true;
}

bool GOGossipSelect_go_ulduar_teleporter(Player *pPlayer, GameObject *pGo, uint32 sender, uint32 action )
{
if(sender != GOSSIP_SENDER_MAIN)
return true;

if(!pPlayer->getAttackers().empty())
return true;

switch(action)
{
case BASE_CAMP:
pPlayer->TeleportTo(603, -706.122, -92.6024, 429.876, 0);
pPlayer->CLOSE_GOSSIP_MENU(); break;
case GROUNDS:
pPlayer->TeleportTo(603, 131.248, -35.3802, 409.804, 0);
pPlayer->CLOSE_GOSSIP_MENU(); break;
case FORGE:
pPlayer->TeleportTo(603, 553.233, -12.3247, 409.679, 0);
pPlayer->CLOSE_GOSSIP_MENU(); break;
case SCRAPYARD:
pPlayer->TeleportTo(603, 926.292, -11.4635, 418.595, 0);
pPlayer->CLOSE_GOSSIP_MENU(); break;
case ANTECHAMBER:
pPlayer->TeleportTo(603, 1498.09, -24.246, 420.967, 0);
pPlayer->CLOSE_GOSSIP_MENU(); break;
case WALKWAY:
pPlayer->TeleportTo(603, 1859.45, -24.1, 448.9, 0);
pPlayer->CLOSE_GOSSIP_MENU(); break;
case CONSERVATORY:
pPlayer->TeleportTo(603, 2086.27, -24.3134, 421.239, 0);
pPlayer->CLOSE_GOSSIP_MENU(); break;
case SPARK:
pPlayer->TeleportTo(603, 2536.87, 2569.15, 412.304, 0);
pPlayer->CLOSE_GOSSIP_MENU(); break;
case PRISON:
pPlayer->TeleportTo(603, 2536.87, 2569.15, 412.304, 0);
pPlayer->CLOSE_GOSSIP_MENU(); break;
}
return true;
}


void AddSC_ulduar_teleport()
{
Script *newscript;

newscript = new Script;
newscript->Name = "go_ulduar_teleporter";
newscript->pGOHello = &GOHello_go_ulduar_teleporter;
newscript->pGOGossipSelect = &GOGossipSelect_go_ulduar_teleporter;
newscript->RegisterSelf();
}



Требует патч на ядро:
diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp
index bf3425d..2185eaa 100644
--- a/src/game/NPCHandler.cpp
+++ b/src/game/NPCHandler.cpp
@@ -338,7 +338,8 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
return;
}

- _player->OnGossipSelect(pGo, gossipListId, menuId);
+ if (!Script->GOGossipSelect(_player, pGo, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)))
+ _player->OnGossipSelect(pGo, gossipListId, menuId);
}
}

diff --git a/src/game/ScriptCalls.cpp b/src/game/ScriptCalls.cpp
index 96f14ae..ae94d23 100644
--- a/src/game/ScriptCalls.cpp
+++ b/src/game/ScriptCalls.cpp
@@ -69,6 +69,7 @@ bool LoadScriptingModule(char const* libName)
||!(testScript->ChooseReward =(scriptCallChooseReward )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ChooseReward" ))
||!(testScript->ItemHello =(scriptCallItemHello )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ItemHello" ))
||!(testScript->GOHello =(scriptCallGOHello )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOHello" ))
+ ||!(testScript->GOGossipSelect =(scriptCallGOGossipSelect )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOGossipSelect" ))
||!(testScript->scriptAreaTrigger =(scriptCallAreaTrigger )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"AreaTrigger" ))
||!(testScript->ItemQuestAccept =(scriptCallItemQuestAccept )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ItemQuestAccept" ))
||!(testScript->GOQuestAccept =(scriptCallGOQuestAccept )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOQuestAccept" ))
diff --git a/src/game/ScriptCalls.h b/src/game/ScriptCalls.h
index f3f5d43..d121680 100644
--- a/src/game/ScriptCalls.h
+++ b/src/game/ScriptCalls.h
@@ -50,6 +50,7 @@ typedef uint32(MANGOS_IMPORT * scriptCallGODialogStatus)( Player *player, GameOb
typedef bool(MANGOS_IMPORT * scriptCallChooseReward)( Player *player, Creature *_Creature, Quest const*, uint32 opt );
typedef bool(MANGOS_IMPORT * scriptCallItemHello)( Player *player, Item *, Quest const*);
typedef bool(MANGOS_IMPORT * scriptCallGOHello)( Player *player, GameObject * );
+typedef bool(MANGOS_IMPORT * scriptCallGOGossipSelect)(Player *player, GameObject *_GO, uint32 sender, uint32 action);
typedef bool(MANGOS_IMPORT * scriptCallAreaTrigger)( Player *player, AreaTriggerEntry const* );
typedef bool(MANGOS_IMPORT * scriptCallItemQuestAccept)(Player *player, Item *, Quest const*);
typedef bool(MANGOS_IMPORT * scriptCallGOQuestAccept)(Player *player, GameObject *, Quest const*);
@@ -79,6 +80,7 @@ typedef struct
scriptCallChooseReward ChooseReward;
scriptCallItemHello ItemHello;
scriptCallGOHello GOHello;
+ scriptCallGOGossipSelect GOGossipSelect;
scriptCallAreaTrigger scriptAreaTrigger;
scriptCallItemQuestAccept ItemQuestAccept;
scriptCallGOQuestAccept GOQuestAccept;



gameobject_scripts - это табличные скрипты, а я привёл код для скриптов на C++
Это разные вещи.


Ядро патчить обязательно, так как без этого не будет работать Госсип-Селект для ГО




Выложен здесь (http://ytdb.ru/Yuriy/patches/sd2/GO_ulduar_teleport/)