关灯
开启左侧

Trinity单机魔兽世界私服中的轮盘游戏(NPC脚本)

  [复制链接]
admin实名认证 发表于 2016-4-28 21:51:29 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
 
20130620094426967.jpg

大概就是这个图的意思了~~~通过NPC来实现。。应该是非常有趣的一种设置了!增加单机中的趣味
然后我们来看看代码

class gamble_npc : public CreatureScript
{
public:
    gamble_npc() : CreatureScript("gamble_npc") { }

  std::string colorstring(uint16 type)
  {
        switch(type)
        {
        default:
            return false;
        case 2:
            return "black";
        case 3:
            return "red";
        case 4:
            return "green";

        }
    }

    int GenerateNumberMessage(uint32 numbervalue)
    {
        uint32 black[18] = {2, 28, 26, 11, 20, 17, 22, 15, 24, 13, 10, 29, 8, 31, 6, 33, 4, 35};
        uint32 red[18] = {9, 30, 7, 32, 5, 34, 3, 36, 1, 27, 25, 12, 19, 18, 21, 16, 23, 14};
        uint32 green[2] = {0, 00};

        for(uint16 i = 0; i < 18; i++)
        {
            if (numbervalue == black)
            return 2;
            else

            if (numbervalue == red)
            return 3;
            else
            if (numbervalue == 37 || 0)
            return 4;   
        }
    }


    bool OnGossipHello(Player * player, Creature * creature)
    {

        player->ADD_GOSSIP_ITEM(3, "I want to play Roulette!", GOSSIP_SENDER_MAIN, 1337);
        player->ADD_GOSSIP_ITEM(3, "How does this Game work?", GOSSIP_SENDER_MAIN, 999);
        player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
        return true;
    }

    bool OnGossipSelect(Player * player, Creature * creature, uint32 sender, uint32 uiAction)
    {
        player->;PlayerTalkClass->ClearMenus();

        if (uiAction == 1337)
        {
        player->ADD_GOSSIP_ITEM(3, "I want to bet on a number.", GOSSIP_SENDER_MAIN,997);
        player->ADD_GOSSIP_ITEM(3, "I want to bet on a color.", GOSSIP_SENDER_MAIN, 996);
        player->ADD_GOSSIP_ITEM(3, "I want to bet on a number set.", GOSSIP_SENDER_MAIN, 995);
        player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
        }


        if(uiAction == 997)
        {
        player->ADD_GOSSIP_ITEM(3, "Stats for this table: Odds 35:1 (1-36, 0, and 00) Payout: x35", GOSSIP_SENDER_MAIN, 997);
        player->ADD_GOSSIP_ITEM_EXTENDED(3, "I want to bet on 0.", GOSSIP_SENDER_MAIN, 0, "How much gold do you want to bet?", 0, true);
        player->ADD_GOSSIP_ITEM_EXTENDED(3, "I want to bet on 1.", GOSSIP_SENDER_MAIN, 1, "How much gold do you want to bet?", 0, true);
        player->ADD_GOSSIP_ITEM_EXTENDED(3, "I want to bet on 2.", GOSSIP_SENDER_MAIN, 2, "How much gold do you want to bet?", 0, true);
        player->ADD_GOSSIP_ITEM_EXTENDED(3, "I want to bet on 3.", GOSSIP_SENDER_MAIN, 3, "How much gold do you want to bet?", 0, true);
        player->ADD_GOSSIP_ITEM_EXTENDED(3, "I want to bet on 4.", GOSSIP_SENDER_MAIN, 4, "How much gold do you want to bet?", 0, true);
        player->ADD_GOSSIP_ITEM_EXTENDED(3, "I want to bet on 5.", GOSSIP_SENDER_MAIN, 5, "How much gold do you want to bet?", 0, true);
        player->ADD_GOSSIP_ITEM_EXTENDED(3, "I want to bet on 6.", GOSSIP_SENDER_MAIN, 6, "How much gold do you want to bet?", 0, true);
        player->ADD_GOSSIP_ITEM_EXTENDED(3, "I want to bet on 7.", GOSSIP_SENDER_MAIN, 7, "How much gold do you want to bet?", 0, true);
        player->ADD_GOSSIP_ITEM_EXTENDED(3, "I want to bet on 8.", GOSSIP_SENDER_MAIN, 8, "How much gold do you want to bet?", 0, true);
        player->ADD_GOSSIP_ITEM_EXTENDED(3, "I want to bet on 9.", GOSSIP_SENDER_MAIN, 9, "How much gold do you want to bet?", 0, true);
        player->ADD_GOSSIP_ITEM(3, "Next", GOSSIP_SENDER_MAIN, 1338);
        player->ADD_GOSSIP_ITEM(3, "Back", GOSSIP_SENDER_MAIN, 1337);


这些是部分代码。。里面的菜单内容都还没有汉化过来。有兴趣的朋友可以试试。。

你首先得学会如何在Trinity里面加NPC脚本!!

完整的脚本代码:American Roulette完整的代码下载
游客,如果您要查看本帖隐藏内容请回复

 

精彩评论5

倒序浏览
天野漂 发表于 2021-10-4 09:52:42 | 显示全部楼层
 
看不懂 下来看看
 
selovean 发表于 2021-6-17 11:36:41 | 显示全部楼层
 
大多数都没法用,可能因为更新的太快!
 
qilinhuhu 发表于 2021-5-25 21:13:50 | 显示全部楼层
 
咕咕咕咕咕咕过过过过过过过过过
 
我回来了 发表于 2016-10-24 21:34:42 | 显示全部楼层
 
感谢楼主分享,祝愿吾爱尚玩越来越好!
 
VIP介绍
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 最佳新人

    注册账号后积极发帖的会员
  • 活跃会员

    经常参与各类话题的讨论,发帖内容较有主见
  • 热心会员

    经常帮助其他会员答疑
  • 推广达人

    积极宣传本站,为本站带来更多注册会员
  • 宣传达人

    积极宣传本站,为本站带来更多的用户访问量
  • 灌水之王

    经常在论坛发帖,且发帖量较大
  • 突出贡献

    长期对论坛的繁荣而不断努力,或多次提出建设性意见
  • 优秀版主

    活跃且尽责职守的版主
  • 荣誉管理

    曾经为论坛做出突出贡献目前已离职的版主
  • 论坛元老

    为论坛做出突出贡献的会员

0关注

5粉丝

3421帖子

排行榜
作者专栏

QQ交流群&&微信订阅号

QQ交流群

微信订阅号

吾爱尚玩资源基地永久域名:

Www.523Play.Com

在线管理员QQ:1589479632

邮箱:Email@523play.com

QQ交流群:558936238

Copyright   ©2015-2116  吾爱尚玩资源基地|523play.comPowered by©523Pplay.Com技术支持:吾爱尚玩资源基地