T端PVP头衔购买脚本


这个是一套NPC脚本的功能代码。主要实现购买头衔

下面是脚本代码,

/****************************************
* Created by: Rochet2 *
* Updated by: Asbert75 *
* With help from: *
* LilleCarl, Rochet2, Jamey *
* *----- Title Vendor -----* *
****************************************/

#include "ScriptPCH.h"

struct Rochet2
{
uint8 icon;
std::string name;
uint32 HK, titleID;
};

/********************************************************
Possible icons:
0, //white chat bubble
1, //brown bag
2, //flight
3, //book
4, //interaction wheel
5, //interaction wheel
6, //brown bag with yellow dot
7, //white chat bubble with black dots
8, //tabard
9, //two swords
10, //yellow dot

Example Gossip Option: {iconID (see above), "title name", honorable_kills_required (set to whatever you require the player to have to get this rank), titleID (from database)}
***********************************************************/

Rochet2 Titles [] =
{

{9, "Private", 50, 1 },
{9, "Corporal", 100, 2 },
{9, "Sergeant", 250, 3 },
{9, "Master Sergeant", 500, 4 },
{9, "Sergeant Major", 750, 5 },
{9, "Knight", 1000, 6 },
{9, "Knight-Lieutenant", 1500, 7 },
{9, "Knight-Captain", 2000, 8 },
{9, "Knight-Champion", 2500, 9 },
{9, "Lieutenant Commander", 3000, 10 },
{9, "Commander", 3500, 11 },
{9, "Marshal", 4000, 12 },
{9, "Field Marshal", 4500, 13 },
{9, "Grand Marshal", 5000, 14 },

{9, "Scout", 50, 15 },
{9, "Grunt", 100, 16 },
{9, "Sergeant", 250, 17 },
{9, "Senior Sergeant", 500, 18 },
{9, "First Sergeant", 750, 19 },
{9, "Stone Guard", 1000, 20 },
{9, "Blood Guard", 1500, 21 },
{9, "Legionnaire", 2000, 22 },
{9, "Centurion", 2500, 23 },
{9, "Champion", 3000, 24 },
{9, "Lieutenant General", 3500, 25 },
{9, "General", 4000, 26 },
{9, "Warlord", 4500, 27 },
{9, "High Warlord", 5000, 28 },
};

enum eEnums
{
Amount = sizeof Titles/sizeof(*Titles),

// npc_text ID
Greetings_A = 1,
Greetings_H = 2,
};

#define ERROR_HASTITLE "|cffff0000You already have this title|r" // Error message that shows up when a player already has the title
#define ERROR_CASH "|cffff0000You don‘t have enough honorable kills|r" // Error message if player does not have enough honorable kills

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

bool OnGossipHello(Player* pPlayer, Creature* pCreature)
{
uint32 txt = Greetings_A;
uint32 i = 0;
uint32 m = Amount/2;
if(pPlayer->GetTeam() == HORDE)
{
txt = Greetings_H;
i = Amount/2;
m = Amount;
}
for (i; i<m; i++)
{
std::ostringstream ss;
ss << Titles[i].name << " - " << Titles[i].HK << " HKs";
std::string showcoolshit = ss.str();
ss.str(" ");
ss.clear();
ss << "Are you sure? You will be granted the title: " << Titles[i].name;
std::string showcoolshit2 = ss.str();
// ADD_GOSSIP_ITEM_EXTENDED Parameters: (icon, label, GOSSIP_SENDER_MAIN (Sender), Title ID ? (action - Sends info to OnGossipSelect), popup, coppercost, code (codebox))
pPlayer->ADD_GOSSIP_ITEM_EXTENDED(Titles[i].icon, showcoolshit.c_str(), GOSSIP_SENDER_MAIN, i, showcoolshit2, 0, false);
}
pPlayer->PlayerTalkClass->SendGossipMenu(txt, pCreature->GetGUID());
return true;
}

bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 i)
{
pPlayer->PlayerTalkClass->ClearMenus(); // clear the menu

if (CharTitlesEntry const* Title = sCharTitlesStore.LookupEntry(Titles[i].titleID)) // Get title
{
if(pPlayer->HasTitle(Title)) // If has title
pPlayer->GetSession()->SendAreaTriggerMessage(ERROR_HASTITLE);
else if(Titles[i].HK > pPlayer->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS)) // If doesnt have enough honored kills
pPlayer->GetSession()->SendAreaTriggerMessage(ERROR_CASH);
else
{
pPlayer->SetTitle(Title);
pPlayer->SaveToDB();
}
OnGossipHello(pPlayer, pCreature);
}
return true;
}
};

void AddSC_Title_gossip_codebox()
{
new Title_gossip_codebox();
}

