Loading...   


 common/features.h      |  3 +++
 zone/bot.cpp           |  2 +-
 zone/client_packet.cpp | 27 ++++++++++++++++-----------
 zone/questmgr.cpp      |  4 ++--
 zone/zone.cpp          | 22 +++++++++++-----------
 5 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/common/features.h b/common/features.h
index 8115efd..d7680ee 100644
--- a/common/features.h
+++ b/common/features.h
@@ -235,6 +235,9 @@ enum {	//some random constants
 
 #define ZONE_CONTROLLER_NPC_ID 10
 
+#define SAYLINK_BASE_ID 16000000
+#define SILENT_SAYLINK_BASE_ID 16250000
+
 //Some hard coded statuses from commands and other places:
 enum {
 	minStatusToBeGM = 40,
diff --git a/zone/bot.cpp b/zone/bot.cpp
index 5ce6371..b0dd9ae 100644
--- a/zone/bot.cpp
+++ b/zone/bot.cpp
@@ -13774,7 +13774,7 @@ std::string Bot::CreateSayLink(Client* c, const char* message, const char* name)
 	}
 	safe_delete_array(escaped_string);
 
-	sayid += 500000;
+	sayid += SAYLINK_BASE_ID;
 
 	Client::TextLink linker;
 	linker.SetLinkType(linker.linkItemData);
diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp
index 58381db..55dcfa8 100644
--- a/zone/client_packet.cpp
+++ b/zone/client_packet.cpp
@@ -8103,22 +8103,27 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app)
 
 	const Item_Struct* item = database.GetItem(ivrs->item_id);
 	if (!item) {
-		if (ivrs->item_id > 500000)
+
+		Log.Out(Logs::General, Logs::Inventory, "Handle_OP_ItemLinkClick (1) :: item_id %u (item link request)", ivrs->item_id);
+
+		if (ivrs->item_id > SAYLINK_BASE_ID)
 		{
 			std::string response = "";
-			int sayid = ivrs->item_id - 500000;
-			bool silentsaylink = false;
+			int saylink_id = ivrs->item_id - SAYLINK_BASE_ID;
+			bool is_silent_saylink = false;
 
-			if (sayid > 250000)	//Silent Saylink
+			if (ivrs->item_id > SILENT_SAYLINK_BASE_ID)	//Silent Saylink
 			{
-				sayid = sayid - 250000;
-				silentsaylink = true;
+				saylink_id = saylink_id - 250000;
+				is_silent_saylink = true;
 			}
 
-			if (sayid > 0)
+			Log.Out(Logs::General, Logs::Inventory, "Handle_OP_ItemLinkClick :: item_id %u :: is_silent_saylink : %B :: saylink_id %i", ivrs->item_id, is_silent_saylink, saylink_id);
+
+			if (ivrs->item_id > SAYLINK_BASE_ID)
 			{
 
-				std::string query = StringFormat("SELECT `phrase` FROM saylink WHERE `id` = '%i'", sayid);
+				std::string query = StringFormat("SELECT `phrase` FROM saylink WHERE `id` = '%i'", saylink_id);
 				auto results = database.QueryDatabase(query);
 				if (!results.Success()) {
 					Message(13, "Error: The saylink (%s) was not found in the database.", response.c_str());
@@ -8137,11 +8142,11 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app)
 
 			if ((response).size() > 0)
 			{
-				if (!mod_saylink(response, silentsaylink)) { return; }
+				if (!mod_saylink(response, is_silent_saylink)) { return; }
 
 				if (GetTarget() && GetTarget()->IsNPC())
 				{
-					if (silentsaylink)
+					if (is_silent_saylink)
 					{
 						parse->EventNPC(EVENT_SAY, GetTarget()->CastToNPC(), this, response.c_str(), 0);
 						parse->EventPlayer(EVENT_SAY, this, response.c_str(), 0);
@@ -8155,7 +8160,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app)
 				}
 				else
 				{
-					if (silentsaylink)
+					if (is_silent_saylink)
 					{
 						parse->EventPlayer(EVENT_SAY, this, response.c_str(), 0);
 					}
diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp
index 86b8cb7..19a319a 100644
--- a/zone/questmgr.cpp
+++ b/zone/questmgr.cpp
@@ -2767,9 +2767,9 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam
 	safe_delete_array(escaped_string);
 
 	if (silent)
-		sayid = sayid + 750000;
+		sayid = sayid + SILENT_SAYLINK_BASE_ID;
 	else
-		sayid = sayid + 500000;
+		sayid = sayid + SAYLINK_BASE_ID;
 
 	//Create the say link as an item link hash
 	Client::TextLink linker;
diff --git a/zone/zone.cpp b/zone/zone.cpp
index b3a6fc1..25f2fb5 100644
--- a/zone/zone.cpp
+++ b/zone/zone.cpp
@@ -285,22 +285,22 @@ bool Zone::LoadGroundSpawns() {
 	Ground_Spawns groundspawn;
 
 	memset(&groundspawn, 0, sizeof(groundspawn));
-	int gsindex=0;
+	int gsindex = 0;
 	Log.Out(Logs::General, Logs::Status, "Loading Ground Spawns from DB...");
 	database.LoadGroundSpawns(zoneid, GetInstanceVersion(), &groundspawn);
-	uint32 ix=0;
-	char* name=0;
-	uint32 gsnumber=0;
-	for(gsindex=0;gsindex<50;gsindex++){
-		if(groundspawn.spawn[gsindex].item>0 && groundspawn.spawn[gsindex].item<500000){
+	uint32 ix = 0;
+	char* name = 0;
+	uint32 gsnumber = 0;
+	for (gsindex = 0; gsindex<50; gsindex++){
+		if (groundspawn.spawn[gsindex].item > 0 && groundspawn.spawn[gsindex].item < SAYLINK_BASE_ID){
 			ItemInst* inst = nullptr;
 			inst = database.CreateItem(groundspawn.spawn[gsindex].item);
-			gsnumber=groundspawn.spawn[gsindex].max_allowed;
-			ix=0;
-			if(inst){
+			gsnumber = groundspawn.spawn[gsindex].max_allowed;
+			ix = 0;
+			if (inst){
 				name = groundspawn.spawn[gsindex].name;
-				for(ix=0;ix<gsnumber;ix++){
-					Object* object = new Object(inst,name,groundspawn.spawn[gsindex].max_x,groundspawn.spawn[gsindex].min_x,groundspawn.spawn[gsindex].max_y,groundspawn.spawn[gsindex].min_y,groundspawn.spawn[gsindex].max_z,groundspawn.spawn[gsindex].heading,groundspawn.spawn[gsindex].respawntimer);//new object with id of 10000+
+				for (ix = 0; ix < gsnumber; ix++){
+					Object* object = new Object(inst, name, groundspawn.spawn[gsindex].max_x, groundspawn.spawn[gsindex].min_x, groundspawn.spawn[gsindex].max_y, groundspawn.spawn[gsindex].min_y, groundspawn.spawn[gsindex].max_z, groundspawn.spawn[gsindex].heading, groundspawn.spawn[gsindex].respawntimer);//new object with id of 10000+
 					entity_list.AddObject(object, false);
 				}
 				safe_delete(inst);

Raw Paste Data