From aef488b3e87520afbe3cfe4f6a7b7833f580f3dc Mon Sep 17 00:00:00 2001
From: Terragor <81566364+zTerragor@users.noreply.github.com>
Date: Thu, 19 Jan 2023 11:40:00 +0300
Subject: [PATCH 1/4] Core/Missings scripts
Core/Missings scripts - wow token
---
src/server/scripts/Custom/wow_token.cpp | 176 ++++++++++++++++++++++++
1 file changed, 176 insertions(+)
create mode 100644 src/server/scripts/Custom/wow_token.cpp
diff --git a/src/server/scripts/Custom/wow_token.cpp b/src/server/scripts/Custom/wow_token.cpp
new file mode 100644
index 000000000..a1daaaf6e
--- /dev/null
+++ b/src/server/scripts/Custom/wow_token.cpp
@@ -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.");
+ }
+ 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();
+ new wow_token_2();
+ new wow_token_5();
+ new wow_token_10();
+}
From 56822af75cab8fad825e77c559f76c8fe4a02450 Mon Sep 17 00:00:00 2001
From: Terragor <81566364+zTerragor@users.noreply.github.com>
Date: Thu, 19 Jan 2023 12:47:39 +0300
Subject: [PATCH 2/4] Rename 2021_11_05_Intendentes-PVE.sql to
sql/updates/master/world/2021_11_05_Intendentes-PVE.sql
---
.../updates/master/world/2021_11_05_Intendentes-PVE.sql | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename 2021_11_05_Intendentes-PVE.sql => sql/updates/master/world/2021_11_05_Intendentes-PVE.sql (100%)
diff --git a/2021_11_05_Intendentes-PVE.sql b/sql/updates/master/world/2021_11_05_Intendentes-PVE.sql
similarity index 100%
rename from 2021_11_05_Intendentes-PVE.sql
rename to sql/updates/master/world/2021_11_05_Intendentes-PVE.sql
From 06848056b56dc27951f820ff154b98159eb31e0f Mon Sep 17 00:00:00 2001
From: Terragor <81566364+zTerragor@users.noreply.github.com>
Date: Mon, 23 Jan 2023 08:45:55 +0500
Subject: [PATCH 3/4] update
update
---
src/server/scripts/Custom/wow_token.cpp | 187 ++++++------------------
1 file changed, 46 insertions(+), 141 deletions(-)
diff --git a/src/server/scripts/Custom/wow_token.cpp b/src/server/scripts/Custom/wow_token.cpp
index a1daaaf6e..a4076922e 100644
--- a/src/server/scripts/Custom/wow_token.cpp
+++ b/src/server/scripts/Custom/wow_token.cpp
@@ -1,176 +1,81 @@
+/*
+* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation; either version 2 of the License, or (at your
+* option) any later version.
+*
+* This program is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+* more details.
+*
+* You should have received a copy of the GNU General Public License along
+* with this program. If not, see .
+*/
+
#include "ScriptMgr.h"
#include "GridNotifiersImpl.h"
-#include "DatabaseEnv.h" // borrar si no necesitas base de datos
+#include "DatabaseEnv.h"
#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.");
- }
- 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;
- }
-};
+#define GetText(a, b, c) a->GetSession()->GetSessionDbLocaleIndex() == LOCALE_ruRU ? b : c
-class wow_token_2 : public ItemScript
+namespace BattlePay
{
-public:
- wow_token_2() : ItemScript("wow_token_2") {}
-
- bool OnUse(Player *player, Item *item, const SpellCastTargets &)
+ enum Type:int64
{
- 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;
- }
-};
+ Coins_1 = 10000,
+ Coins_2 = 20000,
+ Coins_5 = 50000,
+ Coins_10 = 100000
+ };
+}
-class wow_token_10 : public ItemScript
+template
+class battle_pay_token : public ItemScript
{
public:
- wow_token_10() : ItemScript("wow_token_10") {}
+ battle_pay_token(const char *ScriptName) : ItemScript(ScriptName) { }
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.
+ if (player->IsInCombat() || player->InArena() || player->InBattleground())
{
- player->GetSession()->SendNotification("You may not use this token whilst you are in combat or present in an arena or battleground.");
+ player->GetSession()->SendNotification(GetText(player, "Вы не можете использовать этот жетон, пока находитесь в бою, на арене или поле боя.", "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);
+ player->GetSession()->SendNotification(GetText(player, "Жетоны отключены.", "Coins disabled."));
+ player->CastSpell(player, 27880, true);
}
else
{
- if(player->HasItemCount(item->GetEntry(), 1, true)) //verify that the characters have the item
+ if (player->HasItemCount(item->GetEntry(), 1, true))
{
- // 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->AddDonateTokenCount(Coins);
player->DestroyItemCount(item->GetEntry(), 1, true);
- //save pj
+ std::ostringstream coins_amount_message_ru, coins_amount_message_en;
+ coins_amount_message_ru << "Спасибо за помощь проекту Pandaria 5.4.8, вы только что получили очков пожертвования: " << Coins/10000;
+ coins_amount_message_en << "Thanks for helping the Pandaria 5.4.8 project, you just received donate coins: " << Coins/10000;
+ ChatHandler(player->GetSession()).SendSysMessage(GetText(player, coins_amount_message_ru.str().c_str(), coins_amount_message_en.str().c_str()));
player->SaveToDB();
}
else
{
- ChatHandler(player->GetSession()).PSendSysMessage("You do not have the necessary token.");
+ ChatHandler(player->GetSession()).SendSysMessage(GetText(player, "У вас нет необходимого жетона.", "You do not have the necessary token."));
}
}
return true;
}
};
-void AddSC_wow_token() // Add to scriptloader normally
+void AddSC_wow_token()
{
- new wow_token_1();
- new wow_token_2();
- new wow_token_5();
- new wow_token_10();
+ new battle_pay_token("wow_token_1");
+ new battle_pay_token("wow_token_2");
+ new battle_pay_token("wow_token_5");
+ new battle_pay_token("wow_token_10");
}
From 32414478b49682cc431bed000831548afd2e3884 Mon Sep 17 00:00:00 2001
From: leelf00
Date: Wed, 8 Feb 2023 18:08:20 +0800
Subject: [PATCH 4/4] Change locale text to trinity string
Change locale text to trinity string
---
...023_02_07_world_wowtoken_trinitystring.sql | 7 +++++++
src/server/scripts/Custom/wow_token.cpp | 20 ++++++++++---------
2 files changed, 18 insertions(+), 9 deletions(-)
create mode 100644 sql/updates/master/world/2023_02_07_world_wowtoken_trinitystring.sql
diff --git a/sql/updates/master/world/2023_02_07_world_wowtoken_trinitystring.sql b/sql/updates/master/world/2023_02_07_world_wowtoken_trinitystring.sql
new file mode 100644
index 000000000..464940cd6
--- /dev/null
+++ b/sql/updates/master/world/2023_02_07_world_wowtoken_trinitystring.sql
@@ -0,0 +1,7 @@
+-- add wow token trinity string
+DELETE FROM `trinity_string` WHERE `entry` IN (30007,30008,30009,30010);
+INSERT INTO `trinity_string`(`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `content_loc9`, `content_loc10`, `content_loc11`, `content_female`, `content_female_loc1`, `content_female_loc2`, `content_female_loc3`, `content_female_loc4`, `content_female_loc5`, `content_female_loc6`, `content_female_loc7`, `content_female_loc8`, `content_female_loc9`, `content_female_loc10`, `content_female_loc11`) VALUES
+(30007, 'Thanks for helping the Pandaria 5.4.8 project, you just received donate coins: %f', NULL, NULL, NULL, '感谢帮助 Pandaria 5.4.8 项目,你刚获得了%f代币.', '感謝幫助 Pandaria 5.4.8 項目,你剛獲得了%f代幣.', NULL, NULL, 'Спасибо за помощь проекту Pandaria 5.4.8, вы только что получили очков пожертвования: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(30008, 'You do not have the necessary token.', NULL, NULL, NULL, '你没有足够的代币.', '你沒有足夠的代幣.', NULL, NULL, 'У вас нет необходимого жетона.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(30009, 'You may not use this token whilst you are in combat or present in an arena or battleground.', NULL, NULL, NULL, '你无法在战斗中或者处于战场或竞技场中使用代币.', '你無法在戰鬥中或者處於戰場或競技場中使用代幣.', NULL, NULL, 'Вы не можете использовать этот жетон, пока находитесь в бою, на арене или поле боя.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(30010, 'Coins disabled.', NULL, NULL, NULL, '代币已禁用.', '代幣已禁用.', NULL, NULL, 'Жетоны отключены.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
diff --git a/src/server/scripts/Custom/wow_token.cpp b/src/server/scripts/Custom/wow_token.cpp
index a4076922e..e624e4358 100644
--- a/src/server/scripts/Custom/wow_token.cpp
+++ b/src/server/scripts/Custom/wow_token.cpp
@@ -20,7 +20,13 @@
#include "DatabaseEnv.h"
#include "Chat.h"
-#define GetText(a, b, c) a->GetSession()->GetSessionDbLocaleIndex() == LOCALE_ruRU ? b : c
+enum BattlePayTokenTrinityStrings
+{
+ BATTLEPAY_TOKEN_TRINITYSTRING_SUCCESS = 30007, // Thanks for helping the Pandaria 5.4.8 project, you just received donate coins: %f
+ BATTLEPAY_TOKEN_TRINITYSTRING_ERR_NOTENOUGH = 30008, // You do not have the necessary token.
+ BATTLEPAY_TOKEN_TRINITYSTRING_ERR_INBATTLE = 30009, // You may not use this token whilst you are in combat or present in an arena or battleground.
+ BATTLEPAY_TOKEN_TRINITYSTRING_ERR_DISABLED = 30010, // Coins disabled.
+};
namespace BattlePay
{
@@ -43,11 +49,11 @@ class battle_pay_token : public ItemScript
{
if (player->IsInCombat() || player->InArena() || player->InBattleground())
{
- player->GetSession()->SendNotification(GetText(player, "Вы не можете использовать этот жетон, пока находитесь в бою, на арене или поле боя.", "You may not use this token whilst you are in combat or present in an arena or battleground."));
+ ChatHandler(player->GetSession()).PSendSysMessage(player->GetSession()->GetTrinityString(BATTLEPAY_TOKEN_TRINITYSTRING_ERR_INBATTLE));
}
else if (!sWorld->getBoolConfig(CONFIG_WOW_TOKEN))
{
- player->GetSession()->SendNotification(GetText(player, "Жетоны отключены.", "Coins disabled."));
+ ChatHandler(player->GetSession()).PSendSysMessage(player->GetSession()->GetTrinityString(BATTLEPAY_TOKEN_TRINITYSTRING_ERR_DISABLED));
player->CastSpell(player, 27880, true);
}
else
@@ -56,16 +62,12 @@ class battle_pay_token : public ItemScript
{
player->AddDonateTokenCount(Coins);
player->DestroyItemCount(item->GetEntry(), 1, true);
-
- std::ostringstream coins_amount_message_ru, coins_amount_message_en;
- coins_amount_message_ru << "Спасибо за помощь проекту Pandaria 5.4.8, вы только что получили очков пожертвования: " << Coins/10000;
- coins_amount_message_en << "Thanks for helping the Pandaria 5.4.8 project, you just received donate coins: " << Coins/10000;
- ChatHandler(player->GetSession()).SendSysMessage(GetText(player, coins_amount_message_ru.str().c_str(), coins_amount_message_en.str().c_str()));
+ ChatHandler(player->GetSession()).PSendSysMessage(player->GetSession()->GetTrinityString(BATTLEPAY_TOKEN_TRINITYSTRING_SUCCESS),Coins/10000);
player->SaveToDB();
}
else
{
- ChatHandler(player->GetSession()).SendSysMessage(GetText(player, "У вас нет необходимого жетона.", "You do not have the necessary token."));
+ ChatHandler(player->GetSession()).PSendSysMessage(player->GetSession()->GetTrinityString(BATTLEPAY_TOKEN_TRINITYSTRING_ERR_NOTENOUGH));
}
}
return true;