魔兽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):回复下载完整代码
|