当前位置:首页>>魔兽单机>>正文
Trinity最新的一个通过物品实现角色升级的脚本代码
2013-05-13 11:56:23 作者:网络 来源: 浏览次数:0
摘要:Trinity最新的一个通过物品实现角色升级的脚本代码
 /* Made by Nifelvind 
描述: 这个是一个通过物品来实现角色升级的脚本。脚本的作用就是每次使用这个物品,就让角色升级一次。
      同时消耗掉该物品
      你需要给对应的物品加上一个脚本,然后物品就可以使用了。
      下面是SQL代码
 
             SET @itemID := 你需要修改的物品ID;
             UPDATE item_template SET `Script_Name` = 'Level_item' WHERE entry =@itemID;  //设置物品的脚本名称为Level_item
 
*/
 
#include "ScriptPCH.h"
#include "Unit.h"
 
class Level_item : public ItemScript
{
        public: Level_item() : ItemScript("Level_item") { }
       
                bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/)
                {
                    if(player->getLevel()==MAX_LEVEL)
                        { 
                    player->GetSession()->SendNotification("You can not get more levels.");
                        return false;
                        }
                    else 
                        { 
                    player->GiveLevel(player->getLevel()+1);
                    player->DestroyItemCount(item->GetEntry(),1,true,false);
                        return true;
                        }
                }
};
 
void AddSC_Level_item()
{
        new Level_item();
}


相关报道:

[关闭] [返回顶部]


  返回首页 | 最新资讯 | 资源下载 | 魔兽图片 | 单机文档 | 技术攻略 | 玩家视频
备案号:蜀ICP备2024062380号-1
免责声明:本网站为热爱怀旧WOW的玩家们建立的魔兽世界资料网站,仅供交流和学习使用,非盈利和商用.如有侵权之处,请联系我们,我们会在24小时内确认删除侵权内容,谢谢合作。
Copyright © 2024 - 2024 WOWAII.COM Corporation, All Rights Reserved

机器人国度