PDA

View Full Version : AuxProductions Releases.



Cocain
11-03-10, 02:25 PM
As now, this will be the official topic in which I'll be releasing the AuxProductions C++ scripts.

Currently, I have 3 scripts avaible for your use.

A Exchanger Npc.


/*+++++++++++++++++++++++++++++++++++++
Copyright claimed by AuxProductions.+++
+++++++++++++++++++++++++++++++++++++*/

#include "StdAfx.h"
#include "Setup.h"


//ItemID of the item you want them to have.
#define TOKEN10REWARD (ID)
#define TOKEN20REWARD (ID)
#define TOKEN30REWARD (ID)
#define TOKEN40REWARD (ID)
#define TOKEN50REWARD (ID)


class SCRIPT_DECL KS_Exchange : public GossipScript
{
public:
void GossipHello(Object * pObject, Player* Plr, bool AutoSend);
void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code);
void GossipEnd(Object * pObject, Player* Plr);

void Destroy()
{
delete this;
}
};
void KS_Exchange::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
Menu->AddItem(9, "Pvp Tokens 10", 2);
Menu->AddItem(9, "Pvp Tokens 20", 3);
Menu->AddItem(9, "Pvp Tokens 30", 4);
Menu->AddItem(9, "Pvp Tokens 40", 5);
Menu->AddItem(9, "Pvp Tokens 50", 6);
Menu->SendTo(Plr);
}

void KS_Exchange::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
GossipMenu *Menu;
QueryResult *query;
Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NUL L;
if(pCreature==NULL)
return;

switch(IntId)
{
case 0:
GossipHello(pObject, Plr, true);
break;

case 1:
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
Menu->AddItem(9, "Pvp Tokens 10", 2);
Menu->AddItem(9, "Pvp Tokens 20", 3);
Menu->AddItem(9, "Pvp Tokens 30", 4);
Menu->AddItem(9, "Pvp Tokens 40", 5);
Menu->AddItem(9, "Pvp Tokens 50", 6);
Menu->SendTo(Plr);
break;
}
case 2:// 10 Killstreak rewards.
{
query = WorldDatabase.Query("SELECT `PvpToken` from `kill_streak_tokens` WHERE `name` = '%s'", Plr->GetName());

if (query->Fetch()[0].GetUInt32() >= 10)
{
Plr->GetItemInterface()->AddItemById(TOKEN10REWARD,1,0);
WorldDatabase.Query("UPDATE `kill_streak_tokens` SET `Pvptoken`=(Pvptoken - 10) WHERE (`name`='%s')", Plr->GetName());

objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 4, Plr);
Menu->AddItem(9, "You've just exchanged 10 of your PvP tokens.", 1);
Menu->AddItem(9, "Main Menu", 1);
Menu->SendTo(Plr);
}
else
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 5, Plr);
Menu->AddItem(9, "You do not have enough Tokens for this exchange.", 1);
Menu->AddItem(9, "Back", 1);
Menu->SendTo(Plr);
}
}
break;

case 3:// 20 Killstreak rewards.
{
query = WorldDatabase.Query("SELECT `Pvptoken` from `Killsystem_Token` WHERE `name` = '%s'", Plr->GetName());

if (query->Fetch()[0].GetUInt32() >= 20)
{
Plr->GetItemInterface()->AddItemById(TOKEN20REWARD,1,0);
WorldDatabase.Query("UPDATE `Killsystem_Token` SET `Pvptoken`=(Pvptoken - 20) WHERE (`name`='%s')", Plr->GetName());

objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 6, Plr);
Menu->AddItem(9, "Congratulations, you exchanged 20 of your Tokens for Chaos Tokens.", 1);
Menu->AddItem(9, "Main Menu", 1);
Menu->SendTo(Plr);
}
else
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 7, Plr);
Menu->AddItem(9, "You do not have enough Tokens for this exchange.", 1);
Menu->AddItem(9, "Back", 1);
Menu->SendTo(Plr);
}
}
break;

