Скрипт фикс: Тренеры, Торговцы, Квестеры » Статьи » World Of Warcraft Файловый Архив

 
 
 

 
 
 
 
 
 
 
 

Скрипт фикс: Тренеры, Торговцы, Квестеры

Разместил: StarkingПросмотрено: 3200
Категория: Серверная >> MangosДата: 10.07.2009
 
Заметил такую проблему. Когда подходишь к тренеру обучаться, то он без всяких диалогов открывает сразу список спелов. Если же тренер даёт/забирает квест, то вместо названи квеста в меню стоит пункт Do quest. Это не соответсвует офу. Поэтому я решил попробовать исправить положение. И вот что получилось.
Quester_ui.cpp
Код:
#include "../sc_defines.h"
bool GossipHello_Quester_ui(Player *player, Creature *_Creature)
{
uint64 guid = _Creature->GetGUID();
uint32 textid=_Creature->GetNpcTextId();
if (_Creature->isQuestGiver())
{
player->PrepareQuestMenu( guid );
player->SendPreparedQuest( guid );
}
if(textid!=DEFAULT_GOSSIP_MESSAGE )
{
player->SEND_GOSSIP_MENU(textid,_Creature->GetGUID());
return true;
}
return false;
}

bool GossipSelect_Quester_ui(Player *player, Creature *_Creature, uint32 sender, uint32 action )
{
return false;
}

bool GossipSelectWithCode_Quester_ui( Player *player, Creature *_Creature, uint32 sender, uint32 action, char* sCode )
{
return false;
}

bool QuestAccept_Quester_ui(Player *player, Creature *_Creature, Quest *_Quest )
{
return false;
}

bool QuestSelect_Quester_ui(Player *player, Creature *_Creature, Quest *_Quest )
{
return false;
}

bool QuestComplete_Quester_ui(Player *player, Creature *_Creature, Quest *_Quest )
{
return false;
}

uint32 NPCDialogStatus_Quester_ui(Player *player, Creature *_Creature )
{
return _Creature->QUEST_DIALOG_STATUS(player, DIALOG_STATUS_NONE);
}

bool ChooseReward_Quester_ui(Player *player, Creature *_Creature, Quest *_Quest, uint32 opt )
{
return false;
}

void AddSC_Quester_ui()
{
Script *newscript;

newscript = new Script;
newscript->Name="quester_ui";
newscript->pGossipHello = &GossipHello_Quester_ui;
newscript->pGossipSelect = &GossipSelect_Quester_ui;
newscript->pGossipSelectWithCode = &GossipSelectWithCode_Quester_ui;

newscript->pQuestAccept = &QuestAccept_Quester_ui;
newscript->pQuestSelect = &QuestSelect_Quester_ui;
newscript->pQuestComplete = &QuestComplete_Quester_ui;
newscript->pNPCDialogStatus = &NPCDialogStatus_Quester_ui;
newscript->pChooseReward = &ChooseReward_Quester_ui;
m_scripts[nrscripts++] = newscript;
}
Trainer_ui.cpp:

