diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-11-11 10:12:58 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-11-11 10:12:58 +0000 |
commit | 0f94f735f50a320d97c0dacb806de2a65662cc3c (patch) | |
tree | 47509760c4ca70a6bfe7d6599db9e27e0f2c8c4c /src/map/pc.c | |
parent | a1079df40c646c82f6c7fc1e17c1dc0976fbb28c (diff) | |
download | hercules-0f94f735f50a320d97c0dacb806de2a65662cc3c.tar.gz hercules-0f94f735f50a320d97c0dacb806de2a65662cc3c.tar.bz2 hercules-0f94f735f50a320d97c0dacb806de2a65662cc3c.tar.xz hercules-0f94f735f50a320d97c0dacb806de2a65662cc3c.zip |
- Cleaned up pc_calc_weapontype
- made on-touch areas work with walking npcs. Note that the implementation is performance may not be optimal, but I am not sure if it can be done in any better way.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11713 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index f07165776..4402409db 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -440,29 +440,43 @@ int pc_calcweapontype(struct map_session_data *sd) nullpo_retr(0, sd); // single-hand - if(sd->weapontype1 != W_FIST && sd->weapontype2 == W_FIST) + if(sd->weapontype2 == W_FIST) { sd->status.weapon = sd->weapontype1; - else if(sd->weapontype1 == W_FIST && sd->weapontype2 != W_FIST) + return 1; + } + if(sd->weapontype1 == W_FIST) { sd->status.weapon = sd->weapontype2; - // dual-wield, matching types - else if(sd->weapontype1 == W_DAGGER && sd->weapontype2 == W_DAGGER) - sd->status.weapon = W_DOUBLE_DD; - else if(sd->weapontype1 == W_1HSWORD && sd->weapontype2 == W_1HSWORD) - sd->status.weapon = W_DOUBLE_SS; - else if(sd->weapontype1 == W_1HAXE && sd->weapontype2 == W_1HAXE) - sd->status.weapon = W_DOUBLE_AA; - // dual-wield, mixed types - else if(sd->weapontype1 == W_DAGGER && sd->weapontype2 == W_1HSWORD || sd->weapontype1 == W_1HSWORD && sd->weapontype2 == W_DAGGER) - sd->status.weapon = W_DOUBLE_DS; - else if(sd->weapontype1 == W_DAGGER && sd->weapontype2 == W_1HAXE || sd->weapontype1 == W_1HAXE && sd->weapontype2 == W_DAGGER) - sd->status.weapon = W_DOUBLE_DA; - else if(sd->weapontype1 == W_1HSWORD && sd->weapontype2 == W_1HAXE || sd->weapontype1 == W_1HAXE && sd->weapontype2 == W_1HSWORD) - sd->status.weapon = W_DOUBLE_SA; - // unknown, default to left hand type - else + return 1; + } + // dual-wield + sd->status.weapon = 0; + switch (sd->weapontype1){ + case W_DAGGER: + switch (sd->weapontype2) { + case W_DAGGER: sd->status.weapon = W_DOUBLE_DD; break; + case W_1HSWORD: sd->status.weapon = W_DOUBLE_DS; break; + case W_1HAXE: sd->status.weapon = W_DOUBLE_DA; break; + } + break; + case W_1HSWORD: + switch (sd->weapontype2) { + case W_DAGGER: sd->status.weapon = W_DOUBLE_DS; break; + case W_1HSWORD: sd->status.weapon = W_DOUBLE_SS; break; + case W_1HAXE: sd->status.weapon = W_DOUBLE_SA; break; + } + break; + case W_1HAXE: + switch (sd->weapontype2) { + case W_DAGGER: sd->status.weapon = W_DOUBLE_DA; break; + case W_1HSWORD: sd->status.weapon = W_DOUBLE_SA; break; + case W_1HAXE: sd->status.weapon = W_DOUBLE_AA; break; + } + } + // unknown, default to right hand type + if (!sd->status.weapon) sd->status.weapon = sd->weapontype1; - return 0; + return 2; } int pc_setequipindex(struct map_session_data *sd) |