T端PVP头衔购买脚本,布布扣,bubuko.com

时间: 2024-10-09 16:13:55

T端PVP头衔购买脚本的相关文章

T端PVP头衔获得NPC脚本

次代码是一个T端的脚本.通过击杀的角色数量等级来获得不同的头衔. 下面的Ranks就是击杀的数量.根据你的击杀数量,你可以到NPC那里去领取对应的头衔等级 #include "ScriptPCH.h" enum Ranks { RANK_1 = 50, RANK_2 = 100, RANK_3 = 500, RANK_4 = 1000, RANK_5 = 2000, RANK_6 = 4000, RANK_7 = 5000, RANK_8 = 6000, RANK_9 = 8000,

T端音乐盒子-NPC脚本

为什么叫音乐盒子呢??这个说简单点,其实就是制作一个NPC,然后让玩家可以在游戏中有选则性的播放游戏音乐!有趣吧? 其实主要用到了PlayDirectSound函数和SendPlaySound函数. 这两个函数都是用来播放声音的..声音当然是在每个玩家的客户端存储着呢! 这个就是Trinity-Core 端3.3.5怀旧魔兽世界私服中能用到的播放音乐的NPC脚本,大家可以试试 // By Asbert75 (Help from Jameyboor) // // Jukebox // #inclu

T端无限制附魔NPC脚本

1.首先,这个是脚本代码.你需要知道Trinity-Core如何增加脚本 2.这个是一套NPC的脚本. 3.脚本功能就是通过NPC来给自己身上的物品附魔(附魔都知道吧?) 5.你需要在creature_template里面加上对应的NPC,然后使用npc_enchantment脚本名称,.然后进入游戏用.npc add 来增加该功能NPC 下面是代码 #include "ScriptPCH.h" class npc_enchantment : public CreatureScript

T端 GameObject上的T端魔兽私服传送脚本

1.实现魔兽中简单的Gameobeject传送.主要是方便初学者参考使用! 2.与上一篇不同的是.这篇主要是在Gameobeject上实现传送,而不是NPC上.. 例如:你需要在gameobject_template表中找一些模型ID.然后在scriptname这一列中增加脚本名称,本例的脚本名称是"gob_teleport" 比如选一些游戏目标来增加脚本.打开gameobject_template表,选一些物件:祖尔法拉克铁锣,拉瑟莱克之泪,阿尔萨斯之泪, 伊姆贝尔之焰,瑟玛普拉格的

Asp.net 中,在服务端向客户端写脚本的常用方法

在Asp.net 服务端处理脚本,一般都用 ClientScriptManager ,即web窗体服务端的this.ClientScript.该对象比较常用的方法: 1.RegisterArrayDeclaration:在服务端,向客户端生成一个数组定义 服务端代码:   this.ClientScript.RegisterArrayDeclaration("aAry", "1,2,3"); 客户端“源文件”呈现 <script type="text

selenium自学笔记---ecshop购买脚本 xpath定位元素(下拉框,单选框)

本机环境:xamppv3.2.1+ecshop3.0  1.元素定位写对,却一直报错,发现是页面元素加载的太慢,所以加上延时 from selenium import webdriverimport timedriver=webdriver.Chrome()driver.implicitly_wait(10) #自动延时10sdriver.get("http://localhost/ecshop")# driver.find_element_by_xpath('//div[@class

在目标端重建sequence的脚本

select 'create sequence '||SEQUENCE_OWNER||'.'||sequence_name|| ' minvalue '||min_value|| ' maxvalue '||max_value|| ' start with '||(last_number+50)|| ' increment by '||increment_by|| (case when cache_size=0 then ' nocache' else ' cache '||cache_size

Phonegap 之 iOS银联在线支付(js调用ios端银联支付控件)

Phonegap项目,做支付的时候,当把网站打包到ios或android端成app后,在app上通过wap调用银联在线存在一个问题: 就是当从银联支付成功后,再从服务器返回到app客户端就很难实现. wap银联支付流程是这样:客户端---> 服务器(构建支付请求)--> 银联支付 ---> 返回到服务端(处理支付结果).所以对于手机网站银联支付没有问题,但是对于ios端app和android端app, 再通过wap支付,发现支付成功后,很难在回到app客户端了. 所以这里就必须借助Pho

zabbix 3.2.2自动安装脚本 (For Centos6)

方法一.上传源码包到centos上二.复制需要安装部分的代码(如vi /etc/install-zabbix.sh 复制代码)chmod +x /etc/install-zabbix.sh/etc/install-zabbix.sh shell代码如下: #!/bin/sh #服务端加客户端安装脚本 groupadd -g 493 zabbix useradd -u 493 -g zabbix tar xf zabbix-3.2.2.tar.gz -C /usr/local/ mkdir /us