- Removed my barricade implementation. Not required in WoE SE.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13097 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
zephyrus 2008-08-20 19:40:53 +00:00
parent 6ff274c89c
commit 6b6ef43c4b
8 changed files with 0 additions and 308 deletions

View File

@ -7783,45 +7783,6 @@ int atcommand_showdelay(const int fd, struct map_session_data* sd, const char* c
return 0;
}
/*==========================================
* Barricade Build
*------------------------------------------*/
int atcommand_barricade(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
int x = 0, y = 0, size = 1, killable = 0, shootable = 0, dir = 0;
char event[50];
short result;
if( !message || !*message || (sscanf(message, "%d %d %d %d %d %d %50s", &x, &y, &size, &dir, &killable, &shootable, event) < 7) )
{
clif_displaymessage(fd, "usage @barricade <x> <y> <size> <dir> <killable> <shootable> <event>");
return -1;
}
if( x == -1 ) x = sd->bl.x;
if( y == -1 ) y = sd->bl.y;
result = mob_barricade_build(sd->bl.m, x, y, "--ja--", size, dir, (bool)killable, false, (bool)shootable, false, event);
switch( result )
{
case 0: clif_displaymessage(fd, "Barricade build."); return 0; break;
case 1: clif_displaymessage(fd, "Barricade fail. Invalid Size"); break;
case 2: clif_displaymessage(fd, "Barricade fail. Invalid Event"); break;
case 3: clif_displaymessage(fd, "Barricade fail. Event already exists"); break;
case 4: clif_displaymessage(fd, "Barricade fail. Wall problem."); break;
}
return -1;
}
int atcommand_barricade_destroy(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
mob_barricade_destroy(sd->bl.m, message);
return 0;
}
/*==========================================
* Duel organizing functions [LuzZza]
*
@ -8544,8 +8505,6 @@ AtCommandInfo atcommand_info[] = {
{ "allowks", 6, atcommand_allowks },
{ "cash", 60, atcommand_cash },
{ "points", 60, atcommand_cash },
{ "barricade", 60, atcommand_barricade },
{ "killbarricade", 60, atcommand_barricade_destroy },
};

View File

@ -3141,9 +3141,6 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
if (!(agit_flag && map[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id)
return 0; //Disable guardians/emperiums owned by Guilds on non-woe times.
if( md->barricade && !md->barricade->killable )
return 0;
break;
}
}

View File

@ -7937,7 +7937,6 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
//Login Event
npc_script_event(sd, NPCE_LOGIN);
mob_barricade_get(sd);
} else {
//For some reason the client "loses" these on warp/map-change.
clif_updatestatus(sd,SP_STR);
@ -7979,7 +7978,6 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
clif_announce(&sd->bl, output, strlen(output) + 1, 0x00CC66, 3);
}
mob_barricade_get(sd);
sd->state.changemap = false;
}

View File

@ -387,13 +387,6 @@ struct mapcell
#endif
};
struct barricade_data {
char npc_event[50];
short m, x, y, count, amount, dir;
bool killable, shootable, walkable;
};
struct map_data {
char name[MAP_NAME_LENGTH];
unsigned short index; // The map index used by the mapindex* functions.
@ -405,7 +398,6 @@ struct map_data {
short bxs,bys; // map dimensions (in blocks)
int npc_num;
int users;
int barricade_num;
struct map_flag {
unsigned town : 1; // [Suggestion to protect Mail System]
unsigned autotrade : 1;

View File

@ -67,8 +67,6 @@ static struct {
int class_[350];
} summon[MAX_RANDOMMONSTER];
static DBMap* barricade_db;
#define CLASSCHANGE_BOSS_NUM 21
/*==========================================
@ -503,210 +501,6 @@ int mob_once_spawn_area(struct map_session_data* sd,int m,int x0,int y0,int x1,i
return id; // id of last spawned mob
}
/*==========================================
* Barricades [Zephyrus]
*------------------------------------------*/
void mob_barricade_nextxy(short x, short y, short dir, int pos, short *x1, short *y1)
{ // Calculates Next X-Y Position
if( dir == 0 || dir == 4 )
*x1 = x; // Keep X
else if( dir > 0 && dir < 4 )
*x1 = x - pos; // Going left
else
*x1 = x + pos; // Going right
if( dir == 2 || dir == 6 )
*y1 = y;
else if( dir > 2 && dir < 6 )
*y1 = y - pos;
else
*y1 = y + pos;
}
short mob_barricade_build(short m, short x, short y, const char* mobname, short count, short dir, bool killable, bool walkable, bool shootable, bool odd, const char* event)
{
int i, j;
short x1, y1;
struct mob_data *md;
struct barricade_data *barricade;
if( count <= 0 ) return 1;
if( !event ) return 2;
if( (barricade = (struct barricade_data *)strdb_get(barricade_db,event)) != NULL ) return 3; // Already a barricade with event name
if( map_getcell(m, x, y, CELL_CHKNOREACH) ) return 4; // Starting cell problem
CREATE(barricade, struct barricade_data, 1);
barricade->dir = dir;
barricade->x = x;
barricade->y = y;
barricade->m = m;
safestrncpy(barricade->npc_event, event, sizeof(barricade->npc_event));
barricade->amount = 0;
barricade->killable = killable;
// A protection just in case setting a walkable - non shootable
if( (barricade->walkable = walkable) == true )
barricade->shootable = true;
else
barricade->shootable = shootable;
for( i = 0; i < count; i++ )
{
mob_barricade_nextxy(x, y, dir, i, &x1, &y1);
if( map_getcell(m, x1, y1, CELL_CHKNOREACH) ) break; // Collision
if( (odd && i % 2 != 0) || (!odd && i % 2 == 0) )
{
barricade->amount++;
if( map[m].flag.gvg_castle )
j = mob_spawn_guardian(map[m].name, x1, y1, mobname, 1905, "", 0, false);
else
j = mob_once_spawn(NULL, m, x1, y1, mobname, 1905, 1, "");
if( (md = (struct mob_data *)map_id2bl(j)) != NULL )
md->barricade = barricade;
}
if( !barricade->walkable )
{
map_setcell(m, x1, y1, CELL_WALKABLE, false);
map_setcell(m, x1, y1, CELL_SHOOTABLE, barricade->shootable);
}
clif_changemapcell(0, m, x1, y1, map_getcell(barricade->m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
}
barricade->count = i;
strdb_put(barricade_db, barricade->npc_event, barricade);
map[m].barricade_num++;
return 0;
}
void mob_barricade_get(struct map_session_data *sd)
{ // Update Barricade cell in client - Required only on changemap
struct barricade_data *barricade;
DBIterator* iter;
DBKey key;
short x1, y1;
int i;
if( map[sd->bl.m].barricade_num <= 0 )
return;
iter = barricade_db->iterator(barricade_db);
for( barricade = (struct barricade_data *)iter->first(iter,&key); iter->exists(iter); barricade = (struct barricade_data *)iter->next(iter,&key) )
{
if( sd->bl.m != barricade->m )
continue;
for( i = 0; i < barricade->count; i++ )
{
mob_barricade_nextxy(barricade->x, barricade->y, barricade->dir, i, &x1, &y1);
clif_changemapcell(sd->fd, barricade->m, x1, y1, map_getcell(barricade->m, x1, y1, CELL_GETTYPE), SELF);
}
}
iter->destroy(iter);
}
static void mob_barricade_break(struct barricade_data *barricade, struct block_list *src)
{
int i;
struct map_session_data *sd = NULL;
short x1, y1;
if( barricade == NULL )
return;
if( --barricade->amount > 0 )
return; // There are still barricades
for( i = 0; i < barricade->count; i++ )
{
mob_barricade_nextxy(barricade->x, barricade->y, barricade->dir, i, &x1, &y1);
if( !barricade->shootable )
map_setcell(barricade->m, x1, y1, CELL_SHOOTABLE, true);
if( !barricade->walkable )
map_setcell(barricade->m, x1, y1, CELL_WALKABLE, true);
clif_changemapcell(0, barricade->m, x1, y1, map_getcell(barricade->m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
}
if( src )
switch( src->type )
{
case BL_PC:
sd = BL_CAST(BL_PC,src);
break;
case BL_PET:
sd = ((TBL_PET*)src)->msd;
break;
case BL_HOM:
sd = ((TBL_HOM*)src)->master;
break;
}
if( sd ) npc_event(sd, barricade->npc_event, 0);
map[barricade->m].barricade_num--;
strdb_remove(barricade_db, barricade->npc_event);
}
static int mob_barricade_destroy_sub(struct block_list *bl, va_list ap)
{
TBL_MOB* md = (TBL_MOB*)bl;
char *event = va_arg(ap,char *);
if( md->barricade == NULL )
return 0;
if( strcmp(event, md->barricade->npc_event) == 0 )
status_kill(bl);
return 0;
}
void mob_barricade_destroy(short m, const char *event)
{
if( !event )
return;
map_foreachinmap(mob_barricade_destroy_sub, m, BL_MOB, event, 0);
}
void mod_barricade_clearall(void)
{
struct barricade_data *barricade;
DBIterator* iter;
DBKey key;
short x1, y1;
int i;
iter = barricade_db->iterator(barricade_db);
for( barricade = (struct barricade_data *)iter->first(iter,&key); iter->exists(iter); barricade = (struct barricade_data *)iter->next(iter,&key) )
{
for( i = 0; i < barricade->count; i++ )
{
mob_barricade_nextxy(barricade->x, barricade->y, barricade->dir, i, &x1, &y1);
if( !barricade->shootable )
map_setcell(barricade->m, x1, y1, CELL_SHOOTABLE, true);
if( !barricade->walkable )
map_setcell(barricade->m, x1, y1, CELL_WALKABLE, true);
clif_changemapcell(0, barricade->m, x1, y1, map_getcell(barricade->m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
}
}
iter->destroy(iter);
barricade_db->clear(barricade_db, NULL);
}
/*==========================================
* Set a Guardian's guild data [Skotlex]
*------------------------------------------*/
@ -2535,9 +2329,6 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
}
}
if( md->barricade != NULL )
mob_barricade_break(md->barricade, src);
if(md->deletetimer!=-1) {
delete_timer(md->deletetimer,mob_timer_delete);
md->deletetimer = INVALID_TIMER;
@ -4356,8 +4147,6 @@ int do_init_mob(void)
item_drop_ers = ers_new(sizeof(struct item_drop));
item_drop_list_ers = ers_new(sizeof(struct item_drop_list));
barricade_db = strdb_alloc(DB_OPT_RELEASE_DATA,2*NAME_LENGTH+2+1);
#ifndef TXT_ONLY
if(db_use_sqldbs)
mob_read_sqldb();
@ -4404,6 +4193,5 @@ int do_final_mob(void)
}
ers_destroy(item_drop_ers);
ers_destroy(item_drop_list_ers);
barricade_db->destroy(barricade_db,NULL);
return 0;
}

View File

@ -207,10 +207,6 @@ int mob_once_spawn(struct map_session_data* sd,int m,short x,short y,const char*
int mob_once_spawn_area(struct map_session_data* sd,int m,int x0,int y0,int x1,int y1,const char* mobname,int class_,int amount,const char* event);
bool mob_ksprotected (struct block_list *src, struct block_list *target);
short mob_barricade_build(short m, short x, short y, const char* mobname, short count, short dir, bool killable, bool walkable, bool shootable, bool odd, const char* event);
void mob_barricade_destroy(short m, const char *event);
void mob_barricade_get(struct map_session_data *sd);
void mod_barricade_clearall(void);
int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, int guardian, bool has_index); // Spawning Guardians [Valaris]
int mob_guardian_guildchange(struct block_list *bl,va_list ap); //Change Guardian's ownership. [Skotlex]

View File

@ -2900,7 +2900,6 @@ int npc_reload(void)
// clear npc-related data structures
ev_db->clear(ev_db,NULL);
npcname_db->clear(npcname_db,NULL);
mod_barricade_clearall(); // Clear Barricades
npc_warp = npc_shop = npc_script = 0;
npc_mob = npc_cache_mob = npc_delay_mob = 0;

View File

@ -9657,41 +9657,6 @@ BUILDIN_FUNC(guardian)
return 0;
}
/*==========================================
* Build Barricade [Zephyrus]
* buildbarricade("<map name>",<x>,<y>,"<name to show>",<size>,<dir>,<killable>,<walkable>,<shootable>,<odd>,"<event label>")
*------------------------------------------*/
BUILDIN_FUNC(buildbarricade)
{
int m = map_mapname2mapid(script_getstr(st,2));
int x = script_getnum(st,3);
int y = script_getnum(st,4);
const char *str = script_getstr(st,5);
int size = script_getnum(st,6);
short dir = script_getnum(st,7);
bool killable = (bool)script_getnum(st,8);
bool walkable = (bool)script_getnum(st,9);
bool shootable = (bool)script_getnum(st,10);
bool odd = (bool)script_getnum(st,11);
const char *evt = script_getstr(st,12);
if( m < 0 ) return -1;
check_event(st, evt);
mob_barricade_build(m, x, y , str, size, dir, killable, walkable, shootable, odd, evt);
return 0;
}
BUILDIN_FUNC(killbarricade)
{
int m = map_mapname2mapid(script_getstr(st,2));
const char *evt = script_getstr(st,3);
mob_barricade_destroy(m, evt);
return 0;
}
/// Retrieves various information about the specified guardian.
///
@ -13165,8 +13130,6 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(openauction,""),
BUILDIN_DEF(checkcell,"siii"),
BUILDIN_DEF(setcell,"siiiiii"),
BUILDIN_DEF(buildbarricade,"siisiiiiiis"),
BUILDIN_DEF(killbarricade,"ss"),
BUILDIN_DEF(getquest, "ii*"),
BUILDIN_DEF(deletequest, "i"),
BUILDIN_DEF(setquestobjective, "iisi"),