Myerz
04-18-2009, 06:47 AM
http://i378.photobucket.com/albums/oo226/InfernosInfinite/Myerz-Logo.png
Bounty Inserter
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
//Start of Script
class SCRIPT_DECL HunterNPC : 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 HunterNPC::GossipHello(Object* pObject, Player * Plr, bool AutoSend)
{
if(Plr->CombatStatus.IsInCombat()){
Plr->BroadcastMessage("You are in combat!");
return;
}
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 30013, Plr);
Menu->AddItem(1, "I want to hire an Assasin for 100g to kill some one!",1,1);
Menu->AddItem(2, "I want to put a bounty on some one for 50g!", 2,1);
if(AutoSend)
Menu->SendTo(Plr);
}
//Defining Cases
void HunterNPC::GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
GossipMenu * Menu;
uint32 plrid;
switch(IntId)
{
case 1: //Service Center
{
uint32 price = 1000000;
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if(currentgold>=price)
{
int32 newgold = currentgold - price;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
QueryResult*namecheck=WorldDatabase.Query("select `guid` from `characters` where `name`='%s';",Code);
if(namecheck){
plrid=namecheck->Fetch()[0].GetUInt32();
WorldDatabase.Query("replace into `assasin` (`hunted`,`GUID`) Values ('1','%u');",plrid);
}
delete namecheck;
}
else
Plr->BroadcastMessage("You Dont Have enough gold!");
Plr->Gossip_Complete();
}break;
case 2: //bounty
{
uint32 price = 1000000/2;
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if(currentgold>=price)
{
int32 newgold = currentgold - price;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
QueryResult*namecheck=WorldDatabase.Query("select `guid` from `characters` where `name`='%s';",Code);
if(namecheck)
{
plrid=namecheck->Fetch()[0].GetUInt32();
WorldDatabase.Query("replace into bountyhunts (`name`, `plrid`) VALUES ('%s','%u');",Code,plrid);
}
}
Plr->Gossip_Complete();
}break;
}
};
void HunterNPC::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}
void SetupHunterNPC(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new HunterNPC();
mgr->register_gossip_script(30015, gs);
}
Bounty Informant
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
//Start of Script
class SCRIPT_DECL BHNPC : 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 BHNPC::GossipHello(Object* pObject, Player * Plr, bool AutoSend)
{
if(Plr->CombatStatus.IsInCombat()){
Plr->BroadcastMessage("You are in combat!");
return;
}
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 30013, Plr);
QueryResult*bountyresult=WorldDatabase.Query("select `name` from `bountyhunts`;");
if( bountyresult )
{
int x=bountyresult->GetRowCount();
/*if(x==1)
{
const char *name=result->Fetch()[0].GetString();
Menu->AddItem->(1,name,1);
return;
}*/
if(x!=1){
do
{
const char * name =bountyresult->Fetch()[0].GetString();
Menu->AddItem(1,name,1);
} while (bountyresult->NextRow());
}
else{
const char * name =bountyresult->Fetch()[0].GetString();
Menu->AddItem(1,name,1);
}
delete bountyresult;
}
else
{
Plr->BroadcastMessage("There are no Bounties");
}
if(AutoSend)
Menu->SendTo(Plr);
}
//Defining Cases
void BHNPC::GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
GossipMenu * Menu;
uint32 plrid;
switch(IntId)
{
case 1:
Plr->BroadcastMessage("Go kill that Basterd!");
Plr->Gossip_Complete();
}
};
void BHNPC::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}
void SetupBHNPC(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new BHNPC();
mgr->register_gossip_script(30017, gs);
}
Bounty PvP
By:AcD
*/
#include "StdAfx.h"
#include "Setup.h"
void onPVPBounty(Player*hunter, Player*bounty)
{
QueryResult*victimcheck=WorldDatabase.Query("select `name` from `bountyhunts` where `plrid`='%u';",bounty->GetGUID());
bool bountycheck=false;
if(victimcheck)
bountycheck=true;
if(bountycheck==true)
{
hunter->BroadcastMessage("Target...|CFFFF66FF Assasinated |r");
QueryResult*clearbounty=WorldDatabase.Query("Delete from `bountyhunts` WHERE `plrid`='%u';",bounty->GetGUID());
ItemPrototype *proto = ItemPrototypeStorage.LookupEntry(94);
SlotResult slotresult;
slotresult = hunter->GetItemInterface()->FindFreeInventorySlot(proto);
//hunter->BroadcastMessage("|CFFFF00FF Greater PvP Token|r Recieved");
if(!slotresult.Result)
{
hunter->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_INVENTORY_FULL);
hunter->BroadcastMessage("Bag Full!");
}
else
{
Item *itm = objmgr.CreateItem(94, hunter);
itm->SetUInt32Value(ITEM_FIELD_STACK_COUNT, 1);
hunter->GetItemInterface()->SafeAddItem(itm,slotresult.ContainerSlot, slotresult.Slot);
//hunter->GetItemInterface()->SafeAddItem(itm,slotresult.ContainerSlot, slotresult.Slot);
}
delete victimcheck;
delete clearbounty;
}
}
void SetupBountyPVP(ScriptMgr * mgr)
{
//GossipScript * gs = (GossipScript*) new BountyNPC();
/* Teleporter List */
//mgr->register_gossip_script(100001, gs); // Nega
mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, onPVPBounty);
}
Bounty Inserter
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
//Start of Script
class SCRIPT_DECL HunterNPC : 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 HunterNPC::GossipHello(Object* pObject, Player * Plr, bool AutoSend)
{
if(Plr->CombatStatus.IsInCombat()){
Plr->BroadcastMessage("You are in combat!");
return;
}
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 30013, Plr);
Menu->AddItem(1, "I want to hire an Assasin for 100g to kill some one!",1,1);
Menu->AddItem(2, "I want to put a bounty on some one for 50g!", 2,1);
if(AutoSend)
Menu->SendTo(Plr);
}
//Defining Cases
void HunterNPC::GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
GossipMenu * Menu;
uint32 plrid;
switch(IntId)
{
case 1: //Service Center
{
uint32 price = 1000000;
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if(currentgold>=price)
{
int32 newgold = currentgold - price;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
QueryResult*namecheck=WorldDatabase.Query("select `guid` from `characters` where `name`='%s';",Code);
if(namecheck){
plrid=namecheck->Fetch()[0].GetUInt32();
WorldDatabase.Query("replace into `assasin` (`hunted`,`GUID`) Values ('1','%u');",plrid);
}
delete namecheck;
}
else
Plr->BroadcastMessage("You Dont Have enough gold!");
Plr->Gossip_Complete();
}break;
case 2: //bounty
{
uint32 price = 1000000/2;
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if(currentgold>=price)
{
int32 newgold = currentgold - price;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
QueryResult*namecheck=WorldDatabase.Query("select `guid` from `characters` where `name`='%s';",Code);
if(namecheck)
{
plrid=namecheck->Fetch()[0].GetUInt32();
WorldDatabase.Query("replace into bountyhunts (`name`, `plrid`) VALUES ('%s','%u');",Code,plrid);
}
}
Plr->Gossip_Complete();
}break;
}
};
void HunterNPC::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}
void SetupHunterNPC(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new HunterNPC();
mgr->register_gossip_script(30015, gs);
}
Bounty Informant
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
//Start of Script
class SCRIPT_DECL BHNPC : 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 BHNPC::GossipHello(Object* pObject, Player * Plr, bool AutoSend)
{
if(Plr->CombatStatus.IsInCombat()){
Plr->BroadcastMessage("You are in combat!");
return;
}
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 30013, Plr);
QueryResult*bountyresult=WorldDatabase.Query("select `name` from `bountyhunts`;");
if( bountyresult )
{
int x=bountyresult->GetRowCount();
/*if(x==1)
{
const char *name=result->Fetch()[0].GetString();
Menu->AddItem->(1,name,1);
return;
}*/
if(x!=1){
do
{
const char * name =bountyresult->Fetch()[0].GetString();
Menu->AddItem(1,name,1);
} while (bountyresult->NextRow());
}
else{
const char * name =bountyresult->Fetch()[0].GetString();
Menu->AddItem(1,name,1);
}
delete bountyresult;
}
else
{
Plr->BroadcastMessage("There are no Bounties");
}
if(AutoSend)
Menu->SendTo(Plr);
}
//Defining Cases
void BHNPC::GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
GossipMenu * Menu;
uint32 plrid;
switch(IntId)
{
case 1:
Plr->BroadcastMessage("Go kill that Basterd!");
Plr->Gossip_Complete();
}
};
void BHNPC::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}
void SetupBHNPC(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new BHNPC();
mgr->register_gossip_script(30017, gs);
}
Bounty PvP
By:AcD
*/
#include "StdAfx.h"
#include "Setup.h"
void onPVPBounty(Player*hunter, Player*bounty)
{
QueryResult*victimcheck=WorldDatabase.Query("select `name` from `bountyhunts` where `plrid`='%u';",bounty->GetGUID());
bool bountycheck=false;
if(victimcheck)
bountycheck=true;
if(bountycheck==true)
{
hunter->BroadcastMessage("Target...|CFFFF66FF Assasinated |r");
QueryResult*clearbounty=WorldDatabase.Query("Delete from `bountyhunts` WHERE `plrid`='%u';",bounty->GetGUID());
ItemPrototype *proto = ItemPrototypeStorage.LookupEntry(94);
SlotResult slotresult;
slotresult = hunter->GetItemInterface()->FindFreeInventorySlot(proto);
//hunter->BroadcastMessage("|CFFFF00FF Greater PvP Token|r Recieved");
if(!slotresult.Result)
{
hunter->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_INVENTORY_FULL);
hunter->BroadcastMessage("Bag Full!");
}
else
{
Item *itm = objmgr.CreateItem(94, hunter);
itm->SetUInt32Value(ITEM_FIELD_STACK_COUNT, 1);
hunter->GetItemInterface()->SafeAddItem(itm,slotresult.ContainerSlot, slotresult.Slot);
//hunter->GetItemInterface()->SafeAddItem(itm,slotresult.ContainerSlot, slotresult.Slot);
}
delete victimcheck;
delete clearbounty;
}
}
void SetupBountyPVP(ScriptMgr * mgr)
{
//GossipScript * gs = (GossipScript*) new BountyNPC();
/* Teleporter List */
//mgr->register_gossip_script(100001, gs); // Nega
mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, onPVPBounty);
}