Jump to content

Tranquility

Members
  • Content Count

    102
  • Joined

  • Last visited

Posts posted by Tranquility


  1. If you would use the latest revision of Hercules, you'll need to execute the SQL updates manually on your database.

    Depending on which revision you started, you'll have to start updating/upgrading your database with the files that appear to be missing.

    The possibility is that you didn't modify too many files yet, in that case, you can start with a fresh clone from the Herc repository and add your modifications that way.


  2. File Name: [script] storage{mod}item

    File Submitter: Tranquility

    File Submitted: 23 Oct 2015

    File Category: Plugins

     

    Greetings!

     

    The past week I've been messing around with processing how to utilise the storage better for my in-game NPCs & scripts.

    Coming from rA, I noticed we didn't have the script commands "storageadditem", "storagecountitem", "storagedelitem".

    Because of that I thought I should give it a try and aim to develop a plugin or a means, to make it possible to use this functionality again.

     

    How to use:

    • you can use storageadditem to add an item name or itemid to a players storage.
      storageadditem <item id>, <amount>{, <account id>}
      storageadditem<item name>, <amount>{, <account id>}
      Example: storageadditem(501,10);
    • you can use storagecountitem to count a specific item name or itemid in a players storage.
      storagecountitem(nameID,{accountID})
      returns number of items that meet the conditions
      Example: .@pots = storagecountitem(501);
    • you can use storagedeltitem to delete a specific item name or itemid in a players storage.
      storagedelitem <item id>,<amount>{,<account id>}
      storagedelitem "<item name>",<amount>{,<account id>}
      Deletes items from the target/attached player.
      Example: storagedelitem(501,.@pots);

    Read the Hercules Plugin Manager wiki page if you don't know how to add this functionality to your server.

    If you have any questions, suggestions or notice any bugs, kindly let me know and I'll see what I can do about it.

     

    Uploaded to my Git Repo now for easier access.

     

    Click here to download this file


  3. Another question then, how am I able to call  *delitem from storage.h?
    It's located within in the storage_interface struct and I think I need to use that for the storagedelitem script I'm writing. However, when including storage.c I'm able to do it, but it'll throw tons of errors.
    Struggling with an undeclared MakeDWord when processing "buildin_delitem_delete".

    intif->delete_petdata(MakeDWord(inv->card[1], inv->card[2])); 

    That line specifically, anyone able to help out there?
     
    Latest modification for the storagedelitem script but still stuck on the MakeDWord part.

     

    Fixed, had to declare MakeDWord again:

     

    //Declaration of MakeDWord to allow the uint32 MakeDWord(uint16 word0, uint16 word1) {	return		( (uint32)(word0        ) )|		( (uint32)(word1 << 0x10) );}

  4. Greetings,

     

    Upon converting some of my scripts I noticed Herc didn't have a few scriptcommands that rA had. No big deal since we got plugins here!

    Anyhow, that's what I thought until I bumped into getting stuck with the follow plugin that I'm attempting to create:

     

     

     

    #include <stdio.h>#include <string.h>#include <stdlib.h>#include "common/HPMi.h"#include "map/pc.h"#include "common/HPMDataCheck.h" // should always be the last file included! (if you don't make it last, it'll intentionally break compile time)HPExport struct hplugin_info pinfo = {    "storagecountitem", // Plugin name    SERVER_TYPE_MAP,// Which server types this plugin works with?    "0.1",            // Plugin version    HPM_VERSION,    // HPM Version (don't change, macro is automatically updated)};/*========================================== * storagecountitem(nameID,{accountID}) * returns number of items that meet the conditions *==========================================*/BUILDIN(storagecountitem) {    int nameid, i;    int count = 0;    struct item_data* id = NULL;    TBL_PC* sd = script->rid2sd(st);    if( !sd )        return true;    if( script_isstringtype(st, 2) ) {        // item name        id = itemdb->search_name(script_getstr(st, 2));    } else {        // item id        id = itemdb->exists(script_getnum(st, 2));    }    if( id == NULL ) {        ShowError("buildin_storagecountitem: Invalid item '%s'.n", script_getstr(st,2));  // returns string, regardless of what it was        script_pushint(st,0);        return false;    }    nameid = id->nameid;    for(i = 0; i < MAX_STORAGE; i++)        if(sd->status.storage.items[i].nameid == nameid)            count += sd->status.storage.items[i].amount;    script_pushint(st,count);    return true;}/*========================================== * storagecountitem2(nameID,Identified,Refine,Attribute,Card0,Card1,Card2,Card3) * returns number of items that meet the conditions *==========================================*/BUILDIN(storagecountitem2) {    int nameid, iden, ref, attr, c0, c1, c2, c3;    int count = 0;    int i;    struct item_data* id = NULL;    TBL_PC* sd = script->rid2sd(st);    if (!sd) {        return true;    }    if( script_isstringtype(st, 2) ) { //item name        id = itemdb->search_name(script_getstr(st, 2));    } else { //item id        id = itemdb->exists(script_getnum(st, 2));    }    if( id == NULL ) {        ShowError("buildin_storagecountitem2: Invalid item '%s'.n", script_getstr(st,2));  // returns string, regardless of what it was        script_pushint(st,0);        return false;    }    nameid = id->nameid;    iden = script_getnum(st,3);    ref  = script_getnum(st,4);    attr = script_getnum(st,5);    c0 = (short)script_getnum(st,6);    c1 = (short)script_getnum(st,7);    c2 = (short)script_getnum(st,8);    c3 = (short)script_getnum(st,9);    for(i = 0; i < MAX_STORAGE; i++) {        if(sd->status.storage.items[i].nameid > 0 && sd->status.storage.items[i].amount > 0 &&           sd->status.storage.items[i].nameid == nameid && sd->status.storage.items[i].identify == iden &&           sd->status.storage.items[i].refine == ref && sd->status.storage.items[i].attribute == attr &&           sd->status.storage.items[i].card[0] == c0 && sd->status.storage.items[i].card[1] == c1 &&           sd->status.storage.items[i].card[2] == c2 && sd->status.storage.items[i].card[3] == c3           )           count += sd->status.storage.items[i].amount;    }    script_pushint(st,count);    return true;}/* Server Startup */HPExport void plugin_init (void) {    addScriptCommand( "storagecountitem", "v", storagecountitem);    addScriptCommand( "storagecountitem2", "viiiiiii", storagecountitem2);}

     

     

    Fixed the above script, added it incase people are interested. Will 'officially' release it in the plugin release when the below script is finished/working as well.

     

    The next script that had to be made was the deletion of items in the storage. Thus storagedelitem came here to ruin my night, the follow is what I got, but doesn't work for one milimeter:

     

     

    #include <stdio.h>#include <string.h>#include <stdlib.h>#include "common/HPMi.h"#include "common/utils.c"#include "map/intif.h"#include "map/pc.h"#include "map/storage.c"#include "common/HPMDataCheck.h" // should always be the last file included! (if you don't make it last, it'll intentionally break compile time)HPExport struct hplugin_info pinfo = {	"storagedelitem", // Plugin name	SERVER_TYPE_MAP,// Which server types this plugin works with?	"0.1",			// Plugin version	HPM_VERSION,	// HPM Version (don't change, macro is automatically updated)};/// Counts / deletes the current item given by idx./// Used by buildin_delitem_search/// Relies on all input data being already fully valid.void buildin_storage_delitem_delete(struct map_session_data* sd, int idx, int* amount, bool delete_items){	int delamount;	struct item* inv = &sd->status.storage.items[idx];	delamount = ( amount[0] < inv->amount ) ? amount[0] : inv->amount;	if( delete_items )	{		if( itemdb_type(inv->nameid) == IT_PETEGG && inv->card[0] == CARD0_PET )		{// delete associated pet			intif->delete_petdata(MakeDWord(inv->card[1], inv->card[2]));		}		storage_delitem(sd, idx, delamount);	}	amount[0]-= delamount;}/// Searches for item(s) and checks, if there is enough of them./// Used by delitem and delitem2/// Relies on all input data being already fully valid./// @param exact_match will also match item attributes and cards, not just name id/// @return true when all items could be deleted, false when there were not enough items to deletebool buildin_storage_delitem_search(struct map_session_data* sd, struct item* it, bool exact_match){	bool delete_items = false;	int i, amount, size;	struct item* inv;	// prefer always non-equipped items	it->equip = 0;	// when searching for nameid only, prefer additionally	if (!exact_match) {		// non-refined items		it->refine = 0;		// card-less items		memset(it->card, 0, sizeof(it->card));	}	size = MAX_STORAGE;	for (; {		int important = 0;		amount = it->amount;		// 1st pass -- less important items / exact match		for (i = 0; amount && i < size; i++) {			inv = &sd->status.storage.items[i];			if (!inv->nameid || !&inv || inv->nameid != it->nameid) {				// wrong/invalid item				continue;			}			if (inv->equip != it->equip || inv->refine != it->refine) {				// not matching attributes				important++;				continue;			}			if (exact_match) {				if (inv->identify != it->identify || inv->attribute != it->attribute || memcmp(inv->card, it->card, sizeof(inv->card))) {					// not matching exact attributes					continue;				}			} else {				if (itemdb_type(inv->nameid) == IT_PETEGG) {					if (inv->card[0] == CARD0_PET && intif->CheckForCharServer()) {						// pet which cannot be deleted						continue;					}				} else if (memcmp(inv->card, it->card, sizeof(inv->card))) {					// named/carded item					important++;					continue;				}			}			// count / delete item			buildin_storage_delitem_delete(sd, i, &amount, delete_items);		}		// 2nd pass -- any matching item		if (amount == 0 || important == 0) {			// either everything was already consumed or no items were skipped			;		} else {			for (i = 0; amount && i < size; i++) {				inv = &sd->status.storage.items[i];				if (!inv->nameid || !&inv || inv->nameid != it->nameid) {					// wrong/invalid item					continue;				}				if (itemdb_type(inv->nameid) == IT_PETEGG && inv->card[0] == CARD0_PET && intif->CheckForCharServer()) {					// pet which cannot be deleted					continue;				}				if (exact_match) {					if (inv->refine != it->refine || inv->identify != it->identify || inv->attribute != it->attribute					 || memcmp(inv->card, it->card, sizeof(inv->card))) {						// not matching attributes						continue;					}				}				// count / delete item				buildin_storage_delitem_delete(sd, i, &amount, delete_items);			}		}		if (amount) {			// not enough items			return false;		} else if(delete_items) {			// we are done with the work			return true;		} else {			// get rid of the items now			delete_items = true;		}	}}/*========================================== * delitem <item id>,<amount>{,<account id>} * delitem "<item name>",<amount>{,<account id>} * Deletes items from the target/attached player. *==========================================*/BUILDIN(storagedelitem) {	TBL_PC *sd;	struct item it;	if (script_hasdata(st,4)) {		int account_id = script_getnum(st,4);		sd = map->id2sd(account_id); // <account id>		if (sd == NULL) {			ShowError("script:storagedelitem: player not found (AID=%d).n", account_id);			st->state = END;			return false;		}	} else {		sd = script->rid2sd(st);// attached player		if (sd == NULL)			return true;	}	memset(&it, 0, sizeof(it));	if (script_isstringtype(st, 2)) {		const char* item_name = script_getstr(st, 2);		struct item_data* id = itemdb->search_name(item_name);		if (id == NULL) {			ShowError("script:storagedelitem: unknown item "%s".n", item_name);			st->state = END;			return false;		}		it.nameid = id->nameid;// "<item name>"	} else {		it.nameid = script_getnum(st, 2);// <item id>		if (!itemdb->exists(it.nameid)) {			ShowError("script:storagedelitem: unknown item "%d".n", it.nameid);			st->state = END;			return false;		}	}	it.amount=script_getnum(st,3);	if( it.amount <= 0 )		return true;// nothing to do	if( buildin_storage_delitem_search(sd, &it, false) )	{// success		return true;	}	ShowError("script:storagedelitem: failed to delete %d items (AID=%d item_id=%d).n", it.amount, sd->status.account_id, it.nameid);	st->state = END;	clif->scriptclose(sd, st->oid);	return false;}/* Server Startup */HPExport void plugin_init (void) {	addScriptCommand( "storagedelitem", "vi?", storagedelitem);}

     

     

    The original delitem script is used as reference and is as following:

     

     

    /// Counts / deletes the current item given by idx./// Used by buildin_delitem_search/// Relies on all input data being already fully valid.void buildin_delitem_delete(struct map_session_data* sd, int idx, int* amount, bool delete_items){	int delamount;	struct item* inv = &sd->status.inventory[idx];	delamount = ( amount[0] < inv->amount ) ? amount[0] : inv->amount;	if( delete_items )	{		if( sd->inventory_data[idx]->type == IT_PETEGG && inv->card[0] == CARD0_PET )		{// delete associated pet			intif->delete_petdata(MakeDWord(inv->card[1], inv->card[2]));		}		pc->delitem(sd, idx, delamount, 0, DELITEM_NORMAL, LOG_TYPE_SCRIPT);	}	amount[0]-= delamount;}/// Searches for item(s) and checks, if there is enough of them./// Used by delitem and delitem2/// Relies on all input data being already fully valid./// @param exact_match will also match item attributes and cards, not just name id/// @return true when all items could be deleted, false when there were not enough items to deletebool buildin_delitem_search(struct map_session_data* sd, struct item* it, bool exact_match){	bool delete_items = false;	int i, amount;	struct item* inv;	// prefer always non-equipped items	it->equip = 0;	// when searching for nameid only, prefer additionally	if (!exact_match) {		// non-refined items		it->refine = 0;		// card-less items		memset(it->card, 0, sizeof(it->card));	}	for (; {		int important = 0;		amount = it->amount;		// 1st pass -- less important items / exact match		for (i = 0; amount && i < ARRAYLENGTH(sd->status.inventory); i++) {			inv = &sd->status.inventory[i];			if (!inv->nameid || !sd->inventory_data[i] || inv->nameid != it->nameid) {				// wrong/invalid item				continue;			}			if (inv->equip != it->equip || inv->refine != it->refine) {				// not matching attributes				important++;				continue;			}			if (exact_match) {				if (inv->identify != it->identify || inv->attribute != it->attribute || memcmp(inv->card, it->card, sizeof(inv->card))) {					// not matching exact attributes					continue;				}			} else {				if (sd->inventory_data[i]->type == IT_PETEGG) {					if (inv->card[0] == CARD0_PET && intif->CheckForCharServer()) {						// pet which cannot be deleted						continue;					}				} else if (memcmp(inv->card, it->card, sizeof(inv->card))) {					// named/carded item					important++;					continue;				}			}			// count / delete item			script->buildin_delitem_delete(sd, i, &amount, delete_items);		}		// 2nd pass -- any matching item		if (amount == 0 || important == 0) {			// either everything was already consumed or no items were skipped			;		} else {			for (i = 0; amount && i < ARRAYLENGTH(sd->status.inventory); i++) {				inv = &sd->status.inventory[i];				if (!inv->nameid || !sd->inventory_data[i] || inv->nameid != it->nameid) {					// wrong/invalid item					continue;				}				if (sd->inventory_data[i]->type == IT_PETEGG && inv->card[0] == CARD0_PET && intif->CheckForCharServer()) {					// pet which cannot be deleted					continue;				}				if (exact_match) {					if (inv->refine != it->refine || inv->identify != it->identify || inv->attribute != it->attribute					 || memcmp(inv->card, it->card, sizeof(inv->card))) {						// not matching attributes						continue;					}				}				// count / delete item				script->buildin_delitem_delete(sd, i, &amount, delete_items);			}		}		if (amount) {			// not enough items			return false;		} else if(delete_items) {			// we are done with the work			return true;		} else {			// get rid of the items now			delete_items = true;		}	}}/// Deletes items from the target/attached player./// Prioritizes ordinary items.////// delitem <item id>,<amount>{,<account id>}/// delitem "<item name>",<amount>{,<account id>}BUILDIN(delitem) {	TBL_PC *sd;	struct item it;	if (script_hasdata(st,4)) {		int account_id = script_getnum(st,4);		sd = map->id2sd(account_id); // <account id>		if (sd == NULL) {			ShowError("script:delitem: player not found (AID=%d).n", account_id);			st->state = END;			return false;		}	} else {		sd = script->rid2sd(st);// attached player		if (sd == NULL)			return true;	}	memset(&it, 0, sizeof(it));	if (script_isstringtype(st, 2)) {		const char* item_name = script_getstr(st, 2);		struct item_data* id = itemdb->search_name(item_name);		if (id == NULL) {			ShowError("script:delitem: unknown item "%s".n", item_name);			st->state = END;			return false;		}		it.nameid = id->nameid;// "<item name>"	} else {		it.nameid = script_getnum(st, 2);// <item id>		if (!itemdb->exists(it.nameid)) {			ShowError("script:delitem: unknown item "%d".n", it.nameid);			st->state = END;			return false;		}	}	it.amount=script_getnum(st,3);	if( it.amount <= 0 )		return true;// nothing to do	if( script->buildin_delitem_search(sd, &it, false) )	{// success		return true;	}	ShowError("script:delitem: failed to delete %d items (AID=%d item_id=%d).n", it.amount, sd->status.account_id, it.nameid);	st->state = END;	clif->scriptclose(sd, st->oid);	return false;}

     

     

     And what I think is needed is the following part from storage.c:

     

     

    /*========================================== * Internal del-item function *------------------------------------------*/int storage_delitem(struct map_session_data* sd, int n, int amount){	if( sd->status.storage.items[n].nameid == 0 || sd->status.storage.items[n].amount < amount )		return 1;	sd->status.storage.items[n].amount -= amount;	if( sd->status.storage.items[n].amount == 0 )	{		memset(&sd->status.storage.items[n],0,sizeof(sd->status.storage.items[0]));		sd->status.storage.storage_amount--;		if( sd->state.storage_flag == STORAGE_FLAG_NORMAL )			clif->updatestorageamount(sd, sd->status.storage.storage_amount, MAX_STORAGE);	}	if( sd->state.storage_flag == STORAGE_FLAG_NORMAL )		clif->storageitemremoved(sd,n,amount);	return 0;}

     

     

    Where did I mess up this time? Where didn't I mess up you're probably thinking by now..


  5. Original post with workarounds/'solutions' was made here.

     

    However, all solutions provided are workarounds.

     

    The issue came into view with the latest generation of nVidia cards and updating drivers/Direct X doesn't solve the issue. The workarounds provided do temporarily solve it, however certain clients force close using some of those workarounds.

    Toggling "/lightmap" does remove the black squares, however that doesn't fix the horrible sprites with their choppy edges.

     

    A permanent solution is still to be sought after, possibly lies in the game client itself though. No real solution was provided on warp portal forums either, so there are no expectations ;p


  6. Greetings,

     

    Upon going through the modifications I have to make for my scripts and ideas to work with Herc, I encountered different kinds of shops and other features.

    However, stubborn as I am, I wonder if it is possible to modify clif.c to add/modify the current currencies for an item from our item database?

    Taking the source for the Cash/Point shop, I see that currency is being declared, but due to my lack of programming skills I can't think of a way to point it to a new value, namely one from the item database.

    Is anyone able to push me in the right direction? I've already located the most likely point of origin to modify for this to be possible, the spoiler below contains the cash shop code from clif.c.

     

     

    /// CASH/POINT SHOP////// List of items offered in a cash shop (ZC_PC_CASH_POINT_ITEMLIST)./// 0287 <packet len>.W <cash point>.L { <sell price>.L <discount price>.L <item type>.B <name id>.W }*/// 0287 <packet len>.W <cash point>.L <kafra point>.L { <sell price>.L <discount price>.L <item type>.B <name id>.W }* (PACKETVER >= 20070711)void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) {	struct npc_item_list *shop = NULL;	unsigned short shop_size = 0;	int fd,i, c = 0;	int currency[2] = { 0,0 };#if PACKETVER < 20070711	const int offset = 8;#else	const int offset = 12;#endif	nullpo_retv(sd);	nullpo_retv(nd);	if( nd->subtype == SCRIPT ) {		shop = nd->u.scr.shop->item;		shop_size = nd->u.scr.shop->items;		npc->trader_count_funds(nd, sd);		currency[0] = npc->trader_funds[0];		currency[1] = npc->trader_funds[1];	} else {		shop = nd->u.shop.shop_item;		shop_size = nd->u.shop.count;		currency[0] = sd->cashPoints;		currency[1] = sd->kafraPoints;	}	fd = sd->fd;	sd->npc_shopid = nd->bl.id;	WFIFOHEAD(fd,offset+shop_size*11);	WFIFOW(fd,0) = 0x287;	/* 0x2 = length, set after parsing */	WFIFOL(fd,4) = currency[0]; // Cash Points#if PACKETVER >= 20070711	WFIFOL(fd,8) = currency[1]; // Kafra Points#endif	for( i = 0; i < shop_size; i++ ) {		if( shop[i].nameid ) {			struct item_data* id = itemdb->search(shop[i].nameid);			WFIFOL(fd,offset+0+i*11) = shop[i].value;			WFIFOL(fd,offset+4+i*11) = shop[i].value; // Discount Price			WFIFOB(fd,offset+8+i*11) = itemtype(id->type);			WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid;			c++;		}	}	WFIFOW(fd,2) = offset+c*11;	WFIFOSET(fd,WFIFOW(fd,2));}/// Cashshop Buy Ack (ZC_PC_CASH_POINT_UPDATE)./// 0289 <cash point>.L <error>.W/// 0289 <cash point>.L <kafra point>.L <error>.W (PACKETVER >= 20070711)/// For error return codes see enum [email protected] clif_cashshop_ack(struct map_session_data* sd, int error) {	struct npc_data *nd;	int fd;	int currency[2] = { 0,0 };	nullpo_retv(sd);	fd = sd->fd;	if( (nd = map->id2nd(sd->npc_shopid)) && nd->subtype == SCRIPT ) {		npc->trader_count_funds(nd,sd);		currency[0] = npc->trader_funds[0];		currency[1] = npc->trader_funds[1];	} else {		currency[0] = sd->cashPoints;		currency[1] = sd->kafraPoints;	}	WFIFOHEAD(fd, packet_len(0x289));	WFIFOW(fd,0) = 0x289;	WFIFOL(fd,2) = currency[0];#if PACKETVER < 20070711	WFIFOW(fd,6) = TOW(error);#else	WFIFOL(fd,6) = currency[1];	WFIFOW(fd,10) = TOW(error);#endif	WFIFOSET(fd, packet_len(0x289));}void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));/// Request to buy item(s) from cash shop (CZ_PC_BUY_CASH_POINT_ITEM)./// 0288 <name id>.W <amount>.W/// 0288 <name id>.W <amount>.W <kafra points>.L (PACKETVER >= 20070711)/// 0288 <packet len>.W <kafra points>.L <count>.W { <amount>.W <name id>.W }.4B*count (PACKETVER >= 20100803)void clif_parse_cashshop_buy(int fd, struct map_session_data *sd){	int fail = 0;	if( sd->state.trading || !sd->npc_shopid || pc_has_permission(sd,PC_PERM_DISABLE_STORE) )		fail = 1;	else {#if PACKETVER < 20101116		short nameid = RFIFOW(fd,2);		short amount = RFIFOW(fd,4);		int points = RFIFOL(fd,6);		fail = npc->cashshop_buy(sd, nameid, amount, points);#else		int len = RFIFOW(fd,2);		int points = RFIFOL(fd,4);		int count = RFIFOW(fd,8);		unsigned short* item_list = (unsigned short*)RFIFOP(fd,10);		if( len < 10 || len != 10 + count * 4) {			ShowWarning("Player %u sent incorrect cash shop buy packet (len %u:%u)!n", sd->status.char_id, len, 10 + count * 4);			return;		}		fail = npc->cashshop_buylist(sd,points,count,item_list);#endif	}	clif->cashshop_ack(sd,fail);}

     

     

     

    Thanks in advance.

     

    Note: I have done my search and did find this as an option, however I like to expand my horizon and get things done how I have them in mind. Potentially providing a change for others to use.
    I'm not too lazy to search, just too stubborn to accept workaround to be a valid solution.

     


  7.  

    your view ID is out of range (max cap is 30,000 if your client is diff to 30000 max view headgear) 

     

     

    PS: try using lower view ID.

    i change it to 3000.... but on item_db.conf i realize the "view" V is lowercase so i change it to upper.... but it gives me error when i open the client

    Change your lua/lub files to the new view ID you've set. It can't find the sprite for the item now.


  8.  

    check you accaname and accessoryid

     

    and 

     

    check your item_db2.conf "View: <"put the one you put on yor accessoryid">"

     

    still nothing... anything else?

    In that case, show us what you've done to implement it. Add some code boxes with where you put the respective filenames/descriptions.

    The wiki is quite thorough on what you should add and where though.


  9.  

     

     

    np

     

    haha the costumes is not mine

    it just a db lol

     

    Hi zack, is it possible to get this in pre-renewal? 

    It is possible if you take them from the renewal item_db. Since they don't have any effects they should be able to be implemented for pre-renewal too (double check them to be sure though).

    Currently working on the addition of renewal items to pre-renewal db, it's a horror but someone has to do it.

     

    Lol. it sounds easy but it is merged with the item_db at random lines it would be better if it was separated at least and grouped.

    It is more logical that it's done by order of item ID, which is done now. However a chronological order of implementation wouldn't be bad for purposes like this. However, if you want it, you'll have to just sit those 3-4 hours comparing the two databases and merge changes. I'll be doing the migration for the whole renewal database to pre-renewal and not just the costume items. Just the costume items probably is relatively easy to do, I think it's within the item ID range of like 19k-23k or something? Which is done quite fast.


  10.  

    np

     

    haha the costumes is not mine

    it just a db lol

     

    Hi zack, is it possible to get this in pre-renewal? 

    It is possible if you take them from the renewal item_db. Since they don't have any effects they should be able to be implemented for pre-renewal too (double check them to be sure though).

    Currently working on the addition of renewal items to pre-renewal db, it's a horror but someone has to do it.


  11. Tried and used on my live server, conversion completed without any errors. However there could still be some duplicates flaws in the script that I just fail to see.

    Other than that, it works and can be used for rA > Herc conversion.

     

    Made a pull request for it yesterday too, so if the core devs could take a look at it, it'll be able to be used by the masses.


  12. Greetings!

     

    I am currently working on adding the renewal items to the pre-renewal item database. Or rather, doing it again, since I did it on rA before, but just the SQL queries.

    However, since Herc is/was making the move for SQL item & mob databases to be deprecated, I thought I should move everything to text anyhow.

     

    The real question is, has there been anyone who already attempted to do this? Or is there maybe a plugin for it? (I haven't found it)

    If no one has taken such actions before, then I guess I'll compare the two files and copy-pasta the non-existing items to a new file and try to remove all renewal features out of it (3rd class skills or upgrade mechanics for example). When there are multiple people interested or someone knows an easier way to do this (besides going renewal itself), it might be possible to just collaborate and commit them on your/mine/our github repository.

     

    Kind regards,

     

    Tranquility


  13. Greetings (future) Herc users, in the past I've asked a lot about migrating from rA to Herc. One of the issues I came across was the non-updated SQL conversion tool.

    Below in the spoiler is my attempt to update the current available tool, which is to be carried out after a complete rA update.

    Since I doubt my adjustments I post it here, wondering if a few of the interested people could try this out on their test servers, hoping they'll yield the same results as I do.

     

    Do note, the last two queries are to convert your item databases and are thus optional. Remove them from your query if you're already going straight to the conf-file setup.

     

    -- rAthena to Hercules main database upgrade query.-- This upgrades a FULLY UPGRADED rAthena to a FULLY UPGRADED Hercules-- Please don't use if either rAthena or Hercules launched a SQL update after last revision date of this file.-- Remember to make a backup before applying.-- We are not liable for any data loss this may cause.-- Apply in the same database you applied your main.sql-- Last revised: October 13, 2015 05:00 CET-- Drop table contents from `sc_data` since we use a different status order than rAthena-- /! WARNING /! This will remove _ALL_ of the status effects active on the server-- You can disable this, but this is a SECURITY MEASURE-- This will remove even jailed status from users!TRUNCATE TABLE `sc_data`;-- Drop table `skillcooldown` since it's not used in HerculesDROP TABLE IF EXISTS `skillcooldown`;-- Upgrades for table `auction`ALTER TABLE `auction` MODIFY `nameid` INT(11) NOT NULL DEFAULT '0',    MODIFY `card0` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card1` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card2` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card3` SMALLINT(11) NOT NULL DEFAULT '0';-- Upgrades for table `cart_inventory`ALTER TABLE `cart_inventory` MODIFY `nameid` INT(11) NOT NULL DEFAULT '0',    MODIFY `card0` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card1` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card2` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card3` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `bound` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0';-- Upgrades for table `char`ALTER TABLE `char` CHANGE `moves` `slotchange` SMALLINT(3) UNSIGNED NOT NULL DEFAULT '0',    ADD `char_opt` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `slotchange`,    MODIFY `font` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `char_opt`;-- Upgrades for table `charlog`ALTER TABLE `charlog` ADD COLUMN `char_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `account_id`;-- Upgrades for table `guild_storage`ALTER TABLE `guild_storage` MODIFY `nameid` INT(11) NOT NULL DEFAULT '0',    MODIFY `card0` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card1` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card2` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card3` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `bound` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0';-- Upgrades for table `inventory`ALTER TABLE `inventory` MODIFY `nameid` INT(11) NOT NULL DEFAULT '0',    MODIFY `card0` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card1` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card2` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card3` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `bound` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0';-- Login table will be upgraded at a later point on this file-- so that we can save the bank vault.-- Upgrades for table `mail`ALTER TABLE `mail` MODIFY `nameid` INT(11) NOT NULL DEFAULT '0',    MODIFY `card0` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card1` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card2` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card3` SMALLINT(11) NOT NULL DEFAULT '0',    DROP COLUMN `bound`;-- Upgrades for table `pet`ALTER TABLE `pet` MODIFY `egg_id` SMALLINT(11) UNSIGNED NOT NULL DEFAULT '0';-- Upgrades for table `sc_data`ALTER TABLE `sc_data` ADD PRIMARY KEY  (`account_id`,`char_id`,`type`);---- Table structure for table `sql_updates`--CREATE TABLE IF NOT EXISTS `sql_updates` (  `timestamp` INT(11) UNSIGNED NOT NULL,  `ignored` ENUM('Yes','No') NOT NULL DEFAULT 'No',  PRIMARY KEY (`timestamp`)) ENGINE=MyISAM;-- Existent updates to enterINSERT INTO `sql_updates` (`timestamp`) VALUES (1360858500); -- 2013-02-14--16-15.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1360951560); -- 2013-02-15--18-06.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1362445531); -- 2013-03-05--01-05.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1362528000); -- 2013-03-06--00-00.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1362794218); -- 2013-03-09--01-56.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1364409316); -- 2013-03-27--18-35.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1366075474); -- 2013-04-16--01-24.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1366078541); -- 2013-04-16--02-15.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1381354728); -- 2013-10-09--21-38.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1381423003); -- 2013-10-10--16-36.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1382892428); -- 2013-10-27--16-47.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1383162785); -- 2013-10-30--19-53.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1383167577); -- 2013-10-30--21-12.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1383205740); -- 2013-10-31--07-49.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1383955424); -- 2013-11-09--00-03.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1384473995); -- 2013-11-15--00-06.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1384545461); -- 2013-11-15--19-57.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1384588175); -- 2013-11-16--07-49.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1384763034); -- 2013-11-18--08-23.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1387844126); -- 2013-12-24--00-15.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1388854043); -- 2014-01-04--16-47.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1389028967); -- 2014-01-06--17-22.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1392832626); -- 2014-02-19--17-57.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1395789302); -- 2014-03-25--23-57.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1396893866); -- 2014-04-07--22-04.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1398477600); -- 2014-04-26--10-00.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1400256139); -- 2014-05-17--00-06.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1409590380); -- 2014-09-01--16-53.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1414975503); -- 2014-11-03--00-45.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1435860840); -- 2014-07-02--18-14.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1436360978); -- 2015-07-08--13-08.sqlINSERT INTO `sql_updates` (`timestamp`) VALUES (1440688342); -- 2015-08-27--13-08.sql---- Updates to table `storage`ALTER TABLE `storage` MODIFY `nameid` INT(11) NOT NULL DEFAULT '0',    MODIFY `card0` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card1` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card2` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `card3` SMALLINT(11) NOT NULL DEFAULT '0',    MODIFY `bound` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0';---- Table structure for table `account_data`--CREATE TABLE IF NOT EXISTS `account_data` (  `account_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',  `bank_vault` INT(11) UNSIGNED NOT NULL DEFAULT '0',  `base_exp` SMALLINT(6) UNSIGNED NOT NULL DEFAULT  '100',  `base_drop` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '100',  `base_death` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '100',  PRIMARY KEY (`account_id`)) ENGINE=MyISAM;-- Upgrades for table `login`ALTER TABLE `login` DROP COLUMN `vip_time`,    DROP COLUMN `old_group`;-- Drop table `bonus_script` since it's not used in HerculesDROP TABLE IF EXISTS `bonus_script`;---- Table structure for table `npc_market_data`--CREATE TABLE IF NOT EXISTS `npc_market_data` (  `name` VARCHAR(24) NOT NULL DEFAULT '',  `itemid` INT(11) UNSIGNED NOT NULL DEFAULT '0',  `amount` INT(11) UNSIGNED NOT NULL DEFAULT '0',  PRIMARY KEY (`name`,`itemid`)) ENGINE=MyISAM;---- Customised script for transfering data from rA's market to npc_market_data--DROP TABLE IF EXISTS `npc_market_data`;ALTER TABLE `market`  DROP `flag`,  DROP `price`,  MODIFY `name` varchar(24) NOT NULL DEFAULT '',  CHANGE `nameid` `itemid` INT(11) UNSIGNED NOT NULL DEFAULT '0',  MODIFY `amount` INT(11) UNSIGNED NOT NULL DEFAULT '0';RENAME TABLE `market` TO `npc_market_data`;---- Renaming rA tables to fit with the Hercules format--RENAME TABlE `acc_reg_num` to `acc_reg_num_db`;RENAME TABlE `acc_reg_str` to `acc_reg_str_db`;RENAME TABlE `char_reg_num` to `char_reg_num_db`;RENAME TABlE `char_reg_str` to `char_reg_str_db`;RENAME TABlE `global_acc_reg_num` to `global_acc_reg_num_db`;RENAME TABlE `global_acc_reg_str` to `global_acc_reg_str_db`;-- Autotrade saving. Very special thanks to Dastgir Pojee!---- Vending Database Update---- Vending_Items UpdateALTER TABLE `vending_items`  ADD `char_id` INT(11) NOT NULL DEFAULT '0' AFTER `index`;UPDATE `vending_items` v1, `vendings` v2  SET v1.char_id = v2.char_id  WHERE v1.vending_id = v2.id;ALTER TABLE `vending_items`  DROP `vending_id`,  DROP `index`,  CHANGE `cartinventory_id` `itemkey` INT(11) NOT NULL DEFAULT '0',  MODIFY `amount` INT(11) NOT NULL DEFAULT '0',  MODIFY `price` INT(11) NOT NULL DEFAULT '0';ALTER TABLE `vending_items`  ADD PRIMARY KEY ( `char_id`, `itemkey`);RENAME TABLE `vending_items` TO `autotrade_data`;-- Vending Data UpdateALTER TABLE `vendings`  DROP `id`,  DROP `map`,  DROP `x`,  DROP `y`,  DROP `autotrade`; ALTER TABLE `vendings`  CHANGE `sex` `sex_ref` ENUM('F','M') CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'M';ALTER TABLE `vendings`  MODIFY `account_id` INT(11) NOT NULL DEFAULT '0',  MODIFY `char_id` INT(11) NOT NULL DEFAULT '0',  ADD `sex` TINYINT(2) NOT NULL DEFAULT '0' AFTER `char_id`,  MODIFY `title` VARCHAR(80) NOT NULL DEFAULT 'Buy From Me!';UPDATE `vendings`  SET `sex` = 0  WHERE `sex_ref` = 'F'; UPDATE `vendings`  SET `sex` = 1  WHERE `sex_ref` = 'M';ALTER TABLE `vendings` DROP `sex_ref`;ALTER TABLE `vendings` ADD PRIMARY KEY( `account_id`, `char_id`);RENAME TABLE `vendings` TO `autotrade_merchants`;-- Autotrade saving ended-- We don't support saving buyingstores yet...-- Comment next statement if you want to preserve them anywaysDROP TABLE IF EXISTS `buyingstores`, `buyingstore_items`;-- Dropping now useless tablesDROP TABLE `global_reg_value`;DROP TABLE IF EXISTS interreg;DROP TABLE IF EXISTS sstatus;DROP TABLE IF EXISTS db_roulette;---- !! OPTIONAL !!-- Updating the item databases to match with rA's weapon/armor type differences.-- Hercules will soon no longer support SQL item databases-- ? no conversion tool available to conf yet ?--UPDATE item_db SET type =  CASE  WHEN type = 4 THEN 5  WHEN type = 5 THEN 4  ELSE typeEND    UPDATE item_db2 SET type =  CASE  WHEN type = 4 THEN 5  WHEN type = 5 THEN 4  ELSE typeEND

     

     

     

    Kindly leave your feedback in the comments below. If I'm missing a ton of things, I'll revise the entire script soon™ by manually comparing both database tables...

    EDIT: Made some small modifications after recomparing the databases, thus updated the above script.

     

    Thanks in advance,

     

    Tranquility


  14.  

     

    They're outdated and only work till the date it was published.

     

     

    Please i was use rAthena , i have a big db of my server

    i want to change the server from rAthena to Hercules 

    what i should do in the backup of my "ragnarok.sql"  ? 

    " its 7MB "

    theres convertor ?

    ockquote> 

    If you have your mobs & items in the SQL database too, you'll have to convert them to the conf files since Hercules will drop the SQL support for those. There is no convertor for it (yet).

    For the remainder, you'll have to manually make some of the database modifications yourself, so I suggest backing it up and testing it on your own computer/test server before doing it on your live server.

    There's converter for txt to conf in tools folder

     

    I'll have a look at that too, thanks for mentioning that!

    Just felt like completing the conversion script keeping in mind that others (and myself) are still using SQL item/mob databases. Once I've completed my rA struggle (which probably is a pointless one) I'll compare and fix the current rA > Herc conversion again and post it in pastebin, since I'll not be confident in my commits to the repo.


  15. They're outdated and only work till the date it was published.

     

    Please i was use rAthena , i have a big db of my server

    i want to change the server from rAthena to Hercules 

    what i should do in the backup of my "ragnarok.sql"  ? 

    " its 7MB "

    theres convertor ?

     

    If you have your mobs & items in the SQL database too, you'll have to convert them to the conf files since Hercules will drop the SQL support for those. There is no convertor for it (yet).

    For the remainder, you'll have to manually make some of the database modifications yourself, so I suggest backing it up and testing it on your own computer/test server before doing it on your live server.


  16.  

     

    I guess its time to upgrade the sql-script in repo....

    It very much is, that's why I've been trying to figure it all out =P

     

    For renewal based items it'll bring another issue though, shadow gears have a separate type (12) in rA, which is non-existent for Herc. Though probably using the item database from Herc itself would prove easier, it won't if people made modifications to their own database (pre-renewal server with the addition of renewal items for example).

    Hercules discourage using item_db via SQL, and support for reading SQL db will be deprecated soon.

    I realised that in other topics. however, is there a way to easily convert SQL databases back to txt or in Hercules' case, conf files?

    Tokei's tool allows to create most things and convert it to the right format, but it isn't possible (yet) to import a SQL database from a specific emulator.

    I fail to see why reading from SQL for those things will deprecate soon though, it is convenient and easy to access from phpmyadmin on people's browser, whereas the item_db on the VPS usually requires log-ins via Putty, VNC or some FTP synchronisation, which all seem more labourous to me ;p

    Thanks for bringing it to our attention though, I'm just curious as to why this change is coming.


  17. I guess its time to upgrade the sql-script in repo....

    It very much is, that's why I've been trying to figure it all out =P

     

    For renewal based items it'll bring another issue though, shadow gears have a separate type (12) in rA, which is non-existent for Herc. Though probably using the item database from Herc itself would prove easier, it won't if people made modifications to their own database (pre-renewal server with the addition of renewal items for example).


  18. Was making my own upgrader, still not finished, Still researching on differences

     

    Heres what i find out

     

    differences on `type`

     

    itemdb_re in rA has atk:matk field

     

    rA uses `attack` while herc uses `atk`

     

    herc has this

    `bindonequip`,
    `forceserial`,
    `buyingstore`,
    `delay`,
    `trade_flag`,
    `trade_group`,
    `nouse_flag`,
    `nouse_group`,
    `stack_amount`,
    `stack_flag`,
    `sprite`,

     

    differences on size

     

    differences on default value

     

    etc, dunno I watch TV

     

    @@Tranquility

    youll need to update the trade_flag, buying store, etc lol, 

     

    You'll gonna have problems in script field too, rA and Herc have differences in scripting

     

     

    Maybe herc should create a wiki on differences lol

     

    Yes I am aware of it, seeing that I have the following query prepared:

    ALTER TABLE `item_db` MODIFY `price_buy` MEDIUMINT(10) DEFAULT NULL,	MODIFY `price_sell` MEDIUMINT(10) DEFAULT NULL,	MODIFY `weight` smallint(5) UNSIGNED DEFAULT NULL,	CHANGE `attack` `atk` SMALLINT(5) UNSIGNED DEFAULT NULL,	ADD `matk` smallint(5) UNSIGNED DEFAULT NULL AFTER `atk`,	MODIFY `equip_jobs` int(12) UNSIGNED DEFAULT NULL,	MODIFY `equip_upper` tinyint(8) UNSIGNED DEFAULT NULL,	MODIFY `equip_genders` tinyint(2) UNSIGNED DEFAULT NULL,	CHANGE `equip_locations` `equip_locations` smallint(4) UNSIGNED DEFAULT NULL;	MODIFY `weapon_level` tinyint(2) UNSIGNED DEFAULT NULL,	CHANGE `equip_level` `equip_level_min` smallint(5) UNSIGNED DEFAULT NULL,	ADD `equip_level_max` smallint(5) UNSIGNED DEFAULT NULL AFTER `equip_level_min`,	MODIFY `view` smallint(3) UNSIGNED DEFAULT NULL,	ADD `bindonequip` tinyint(1) UNSIGNED DEFAULT NULL,	ADD `buyingstore` tinyint(1) UNSIGNED DEFAULT NULL,	ADD `delay` mediumint(9) UNSIGNED DEFAULT NULL,	ADD `trade_flag` smallint(4) UNSIGNED DEFAULT NULL,	ADD `trade_group` smallint(3) UNSIGNED DEFAULT NULL,	ADD `nouse_flag` smallint(4) UNSIGNED DEFAULT NULL,	ADD `nouse_group` smallint(4) UNSIGNED DEFAULT NULL,	ADD `stack_amount` mediumint(6) UNSIGNED DEFAULT NULL,	ADD `stack_flag` tinyint(2) UNSIGNED DEFAULT NULL,	ADD `sprite` mediumint(6) UNSIGNED DEFAULT NULL;

    There are indeed quite some differences and it amazes me, because it's focussed around the same game.

    However, since Herc seems to be a tad bit more up-to-date with clients and have a plugin system, they now have a slight preferrence. Which is why this conversion tool has to be upgraded and modified accordingly.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.