Jump to content
  • 0
Sign in to follow this  
Ragnar Lothbrok

Can anyone edit this script

Question

can anyone edit this source?

 

 

Index: db/item_announce.txt
===================================================================
--- db/item_announce.txt (revision 0)
+++ db/item_announce.txt (working copy)
@@ -0,0 +1,6 @@
+//to set drop announce item id
+//@reloditemdb to reload all setting
+//format: item id
+//512
+//501
+//502
No newline at end of file
Index: src/map/itemdb.c
===================================================================
--- src/map/itemdb.c (revision 16146)
+++ src/map/itemdb.c (working copy)
@@ -1040,6 +1040,25 @@
}

/*====================================
+* read item_announce.txt
+*------------------------------------*/
+static bool itemdb_read_announce(char* fields[], int columns, int current)
+{
+   unsigned short nameid;
+   struct item_data* id;
+   nameid = (unsigned short)strtoul(fields[0], NULL, 10);
+   if( ( id = itemdb_exists(nameid) ) == NULL )
+   {
+   ShowWarning("itemdb_read_announce: Unknow item id '%hu'.n", nameid);
+   return false;
+   }
+
+   id->ann=1;
+   return true;
+}
+
+
+/*====================================
  * read all item-related databases
  *------------------------------------*/
static void itemdb_read(void)
@@ -1055,6 +1074,8 @@
  sv_readdb(db_path, DBPATH"item_trade.txt", ',', 3, 3, -1, &itemdb_read_itemtrade);
  sv_readdb(db_path, "item_delay.txt", ',', 2, 2, -1, &itemdb_read_itemdelay);
  sv_readdb(db_path, "item_buyingstore.txt", ',', 1, 1, -1, &itemdb_read_buyingstore);
+ sv->readdb(map->db_path, "item_announce.txt", ',', 1, 1, -1,   &itemdb->read_announce);
+
}

/*==========================================
Index: src/map/itemdb.h
===================================================================
--- src/map/itemdb.h (revision 16146)
+++ src/map/itemdb.h (working copy)
@@ -125,6 +125,7 @@
unsigned autoequip: 1;
unsigned buyingstore : 1;
  } flag;
+ unsigned ann: 1;//annouce flag
  short gm_lv_trade_override; //GM-level to override trade_restriction
};

Index: src/map/mob.c
===================================================================
--- src/map/mob.c (revision 16146)
+++ src/map/mob.c (working copy)
@@ -2357,6 +2357,18 @@
//MSG: "'%s' won %s's %s (chance: %0.02f%%)"
intif_broadcast(message,strlen(message)+1,0);
  }
+   if(mvp_sd) {//specify drop item announce
+   struct item_data *dd = NULL;
+   char anme[128];
+   dd = itemdb->search(ditem->item_data.nameid);
+   if(dd->ann==1){
+   sprintf (anme, msg_txt(541), mvp_sd->status.name, md->name, dd->jname, (float)drop_rate/100);
+   //MSG: "'%s' won %s's %s (chance: %0.02f%%)"
+   intif->broadcast(anme,strlen(anme)+1,0);
+
+   }
+
+   } 
  // Announce first, or else ditem will be freed. [Lance]
  // By popular demand, use base drop rate for autoloot code. [skotlex]
  mob_item_drop(md, dlist, ditem, 0, md->db->dropitem.p, homkillonly);
@@ -2484,6 +2496,19 @@
intif_broadcast(message,strlen(message)+1,0);
  }

+   if(mvp_sd) {//specify drop item announce
+   struct item_data *dd = NULL;
+   char anme[128];
+   dd = itemdb->search(item.nameid);
+   if(dd->ann==1){
+   sprintf (anme, msg_txt(541), mvp_sd->status.name, md->name, dd->jname, (float)temp/100);
+   //MSG: "'%s' won %s's %s (chance: %0.02f%%)"
+   intif->broadcast(anme,strlen(anme)+1,0);
+
+   }
+
+   }
+
  if((temp = pc_additem(mvp_sd,&item,1,LOG_TYPE_PICKDROP_PLAYER)) != 0) {
clif_additem(mvp_sd,0,0,temp);
map_addflooritem(&item,1,mvp_sd->bl.m,mvp_sd->bl.x,mvp_sd->bl.y,mvp_sd->status.char_id,(second_sd?second_sd->status.char_id:0),(third_sd?third_sd->status.char_id:0),1);

 

I want to make the global announcement like this only : "'Admin' got Moonlight Flower Card (chance 1.00%)"

 

not like this : "'Admin' got Moonlight Flower's Moonlight Flower Card (chance 1.00%)"

LNWAc.png

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

where's your message files? search 541 message and show here:

 

may be your message look like this:

MSG: "'%s' got %s's %s (chance: %0.02f%%)"

change to:

MSG: "'%s' got %s (chance: %0.02f%%)"

 

this line:

sprintf (anme, msg_txt(541), mvp_sd->status.name, md->name, dd->jname, (float)temp/100);

change to

sprintf (anme, msg_txt(541), mvp_sd->status.name, dd->jname, (float)temp/100);

 

this line:

sprintf (anme, msg_txt(541), mvp_sd->status.name, md->name, dd->jname, (float)drop_rate/100);

change to

sprintf (anme, msg_txt(541), mvp_sd->status.name, dd->jname, (float)drop_rate/100);
Edited by Gerz

Share this post


Link to post
Share on other sites
  • 0

 

where's your message files? search 541 message and show here:

 

may be your message look like this:

MSG: "'%s' got %s's %s (chance: %0.02f%%)"

change to:

MSG: "'%s' got %s (chance: %0.02f%%)"

 

this line:

sprintf (anme, msg_txt(541), mvp_sd->status.name, md->name, dd->jname, (float)temp/100);

change to

sprintf (anme, msg_txt(541), mvp_sd->status.name, dd->jname, (float)temp/100);

 

this line:

sprintf (anme, msg_txt(541), mvp_sd->status.name, md->name, dd->jname, (float)drop_rate/100);

change to

sprintf (anme, msg_txt(541), mvp_sd->status.name, dd->jname, (float)drop_rate/100);

 

I try this one and i got this " Admin' got Moonlight Flower (null) (chance 0.00%)..

 

became (null) and the chance became 0.00% it should be 1.00%

Edited by P r o p e r t i e s

Share this post


Link to post
Share on other sites
  • 0

 

 

did you edit your message in message.conf?

No.. i just follow the one you post it..

Did you change this

541: "'%s' got %s's %s (chance: %0.02f%%)"

change to

541: "'%s' got %s (chance: %0.02f%%)"

at message.conf https://github.com/HerculesWS/Hercules/blob/master/conf/messages.conf#L469

Okei, i already change it and (null) already remove but the problem now is this (chance 0.00%) it should be (chance 1.00%)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

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