Alex.
04-20-2009, 02:07 AM
This lets players type certain phrases and let them receive benefits from them. Don't forget to change the teleport locations. If you would like me to add a feature I'll gladly try.
Thanks
Alex.
Twingle.cpp
// "Twingle" System By Dr. Feelgood. Don't Ninja Leechers! Based of the idea of "FrozenEye" --- Made by Kelwing.
#include "StdAfx.h" /*Drfg*/
#include "Setup.h" /* Drfg */
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
#define FOOD_TY 22895 //Conjured Cinnamon Roll
#define COUNT_FOOD 20
static string pvp = "#pvp"; // Teleport to PvP Zone
static string mall = "#mall"; // Teleport to mall
static string buff = "#buffme"; // Buffs
static string help = "#help"; // Help Menu
static string command = "#commands"; // Shows Commands
static string foodz = "#poptart"; // Gives Food
void EventChat(Player * pPlayer, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
{
if (Message == foodz)
{
ItemPrototype* it = ItemPrototypeStorage.LookupEntry(FOOD_TY);
Item *item;
item = objmgr.CreateItem( FOOD_TY, pPlayer);
item->SetUInt32Value(ITEM_FIELD_STACK_COUNT, ((COUNT_FOOD > it->MaxCount) ? it->MaxCount : COUNT_FOOD));
if(it->Bonding==ITEM_BIND_ON_PICKUP)
item->SoulBind();
if(!pPlayer->GetItemInterface()->AddItemToFreeSlot(item))
{
pPlayer->BroadcastMessage("No free slots were found in your inventory!");
delete item;
}
SlotResult *lr = pPlayer->GetItemInterface()->LastSearchResult();
pPlayer->GetSession()->SendItemPushResult(item,false,true,false,true,lr->ContainerSlot,lr->Slot,COUNT_FOOD);
}
if(Message == mall && pPlayer->CombatStatus.IsInCombat())
pPlayer->BroadcastMessage("Cannot teleport when in combat!");
else
{
if(Message == mall)
{
pPlayer->BroadcastMessage("You've been taken to the mall location!");
pPlayer->EventTeleport(map, x, y, z); // Change this
}
}
if(Message == pvp && pPlayer->CombatStatus.IsInCombat()){
pPlayer->BroadcastMessage("Cannot teleport when in combat!");
}
else
{
if(Message == pvp)
{
pPlayer->BroadcastMessage("CHANGE THIS");
pPlayer->EventTeleport(map, x, y, z);
}
}
if(Message == buff)
{
pPlayer->BroadcastMessage("Say hello to my little friend!");
pPlayer->CastSpell(pPlayer, 48161, true); // Fort
pPlayer->CastSpell(pPlayer, 48932, true); // Might
pPlayer->CastSpell(pPlayer, 48469, true); // Mark of Wild
pPlayer->CastSpell(pPlayer, 48936, true); // Wisdom
pPlayer->CastSpell(pPlayer, 42995, true); // Intell
}
if(Message == help){
pPlayer->BroadcastMessage("CHANGE ME"); // Add Name
}
if(Message == command){
pPlayer->BroadcastMessage("Commands currently operational:"); // Opening
pPlayer->BroadcastMessage("#pvp - Teleports you to the pvp location. #mall - teleports you to the mall. #buffme - Buffs you, duh. #help - for help. #poptart - Gives you food."); // Showing commands
}
}
void SetupTwingle(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, &EventChat);
}
Setup.h
#ifndef DONATOR_TOOLS_SETUP_H
#define DONATOR_TOOLS_SETUP_H
void SetupTwingle(ScriptMgr * mgr);
#endif
Setup.cpp
#include "StdAfx.h"
#include "Setup.h"
#define SKIP_ALLOCATOR_SHARING 1
#include <ScriptSetup.h>
extern "C" SCRIPT_DECL uint32 _exp_get_script_type()
{
return SCRIPT_TYPE_MISC;
}
extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)
{
SetupTwingle(mgr);
}
#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
return TRUE;
}
#endif
Thanks
Alex.
Twingle.cpp
// "Twingle" System By Dr. Feelgood. Don't Ninja Leechers! Based of the idea of "FrozenEye" --- Made by Kelwing.
#include "StdAfx.h" /*Drfg*/
#include "Setup.h" /* Drfg */
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
#define FOOD_TY 22895 //Conjured Cinnamon Roll
#define COUNT_FOOD 20
static string pvp = "#pvp"; // Teleport to PvP Zone
static string mall = "#mall"; // Teleport to mall
static string buff = "#buffme"; // Buffs
static string help = "#help"; // Help Menu
static string command = "#commands"; // Shows Commands
static string foodz = "#poptart"; // Gives Food
void EventChat(Player * pPlayer, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
{
if (Message == foodz)
{
ItemPrototype* it = ItemPrototypeStorage.LookupEntry(FOOD_TY);
Item *item;
item = objmgr.CreateItem( FOOD_TY, pPlayer);
item->SetUInt32Value(ITEM_FIELD_STACK_COUNT, ((COUNT_FOOD > it->MaxCount) ? it->MaxCount : COUNT_FOOD));
if(it->Bonding==ITEM_BIND_ON_PICKUP)
item->SoulBind();
if(!pPlayer->GetItemInterface()->AddItemToFreeSlot(item))
{
pPlayer->BroadcastMessage("No free slots were found in your inventory!");
delete item;
}
SlotResult *lr = pPlayer->GetItemInterface()->LastSearchResult();
pPlayer->GetSession()->SendItemPushResult(item,false,true,false,true,lr->ContainerSlot,lr->Slot,COUNT_FOOD);
}
if(Message == mall && pPlayer->CombatStatus.IsInCombat())
pPlayer->BroadcastMessage("Cannot teleport when in combat!");
else
{
if(Message == mall)
{
pPlayer->BroadcastMessage("You've been taken to the mall location!");
pPlayer->EventTeleport(map, x, y, z); // Change this
}
}
if(Message == pvp && pPlayer->CombatStatus.IsInCombat()){
pPlayer->BroadcastMessage("Cannot teleport when in combat!");
}
else
{
if(Message == pvp)
{
pPlayer->BroadcastMessage("CHANGE THIS");
pPlayer->EventTeleport(map, x, y, z);
}
}
if(Message == buff)
{
pPlayer->BroadcastMessage("Say hello to my little friend!");
pPlayer->CastSpell(pPlayer, 48161, true); // Fort
pPlayer->CastSpell(pPlayer, 48932, true); // Might
pPlayer->CastSpell(pPlayer, 48469, true); // Mark of Wild
pPlayer->CastSpell(pPlayer, 48936, true); // Wisdom
pPlayer->CastSpell(pPlayer, 42995, true); // Intell
}
if(Message == help){
pPlayer->BroadcastMessage("CHANGE ME"); // Add Name
}
if(Message == command){
pPlayer->BroadcastMessage("Commands currently operational:"); // Opening
pPlayer->BroadcastMessage("#pvp - Teleports you to the pvp location. #mall - teleports you to the mall. #buffme - Buffs you, duh. #help - for help. #poptart - Gives you food."); // Showing commands
}
}
void SetupTwingle(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, &EventChat);
}
Setup.h
#ifndef DONATOR_TOOLS_SETUP_H
#define DONATOR_TOOLS_SETUP_H
void SetupTwingle(ScriptMgr * mgr);
#endif
Setup.cpp
#include "StdAfx.h"
#include "Setup.h"
#define SKIP_ALLOCATOR_SHARING 1
#include <ScriptSetup.h>
extern "C" SCRIPT_DECL uint32 _exp_get_script_type()
{
return SCRIPT_TYPE_MISC;
}
extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)
{
SetupTwingle(mgr);
}
#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
return TRUE;
}
#endif