summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-30 17:10:03 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-30 17:10:03 +0000
commit56f8c49f065831c21156dd88bd5397b6ba355813 (patch)
treeb667b75966806a271eeee6ac72e42a7aacfeb0bd
parentc883ca205971275e576d34b54304c3c5c30f3580 (diff)
downloadhercules-56f8c49f065831c21156dd88bd5397b6ba355813.tar.gz
hercules-56f8c49f065831c21156dd88bd5397b6ba355813.tar.bz2
hercules-56f8c49f065831c21156dd88bd5397b6ba355813.tar.xz
hercules-56f8c49f065831c21156dd88bd5397b6ba355813.zip
* Added base code for loading Ser's UPNP plugin
* Added 'idle_no_share' to battle_athena.conf * Added item_findingore.txt git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1343 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-SVN.txt3
-rw-r--r--conf-tmpl/battle_athena.conf3
-rw-r--r--db/item_findingore.txt24
-rw-r--r--src/common/socket.c48
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/itemdb.c16
-rw-r--r--src/map/mob.c5
-rw-r--r--src/map/party.c26
-rw-r--r--src/map/skill.c54
10 files changed, 129 insertions, 53 deletions
diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt
index 316f0d8c3..28da82c4b 100644
--- a/Changelog-SVN.txt
+++ b/Changelog-SVN.txt
@@ -2,6 +2,8 @@
Date Added
03/30
+ * Added base code for loading Ser's UPNP plugin [celest]
+ * Added 'idle_no_share' to battle_athena.conf [celest]
* updated map server to jA1137~1159
- Added @reloadatcommand, @reloadbattleconf, @reloadstatusdb, @reloadpcdb
@@ -16,6 +18,7 @@ Date Added
- Updated Hammerfall, Meteor Shower and Lord of Vermillion -- when MvP's
cast them they should have much more range
- Some other skill tweaks
+ - Added item_findingore.txt
* Some tidying up in mob.c and skill.c [celest]
03/29
diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf
index 5663bc4e6..a92f27c4e 100644
--- a/conf-tmpl/battle_athena.conf
+++ b/conf-tmpl/battle_athena.conf
@@ -823,5 +823,8 @@ exp_calc_type: 1
// P.S 2: This skill is not implemented on official servers, so its only optional
require_glory_guild: no
+// Is exp sharing disabled for idle members in the party?
+idle_no_share: no
+
import: conf/import/battle_conf.txt
diff --git a/db/item_findingore.txt b/db/item_findingore.txt
new file mode 100644
index 000000000..d14d14f29
--- /dev/null
+++ b/db/item_findingore.txt
@@ -0,0 +1,24 @@
+// 鉱石発見スキルでドロップされる鉱石
+// item ID, Jname (dummy), 確率を 1 万倍 (100% なら 1000000)
+// 0 はデフォルト項目
+0,Iron Ore,1002
+714,Emperium,30000
+756,Rough Oridecon,200000
+757,Rough Elunium,200000
+969,Gold,20000
+984,Oridecon,100000
+985,Elunium,100000
+990,Red Blood,300000
+991,Crystal Blue,300000
+992,Wind of Verdure,300000
+993,Green Live,300000
+994,Flame Heart,150000
+995,Mystic Frozen,150000
+996,Rough Wind,150000
+997,Great Nature,150000
+998,Iron,800000
+999,Steel,500000
+1002,Iron Ore,1000000
+1003,Coal,600000
+1010,Phracon,950000
+1011,Emveretarcon,550000 \ No newline at end of file
diff --git a/src/common/socket.c b/src/common/socket.c
index 70432eddf..5dd2e38f9 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -38,6 +38,20 @@ typedef int socklen_t;
#include "memwatch.h"
#endif
+#ifdef UPNP
+ #if defined(CYGWIN)
+ #include <dlfcn.h>
+ #elif _WIN32
+ // windows.h already included
+ #else
+ #error This doesnt work with non-Windows yet
+ #endif
+
+ void *upnp_dll;
+ void (*upnp_init)();
+ void (*upnp_final)();
+#endif
+
fd_set readfds;
int fd_max;
time_t tick_;
@@ -920,6 +934,27 @@ int Net_Init(void)
return(0);
}
+#ifdef UPNP
+// not implemented yet ^^;
+void do_init_upnp(void)
+{
+ upnp_dll = dlopen("upnp.dll", RTLD_NOW);
+ if (!upnp_dll) {
+ printf ("Cannot open upnp.dll: %s\n", dlerror());
+ return;
+ }
+ upnp_init = (void *)dlsym(upnp_dll, "do_init");
+ upnp_final = (void *)dlsym(upnp_dll, "do_final");
+ if (!upnp_init || !upnp_final) {
+ printf ("Cannot load symbol: %s\n", dlerror());
+ dlclose (upnp_dll);
+ return;
+ }
+ upnp_init();
+ return;
+}
+#endif
+
void do_final_socket(void)
{
int i;
@@ -945,7 +980,14 @@ void do_final_socket(void)
// session[0] のダミーデータを削除
aFree(session[0]->rdata);
aFree(session[0]->wdata);
- aFree(session[0]);
+ aFree(session[0]);
+
+#ifdef UPNP
+ if (upnp_final)
+ upnp_final();
+ if (upnp_dll)
+ dlclose(upnp_dll);
+#endif
}
void do_socket(void)
@@ -966,4 +1008,8 @@ void do_socket(void)
// とりあえず5分ごとに不要なデータを削除する
add_timer_interval(gettick()+1000,connect_check_clear,0,0,300*1000);
+
+#ifdef UPNP
+ do_init_upnp();
+#endif
}
diff --git a/src/map/battle.c b/src/map/battle.c
index aa30ef0a9..421f85ec3 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -4202,6 +4202,7 @@ static const struct {
{ "exp_calc_type", &battle_config.exp_calc_type}, // [celest]
{ "min_skill_delay_limit", &battle_config.min_skill_delay_limit}, // [celest]
{ "require_glory_guild", &battle_config.require_glory_guild}, // [celest]
+ { "idle_no_share", &battle_config.idle_no_share}, // [celest], for a feature by [MouseJstr]
//SQL-only options start
#ifndef TXT_ONLY
@@ -4450,6 +4451,7 @@ void battle_set_defaults() {
battle_config.exp_calc_type = 1;
battle_config.min_skill_delay_limit = 100;
battle_config.require_glory_guild = 0;
+ battle_config.idle_no_share = 0;
//SQL-only options start
#ifndef TXT_ONLY
diff --git a/src/map/battle.h b/src/map/battle.h
index 3bb9068bf..393cc58b4 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -312,6 +312,7 @@ extern struct Battle_Config {
int exp_calc_type;
int min_skill_delay_limit;
int require_glory_guild;
+ int idle_no_share;
#ifndef TXT_ONLY /* SQL-only options */
int mail_system; // [Valaris]
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index d575e8a77..91ec58c81 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -26,9 +26,9 @@
static struct dbt* item_db;
-static struct random_item_data blue_box[MAX_RANDITEM],violet_box[MAX_RANDITEM],card_album[MAX_RANDITEM],gift_box[MAX_RANDITEM],scroll[MAX_RANDITEM];
-static int blue_box_count=0,violet_box_count=0,card_album_count=0,gift_box_count=0,scroll_count=0;
-static int blue_box_default=0,violet_box_default=0,card_album_default=0,gift_box_default=0,scroll_default=0;
+static struct random_item_data blue_box[MAX_RANDITEM], violet_box[MAX_RANDITEM], card_album[MAX_RANDITEM], gift_box[MAX_RANDITEM], scroll[MAX_RANDITEM], finding_ore[MAX_RANDITEM];
+static int blue_box_count=0, violet_box_count=0, card_album_count=0, gift_box_count=0, scroll_count=0, finding_ore_count = 0;
+static int blue_box_default=0, violet_box_default=0, card_album_default=0, gift_box_default=0, scroll_default=0, finding_ore_default = 0;
// Function declarations
@@ -102,7 +102,7 @@ int itemdb_searchrandomid(int flags)
struct {
int nameid,count;
struct random_item_data *list;
- } data[6];
+ } data[7];
// for BCC32 compile error
data[0].nameid = 0; data[0].count = 0; data[0].list = NULL;
@@ -111,8 +111,9 @@ int itemdb_searchrandomid(int flags)
data[3].nameid = card_album_default; data[3].count = card_album_count; data[3].list = card_album;
data[4].nameid = gift_box_default; data[4].count = gift_box_count; data[4].list = gift_box;
data[5].nameid = scroll_default; data[5].count = scroll_count; data[5].list = scroll;
+ data[6].nameid = finding_ore_default; data[6].count = finding_ore_count; data[6].list = finding_ore;
- if(flags>=1 && flags<=5){
+ if(flags>=1 && flags<=6){
nameid=data[flags].nameid;
count=data[flags].count;
list=data[flags].list;
@@ -410,8 +411,9 @@ static int itemdb_read_randomitem()
{"db/item_bluebox.txt", blue_box, &blue_box_count, &blue_box_default },
{"db/item_violetbox.txt", violet_box, &violet_box_count, &violet_box_default },
{"db/item_cardalbum.txt", card_album, &card_album_count, &card_album_default },
- {"db/item_giftbox.txt", gift_box, &gift_box_count, &gift_box_default },
- {"db/item_scroll.txt", scroll, &scroll_count, &scroll_default },
+ {"db/item_giftbox.txt", gift_box, &gift_box_count, &gift_box_default },
+ {"db/item_scroll.txt", scroll, &scroll_count, &scroll_default },
+ {"db/item_findingore.txt", finding_ore,&finding_ore_count, &finding_ore_default },
};
for(i=0;i<sizeof(data)/sizeof(data[0]);i++){
diff --git a/src/map/mob.c b/src/map/mob.c
index b46b2a317..c9626fa72 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2624,11 +2624,10 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
}
// Ore Discovery [Celest]
- if (sd && pc_checkskill(sd,BS_FINDINGORE)>0 && battle_config.finding_ore_rate/100 >= rand()%1000) {
+ if (sd == mvp_sd && pc_checkskill(sd,BS_FINDINGORE)>0 && battle_config.finding_ore_rate/100 >= rand()%1000) {
struct delay_item_drop *ditem;
- int itemid[17] = { 714, 756, 757, 969, 984, 985, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1002 };
ditem=(struct delay_item_drop *)aCalloc(1,sizeof(struct delay_item_drop));
- ditem->nameid = itemid[rand()%17]; //should return from 0 to 16
+ ditem->nameid = itemdb_searchrandomid(6);
if (drop_ore<0) i=8; //we have only 10 slots in LOG, there's a check to not overflow (9th item usually a card, so we use 8th slot)
log_item[i] = ditem->nameid; //it's for logging only
drop_items++; //we cound if there were any drops
diff --git a/src/map/party.c b/src/map/party.c
index 17f0cf5eb..7eb3f02dc 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -586,23 +586,23 @@ int party_exp_share(struct party *p,int map,int base_exp,int job_exp,int zeny)
nullpo_retr(0, p);
- for(i=c=0;i<MAX_PARTY;i++)
- if((sd=p->member[i].sd)!=NULL && p->member[i].online && sd->bl.m==map && session[sd->fd] != NULL)
+ for (i=c=0; i < MAX_PARTY; i++)
+ if ((sd = p->member[i].sd) != NULL && p->member[i].online && sd->bl.m == map /*&& session[sd->fd] != NULL*/) // should be done in socket.c
c++;
-
- if(c==0)
+
+ if(c == 0)
return 0;
- for(i=0;i<MAX_PARTY;i++)
- if((sd=p->member[i].sd)!=NULL && p->member[i].online && sd->bl.m==map && session[sd->fd] != NULL) {
- if (/* pc_issit(sd) || */ sd->chatID || (sd->idletime < (tick_ - 120)))
+ for (i = 0; i < MAX_PARTY; i++)
+ if ((sd = p->member[i].sd) != NULL && p->member[i].online && sd->bl.m == map /*&& session[sd->fd] != NULL*/) {
+ if (battle_config.idle_no_share && (/* pc_issit(sd) || */ sd->chatID || (sd->idletime < (tick_ - 120))))
continue;
-#ifdef TWILIGHT
+ #ifdef TWILIGHT
pc_gainexp(sd,base_exp,job_exp);
-#else
- pc_gainexp(sd,base_exp/c+1,job_exp/c+1);
-#endif
- if(battle_config.zeny_from_mobs) // zeny from mobs [Valaris]
- pc_getzeny(sd,zeny/c+1);
+ #else
+ pc_gainexp(sd,(base_exp/c)+1,(job_exp/c)+1);
+ #endif
+ if (battle_config.zeny_from_mobs) // zeny from mobs [Valaris]
+ pc_getzeny(sd,(zeny/c)+1);
}
return 0;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 40626fa57..b6010f151 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -608,8 +608,8 @@ int skillnotok(int skillid, struct map_session_data *sd)
return 1;
}
- if (pc_isGM(sd) >= 20)
- return 0; // gm's can do anything damn thing they want
+ if (pc_isGM(sd) >= 20)
+ return 0; // gm's can do anything damn thing they want
// Check skill restrictions [Celest]
if(!map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.gvg && skill_get_nocast (skillid) & 1)
@@ -630,7 +630,7 @@ int skillnotok(int skillid, struct map_session_data *sd)
case MC_IDENTIFY:
return 0; // always allowed
default:
- return(map[sd->bl.m].flag.noskill);
+ return (map[sd->bl.m].flag.noskill);
}
}
@@ -639,9 +639,9 @@ static int distance(int x0,int y0,int x1,int y1)
{
int dx,dy;
- dx=abs(x0-x1);
- dy=abs(y0-y1);
- return dx>dy ? dx : dy;
+ dx = abs(x0 - x1);
+ dy = abs(y0 - y1);
+ return dx > dy ? dx : dy;
}
/* スキルユニットの配置情報を返す */
@@ -649,26 +649,25 @@ struct skill_unit_layout skill_unit_layout[MAX_SKILL_UNIT_LAYOUT];
int firewall_unit_pos;
int icewall_unit_pos;
-struct skill_unit_layout *skill_get_unit_layout(int skillid,int skilllv,struct block_list *src,int x,int y)
-{
-
+struct skill_unit_layout *skill_get_unit_layout (int skillid, int skilllv, struct block_list *src, int x, int y)
+{
int pos = skill_get_unit_layout_type(skillid,skilllv);
int dir;
- if (pos!=-1)
+ if (pos != -1)
return &skill_unit_layout[pos];
- if (src->x==x && src->y==y)
+ if (src->x == x && src->y == y)
dir = 2;
else
dir = map_calc_dir(src,x,y);
- if (skillid==MG_FIREWALL)
- return &skill_unit_layout[firewall_unit_pos+dir];
- else if (skillid==WZ_ICEWALL)
- return &skill_unit_layout[icewall_unit_pos+dir];
+ if (skillid == MG_FIREWALL)
+ return &skill_unit_layout [firewall_unit_pos + dir];
+ else if (skillid == WZ_ICEWALL)
+ return &skill_unit_layout [icewall_unit_pos + dir];
- printf("unknown unit layout for skill %d, %d\n",skillid,skilllv);
+ printf("Unknown unit layout for skill %d, %d\n",skillid,skilllv);
return &skill_unit_layout[0];
}
@@ -691,7 +690,7 @@ struct skill_unit_layout *skill_get_unit_layout(int skillid,int skilllv,struct b
* スキル追加?果
*------------------------------------------
*/
-int skill_additional_effect( struct block_list* src, struct block_list *bl,int skillid,int skilllv,int attack_type,unsigned int tick)
+int skill_additional_effect (struct block_list* src, struct block_list *bl, int skillid, int skilllv, int attack_type, unsigned int tick)
{
/* MOB追加?果スキル用 */
const int sc[]={
@@ -825,8 +824,9 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s
case WZ_FROSTNOVA: /* フロストノヴァ */
{
struct status_change *sc_data = status_get_sc_data(bl);
- rate=(skilllv*3+35)*sc_def_mdef/100-(status_get_int(bl)+status_get_luk(bl))/15;
- rate=rate<=5?5:rate;
+ rate = (skilllv*3+35)*sc_def_mdef/100-(status_get_int(bl)+status_get_luk(bl))/15;
+ if (rate <= 5)
+ rate = 5;
if(sc_data && sc_data[SC_FREEZE].timer == -1 && rand()%100 < rate)
status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv)*(1-sc_def_mdef/100),0);
else if (sd && skillid == MG_FROSTDIVER)
@@ -2384,9 +2384,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s
case SM_MAGNUM: /* マグナムブレイク [celest] */
if(flag&1 && bl->id != skill_area_temp[1]){
- int dx = abs( bl->x - skill_area_temp[2] );
- int dy = abs( bl->y - skill_area_temp[3] );
- int dist = ((dx>dy)?dx:dy);
+ int dist = distance (bl->x, bl->y, skill_area_temp[2], skill_area_temp[3]);
skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,
0x0500|dist);
} else {
@@ -2514,18 +2512,16 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s
case MG_NAPALMBEAT: /* ナパ?ムビ?ト */
case MG_FIREBALL: /* ファイヤ?ボ?ル */
case WZ_SIGHTRASHER: /* サイトラッシャー */
- if(flag&1){
+ if (flag & 1) {
/* 個別にダメ?ジを?える */
- if(bl->id!=skill_area_temp[1]){
- if(skillid==MG_FIREBALL){ /* ファイヤ?ボ?ルなら中心からの距離を計算 */
- int dx=abs( bl->x - skill_area_temp[2] );
- int dy=abs( bl->y - skill_area_temp[3] );
- skill_area_temp[0]=((dx>dy)?dx:dy);
+ if (bl->id != skill_area_temp[1]){
+ if(skillid == MG_FIREBALL){ /* ファイヤ?ボ?ルなら中心からの距離を計算 */
+ skill_area_temp[0] = distance(bl->x, bl->y, skill_area_temp[2], skill_area_temp[3]);
}
skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,
skill_area_temp[0]| 0x0500);
}
- }else{
+ } else {
int ar;
skill_area_temp[0]=0;
skill_area_temp[1]=bl->id;