Код:
#include "../sc_defines.h"
bool GossipHello_Trainer_ui(Player *player, Creature *_Creature)
{
uint64 guid = _Creature->GetGUID();
uint32 textid=_Creature->GetNpcTextId();
bool isqg=false, istr=false;

uint32 result = DIALOG_STATUS_NONE;
result = _Creature->QUEST_DIALOG_STATUS(player, DIALOG_STATUS_NONE);
if(result!=DIALOG_STATUS_NONE)isqg = true;
if (_Creature->isQuestGiver())
{
player->PrepareQuestMenu( guid );
player->SendPreparedQuest( guid );
}
if(_Creature->isTrainer())
{
if(_Creature->isCanTrainingOf(player,false))
{
istr = true;
switch(_Creature->GetCreatureInfo()->trainer_type)
{
case TRAINER_TYPE_CLASS:
{
switch(_Creature->GetCreatureInfo()->classNum)
{
case DRUID: {player->ADD_GOSSIP_ITEM( 3, "I seek training as a druid", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); break;}
case HUNTER: {player->ADD_GOSSIP_ITEM( 3, "I seek training as a hunter", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); break;}
case MAGE: {player->ADD_GOSSIP_ITEM( 3, "I seek training as a mage", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); break;}
case PALADIN:{player->ADD_GOSSIP_ITEM( 3, "I seek training as a paladin", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); break;}
case PRIEST: {player->ADD_GOSSIP_ITEM( 3, "I seek training as a priest", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); break;}
case ROGUE: {player->ADD_GOSSIP_ITEM( 3, "I seek training as a rogue", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); break;}
case SHAMAN: {player->ADD_GOSSIP_ITEM( 3, "I seek training as a shaman", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); break;}
case WARLOCK:{player->ADD_GOSSIP_ITEM( 3, "I seek training as a warlock", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); break;}
case WARRIOR:{player->ADD_GOSSIP_ITEM( 3, "I seek training as a warrior", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); break;}
}
break;
}
case TRAINER_TYPE_PETS:
{
player->ADD_GOSSIP_ITEM( 3, "Train me.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
break;
}
case TRAINER_TYPE_MOUNTS:
{
player->ADD_GOSSIP_ITEM( 3, "Train me.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
break;
}
case TRAINER_TYPE_TRADESKILLS:
{
player->ADD_GOSSIP_ITEM( 3, "Train me.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
break;
}
}
}
else
{
switch(_Creature->GetCreatureInfo()->classNum)
{
case DRUID: {textid=4913; break;}
case HUNTER: {textid=10090; break;}
case MAGE: {textid=328; break;}
case PALADIN:{textid=1635; break;}
case PRIEST: {textid=4436; break;}
case ROGUE: {textid=4797; break;}
case SHAMAN: {textid=5003; break;}
case WARLOCK:{textid=5836; break;}
case WARRIOR:{textid=4985; break;}
}
}
}
if(textid!=DEFAULT_GOSSIP_MESSAGE || (isqg&&istr) )
{
player->SEND_GOSSIP_MENU(textid,_Creature->GetGUID());
return true;
}
return false;
}

bool GossipSelect_Trainer_ui(Player *player, Creature *_Creature, uint32 sender, uint32 action )
{
player->SEND_TRAINERLIST( _Creature->GetGUID() );
return false;
}

bool GossipSelectWithCode_Trainer_ui( Player *player, Creature *_Creature, uint32 sender, uint32 action, char* sCode )
{
return false;
}

bool QuestAccept_Trainer_ui(Player *player, Creature *_Creature, Quest *_Quest )
{
return false;
}

bool QuestSelect_Trainer_ui(Player *player, Creature *_Creature, Quest *_Quest )
{
return false;
}

bool QuestComplete_Trainer_ui(Player *player, Creature *_Creature, Quest *_Quest )
{
return false;
}

uint32 NPCDialogStatus_Trainer_ui(Player *player, Creature *_Creature )
{
uint32 textid=_Creature->GetNpcTextId();
uint32 result = DIALOG_STATUS_NONE;
result = _Creature->QUEST_DIALOG_STATUS(player, DIALOG_STATUS_NONE);
if(result!=DIALOG_STATUS_NONE) return result;
if(textid!=DEFAULT_GOSSIP_MESSAGE) return DIALOG_STATUS_CHAT;
return false;
}

bool ChooseReward_Trainer_ui(Player *player, Creature *_Creature, Quest *_Quest, uint32 opt )
{
return false;
}

void AddSC_Trainer_ui()
{
Script *newscript;

newscript = new Script;
newscript->Name="trainer_ui";
newscript->pGossipHello = &GossipHello_Trainer_ui;
newscript->pGossipSelect = &GossipSelect_Trainer_ui;
newscript->pGossipSelectWithCode = &GossipSelectWithCode_Trainer_ui;

newscript->pQuestAccept = &QuestAccept_Trainer_ui;
newscript->pQuestSelect = &QuestSelect_Trainer_ui;
newscript->pQuestComplete = &QuestComplete_Trainer_ui;
newscript->pNPCDialogStatus = &NPCDialogStatus_Trainer_ui;
newscript->pChooseReward = &ChooseReward_Trainer_ui;
m_scripts[nrscripts++] = newscript;
}Vendor_ui.cpp:

Код:
Code
#include "../sc_defines.h"

bool GossipHello_Vendor_ui(Player *player, Creature *_Creature)
{
uint64 guid = _Creature->GetGUID();
uint32 textid=_Creature->GetNpcTextId();
bool isqg=false, isven=false;

uint32 result = DIALOG_STATUS_NONE;
result = _Creature->QUEST_DIALOG_STATUS(player, DIALOG_STATUS_NONE);
if(result!=DIALOG_STATUS_NONE)isqg = true;
if (_Creature->isQuestGiver())
{
player->PrepareQuestMenu( guid );
player->SendPreparedQuest( guid );
}
if(_Creature->GetItemCount())
{
player->ADD_GOSSIP_ITEM( 1, "I want to browse your goods.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
isven = true;
}
if(textid!=DEFAULT_GOSSIP_MESSAGE || (isqg&&isven) )
{
player->SEND_GOSSIP_MENU(textid,_Creature->GetGUID());
return true;
}
return false;
}

bool GossipSelect_Vendor_ui(Player *player, Creature *_Creature, uint32 sender, uint32 action )
{
player->SEND_VENDORLIST( _Creature->GetGUID() );
return false;
}

bool GossipSelectWithCode_Vendor_ui( Player *player, Creature *_Creature, uint32 sender, uint32 action, char* sCode )
{
return false;
}

bool QuestAccept_Vendor_ui(Player *player, Creature *_Creature, Quest *_Quest )
{
return false;
}

bool QuestSelect_Vendor_ui(Player *player, Creature *_Creature, Quest *_Quest )
{
return false;
}

bool QuestComplete_Vendor_ui(Player *player, Creature *_Creature, Quest *_Quest )
{
return false;
}

uint32 NPCDialogStatus_Vendor_ui(Player *player, Creature *_Creature )
{
uint32 textid=_Creature->GetNpcTextId();
uint32 result = DIALOG_STATUS_NONE;
result = _Creature->QUEST_DIALOG_STATUS(player, DIALOG_STATUS_NONE);
if(result!=DIALOG_STATUS_NONE) return result;
if(textid!=DEFAULT_GOSSIP_MESSAGE) return DIALOG_STATUS_CHAT;
return false;
}

bool ChooseReward_Vendor_ui(Player *player, Creature *_Creature, Quest *_Quest, uint32 opt )
{
return false;
}

void AddSC_Vendor_ui()
{
Script *newscript;

newscript = new Script;
newscript->Name="vendor_ui";
newscript->pGossipHello = &GossipHello_Vendor_ui;
newscript->pGossipSelect = &GossipSelect_Vendor_ui;
newscript->pGossipSelectWithCode = &GossipSelectWithCode_Vendor_ui;

newscript->pQuestAccept = &QuestAccept_Vendor_ui;
newscript->pQuestSelect = &QuestSelect_Vendor_ui;
newscript->pQuestComplete = &QuestComplete_Vendor_ui;
newscript->pNPCDialogStatus = &NPCDialogStatus_Vendor_ui;
newscript->pChooseReward = &ChooseReward_Vendor_ui;
m_scripts[nrscripts++] = newscript;
}
Я не совсем понял как задавать госсип-текст (на вики ничего нет), но с использованием данных скриптов нужно просто заполнить поля npc_guid и textid таблицы npc_gossip. textid берётся из таблицы npc_text.

 

Версия для печати
 

Комментарии

 
 

Оставить комментарий может только зарегистрированный пользователь.