此代码仅仅作为单机版程序代码的一些历史查询和研究使用。对于现在的服务端基本没有任何实际价值
Index: src/game/LootMgr.cpp
===================================================================
--- src/game/LootMgr.cpp (revision 4737)
+++ src/game/LootMgr.cpp (working copy)
@@ -246,6 +246,12 @@
LootStoreItem* operator() ( LootStoreItem& itm )
{
+ uint32 quality=0;
+
+ // Get loot quality
+ ItemPrototype const *itemProto = objmgr.GetItemPrototype(itm.itemid);
+ if (itemProto) quality = itemProto->Quality;
+
// Quest loot handled separately
if (itm.questChanceOrGroup > 0)
return NULL;
@@ -253,10 +259,35 @@
// Non-grouped loot
if (itm.questChanceOrGroup == 0)
{
- // reference non group loot ( itm.chanceOrRef < 0) handled separatly
- if ( itm.chanceOrRef > 0 && roll_chance_f(itm.chanceOrRef * sWorld.getRate(RATE_DROP_ITEMS)) )
- return &itm;
- return NULL;
+ // Checks to see the quality of the loot and applies loot modifiers based on the rarity.
+ switch (quality)
+ {
+ case QUALITY_POOR:
+ if ( itm.chanceOrRef > 0 && roll_chance_f(itm.chanceOrRef * sWorld.getRate(RATE_DROP_POOR)) )
+ return &itm;
+ break;
+ case QUALITY_COMMON:
+ if ( itm.chanceOrRef > 0 && roll_chance_f(itm.chanceOrRef * sWorld.getRate(RATE_DROP_COMMON)) )
+ return &itm;
+ break;
+ case QUALITY_UNCOMMON:
+ if ( itm.chanceOrRef > 0 && roll_chance_f(itm.chanceOrRef * sWorld.getRate(RATE_DROP_UNCOMMON)) )
+ return &itm;
+ break;
+ case QUALITY_RARE:
+ if ( itm.chanceOrRef > 0 && roll_chance_f (itm.chanceOrRef * sWorld.getRate(RATE_DROP_RARE)) )
+ return &itm;
+ break;
+ case QUALITY_EPIC:
+ if ( itm.chanceOrRef > 0 && roll_chance_f (itm.chanceOrRef * sWorld.getRate(RATE_DROP_EPIC)) )
+ return &itm;
+ break;
+ case QUALITY_LEGENDARY:
+ if ( itm.chanceOrRef > 0 && roll_chance_f (itm.chanceOrRef * sWorld.getRate(RATE_DROP_LEGEND)) )
+ return &itm;
+ break;
+ }
+ return NULL;
}
// Grouped loot
@@ -311,7 +342,7 @@
struct HasQuestChance
{
// explicit HasQuestChanceFor() : {}
- inline bool operator() ( LootStoreItem &itm ) { return roll_chance_i(itm.questChanceOrGroup); }
+ inline bool operator() ( LootStoreItem &itm ) { return roll_chance_i(itm.questChanceOrGroup) * sWorld.getRate(RATE_DROP_QUEST); }
};
void FillLoot(Loot* loot, uint32 loot_id, LootStore& store, Player* loot_owner, bool referenced)
Index: src/game/LootMgr.h
===================================================================
--- src/game/LootMgr.h (revision 4737)
+++ src/game/LootMgr.h (working copy)
@@ -50,6 +50,16 @@
NEED_BEFORE_GREED = 4
};
+enum LootTypes
+{
+ QUALITY_POOR = 0,
+ QUALITY_COMMON = 1,
+ QUALITY_UNCOMMON = 2,
+ QUALITY_RARE = 3,
+ QUALITY_EPIC = 4,
+ QUALITY_LEGENDARY = 5
+};
+
enum PermissionTypes
{
ALL_PERMISSION = 0,
Index: src/game/World.cpp
===================================================================
--- src/game/World.cpp (revision 4737)
+++ src/game/World.cpp (working copy)
@@ -328,6 +328,13 @@
rate_values[RATE_POWER_FOCUS] = sConfig.GetFloatDefault("Rate.Focus", 1);
rate_values[RATE_LOYALTY] = sConfig.GetFloatDefault("Rate.Loyalty", 1);
rate_values[RATE_DROP_ITEMS] = sConfig.GetFloatDefault("Rate.Drop.Items", 1);
+ rate_values[RATE_DROP_POOR] = sConfig.GetFloatDefault("Rate.Drop.Items.Quality.Poor", 1);
+ rate_values[RATE_DROP_COMMON] = sConfig.GetFloatDefault("Rate.Drop.Items.Quality.Common", 1);
+ rate_values[RATE_DROP_UNCOMMON] = sConfig.GetFloatDefault("Rate.Drop.Items.Quality.Uncommon", 1);
+ rate_values[RATE_DROP_RARE] = sConfig.GetFloatDefault("Rate.Drop.Items.Quality.Rare", 1);
+ rate_values[RATE_DROP_EPIC] = sConfig.GetFloatDefault("Rate.Drop.Items.Quality.Epic", 1);
+ rate_values[RATE_DROP_LEGEND] = sConfig.GetFloatDefault("Rate.Drop.Items.Quality.Legendary", 1);
+ rate_values[RATE_DROP_QUEST] = sConfig.GetFloatDefault("Rate.Drop.Items.Quest", 1);
rate_values[RATE_DROP_MONEY] = sConfig.GetFloatDefault("Rate.Drop.Money", 1);
rate_values[RATE_XP_KILL] = sConfig.GetFloatDefault("Rate.XP.Kill", 1);
rate_values[RATE_XP_QUEST] = sConfig.GetFloatDefault("Rate.XP.Quest", 1);
Index: src/game/World.h
===================================================================
--- src/game/World.h (revision 4737)
+++ src/game/World.h (working copy)
@@ -121,6 +121,13 @@
RATE_POWER_RAGE_LOSS,
RATE_POWER_FOCUS,
RATE_DROP_ITEMS,
+ RATE_DROP_POOR,
+ RATE_DROP_COMMON,
+ RATE_DROP_UNCOMMON,
+ RATE_DROP_RARE,
+ RATE_DROP_EPIC,
+ RATE_DROP_LEGEND,
+ RATE_DROP_QUEST,
RATE_DROP_MONEY,
RATE_XP_KILL,
RATE_XP_QUEST,
Index: src/mangosd/mangosd.conf.in
===================================================================
--- src/mangosd/mangosd.conf.in (revision 4737)
+++ src/mangosd/mangosd.conf.in (working copy)
@@ -311,6 +311,13 @@
# Drop rates
# Default: 1
Rate.Drop.Items = 1
+Rate.Drop.Items.Quality.Poor = 1
+Rate.Drop.Items.Quality.Common = 1
+Rate.Drop.Items.Quality.Uncommon = 1
+Rate.Drop.Items.Quality.Rare = 1
+Rate.Drop.Items.Quality.Epic = 1
+Rate.Drop.Items.Quality.Legendary = 1
+Rate.Drop.Items.Quest = 1
Rate.Drop.Money = 1
# XP rates
|