吾爱尚玩资源基地
标题: 魔兽sf单机中一个VIP物品控制系统 [打印本页]
作者: admin 时间: 2016-4-25 22:40
标题: 魔兽sf单机中一个VIP物品控制系统
魔兽sf单机中一个VIP物品控制系统
1、这个是让GM可以设置多少会员GM等级的玩家可以装备使用物品
2、可以作为变态魔兽世界私服来使用,可以提高装备销售的方式。
3、总体说,就是你可以设置某个物品的使用需求GM等级
首先是SQL:
ALTER TABLE `item_template` ADD COLUMN `vipLevel` INT NOT NULL DEFAULT '0' AFTER `WDBVerified`;
然后是代码
diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemPrototype.h
index 5fc49c9..e44e87a 100644
--- a/src/server/game/Entities/Item/ItemPrototype.h
+++ b/src/server/game/Entities/Item/ItemPrototype.h
@@ -662,6 +662,7 @@ struct ItemTemplate
uint32 MinMoneyLoot;
uint32 MaxMoneyLoot;
uint32 FlagsCu;
+ uint32 vipLevel;
// helpers
bool CanChangeEquipStateInCombat() const
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 2b39045..d23ee8d 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -11507,6 +11511,10 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
ItemTemplate const* pProto = pItem->GetTemplate();
if (pProto)
{
+ uint32 IvipLevel = pProto->vipLevel;
+ uint32 PvipLevel = GetSession()->GetSecurity()
+ if(IvipLevel > PvipLevel)
+ {
+ // can't equip item if vip level higher than your GM rank
+ return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
+ }
// item used
if (pItem->m_lootGenerated)
return EQUIP_ERR_ALREADY_LOOTED;
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 1191bc4..c6dda00 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -2152,7 +2152,7 @@ void ObjectMgr::LoadItemTemplates()
// 126 127 128 129 130 131 132 133
"GemProperties, RequiredDisenchantSkill, ArmorDamageModifier, duration, ItemLimitCategory, HolidayId, ScriptName, DisenchantID, "
// 134 135 136
- "FoodType, minMoneyLoot, maxMoneyLoot, flagsCustom FROM item_template");
+ "FoodType, minMoneyLoot, maxMoneyLoot, flagsCustom, vipLevel FROM item_template");
if (!result)
{
@@ -2277,6 +2277,7 @@ void ObjectMgr::LoadItemTemplates()
itemTemplate.MinMoneyLoot = fields[135].GetUInt32();
itemTemplate.MaxMoneyLoot = fields[136].GetUInt32();
itemTemplate.FlagsCu = fields[137].GetUInt32();
+ itemTemplate.vipLevel = fields[138].GetUInt32();
// Checks
完整代码下载(不含SQL):回复下载完整代码
作者: wbpzj1314 时间: 2019-7-7 00:06
这个也很6了
作者: wang1314 时间: 2019-7-11 12:09
楼主好棒,终于找到需要的了
作者: fang139842 时间: 2019-12-7 19:10
怎么使用咯。好像很含糊,嘿嘿对小白不友好呢
作者: paker5200 时间: 2022-7-3 16:16
这个很实用 看看
作者: moqizheng 时间: 2023-7-3 10:44
感谢楼主分享,祝愿吾爱尚玩越来越好!
欢迎光临 吾爱尚玩资源基地 (http://bbs.523play.com/) |
Powered by Discuz! X3.4 |