Browse Source

Added customizeable LootRadius rule

Syncs to disarm and loot right click options + /loot distance check.

Fixes #50, side issue #53 to be fixed in Aries Stage 1.0
Image 4 years ago
parent
commit
5a38e28d1e

+ 1 - 1
EQ2/source/WorldServer/Commands/Commands.cpp

@@ -2007,7 +2007,7 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie
 			}
 
 			if(cmdTarget && cmdTarget->IsEntity()){
-				if (cmdTarget->GetDistance(client->GetPlayer()) <= 10){
+				if (cmdTarget->GetDistance(client->GetPlayer()) <= rule_manager.GetGlobalRule(R_Loot, LootRadius)->GetFloat()){
 					client->Loot((Entity*)cmdTarget);
 					if (!((Entity*)cmdTarget)->HasLoot()){
 						if (((Entity*)cmdTarget)->IsNPC())

+ 2 - 2
EQ2/source/WorldServer/Items/Loot.cpp

@@ -442,8 +442,8 @@ NPC* Entity::DropChest() {
 	chest->SetHeading(GetHeading() - 180);
 	chest->SetLocation(GetLocation());
 	// Set the primary command to loot and the secondary to disarm
-	chest->AddPrimaryEntityCommand("loot", 10.0f, "loot", "", 0, 0);
-	chest->AddSecondaryEntityCommand("Disarm", 10.0f, "Disarm", "", 0, 0);
+	chest->AddPrimaryEntityCommand("loot", rule_manager.GetGlobalRule(R_Loot, LootRadius)->GetFloat(), "loot", "", 0, 0);
+	chest->AddSecondaryEntityCommand("Disarm", rule_manager.GetGlobalRule(R_Loot, LootRadius)->GetFloat(), "Disarm", "", 0, 0);
 	// 32 = loot icon for the mouse
 	chest->SetIcon(32);
 	// 1 = show the right click menu

+ 3 - 0
EQ2/source/WorldServer/Rules/Rules.cpp

@@ -283,6 +283,9 @@ RuleManager::RuleManager() {
 	RULE_INIT(R_Zone, DefaultZoneShutdownTimer, "300000");
 	RULE_INIT(R_Zone, WeatherTimer, "60000");						// default: 1 minute
 	RULE_INIT(R_Zone, SpawnDeleteTimer, "30000");					// default: 30 seconds, how long a spawn pointer is held onto after being removed from the world before deleting it
+	
+	RULE_INIT(R_Loot, LootRadius, "5.0");
+
 	#undef RULE_INIT
 }
 

+ 4 - 1
EQ2/source/WorldServer/Rules/Rules.h

@@ -36,7 +36,8 @@ enum RuleCategory {
 	R_Spawn,
 	R_UI,
 	R_World,
-	R_Zone
+	R_Zone,
+	R_Loot
 };
 
 enum RuleType {
@@ -139,6 +140,8 @@ enum RuleType {
 	CheckAttackNPC,
 	HOTime,
 
+	/* LOOT */
+	LootRadius,
 	/* ZONE TIMERS */
 	RegenTimer,
 	ClientSaveTimer,