forked from cooler-SAI/pandaria_5.4.8
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core/Missings scripts #129
Closed
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
aef488b
Core/Missings scripts
zTerragor ddb47ba
Merge branch 'master' into wow-token
zTerragor 56822af
Rename 2021_11_05_Intendentes-PVE.sql to sql/updates/master/world/202…
zTerragor 74c779b
Merge branch 'master' into wow-token
zTerragor 0684805
update
zTerragor bd59df9
Merge branch 'master' into wow-token
zTerragor 3241447
Change locale text to trinity string
leelf00 c625bc0
Merge branch 'master' into wow-token
fuzionproject File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
#include "ScriptMgr.h" | ||
#include "GridNotifiersImpl.h" | ||
#include "DatabaseEnv.h" // borrar si no necesitas base de datos | ||
#include "Chat.h" | ||
|
||
enum coins | ||
{ | ||
coins_1 = 10000, | ||
coins_2 = 20000, | ||
coins_5 = 50000, | ||
coins_10 = 100000, | ||
}; | ||
|
||
class wow_token_1 : public ItemScript | ||
{ | ||
public: | ||
wow_token_1() : ItemScript("wow_token_1") {} | ||
|
||
bool OnUse(Player *player, Item *item, const SpellCastTargets &) | ||
{ | ||
if (player->IsInCombat() || player->InArena() || player->InBattleground()) //Item is not usable in combat, arenas and battlegrounds. This can be modified to your taste. | ||
{ | ||
player->GetSession()->SendNotification("You may not use this token whilst you are in combat or present in an arena or battleground."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think custom message can handler in trinity_string table. |
||
} | ||
else if (!sWorld->getBoolConfig(CONFIG_WOW_TOKEN)) | ||
{ | ||
player->GetSession()->SendNotification("Coins disabled."); | ||
player->CastSpell(player, 27880, true); | ||
} | ||
else | ||
{ | ||
if(player->HasItemCount(item->GetEntry(), 1, true)) //verify that the characters have the item | ||
{ | ||
// add and log the wow token | ||
player->AddDonateTokenCount(coins_1); | ||
ChatHandler(player->GetSession()).PSendSysMessage("Thanks for helping the WoW project, you just received %i Coins.", (coins_1 / 10000)); | ||
|
||
//Item is destroyed on useage. | ||
player->DestroyItemCount(item->GetEntry(), 1, true); | ||
|
||
//save pj | ||
player->SaveToDB(); | ||
} | ||
else | ||
{ | ||
ChatHandler(player->GetSession()).PSendSysMessage("You do not have the necessary token."); | ||
} | ||
} | ||
return true; | ||
} | ||
}; | ||
|
||
class wow_token_2 : public ItemScript | ||
{ | ||
public: | ||
wow_token_2() : ItemScript("wow_token_2") {} | ||
|
||
bool OnUse(Player *player, Item *item, const SpellCastTargets &) | ||
{ | ||
if (player->IsInCombat() || player->InArena() || player->InBattleground()) //Item is not usable in combat, arenas and battlegrounds. This can be modified to your taste. | ||
{ | ||
player->GetSession()->SendNotification("You may not use this token whilst you are in combat or present in an arena or battleground."); | ||
} | ||
else if (!sWorld->getBoolConfig(CONFIG_WOW_TOKEN)) | ||
{ | ||
player->GetSession()->SendNotification("Coins disabled."); | ||
player->CastSpell(player, 27880, true); | ||
} | ||
else | ||
{ | ||
if(player->HasItemCount(item->GetEntry(), 1, true)) //verify that the characters have the item | ||
{ | ||
// add and log the wow token | ||
player->AddDonateTokenCount(coins_2); | ||
ChatHandler(player->GetSession()).PSendSysMessage("Thanks for helping the WoW project, you just received %i Coins.", (coins_2 / 10000)); | ||
|
||
//Item is destroyed on useage. | ||
player->DestroyItemCount(item->GetEntry(), 1, true); | ||
|
||
//save pj | ||
player->SaveToDB(); | ||
} | ||
else | ||
{ | ||
ChatHandler(player->GetSession()).PSendSysMessage("You do not have the necessary token."); | ||
} | ||
} | ||
return true; | ||
} | ||
}; | ||
|
||
class wow_token_5 : public ItemScript | ||
{ | ||
public: | ||
wow_token_5() : ItemScript("wow_token_5") {} | ||
|
||
bool OnUse(Player *player, Item *item, const SpellCastTargets &) | ||
{ | ||
if (player->IsInCombat() || player->InArena() || player->InBattleground()) //Item is not usable in combat, arenas and battlegrounds. This can be modified to your taste. | ||
{ | ||
player->GetSession()->SendNotification("You may not use this token whilst you are in combat or present in an arena or battleground."); | ||
} | ||
else if (!sWorld->getBoolConfig(CONFIG_WOW_TOKEN)) | ||
{ | ||
player->GetSession()->SendNotification("Coins disabled."); | ||
player->CastSpell(player, 27880, true); | ||
} | ||
else | ||
{ | ||
if(player->HasItemCount(item->GetEntry(), 1, true)) //verify that the characters have the item | ||
{ | ||
// add and log the wow token | ||
player->AddDonateTokenCount(coins_5); | ||
ChatHandler(player->GetSession()).PSendSysMessage("Thanks for helping the WoW project, you just received %i Coins.", (coins_5 / 10000)); | ||
|
||
//Item is destroyed on useage. | ||
player->DestroyItemCount(item->GetEntry(), 1, true); | ||
|
||
//save pj | ||
player->SaveToDB(); | ||
} | ||
else | ||
{ | ||
ChatHandler(player->GetSession()).PSendSysMessage("You do not have the necessary token."); | ||
} | ||
} | ||
return true; | ||
} | ||
}; | ||
|
||
class wow_token_10 : public ItemScript | ||
{ | ||
public: | ||
wow_token_10() : ItemScript("wow_token_10") {} | ||
|
||
bool OnUse(Player *player, Item *item, const SpellCastTargets &) | ||
{ | ||
if (player->IsInCombat() || player->InArena() || player->InBattleground()) //Item is not usable in combat, arenas and battlegrounds. This can be modified to your taste. | ||
{ | ||
player->GetSession()->SendNotification("You may not use this token whilst you are in combat or present in an arena or battleground."); | ||
} | ||
else if (!sWorld->getBoolConfig(CONFIG_WOW_TOKEN)) | ||
{ | ||
player->GetSession()->SendNotification("Coins disabled."); | ||
player->CastSpell(player, 27880, true); | ||
} | ||
else | ||
{ | ||
if(player->HasItemCount(item->GetEntry(), 1, true)) //verify that the characters have the item | ||
{ | ||
// add and log the wow token | ||
player->AddDonateTokenCount(coins_10); | ||
ChatHandler(player->GetSession()).PSendSysMessage("Thanks for helping the WoW project, you just received %i Coins.", (coins_10 / 10000)); | ||
|
||
//Item is destroyed on useage. | ||
player->DestroyItemCount(item->GetEntry(), 1, true); | ||
|
||
//save pj | ||
player->SaveToDB(); | ||
} | ||
else | ||
{ | ||
ChatHandler(player->GetSession()).PSendSysMessage("You do not have the necessary token."); | ||
} | ||
} | ||
return true; | ||
} | ||
}; | ||
|
||
void AddSC_wow_token() // Add to scriptloader normally | ||
{ | ||
new wow_token_1(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe token_1,token_2,token_5,token_10 can handler in onescript. |
||
new wow_token_2(); | ||
new wow_token_5(); | ||
new wow_token_10(); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems not using databases function.