Idea Motion Group
လူၾကီးမင္းတြင္ Idea Motion Group မွမွတ္ပံုတင္ျပီးေသာ Member Account ရွိပါက Log In မွ တဆင့္ဝင္ေရာက္ပါ။
New Guest ျဖစ္ပါက Register ျပဳလုပ္၍ဝင္ေရာက္ေပးပို႔ႏိုင္ပါသည္။။
*********Idea Motion Group*********
Log in

I forgot my password

Latest topics
Country Codes

Timer

Total
  • >

/>

Test

C++ – Buy Level with Vote Tokens

View previous topic View next topic Go down

default C++ – Buy Level with Vote Tokens

Post   on Thu Jul 05, 2012 5:23 pm

Things to edit:
#define DONE_TOKEN_ID 66015 // Put here id of your token
#define LEVELUP_NPC_ID 66000 // Put here your id of mob for it
#define VOTE_TOKEN_AMOUNT 5 // Put here amount for how much it needs to gain level 20
#define VOTE_TOKEN_AMOUNTE 10 // Put here amount for how much it needs to gain level 40
#define VOTE_TOKEN_AMOUNTEA 15 // Put here amount for how much it needs to gain level 60
#define VOTE_TOKEN_AMOUNTERA 20 // Put here amount for how much it needs to gain level 80


Where do you see GetItemCount(66015) change 66015 with your Token id

<blockquote>
#define DONE_TOKEN_ID 66015 // DONOR TOKEN
#define LEVELUP_NPC_ID 66000 // LEVEL UP NPC FOR TOKENS
#define VOTE_TOKEN_AMOUNT 5 // for 20 levels
#define VOTE_TOKEN_AMOUNTE 10 // FOR 40 LEVEL
#define VOTE_TOKEN_AMOUNTEA 15 // For 60 lvl
#define VOTE_TOKEN_AMOUNTERA 20 // For level 80

class SCRIPT_DECL LevelNPC : 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 LevelNPC::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
{
GossipMenu *Menu;
uint32 TextID = 820;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), TextID, Plr);
if (Plr->getLevel() == 1)
{
Menu->AddItem( 0, "I would like to Levelup to Level 80", 1 );
}
else
{
Menu->AddItem( 0, "I would like to Levelup 20 Level", 1 );
Menu->AddItem( 0, "I would like to Levelup 40 Levels", 2 );
Menu->AddItem( 0, "I would like to Levelup 60 Levels", 3 );
}
if(AutoSend)
{
Menu->SendTo(Plr);
}

}

void LevelNPC::GossipSelectOption(Object * pObject, Player* Plr,
uint32 Id, uint32 IntId, const char * Code)
{
Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?
((Creature*)pObject):NULL;
if(pCreature==NULL)
{
return;
}

switch(IntId)
{
case 1:
{
if (Plr->getLevel() == 1)
{
if (Plr->GetItemInterface()->GetItemCount(66015)
< VOTE_TOKEN_AMOUNTERA)
{
sChatHandler.SystemMessage(Plr->GetSession(),
"You do not have any <Level UP Tokens>. Please Donate for Level UP Tokens");
return;
}
Plr->GetItemInterface()->RemoveItemAmt
(DONE_TOKEN_ID, VOTE_TOKEN_AMOUNTERA);
Plr->BroadcastMessage("You are now level 80!" );
uint32 Level = 80;
LevelInfo * Info = objmgr.GetLevelInfo(Plr->getRace(),
Plr->getClass(), Level);
Plr->ApplyLevelInfo(Info, Level);
Plr->Gossip_Complete();
}
else
{
if (Plr->GetItemInterface()->GetItemCount(66015) < VOTE_TOKEN_AMOUNT)
{
sChatHandler.SystemMessage(Plr->GetSession(),
"You do not have any <Level UP Tokens>. Please Donate for Level UP Tokens");
return;
}
Plr->GetItemInterface()->
RemoveItemAmt(DONE_TOKEN_ID, VOTE_TOKEN_AMOUNT);
Plr->BroadcastMessage("You are now level 20!" );
uint32 Level = 20;
LevelInfo * Info = objmgr.GetLevelInfo(Plr->getRace(),
Plr->getClass(), Level);
Plr->ApplyLevelInfo(Info, Level);
Plr->Gossip_Complete();
}
}break;
case 2:
{
if (Plr->GetItemInterface()->GetItemCount(66015) < VOTE_TOKEN_AMOUNTE)
{
sChatHandler.SystemMessage(Plr->GetSession(),
"You do not have any <Level UP Tokens>. Please Donate for Level UP Tokens");
return;
}
Plr->GetItemInterface()->
RemoveItemAmt(DONE_TOKEN_ID, VOTE_TOKEN_AMOUNTE);
Plr->BroadcastMessage("You are now level 40!" );
uint32 Level =40;
LevelInfo * Info = objmgr.GetLevelInfo(Plr->getRace(),
Plr->getClass(), Level);
Plr->ApplyLevelInfo(Info, Level);
Plr->Gossip_Complete();
}break;

case 3:
{
if (Plr->GetItemInterface()->GetItemCount(66015) < VOTE_TOKEN_AMOUNTEA)
{
sChatHandler.SystemMessage(Plr->GetSession(),
"You do not have any <Level UP Tokens>. Please Donate for Level UP Tokens");
return;
}
Plr->GetItemInterface()->RemoveItemAmt
(DONE_TOKEN_ID, VOTE_TOKEN_AMOUNTEA);
Plr->BroadcastMessage("You are now level 60!" );
uint32 Level = 60;
LevelInfo * Info = objmgr.GetLevelInfo(Plr->getRace(),
Plr->getClass(), Level);
Plr->ApplyLevelInfo(Info, Level);
Plr->Gossip_Complete();

break;
}
}
}

void LevelNPC::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}

void SetupLevelupNpc(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new LevelNPC();
mgr->register_gossip_script(LEVELUP_NPC_ID, gs);
}
</blockquote>


Join date : 1970-01-01

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum