吾爱尚玩资源基地
标题:
可消耗物品的修改阵营,种族,外貌,姓名的脚本代码
[打印本页]
作者:
admin
时间:
2016-5-3 22:57
标题:
可消耗物品的修改阵营,种族,外貌,姓名的脚本代码
1、先来看看该魔兽单机代码有些什么功能
pPlayer->ADD_GOSSIP_ITEM(4, " 种族修改 5个物品消耗", GOSSIP_SENDER_MAIN, 0);
pPlayer->ADD_GOSSIP_ITEM(4, " 阵营修改 10个物品消耗", GOSSIP_SENDER_MAIN, 1);
pPlayer->ADD_GOSSIP_ITEM(4, " 修改外貌 1个物品消耗", GOSSIP_SENDER_MAIN, 2);
pPlayer->ADD_GOSSIP_ITEM(4, " 修改名字 1个物品消耗", GOSSIP_SENDER_MAIN, 3);
2、该功能脚本需要消耗你定义的物品(就是说,你需要有某些物品,才能使用该功能),呵呵,这样就给某些魔兽私服单机定义了更多的功能
if(Player->HasItemCount(12345, 5)) // 修改一下12345,修改成你需要设置消耗的物品ID
{
Player->DestroyItemCount(12345, 5, true, true); // 销毁该物品
Player->DestroyItemCount(12345, 5, true, false); // race change token (12345) you can change it
Player->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
CharacterDatabase.PExecute("UPDATe characters Set at_login = at_login | '128' Where guid = %u", Player->GetGUID());
Player->GetSession()->SendNotification("你需要重新登录,然后才能修改种族!");
Player->PlayerTalkClass->CloseGossip();
3、支持TrinityCore的最新版本! 该脚本是宝石脚本,用在item_tempalte库中
4、例子:你可以选一些好看的模型来使用该脚本。
打开item_template表,选择一些好看的模型: 例如 勇猛的古莲,毒化雕纹,荣誉奖章,天然黑暗符印,巫术指环,蓝铜锭,附魔武器卷轴之类的
下面看看代码:
#include "ScriptPCH.h"
class npc_tool : public CreatureScript
{
public:
npc_tool() : CreatureScript("npc_tool"){}
bool OnGossipHello(Player * pPlayer, Creature * pCreature)
{
pPlayer->ADD_GOSSIP_ITEM(4, " 种族修改 5个物品消耗", GOSSIP_SENDER_MAIN, 0);
pPlayer->ADD_GOSSIP_ITEM(4, " 阵营修改 10个物品消耗", GOSSIP_SENDER_MAIN, 1);
pPlayer->ADD_GOSSIP_ITEM(4, " 修改外貌 1个物品消耗", GOSSIP_SENDER_MAIN, 2);
pPlayer->ADD_GOSSIP_ITEM(4, " 修改名字 1个物品消耗", GOSSIP_SENDER_MAIN, 3);
pPlayer->PlayerTalkClass->SendGossipMenu(9425, pCreature->GetGUID());
return true;
}
bool OnGossipSelect(Player * Player, Creature * Creature, uint32 /*uiSender*/, uint32 uiAction)
{
if(!Player)
return true;
switch(uiAction)
{
case 0:
if(Player->HasItemCount(12345, 5)) // 修改一下12345,修改成你需要设置消耗的物品ID
{
Player->DestroyItemCount(12345, 5, true, true); // 销毁该物品
Player->DestroyItemCount(12345, 5, true, false); // race change token (12345) you can change it
Player->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
CharacterDatabase.PExecute("UPDATe characters Set at_login = at_login | '128' Where guid = %u", Player->GetGUID());
Player->GetSession()->SendNotification("你需要重新登录,然后才能修改种族!");
Player->PlayerTalkClass->CloseGossip();
}
else
{
Player->GetSession()->SendNotification("You need atleast 5 race change token!");
Player->PlayerTalkClass->CloseGossip();
}
break;
case 1:
if(Player->HasItemCount(123, 10)) // 修改一下123,修改成你需要设置消耗的物品ID
{
Player->DestroyItemCount(123, 10, true, true); // race change token (123) you can change it
Player->DestroyItemCount(123, 10, true, false); // race change token (123) you can change it
Player->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '64' WHERE guid = %u", Player->GetGUID());
Player->GetSession()->SendNotification("你需要重新登录,然后才能修改阵营!");
Player->PlayerTalkClass->CloseGossip();
}
else
{
Player->GetSession()->SendNotification("you need atleast 10 faction change token!");
Player->PlayerTalkClass->CloseGossip();
回复查看完整代码
作者:
zz12
时间:
2017-12-5 20:53
楼主好棒,终于找到需要的了!有需求就来吾爱尚玩!
作者:
52vista
时间:
2020-1-6 11:16
have a look
作者:
haizhan1945
时间:
2020-1-29 10:20
顶顶顶顶顶
作者:
半世繁华
时间:
2020-6-10 06:39
谢谢楼主分享
作者:
dengdingjun
时间:
2021-11-28 23:42
几块好来看看就看
作者:
wshjf2019
时间:
2022-1-28 23:03
楼主好棒,终于找到需要的了!有需求就来吾爱尚玩!
作者:
f00000
时间:
2022-3-12 03:34
路过支持一下吧,虽然看不明白
作者:
半支烟
时间:
2023-2-1 12:39
感谢楼主分享,吾爱尚玩,可以免费下载网单!
欢迎光临 吾爱尚玩资源基地 (http://bbs.523play.com/)
Powered by Discuz! X3.4