R
Rozinx
Guest
Leave it the way it is, people would take some time to learn, thats a nice idea but I think LUA systems can be even more improved without having to change the whole codes
I second that!phpish![]()
/*######
## npc_thorim
######*/
#define GOSSIP_ITEM_THORIM1 "Can you tell me what became of Sif?"
#define GOSSIP_ITEM_THORIM2 "He did more than that, Thorim. He controls Ulduar now."
#define GOSSIP_ITEM_THORIM3 "It needn't end this way."
enum
{
QUEST_SIBLING_RIVALRY = 13064,
SPELL_THORIM_STORY_KILL_CREDIT = 56940,
GOSSIP_TEXTID_THORIM1 = 13799,
GOSSIP_TEXTID_THORIM2 = 13801,
GOSSIP_TEXTID_THORIM3 = 13802,
GOSSIP_TEXTID_THORIM4 = 13803
};
bool GossipHello_npc_thorim(Player* pPlayer, Creature* pCreature)
{
if (pCreature->isQuestGiver())
pPlayer->PrepareQuestMenu(pCreature->GetGUID());
if (pPlayer->GetQuestStatus(QUEST_SIBLING_RIVALRY) == QUEST_STATUS_INCOMPLETE)
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_THORIM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM1, pCreature->GetGUID());
}
else
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
return true;
}
bool GossipSelect_npc_thorim(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
switch(uiAction)
{
case GOSSIP_ACTION_INFO_DEF+1:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_THORIM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM2, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_THORIM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM3, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+3:
pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM4, pCreature->GetGUID());
pCreature->CastSpell(pPlayer, SPELL_THORIM_STORY_KILL_CREDIT, true);
break;
}
return true;
}
/*######
## npc_roxi_ramrocket
######*/
#define GOSSIP_TEXT_RAMROCKET1 "How do you fly in this cold climate?"
#define GOSSIP_TEXT_RAMROCKET2 "I hear you sell motorcycle parts."
enum
{
SPELL_MECHANO_HOG = 60866,
SPELL_MEKGINEER_CHOPPER = 60867
};
bool GossipHello_npc_roxi_ramrocket(Player* pPlayer, Creature* pCreature)
{
if (pCreature->isTrainer())
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_RAMROCKET1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
if (pCreature->isVendor())
{
if (pPlayer->HasSpell(SPELL_MECHANO_HOG) || pPlayer->HasSpell(SPELL_MEKGINEER_CHOPPER))
{
if (pPlayer->HasSkill(SKILL_ENGINERING) && pPlayer->GetBaseSkillValue(SKILL_ENGINERING) >= 450)
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_RAMROCKET2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
}
}
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
return true;
}
bool GossipSelect_npc_roxi_ramrocket(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
switch(uiAction)
{
case GOSSIP_ACTION_TRAIN:
pPlayer->SEND_TRAINERLIST(pCreature->GetGUID());
break;
case GOSSIP_ACTION_TRADE:
pPlayer->SEND_VENDORLIST(pCreature->GetGUID());
break;
}
return true;
}
void AddSC_storm_peaks()
{
Script* newscript;
newscript = new Script;
newscript->Name = "npc_loklira_the_crone";
newscript->pGossipHello = &GossipHello_npc_loklira_the_crone;
newscript->pGossipSelect = &GossipSelect_npc_loklira_the_crone;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "npc_thorim";
newscript->pGossipHello = &GossipHello_npc_thorim;
newscript->pGossipSelect = &GossipSelect_npc_thorim;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "npc_roxi_ramrocket";
newscript->pGossipHello = &GossipHello_npc_roxi_ramrocket;
newscript->pGossipSelect = &GossipSelect_npc_roxi_ramrocket;
newscript->RegisterSelf();
}
#define GOSSIP_ITEM_ROYAL "I am ready to listen"
#define GOSSIP_ITEM_ROYAL_1 "That is tragic. How did this happen?"
#define GOSSIP_ITEM_ROYAL_2 "Interesting, continue please."
#define GOSSIP_ITEM_ROYAL_3 "Unbelievable! How dare they??"
#define GOSSIP_ITEM_ROYAL_4 "Of course I will help!"
bool GossipHello_npc_royal_historian_archesonus(Player* pPlayer, Creature* pCreature)
{
if (pCreature->isQuestGiver())
pPlayer->PrepareQuestMenu(pCreature->GetGUID());
if (pPlayer->GetQuestStatus(3702) == QUEST_STATUS_INCOMPLETE)
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
pPlayer->SEND_GOSSIP_MENU(2235, pCreature->GetGUID());
}
else
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
return true;
}
bool GossipSelect_npc_royal_historian_archesonus(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
switch(uiAction)
{
case GOSSIP_ACTION_INFO_DEF:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
pPlayer->SEND_GOSSIP_MENU(2236, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+1:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
pPlayer->SEND_GOSSIP_MENU(2237, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
pPlayer->SEND_GOSSIP_MENU(2238, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+3:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
pPlayer->SEND_GOSSIP_MENU(2239, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+4:
pPlayer->CLOSE_GOSSIP_MENU();
pPlayer->AreaExploredOrEventHappens(3702);
break;
}
return true;
}
void AddSC_ironforge()
{
Script *newscript;
newscript = new Script;
newscript->Name = "npc_royal_historian_archesonus";
newscript->pGossipHello = &GossipHello_npc_royal_historian_archesonus;
newscript->pGossipSelect = &GossipSelect_npc_royal_historian_archesonus;
newscript->RegisterSelf();
}
that example looks like C stian, but why would you want it implented. It looks so much at the code from tfs you could simply better hardcode things then![]()
Pointeres allow you to modify the data without the need to return it. And the references are there to save having two copies of the same function. C++ got some cleanings after functions return buildtin.
There is a million scripts. Only examples i can find that uses objects are the AIs, and basicly there isn't so much need to script hardcore complex AIs in Tibia.
*Facepalms*
Ah yes... Silly me.
Still, it would be a wonderful language to code in regardless.![]()
i dont like it :/
i have a big head and little arms
Pointeres allow you to modify the data without the need to return it. And the references are there to save having two copies of the same function.
If it is possible I think a .NET language is better. This has great tools to program in and it is very easy to understand.
#include <iostream>
int test(int x)
{
x = 10;
}
int main()
{
int y = 5;
test(y);
std::cout << y;
}
5
#include <iostream>
int test(int &x)
{
x = 10;
}
int main()
{
int y = 5;
test(y);
std::cout << y;
}
10