View Single Post
  #1  
Old 03-09-2008, 11:56 AM
LordKahel
Fire Beetle
 
Join Date: Sep 2007
Posts: 22
Default Adding a ATK field to npc_types

This is a simple fix to add a ATK field in the db and populate the atk value of a npc . There is a value ATK in npc but presently it always 0 (you see it with the #showstats command) and this value is used in the IntervalAC calculation for damage mitigation .


Here the required SQL for the db
Code:
ALTER TABLE npc_types ADD COLUMN `ATK` mediumint(8) unsigned NOT NULL default '0';

And then in the zonedb.cpp file . In the ZoneDatabase::GetNPCType (uint32 id) function.

change the code

Code:
			"npc_types.see_invis_undead,"
            "npc_types.lastname,"
			"npc_types.qglobal,"
			"npc_types.AC,"
            "npc_types.npc_aggro,"
			"npc_types.spawn_limit,"
			"npc_types.see_hide,"
			"npc_types.see_improved_hide";
      if (id == 0)
         MakeAnyLenString(&query,
            "%s FROM npc_types,spawn2 WHERE spawn2.zone='%s'"
            " AND npc_types.id=spawn2.id",
            basic_query, zone->GetShortName());
TO

Code:
			"npc_types.see_invis_undead,"
            "npc_types.lastname,"
			"npc_types.qglobal,"
			"npc_types.AC,"
            "npc_types.npc_aggro,"
			"npc_types.spawn_limit,"
			"npc_types.see_hide,"
			"npc_types.see_improved_hide,"
			"npc_types.ATK";
      if (id == 0)
         MakeAnyLenString(&query,
            "%s FROM npc_types,spawn2 WHERE spawn2.zone='%s'"
            " AND npc_types.id=spawn2.id",
            basic_query, zone->GetShortName());


And add the bold line in the following code:
Code:
				tmpNPCType->qglobal = atoi(row[r++])==0?false:true;	// qglobal
				tmpNPCType->AC = atoi(row[r++]);
				tmpNPCType->npc_aggro = atoi(row[r++])==0?false:true;
				tmpNPCType->spawn_limit = atoi(row[r++]);
				tmpNPCType->see_hide = atoi(row[r++])==0?false:true;
				tmpNPCType->see_improved_hide = atoi(row[r++])==0?false:true;
				tmpNPCType->ATK = atoi(row[r++]);

This will give you the possiblity of adding a atk value to npc and give them more chance of passing thru player mitigation.

--
Pyronis / Kahel
Dev Jest 3 Server
Reply With Quote