dp_system.rar

  • rksemk
    了解作者
  • C/C++
    开发工具
  • 12KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 0
    下载次数
  • 2021-01-18 00:31
    上传日期
cloned scripts of the Latin American wow game credits system
dp_system.rar
  • dp_system.cpp
    153.4KB
内容介绍
#include "Database/DatabaseEnv.h" #include "ScriptPCH.h" #include <cstring> #include "ScriptSystem.h" #include "ObjectMgr.h" #include "InstanceSaveMgr.h" #include "Item.h" #include "Log.h" #define MSG_BALANCE "El saldo de tu cuenta es de %u creditos" #define MSG_NOBALANCE "No tienes creditos en tu cuenta!" #define MSG_GOSSIP_GETBALANCE "Quiero conocer mi saldo en creditos" #define MSG_GOSSIP_THANKS "Nada mas, gracias." #define MSG_GOSSIP_VOLVER "Ir al inicio" #define MSG_GOSSIP_SIG "Siguiente -->" #define MSG_GOSSIP_ANT "<-- Anterior" #define ACTION_GETBALANCE 1 class npc_gossip_submenus : public CreatureScript { public: npc_gossip_submenus() : CreatureScript("npc_gossip_submenus") { } uint32 checkCredits(Player *player, Creature *_creature, bool Silent = true) { char Qry[100]; char msg[100]; sprintf(Qry, "SELECT `dp` FROM `site`.`account_data` WHERE `id` = %u LIMIT 1", player->GetSession()->GetAccountId()); QueryResult result = LoginDatabase.Query(Qry); if (result) { Field *fields = result->Fetch(); uint32 creditos = fields[0].GetInt32(); QueryResult result = LoginDatabase.Query(Qry); if (creditos) { if (!Silent) { sprintf(msg, MSG_BALANCE, creditos); ChatHandler(player->GetSession()).PSendSysMessage(msg); } return creditos; } } if (!Silent) { ChatHandler(player->GetSession()).PSendSysMessage(MSG_NOBALANCE); } return 0; } bool updateCredits(Player *player, Creature *_creature, uint32 Amount) { char Qry[100]; uint32 Actual = checkCredits(player, _creature); if (Actual >= Amount) //Prevenir desbordamiento { uint32 NuevoSaldo = Actual - Amount; sprintf(Qry, "UPDATE `site`.`account_data` SET `dp`=%u WHERE `id` = %u", NuevoSaldo, player->GetSession()->GetAccountId()); QueryResult result = LoginDatabase.Query(Qry); if (!result) { char msg[160]; sprintf(msg, "Se han descontado %u creditos de tu cuenta, tu nuevo saldo es de %u creditos", Amount, NuevoSaldo); ChatHandler(player->GetSession()).PSendSysMessage(msg); return true; } ChatHandler(player->GetSession()).PSendSysMessage("se ha producido un error, porfavor contacta a un administrador"); return false; } return false; } void EnviarItems(Player *player, uint32 ItemID, uint32 Quantity = 1) { if (Quantity > 12) { //sLog->outDetail("Script de migracion: Error al tratar de enviar mas de 12 items en correo"); return; } ItemPosCountVec dest; uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ItemID, Quantity); Item *pItem = Item::CreateItem(ItemID, Quantity, player); if (msg == EQUIP_ERR_OK) { if (Item* item = player->StoreNewItem(dest, ItemID, true)){ player->SendNewItem(item, Quantity, false, true); } } else { ChatHandler(player->GetSession()).PSendSysMessage("No puedo entregarte esta recompensa!"); return; } } bool OnGossipHello(Player* player, Creature* creature) { player->PlayerTalkClass->ClearMenus(); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Deseo Conocer mi Saldo en Creditos", GOSSIP_SENDER_MAIN, ACTION_GETBALANCE); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Deseo comprar Armas", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Deseo comprar Armaduras", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Deseo comprar Accesorios", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Deseo comprar Recetas y Materiales", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Deseo comprar Monturas", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Deseo comprar Companeros", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Nevermind..", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 99); player->SEND_GOSSIP_MENU(1, creature->GetGUID()); return true; } bool OnGossipSelect(Player* player, Creature* creature, uint32 /* sender */, uint32 actions) { player->PlayerTalkClass->ClearMenus(); switch (actions) { case GOSSIP_ACTION_INFO_DEF + 1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Armas de una Mano", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Armas de Puno", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Hachas de una Mano", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Mazas de una Mano", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Espadas de una Mano", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Armas de Asta", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Bastones", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Hachas de dos Manos", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Mazas de dos Manos", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Espadas de dos Manos", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Arcos", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Ballestas", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Armas de Fuego", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Arrojadizas", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 15000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Varitas", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 16000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Escudos", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 17000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Dagas", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 18000); player->SEND_GOSSIP_MENU(1, creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 2: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Set de Guerrero", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2100); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Set de Paladin", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3100); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Set de Cazador", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4100); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Set de Picaro", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5100); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Set de Sacerdote", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6100); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Set de Caballero de la Muerte", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7100); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Set de Chaman", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8100); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Set de Mago", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9100); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Set de Brujo", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 110000); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Set de Druida", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 120000); player->SEND_GOSSIP_MENU(1, creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 3: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Abalorios", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2200); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Anillos", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_I
评论
    相关推荐
    • WOWsf.rar
      单机魔兽世界用,包含安装和进入游戏后的使用步骤等等。想玩单机魔兽世界的可以看看。
    • ModelViewer-Ogre3D.zip
      A World of Warcraft model viewer for based on Ogre3D instead of the usual wxWindows ui toolkit. This one is for BC clients, but it should work with 1.12 clients, too.
    • YAWE.rar
      YAWE is World Of Warcraft Server Emulator.
    • Programming In Lua First Edition(Finalized Revision 2.0) - 7Z
      众所周知,Lua最著名的应用是暴雪娱乐公司(Blizzard)的网络游戏魔兽世界(World of Warcraft)。 本翻译取材于http://www.lua.org/pil/,即《Programming In Lua》之英文原版,在尽可能依照原文内容的前提下对部分...
    • Lua 5.0 Reference Manual(Revision 1.0) - ZIP
      众所周知,Lua最著名的应用是暴雪娱乐公司(Blizzard)的网络游戏魔兽世界(World of Warcraft)。 本翻译取材于http://www.lua.org/manual/5.0/manual.html,即《Lua 5.0 Reference Manual》之英文原版,在尽可能...
    • 疯狂的java讲义项目源码-starred:我的已加星标的存储库!
      C++ - 在不丢失文本或格式的情况下将 PDF 转换为 HTML。 - 适用于 Linux 的 Android 文件传输 - 带有选项卡、拆分、地震式等的可定制 Windows 终端 - 用运动来构建很酷的东西的开源软件 - 实时网络的开源数据库。 - ...
    • ur公司java开发笔试题-awesome-stars:真棒明星
      C++ 制作计算机操作系统 C# - 汇总并显示您的个人工作表现 - 第一人称生成城市行者 - 快速、轻量级的 .NET micro-ORM - 使应用程序看起来像 Expression Blend 的 WPF 主题。 - Snip 将从 Spotify 和 iTunes 中获取...
    • PooGonzalez_NPCA.rar
      cloned scripts of the Latin American wow game ingame store script
    • WLAMigracion_NPC.rar
      cloned scripts of the Latin American wow game migration script
    • snowglobe-src-viewer-2.0.0-r0.tar.gz
      国外的开源游戏引擎,能够承载上千人,属于社交类的游戏