From 62c6e90f201643b5cebb81ce4bc58cd4a28cf8f6 Mon Sep 17 00:00:00 2001 From: skotlex Date: Fri, 23 Jun 2006 16:11:51 +0000 Subject: - Standarized PF_MEMORIZE to be 50% cast time on all skills (instead of -50% for targetted skills and -66% for ground skills >.>) - Cleared up the comment on what item_check does and how it works. - Changed the pointer dummy_item to a normal struct variable. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7316 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 4 ++++ conf-tmpl/battle/items.conf | 5 ++++- src/map/clif.c | 2 +- src/map/itemdb.c | 46 ++++++++++++++++++++------------------------- src/map/skill.c | 5 +++++ src/map/unit.c | 12 ------------ 6 files changed, 34 insertions(+), 40 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 94ed81d36..f3b08f58f 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/06/23 + * Standarized PF_MEMORIZE to be 50% cast time on all skills (instead of + -50% for targetted skills and -66% for ground skills >.>) [Skotlex] + * Cleared up the comment on what item_check does and how it works. + [Skotlex] * Changed setting for skill_nocast flag 16. It is no longer a "pk-mode map" setting, it's now a clone-forbidden skill. That is, skills with the flag 16 will never be copied by clones. If you use a PK-mode server, use flag 2 now diff --git a/conf-tmpl/battle/items.conf b/conf-tmpl/battle/items.conf index b3243c188..5df906523 100644 --- a/conf-tmpl/battle/items.conf +++ b/conf-tmpl/battle/items.conf @@ -65,7 +65,10 @@ random_monster_checklv: yes ignore_items_gender: yes // Item check? (Note 1) -// When logged in or moving in map if the item the player is holding isn't correct there will be a check. +// On map change it will check for items not tagged as "available" and +// auto-delete them from inventory/cart. +// NOTE: An item is not available if it was not loaded from the item_db or you +// specify it as unavailable in db/item_avail.txt item_check: no // How much time must pass between item uses? diff --git a/src/map/clif.c b/src/map/clif.c index b5ea9fe40..324994d69 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1859,7 +1859,7 @@ int clif_selllist(struct map_session_data *sd) { nullpo_retr(0, sd); fd=sd->fd; - WFIFOHEAD(fd, MAX_INVENTORY * 10 + 4); + WFIFOHEAD(fd, MAX_INVENTORY * 10 + 4); WFIFOW(fd,0)=0xc7; for(i=0;istatus.inventory[i].nameid > 0 && sd->inventory_data[i]) { diff --git a/src/map/itemdb.c b/src/map/itemdb.c index dfc59416d..a577b1baa 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -24,7 +24,7 @@ static struct dbt* item_db; static struct item_group itemgroup_db[MAX_ITEMGROUP]; -struct item_data *dummy_item=NULL; //This is the default dummy item used for non-existant items. [Skotlex] +struct item_data dummy_item; //This is the default dummy item used for non-existant items. [Skotlex] /*========================================== * 名前で検索用 @@ -37,7 +37,7 @@ int itemdb_searchname_sub(DBKey key,void *data,va_list ap) char *str; str=va_arg(ap,char *); dst=va_arg(ap,struct item_data **); - if(item == dummy_item) return 0; + if(item == &dummy_item) return 0; if( strcmpi(item->name,str)==0 ) //by lupus *dst=item; return 0; @@ -74,7 +74,7 @@ static int itemdb_searchname_array_sub(DBKey key,void * data,va_list ap) struct item_data *item=(struct item_data *)data; char *str; str=va_arg(ap,char *); - if (item == dummy_item) + if (item == &dummy_item) return 1; //Invalid item. if(stristr(item->jname,str)) return 0; @@ -135,7 +135,7 @@ int itemdb_group (int nameid) struct item_data* itemdb_exists(int nameid) { struct item_data* id = idb_get(item_db,nameid); - if (id == dummy_item) return NULL; + if (id == &dummy_item) return NULL; return id; } @@ -201,16 +201,14 @@ static void itemdb_jobid2mapid(unsigned int *bclass, unsigned int jobmask) } static void create_dummy_data(void) { - if (dummy_item) - aFree(dummy_item); - - dummy_item=(struct item_data *)aCalloc(1,sizeof(struct item_data)); - dummy_item->nameid=500; - dummy_item->weight=1; - dummy_item->type=3; //Etc item - strncpy(dummy_item->name,"UNKNOWN_ITEM",ITEM_NAME_LENGTH-1); - strncpy(dummy_item->jname,"UNKNOWN_ITEM",ITEM_NAME_LENGTH-1); - dummy_item->view_id = 512; //Use apple sprite. + memset(&dummy_item, 0, sizeof(struct item_data)); + dummy_item.nameid=500; + dummy_item.weight=1; + dummy_item.value_sell = 1; + dummy_item.type=3; //Etc item + strncpy(dummy_item.name,"UNKNOWN_ITEM",ITEM_NAME_LENGTH-1); + strncpy(dummy_item.jname,"UNKNOWN_ITEM",ITEM_NAME_LENGTH-1); + dummy_item.view_id = 512; //Use apple sprite. } static void* create_item_data(DBKey key, va_list args) { @@ -234,7 +232,7 @@ struct item_data* itemdb_load(int nameid) static void* return_dummy_data(DBKey key, va_list args) { if (battle_config.error_log) ShowWarning("itemdb_search: Item ID %d does not exists in the item_db. Using dummy data.\n", key.i); - return dummy_item; + return &dummy_item; } /*========================================== @@ -1170,7 +1168,7 @@ static int itemdb_final_sub (DBKey key,void *data,va_list ap) id->unequip_script = NULL; } // Whether to clear the item data (exception: do not clear the dummy item data - if (flag && id != dummy_item) + if (flag && id != &dummy_item) aFree(id); return 0; @@ -1186,16 +1184,12 @@ void itemdb_reload(void) void do_final_itemdb(void) { item_db->destroy(item_db, itemdb_final_sub, 1); - if (dummy_item) { - if (dummy_item->script) - script_free_code(dummy_item->script); - if (dummy_item->equip_script) - script_free_code(dummy_item->equip_script); - if (dummy_item->unequip_script) - script_free_code(dummy_item->unequip_script); - aFree(dummy_item); - dummy_item = NULL; - } + if (dummy_item.script) + script_free_code(dummy_item.script); + if (dummy_item.equip_script) + script_free_code(dummy_item.equip_script); + if (dummy_item.unequip_script) + script_free_code(dummy_item.unequip_script); } int do_init_itemdb(void) diff --git a/src/map/skill.c b/src/map/skill.c index d2438c855..6bb438690 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -8152,6 +8152,11 @@ int skill_castfix_sc (struct block_list *bl, int time) time -= time * (sc->data[SC_SUFFRAGIUM].val1 * 15) / 100; status_change_end(bl, SC_SUFFRAGIUM, -1); } + if (sc->data[SC_MEMORIZE].timer != -1) { + time>>=1; + if ((--sc->data[SC_MEMORIZE].val2) <= 0) + status_change_end(bl, SC_MEMORIZE, -1); + } if (sc->data[SC_POEMBRAGI].timer != -1) time -= time * sc->data[SC_POEMBRAGI].val2 / 100; } diff --git a/src/map/unit.c b/src/map/unit.c index a4534f766..0ca1e2559 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -873,12 +873,6 @@ int unit_skilluse_id2(struct block_list *src, int target_id, int skill_num, int break; } - if (sc && sc->data[SC_MEMORIZE].timer != -1 && casttime > 0) { - casttime = casttime/2; - if ((--sc->data[SC_MEMORIZE].val2) <= 0) - status_change_end(src, SC_MEMORIZE, -1); - } - if( casttime>0 || temp){ clif_skillcasting(src, src->id, target_id, 0,0, skill_num,casttime); @@ -995,12 +989,6 @@ int unit_skilluse_pos2( struct block_list *src, int skill_x, int skill_y, int sk unit_stop_attack(src); ud->state.skillcastcancel = castcancel; - if (sc && sc->data[SC_MEMORIZE].timer != -1 && casttime > 0){ - casttime = casttime/3; - if ((--sc->data[SC_MEMORIZE].val2)<=0) - status_change_end(src, SC_MEMORIZE, -1); - } - if( casttime>0 ) { unit_stop_walking( src, 1); clif_skillcasting(src, src->id, 0, skill_x,skill_y, skill_num,casttime); -- cgit v1.2.3-70-g09d2