summaryrefslogtreecommitdiff
path: root/src/map/guild.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-14 23:38:11 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-14 23:38:11 +0000
commit1382b22cd68bf90f2adc4ae13187416982f9a12f (patch)
tree60602ab8f3578407bffbd1859603c3a586c52256 /src/map/guild.c
parent78474fe9877675f3fc173f0b7e7235fd6c105067 (diff)
downloadhercules-1382b22cd68bf90f2adc4ae13187416982f9a12f.tar.gz
hercules-1382b22cd68bf90f2adc4ae13187416982f9a12f.tar.bz2
hercules-1382b22cd68bf90f2adc4ae13187416982f9a12f.tar.xz
hercules-1382b22cd68bf90f2adc4ae13187416982f9a12f.zip
Guardian hp handling code removal (see bugreport:342)
- removed guardian hp from the castle data structure, database, savefiles and various script functions (use upgrade_svn11914.sql) - removed guardian hp calculation and manipulation from the castle manager npc, now the hp values are updated by the server itself (glitch: when castle defense changes, all guardians are healed to full) - tweaked script function 'guardianinfo' to provide some data needed by the manager npc (currently available are hp, maxhp and visibility); also, it doesn't need a player attached to execute anymore The whole thing is experimental, use at your own risk (seems to work though...) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11915 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/guild.c')
-rw-r--r--src/map/guild.c43
1 files changed, 17 insertions, 26 deletions
diff --git a/src/map/guild.c b/src/map/guild.c
index 8fe10116d..a6ebd5157 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1723,15 +1723,6 @@ int guild_castledataloadack(int castle_id,int index,int value)
case 16:
case 17:
gc->guardian[index-10].visible = value; break;
- case 18:
- case 19:
- case 20:
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- gc->guardian[index-18].hp = value; break;
default:
ShowError("guild_castledataloadack ERROR!! (Not found index=%d)\n", index);
return 0;
@@ -1749,14 +1740,28 @@ int guild_castledataloadack(int castle_id,int index,int value)
// ギルド城データ変更要求
int guild_castledatasave(int castle_id,int index,int value)
{
- if (index == 1)
+ if( index == 1 )
{ //The castle's owner has changed? Update Guardian ownership, too. [Skotlex]
struct guild_castle *gc = guild_castle_search(castle_id);
int m = -1;
if (gc) m = map_mapname2mapid(gc->map_name);
if (m != -1)
- map_foreachinmap(mob_guardian_guildchange, m, BL_MOB);
+ map_foreachinmap(mob_guardian_guildchange, m, BL_MOB); //FIXME: why not iterate over gc->guardian[i].id ?
}
+ else
+ if( index == 3 )
+ { // defense invest change -> recalculate guardian hp
+ struct guild_castle* gc = guild_castle_search(castle_id);
+ if( gc )
+ {
+ int i;
+ struct mob_data* gd;
+ for( i = 0; i < MAX_GUARDIANS; i++ )
+ if( gc->guardian[i].visible && (gd = map_id2md(gc->guardian[i].id)) != NULL )
+ status_calc_mob(gd,0);
+ }
+ }
+
return intif_guild_castle_datasave(castle_id,index,value);
}
@@ -1786,15 +1791,6 @@ int guild_castledatasaveack(int castle_id,int index,int value)
case 16:
case 17:
gc->guardian[index-10].visible = value; break;
- case 18:
- case 19:
- case 20:
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- gc->guardian[index-18].hp = value; break;
default:
ShowError("guild_castledatasaveack ERROR!! (Not found index=%d)\n", index);
return 0;
@@ -1864,7 +1860,7 @@ static int Gid[MAX_GUILDCASTLE];
int guild_save_sub(int tid,unsigned int tick,int id,int data)
{
struct guild_castle *gc;
- int i,j;
+ int i;
for(i = 0; i < MAX_GUILDCASTLE; i++) { // [Yor]
gc = guild_castle_search(i);
@@ -1874,11 +1870,6 @@ int guild_save_sub(int tid,unsigned int tick,int id,int data)
guild_castledatasave(gc->castle_id, 1, gc->guild_id);
Gid[i] = gc->guild_id;
}
- for (j = 0; j < MAX_GUARDIANS; j++)
- {
- if (gc->guardian[j].visible && Ghp[i][j] != gc->guardian[j].hp)
- guild_castledatasave(gc->castle_id, 18+j, gc->guardian[j].hp);
- }
}
return 0;