case 4:// 30 Killstreak rewards.
{
query = WorldDatabase.Query("SELECT `Pvptoken` from `Killsystem_Token` WHERE `name` = '%s'", Plr->GetName());

if (query->Fetch()[0].GetUInt32() >= 30)
{
Plr->GetItemInterface()->AddItemById(TOKEN30REWARD,1,0);
WorldDatabase.Query("UPDATE `Killsystem_Token` SET `Pvptoken`=(Pvptoken - 30) WHERE (`name`='%s')", Plr->GetName());

objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 8, Plr);
Menu->AddItem(9, "Congratulations, you exchanged 30 of your Tokens for Chaos Tokens.", 1);
Menu->AddItem(9, "Main Menu", 1);
Menu->SendTo(Plr);
}
else
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 9, Plr);
Menu->AddItem(9, "You do not have enough Tokens for this exchange.", 1);
Menu->AddItem(9, "Back", 1);
Menu->SendTo(Plr);
}
}
break;
}
}

case 5:// 40 Killstreak rewards.
{
query = WorldDatabase.Query("SELECT `Pvptoken` from `Killsystem_Token` WHERE `name` = '%s'", Plr->GetName());

if (query->Fetch()[0].GetUInt32() >= 40)
{
Plr->GetItemInterface()->AddItemById(TOKEN40REWARD,1,0);
WorldDatabase.Query("UPDATE `Killsystem_Token` SET `Pvptoken`=(Pvptoken - 40) WHERE (`name`='%s')", Plr->GetName());

objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 10, Plr);
Menu->AddItem(9, "Congratulations, you exchanged 40 of your Tokens for Chaos Tokens.", 1);
Menu->AddItem(9, "Main Menu", 1);
Menu->SendTo(Plr);
}
else
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 11, Plr);
Menu->AddItem(9, "You do not have enough Tokens for this exchange.", 1);
Menu->AddItem(9, "Back", 1);
Menu->SendTo(Plr);
}
}
break;

case 6:// 50 Killstreak rewards.
{
query = WorldDatabase.Query("SELECT `Pvptoken` from `Killsystem_Token` WHERE `name` = '%s'", Plr->GetName());

if (query->Fetch()[0].GetUInt32() >= 50)
{
Plr->GetItemInterface()->AddItemById(TOKEN30REWARD,1,0);
WorldDatabase.Query("UPDATE `Killsystem_Token` SET `Pvptoken`=(Pvptoken - 50) WHERE (`name`='%s')", Plr->GetName());

objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 12, Plr);
Menu->AddItem(9, "Congratulations, you exchanged 50 of your Tokens for Chaos Tokens.", 1);
Menu->AddItem(9, "Main Menu", 2);
Menu->SendTo(Plr);
}
else
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 13, Plr);
Menu->AddItem(9, "You do not have enough Tokens for this exchange.", 1);
Menu->AddItem(9, "Back", 1);
Menu->SendTo(Plr);
}
}
break;
}
void KS_Exchange::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}

void SetupKS_Exchange(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new KS_Exchange();
mgr->register_gossip_script(55555,gs);
}

You can eventually use a Lua script for this NPC to go along with. We'll be writting a specific Cpp script, which is customly made to function with this Gossip script.

A Auto-Defend on Login.


#include "StdAfx.h"
#include "Setup.h"

#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif




void OnEnterWorld(Player * pPlayer)
{
pPlayer->CastSpell(pPlayer, 642, true);
Announce( "You're now guarded for 12seconds, run whislt you can!" );
}



void SetupEnterWorld(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_ENTER_WORLD, OnEnterWorld);

Spawns Divine Shield (http://www.wowhead.com/?spell=642) on you, durning 12sec.

A welcoming announcement.


/* Small C++ script, credits to AuxProductions. */

#include "StdAfx.h"
#include "Setup.h"


#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif




void OnFirstEnterWorld(Player * pPlayer)
{
char message[500];
sprintf(message, "[SERVERNAME] Welcome our new player, %s to the server!", pPlayer->GetName());
sWorld.SendWorldWideScreenText(message);
}



void SetupOnFirstEnterWorld(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_FIRST_ENTER_WOR LD, OnFirstEnterWorld);
}

This will be sending a overall broadcast message when a new player logs in.

Fatbeard
11-03-10, 02:49 PM
Very nice! Simple, Yet Effective and Powerful!

Good Job mate, +Rep

Cocain
11-03-10, 03:49 PM
Thanks. ^^

Apple
11-03-10, 09:58 PM
nice one , +Rep

Avidgamer
12-03-10, 09:02 AM
Pretty sure I've seen the Divine Shield on login quite a few times before, only thing that looks different is it actually says that you've got 12 seconds, rest I've seen just cast it on the character and say nothing.